/**
 * hd-player.css — Premium AniVibe HD Player Styles
 * Glassmorphism design with animated quality badges & custom video controls
 */

/* =========================================================
   1. HD QUALITY BADGE (Glowing Gold)
   ========================================================= */
.quality-badge.hd {
    background: linear-gradient(135deg, #f7971e, #ffd200);
    color: #1a1a2e;
    font-weight: 800;
    animation: hdGlow 2s ease-in-out infinite alternate;
    text-shadow: none;
    letter-spacing: 0.5px;
}

@keyframes hdGlow {
    0% {
        box-shadow: 0 0 4px rgba(255, 210, 0, 0.4);
    }

    100% {
        box-shadow: 0 0 12px rgba(255, 210, 0, 0.8), 0 0 24px rgba(247, 151, 30, 0.3);
    }
}

.player-source-btn[data-player="hd"] {
    position: relative;
}

.player-source-btn[data-player="hd"].active {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    color: #1a1a2e;
    font-weight: 700;
}

/* =========================================================
   2. HD PLAYER AREA LAYOUT
   ========================================================= */
.hd-player-area-modern {
    display: flex !important;
    flex-direction: row-reverse !important;
    /* Video on LEFT, Sidebar on RIGHT */
    background: #0d0d1a;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    width: 100% !important;
    min-height: 250px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.hd-player-main {
    flex: 1 !important;
    min-width: 0 !important;
    position: relative !important;
    background: #000;
    display: flex !important;
    flex-direction: column !important;
}

/* =========================================================
   3. VIDEO CONTAINER & SCREENS (HIDDEN BY DEFAULT)
   ========================================================= */
.hd-video-container,
.hd-setup-screen,
.hd-loading-screen,
.hd-error-screen {
    display: none;
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 5;
    background: #000;
}

.hd-video-container.active,
.hd-setup-screen.active,
.hd-loading-screen.active,
.hd-error-screen.active {
    display: flex !important;
    flex-direction: column;
}

.hd-video-container {
    position: absolute !important;
    inset: 0 !important;
    z-index: 1 !important;
    background: #000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
}

.hd-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

/* SubtitlesOctopus canvas overlay — must cover the entire video area */
.libassjs-canvas-parent {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 10 !important;
    overflow: visible !important;
}

.libassjs-canvas {
    pointer-events: none;
    z-index: 10;
    /* Do NOT override top/left/width/height — SubtitlesOctopus manages these */
}

/* Controls Overlay */
.hd-player-controls {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 40%, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: default;
    pointer-events: none !important;
}

.hd-player-controls.active {
    opacity: 1 !important;
}

.hd-player-controls .hd-top-bar,
.hd-player-controls .hd-top-episode-list,
.hd-player-controls .hd-bottom-bar,
.hd-player-controls .hd-center-action,
.hd-player-controls .hd-control-btn,
.hd-player-controls .hd-progress-container {
    pointer-events: auto !important;
}

/* =========================================================
   4. INTERACTIVE ELEMENTS
   ========================================================= */

/* Stream Bar (Top Status) */
.hd-stream-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 34px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1500;
    display: none;
    /* Active via class */
    align-items: center;
    padding: 0 15px;
    gap: 20px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hd-stream-bar.active {
    display: flex;
}

.hd-stream-bar .stream-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hd-stream-bar .stat-val {
    color: #fff;
    font-weight: 600;
}

/* Screens */
.hd-setup-screen,
.hd-loading-screen,
.hd-error-screen {
    flex: 1;
    background: radial-gradient(circle at center, #1a1b2e 0%, #0d0d1a 100%);
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Setup Form */
.hd-magnet-form {
    width: 100%;
    max-width: 500px;
    margin: 20px 0;
}

.hd-magnet-input-wrap {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hd-magnet-input-wrap:focus-within {
    border-color: #ffd200;
    box-shadow: 0 0 15px rgba(255, 210, 0, 0.2);
}

.hd-magnet-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px 15px;
    font-size: 13px;
    outline: none !important;
}

.hd-start-btn {
    background: #ffd200;
    color: #000;
    border: none;
    padding: 0 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.hd-start-btn:hover {
    background: #fff;
}

/* =========================================================
   TOP BAR — Episode Navigation
   ========================================================= */
.hd-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    pointer-events: auto !important;
    gap: 8px;
}

.hd-top-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.hd-top-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.hd-top-btn i {
    font-size: 11px;
}

.hd-top-current {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 210, 0, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 210, 0, 0.3);
    border-radius: 8px;
    color: #ffd200;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.hd-top-current:hover {
    background: rgba(255, 210, 0, 0.25);
}
.hd-top-current i {
    font-size: 10px;
    transition: transform 0.2s;
}

/* Episode dropdown from top bar */
.hd-top-episode-list {
    position: absolute;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    max-height: 50vh;
    overflow-y: auto;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px;
    z-index: 1100;
    pointer-events: auto !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: hdCardIn 0.2s ease;
}

.hd-top-ep-item {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.hd-top-ep-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.hd-top-ep-item.active {
    background: rgba(255, 210, 0, 0.12);
    color: #ffd200;
    font-weight: 600;
}
.hd-top-ep-progress {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
    flex-basis: 100%;
}
.hd-top-ep-progress-fill {
    height: 100%;
    background: #ffd200;
    border-radius: 2px;
}

/* Scrollbar styling for episode list */
.hd-top-episode-list::-webkit-scrollbar {
    width: 4px;
}
.hd-top-episode-list::-webkit-scrollbar-track {
    background: transparent;
}
.hd-top-episode-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* Bottom Bar Controls */
.hd-bottom-bar {
    padding: 0 20px 15px 20px !important;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.95), transparent) !important;
}

.hd-progress-container {
    height: 4px;
    width: 100%;
    position: relative;
    cursor: pointer;
    margin-bottom: 10px;
}

.hd-progress-bg {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.hd-progress-active {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #ffd200;
    width: 0%;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 210, 0, 0.4);
}

/* Sidebar */
.hd-sidebar {
    width: 280px;
    min-width: 280px;
    background: #0b0b14;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.hd-episode-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.hd-episode-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.hd-episode-btn.active {
    background: rgba(255, 210, 0, 0.1);
    border-color: #ffd200;
    color: #ffd200;
}

/* ── Episode progress bar ── */
.hd-ep-progress {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.hd-ep-progress-fill {
    height: 100%;
    background: #ffd200;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── Last-watched badge ── */
.hd-ep-badge {
    font-size: 10px;
    color: #ffd200;
    background: rgba(255, 210, 0, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.hd-episode-btn {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
}
.hd-episode-btn .hd-ep-name {
    flex: 1;
}
.hd-episode-btn .hd-ep-progress {
    flex-basis: 100%;
}

/* ── Continue button at top of episode list ── */
.hd-episode-continue-btn {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 210, 0, 0.15);
    border: 1px solid rgba(255, 210, 0, 0.4);
    border-radius: 8px;
    color: #ffd200;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
    text-align: left;
}
.hd-episode-continue-btn i {
    margin-right: 6px;
}
.hd-episode-continue-btn:hover {
    background: rgba(255, 210, 0, 0.25);
    border-color: #ffd200;
}

/* =========================================================
   5. CONTROLS ROW & BUTTONS
   ========================================================= */
.hd-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.hd-controls-left,
.hd-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    padding: 0;
}

.hd-control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

/* Time display */
.hd-time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-variant-numeric: tabular-nums;
    user-select: none;
    margin-left: 4px;
}

.hd-time-separator {
    color: rgba(255, 255, 255, 0.4);
}

/* =========================================================
   6. CENTER ACTION (play/pause/loading overlay)
   ========================================================= */
.hd-center-action {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    cursor: pointer;
    z-index: 10;
}

/* Visible when controls are shown (tap to show/hide) */
.hd-center-action.visible {
    opacity: 1;
    pointer-events: auto;
}

.hd-center-action.show {
    opacity: 1;
    pointer-events: auto;
}

.hd-center-action.buffering {
    opacity: 1;
    pointer-events: none;
}

/* =========================================================
   7. VOLUME SLIDER
   ========================================================= */
.hd-volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hd-volume-slider-wrap {
    width: 70px;
    display: flex;
    align-items: center;
}

.hd-volume-slider-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.hd-volume-slider-active {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #fff;
    border-radius: 2px;
    width: 100%;
    transition: width 0.1s;
}

/* =========================================================
   8. PROGRESS HANDLE
   ========================================================= */
.hd-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ffd200;
    border-radius: 50%;
    left: 0%;
    box-shadow: 0 0 6px rgba(255, 210, 0, 0.6);
    opacity: 0;
    transition: opacity 0.15s;
}

.hd-progress-container:hover .hd-progress-handle {
    opacity: 1;
}

.hd-progress-container:hover {
    height: 6px;
}

.hd-progress-load {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    width: 0%;
    border-radius: 2px;
}

/* =========================================================
   9. LOADING SCREEN EXTRAS
   ========================================================= */
.hd-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 210, 0, 0.2);
    border-top-color: #ffd200;
    border-radius: 50%;
    animation: hdSpin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes hdSpin {
    to {
        transform: rotate(360deg);
    }
}

.hd-loading-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.hd-loading-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

.hd-progress-bar {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.hd-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f7971e, #ffd200);
    width: 0%;
    transition: width 0.3s;
}

.hd-status-pills {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.hd-status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
}

.hd-status-pill .pill-value {
    color: #fff;
    font-weight: 600;
}

/* =========================================================
   10. SETUP SCREEN EXTRAS
   ========================================================= */
.hd-setup-icon {
    font-size: 48px;
    color: #ffd200;
    margin-bottom: 16px;
}

.hd-setup-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.hd-setup-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    max-width: 400px;
    text-align: center;
    line-height: 1.5;
}

.hd-features {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
}

.hd-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.hd-feature i {
    color: #ffd200;
}

/* =========================================================
   11. ERROR SCREEN
   ========================================================= */
.hd-error-icon {
    font-size: 48px;
    color: #ff4757;
    margin-bottom: 16px;
}

.hd-error-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.hd-error-message {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    text-align: center;
    max-width: 400px;
}

.hd-retry-btn {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff4757;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.hd-retry-btn:hover {
    background: rgba(255, 71, 87, 0.25);
}

/* =========================================================
   12. SIDEBAR HEADER
   ========================================================= */
.hd-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hd-file-selector-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 13px;
}

/* =========================================================
   13. STREAM BAR — HIDDEN
   ========================================================= */
.hd-stream-bar {
    display: none !important;
}

/* =========================================================
   14. FULLSCREEN — ONLY VIDEO
   ========================================================= */
.hd-video-container:fullscreen,
.hd-video-container:-webkit-full-screen {
    background: #000;
    width: 100vw !important;
    height: 100vh !important;
}

.hd-video-container:fullscreen video,
.hd-video-container:-webkit-full-screen video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.hd-video-container:fullscreen .hd-player-controls,
.hd-video-container:-webkit-full-screen .hd-player-controls {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
}

/* =========================================================
   15. EPISODE BTN INNER LAYOUT
   ========================================================= */
.hd-episode-btn .ep-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.hd-episode-btn.active .ep-num {
    background: rgba(255, 210, 0, 0.2);
    color: #ffd200;
}

.hd-episode-btn .ep-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.hd-episode-btn .ep-size {
    flex-shrink: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

/* =========================================================
   16. MOBILE CONTROLS
   ========================================================= */
.hd-mobile-controls {
    background: rgba(13, 13, 26, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
}

.hd-mobile-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-mobile-nav-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.hd-mobile-nav-btn:hover {
    background: rgba(255, 210, 0, 0.15);
    border-color: rgba(255, 210, 0, 0.3);
}

.hd-mobile-info {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.hd-mobile-info .ep-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.hd-mobile-info .ep-detail {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-mobile-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.hd-mobile-action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
    transition: all 0.2s;
}

.hd-mobile-action-btn:hover {
    background: rgba(255, 210, 0, 0.1);
    border-color: rgba(255, 210, 0, 0.2);
    color: #ffd200;
}

/* =========================================================
   17. MOBILE RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
    .hd-player-area-modern {
        flex-direction: column !important;
        min-height: unset;
    }

    .hd-player-main {
        min-height: 220px;
    }

    .hd-video-container {
        min-height: unset;
    }

    .hd-player-main {
        aspect-ratio: 16 / 9;
        height: auto !important;
        min-height: unset !important;
    }

    /* Sidebar on mobile: hidden — use bottom sheet or in-player nav */
    .hd-sidebar {
        display: none !important;
    }

    /* Top bar compact on mobile */
    .hd-top-bar {
        padding: 6px 10px;
        gap: 4px;
    }
    .hd-top-btn {
        font-size: 11px;
        padding: 5px 8px;
    }
    .hd-top-btn span {
        display: none;
    }
    .hd-top-current {
        font-size: 12px;
        padding: 5px 10px;
    }
    .hd-top-episode-list {
        width: 180px;
        top: 40px;
    }
    .hd-top-ep-item {
        font-size: 12px;
        padding: 7px 10px;
    }

    .hd-episode-list {
        max-height: 40vh;
        overflow-y: auto;
    }

    /* Mobile controls visible */
    .hd-mobile-controls {
        display: block !important;
    }

    /* Hide volume slider on mobile (use hardware buttons) */
    .hd-volume-slider-wrap {
        display: none;
    }

    .hd-controls-row {
        padding: 4px 8px;
    }

    .hd-control-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .hd-time-display {
        font-size: 11px;
    }

    /* Setup screen compact */
    .hd-setup-title {
        font-size: 20px;
    }

    .hd-setup-subtitle {
        font-size: 12px;
    }

    .hd-magnet-input-wrap {
        flex-direction: column;
    }

    .hd-magnet-input {
        font-size: 13px;
    }

    .hd-features {
        gap: 8px;
    }

    .hd-feature {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Desktop: hide mobile controls */
@media (min-width: 769px) {
    .hd-player-area-modern {
        height: 500px !important;
    }

    .hd-mobile-controls {
        display: none !important;
    }
}

/* =========================================================
   18. CENTER ACTION ANIMATION
   ========================================================= */
.hd-center-action.show {
    animation: hdCenterPulse 0.6s ease forwards;
}

/* Buffering state - stays visible */
.hd-center-action.buffering {
    opacity: 1 !important;
    pointer-events: none !important;
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(4px);
    z-index: 2000;
}

.hd-center-action.buffering #hd-center-icon {
    display: none !important;
}

.hd-center-action.buffering .hd-buffering-spinner {
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #ffd200;
}

@keyframes hdCenterPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.3);
    }
}

/* =========================================================
   19. FAQ SECTION
   ========================================================= */
.hd-faq {
    margin-top: 8px;
}

.hd-faq-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.hd-faq-toggle:hover {
    background: rgba(255, 210, 0, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.hd-faq-toggle .faq-arrow {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.3s;
}

.hd-faq-content {
    padding: 12px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.hd-faq-content .faq-item {
    margin-bottom: 12px;
}

.hd-faq-content .faq-item:last-child {
    margin-bottom: 0;
}

.hd-faq-content .faq-item strong {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 4px;
}

.hd-faq-content .faq-item p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
    margin: 0;
}

/* =========================================================
   18. AUDIO TRACK SELECTOR
   ========================================================= */
.hd-audio-track-container {
    position: relative;
}

.hd-audio-track-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: rgba(18, 18, 22, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 6px 0;
    min-width: 240px;
    max-height: 320px;
    overflow-y: auto;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 200;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    animation: hd-dropdown-in 0.15s ease-out;
}

.hd-audio-track-dropdown.open {
    display: block;
}

@keyframes hd-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hd-audio-track-dropdown::-webkit-scrollbar {
    width: 4px;
}

.hd-audio-track-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.hd-audio-track-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.3;
    transition: background 0.12s, color 0.12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.hd-audio-track-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.hd-audio-track-item.active {
    color: #fff;
    background: rgba(140, 82, 255, 0.15);
}

.hd-audio-track-item .track-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: transparent;
}

.hd-audio-track-item.active .track-dot {
    background: #8c52ff;
    box-shadow: 0 0 6px rgba(140, 82, 255, 0.5);
}

.hd-audio-track-item .track-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-audio-track-item .track-lang {
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.hd-audio-track-item.active .track-lang {
    background: rgba(140, 82, 255, 0.3);
    color: #c9a8ff;
}

/* Подсветка кнопки когда dropdown открыт */
.hd-audio-track-container .hd-control-btn.active-dropdown {
    color: #8c52ff;
}

/* ─── Double Tap Seek Indicators ─── */
.hd-seek-indicator {
    position: absolute;
    top: 50%;
    transform: translate(0, -50%) scale(0.8);
    width: 30%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    /* Above controls */
}

.hd-seek-indicator.left {
    left: 0;
}

.hd-seek-indicator.right {
    right: 0;
}

.hd-seek-indicator.active {
    opacity: 1;
    transform: translate(0, -50%) scale(1.1);
}

.hd-seek-indicator i {
    font-size: 38px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 15px rgba(255, 210, 0, 0.4));
    color: #ffd200;
}

.hd-seek-indicator span {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* Ripple effect for double tap - more subtle and premium */
.hd-seek-ripple {
    position: absolute;
    top: 0;
    width: 40%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

.hd-seek-ripple.left {
    left: 0;
    background: radial-gradient(circle at 0% 50%, rgba(255, 210, 0, 0.15), transparent 70%);
}

.hd-seek-ripple.right {
    right: 0;
    background: radial-gradient(circle at 100% 50%, rgba(255, 210, 0, 0.15), transparent 70%);
}

@keyframes ripple-pulse {
    0% {
        opacity: 0;
        transform: scaleX(0.5);
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: scaleX(1);
    }
}

.hd-seek-ripple.animate-left {
    animation: ripple-pulse 0.6s ease-out;
    transform-origin: left;
}

.hd-seek-ripple.animate-right {
    animation: ripple-pulse 0.6s ease-out;
    transform-origin: right;
}

/* ═══════════════════════════════════════════════════════════════
   OVERLAY SYSTEM (Resume, Next Episode)
   ═══════════════════════════════════════════════════════════════ */
.hd-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
    animation: hdOverlayIn 0.3s ease;
}

@keyframes hdOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hd-overlay-card {
    background: rgba(30, 30, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px 40px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    animation: hdCardIn 0.3s ease;
}

@keyframes hdCardIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.hd-overlay-icon {
    font-size: 36px;
    color: #ffd700;
    margin-bottom: 12px;
}

.hd-overlay-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 20px;
    line-height: 1.4;
}

.hd-overlay-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.hd-overlay-btn {
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-overlay-btn--primary {
    background: linear-gradient(135deg, #ffd700, #ffb800);
    color: #1a1a2e;
}

.hd-overlay-btn--primary:hover {
    background: linear-gradient(135deg, #ffe040, #ffc520);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.hd-overlay-btn--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.hd-overlay-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

/* Next episode countdown ring */
.hd-next-countdown {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 3px solid rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #ffd700;
    position: relative;
    animation: hdCountdownPulse 1s ease-in-out infinite;
}

@keyframes hdCountdownPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.2); }
    50% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
}

.hd-next-episode-name {
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════
   SPEED INDICATOR (Long-press 2x)
   ═══════════════════════════════════════════════════════════════ */
.hd-speed-indicator {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #ffd700;
    font-size: 15px;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 20px;
    z-index: 45;
    pointer-events: none;
    animation: hdSpeedIn 0.2s ease;
    border: 1px solid rgba(255, 215, 0, 0.25);
}

@keyframes hdSpeedIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   SWIPE SEEK INDICATOR
   ═══════════════════════════════════════════════════════════════ */
.hd-swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 14px;
    padding: 14px 28px;
    text-align: center;
    z-index: 45;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hd-swipe-delta {
    font-size: 22px;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 4px;
}

.hd-swipe-time {
    font-size: 13px;
    color: #aaa;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════
   ERROR SCREEN — FALLBACK BUTTON
   ═══════════════════════════════════════════════════════════════ */
.hd-error-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

.hd-fallback-btn {
    background: rgba(100, 100, 255, 0.15);
    border: 1px solid rgba(100, 100, 255, 0.3);
    color: #aac;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-fallback-btn:hover {
    background: rgba(100, 100, 255, 0.25);
    color: #fff;
}

/* Loading screen fallback link */
.hd-loading-fallback {
    margin-top: 14px;
    font-size: 13px;
}

.hd-loading-fallback a {
    color: #aac;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.hd-loading-fallback a:hover {
    color: #fff;
}

/* Progress bar fill transition */
.hd-progress-bar-fill {
    transition: width 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — NEW OVERLAYS
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hd-overlay-card {
        padding: 16px 14px;
        max-width: 260px;
        width: 75%;
        border-radius: 12px;
    }

    .hd-overlay-icon {
        font-size: 24px;
        margin-bottom: 6px;
    }

    .hd-overlay-title {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .hd-overlay-actions {
        gap: 8px;
    }

    .hd-overlay-btn {
        padding: 8px 14px;
        font-size: 12px;
        gap: 5px;
    }

    .hd-next-countdown {
        width: 48px;
        height: 48px;
        font-size: 20px;
        margin-bottom: 10px;
    }

    .hd-next-episode-name {
        font-size: 11px;
        margin-bottom: 10px;
    }

    /* Hide sidebar on mobile — use bottom-sheet instead */
    .hd-sidebar {
        display: none !important;
    }

    .hd-speed-indicator {
        top: 10px;
        font-size: 13px;
        padding: 5px 14px;
    }

    .hd-swipe-indicator {
        padding: 10px 20px;
    }

    .hd-swipe-delta {
        font-size: 18px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BAR — DRAGGING STATE
   ═══════════════════════════════════════════════════════════════ */
.hd-progress-container.dragging {
    height: 8px;
}
.hd-progress-container.dragging .hd-progress-handle {
    opacity: 1;
    width: 14px;
    height: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE BOTTOM-SHEET — Episode progress bars
   ═══════════════════════════════════════════════════════════════ */
.hd-ep-progress-mobile {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.hd-ep-progress-mobile-fill {
    height: 100%;
    background: #ffd200;
    border-radius: 2px;
}
.hd-sheet-continue {
    background: rgba(255, 210, 0, 0.12) !important;
    border-left: 3px solid #ffd200 !important;
    color: #ffd200 !important;
    font-weight: 600 !important;
}
.hd-sheet-continue i {
    margin-right: 6px;
}