.watch-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    align-items: stretch;
}

@media (min-width: 1025px) {
    .watch-main {
        display: grid;
        grid-template-columns: 320px minmax(0, 1fr);
        gap: 0 var(--space-xl);
        align-items: start;
    }

    .watch-sidebar-column {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        gap: 12px;
        z-index: 10;
    }

    .watch-player-column {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-direction: column;
    }

    .watch-main.hide-sidebar,
    .watch-main.hide-sidebar.sidebar-right {
        grid-template-columns: 1fr !important;
    }

    .watch-main.hide-sidebar .watch-sidebar-column {
        display: none !important;
    }

    .watch-main.hide-sidebar .watch-player-column {
        grid-column: 1 !important;
        max-width: 1120px;
        margin: 0 auto;
        width: 100%;
    }

    .watch-main.sidebar-right {
        grid-template-columns: minmax(0, 1fr) 320px !important;
    }

    .watch-main.sidebar-right .watch-sidebar-column {
        grid-column: 2 !important;
    }

    .watch-main.sidebar-right .watch-player-column {
        grid-column: 1 !important;
    }

    .episode-sidebar {
        /* Height is set dynamically by JS to match the video player */
        max-height: var(--player-area-height, calc(100vh - 100px)) !important;
        height: var(--player-area-height, calc(100vh - 100px)) !important;
        margin-top: 0 !important;
    }

    .episode-sidebar-list {
        max-height: none !important;
        flex: 1;
    }
}

@media (max-width: 1024px) {
    .watch-layout {
        gap: var(--space-md);
    }
}

.episode-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    height: auto;
    max-height: none;
    position: relative;
    top: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1024px) {
    .episode-sidebar {
        height: auto;
        max-height: none;
        position: relative;
        top: 0;
    }
}

.episode-sidebar-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    background: var(--bg-surface);
    z-index: 10;
}

.episode-sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.view-toggle {
    display: flex;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 2px;
    border: 1px solid var(--border-color);
}

.view-btn {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}


.episode-search-wrapper {
    position: relative;
    width: 100%;
}

.episode-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.episode-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all var(--transition-fast);
}

.episode-search-input:focus {
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.episode-search-input::placeholder {
    color: var(--text-muted);
}

.episode-sidebar-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* smooth momentum scroll on iOS */
    overscroll-behavior: contain;
    /* prevent scroll from bubbling to page */
    padding: var(--space-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    max-height: 400px;
}

.episode-sidebar-list::-webkit-scrollbar {
    width: 6px;
}

.episode-sidebar-list::-webkit-scrollbar-track {
    background: transparent;
}

.episode-sidebar-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
}

/* List View */
.episode-sidebar-list[data-view="list"] .episode-sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    text-align: left;
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}


.episode-sidebar-list[data-view="list"] .episode-sidebar-item.current {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-weight: 600;
    flex-shrink: 0;
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-item.current .episode-sidebar-num {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.episode-sidebar-list[data-view="list"] .episode-info {
    display: block;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.episode-sidebar-list[data-view="list"] .episode-title {
    font-size: 0.9rem;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* List View Filler Marks */
.filler-badge {
    font-size: 0.65rem;
    background: rgba(243, 156, 18, 0.15);
    color: #90887a;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 700;
    vertical-align: middle;
    text-transform: uppercase;
    border: 1px solid rgba(243, 156, 18, 0.3);
    display: inline-block;
    margin-top: -2px;
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-item.is-filler {
    background: rgba(243, 156, 18, 0.05);
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-item.is-filler:hover {
    background: rgba(243, 156, 18, 0.1);
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-item.is-filler .episode-sidebar-num {
    background: rgba(243, 156, 18, 0.15);
    color: #90887a;
}

/* Keep 'current' styling dominant for filler episodes */
.episode-sidebar-list[data-view="list"] .episode-sidebar-item.current.is-filler {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.episode-sidebar-list[data-view="list"] .episode-sidebar-item.current.is-filler .episode-sidebar-num {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Grid View */
.episode-sidebar-list[data-view="grid"] {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 8px;
    padding: 12px;
    align-content: start;
}

.episode-sidebar-list[data-view="grid"] .episode-sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
    height: 50px;
    margin-bottom: 0;
    text-decoration: none;
}

.episode-sidebar-list[data-view="grid"] .episode-sidebar-item:hover {
    transform: translateY(-2px);
    border-color: var(--text-primary);
    color: var(--text-primary);
}


.episode-sidebar-list[data-view="grid"] .episode-sidebar-item.current {
    background: var(--text-primary);
    color: var(--bg-primary);
    font-weight: bold;
    border-color: transparent;
}

.episode-sidebar-list[data-view="grid"] .episode-info {
    display: none;
}

.episode-sidebar-list[data-view="grid"] .episode-sidebar-num {
    width: auto;
    height: auto;
    background: transparent;
    font-size: 0.95rem;
    display: block;
}

.episode-sidebar-list[data-view="grid"]>.episodes-empty-state {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 180px;
    padding: var(--space-xl) var(--space-lg);
}

/* Grid View Filler Marks */
.episode-sidebar-list[data-view="grid"] .episode-sidebar-item.is-filler {
    border-color: rgba(243, 156, 18, 0.4);
    background: rgba(243, 156, 18, 0.05);
    color: #90887a;
}

.episode-sidebar-list[data-view="grid"] .episode-sidebar-item.is-filler:hover {
    border-color: #90887a;
    background: rgba(243, 156, 18, 0.15);
}

/* Keep 'current' styling dominant */
.episode-sidebar-list[data-view="grid"] .episode-sidebar-item.current.is-filler {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: transparent;
}

@media (max-width: 768px) {
    .episode-sidebar-list[data-view="grid"] {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
        padding: 10px;
    }

    .episode-sidebar-list[data-view="grid"] .episode-sidebar-item {
        height: 50px;
    }

    .episode-sidebar-list[data-view="grid"] .episode-sidebar-num {
        font-size: 1rem;
        font-weight: 600;
    }
}

@media (max-width: 380px) {
    .episode-sidebar-list[data-view="grid"] {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        padding: 6px;
    }

    .episode-sidebar-list[data-view="grid"] .episode-sidebar-item {
        height: 40px;
    }

    .episode-sidebar-list[data-view="list"] .episode-sidebar-item {
        padding: var(--space-xs) var(--space-sm);
    }

    .episode-sidebar-list[data-view="list"] .episode-sidebar-num {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .episode-sidebar-list[data-view="list"] .episode-title {
        font-size: 0.85rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
}

/* --- Premium Custom Video Player --- */
.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Vidstack Player — Fill wrapper */
media-player {
    --media-font-family: 'Inter', sans-serif;
    --media-brand: var(--accent, #805ad5);
    --media-focus-ring-color: var(--accent, #805ad5);
    --media-tooltip-bg-color: rgba(20, 20, 25, 0.95);
    width: 100% !important;
    height: 100% !important;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

media-player[data-view-type="video"] {
    aspect-ratio: 16/9;
}

/* Ensure the video element fills the player */
media-player video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    background: #000;
}

/* ── Stable Loading Spinner (override Vidstack buffering indicator) ── */
media-buffering-indicator {
    --media-buffering-size: 72px;
    --media-buffering-track-color: rgba(255, 255, 255, 0.15);
    --media-buffering-track-fill-color: var(--accent, #805ad5);
}

/* Ensure smooth, non-jittery spin */
media-buffering-indicator [data-part="track"],
media-buffering-indicator [data-part="track-fill"] {
    animation-timing-function: linear !important;
}

/* Prevent FOUC for custom elements */
media-player:not(:defined) {
    opacity: 0;
}

/* Control Bar */
.controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0 20px 20px;
    z-index: 20;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
}

/* Progress */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s ease;
    touch-action: none;
    /* Larger touch target via padding — visible bar stays 6px but hitbox is ~32px */
    padding: 13px 0;
    margin: -13px 0;
    background-clip: content-box;
    -webkit-user-select: none;
    user-select: none;
}

.progress-container:hover,
.progress-container.seeking {
    height: 8px;
}

.progress-buffer {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
    transition: height 0.15s ease;
}

.progress-container:hover .progress-buffer,
.progress-container.seeking .progress-buffer {
    height: 8px;
}

.progress-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    transform: translateY(-50%);
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.8);
    transition: height 0.15s ease;
}

.progress-container:hover .progress-fill,
.progress-container.seeking .progress-fill {
    height: 8px;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    left: 0%;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.progress-container:hover .progress-thumb,
.progress-container.seeking .progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

.progress-container.seeking .progress-thumb {
    transform: translate(-50%, -50%) scale(1.2);
}

.progress-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-mono, monospace);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 10;
}

.progress-container:hover .progress-tooltip,
.progress-container.seeking .progress-tooltip {
    opacity: 1;
}

/* Buttons */
.controls-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.8;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--accent);
}

.control-btn svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.5));
}

/* Volume */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.volume-slider-container {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    transform: translateX(-10px);
    padding-left: 2px;
}

.volume-container:hover .volume-slider-container,
.controls-main:focus-within .volume-container .volume-slider-container {
    width: 80px;
    opacity: 1;
    transform: translateX(0);
}

.volume-slider {
    width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--accent) var(--vol-prog, 100%), rgba(255, 255, 255, 0.2) var(--vol-prog, 100%));
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.15s ease;
    margin-top: -1px;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.25);
}

.time-display {
    color: white;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    font-weight: 500;
    user-select: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-left: 10px;
}

/* Menus */
.menu-btn-container {
    position: relative;
}

.player-menu {
    position: absolute;
    bottom: 45px;
    right: -10px;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 10px 0;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: auto;
    transform: translateY(10px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    z-index: 20;
}

.menu-btn-container.active .player-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.player-menu-header {
    padding: 5px 15px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
    font-weight: 700;
}

.player-menu-item {
    padding: 8px 25px 8px 35px;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    position: relative;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.player-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-menu-item.active {
    color: var(--accent);
}

.player-menu-item.active::before {
    content: '';
    position: absolute;
    left: 15px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.player-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

.settings-row {
    display: flex;
    gap: 5px;
    padding: 5px 15px;
    margin-bottom: 10px;
}

.settings-opt-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    color: white;
    padding: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    text-align: center;
}

.settings-opt-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.settings-opt-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Top Bar & Title */
.player-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: auto;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (hover: hover) {
    .video-wrapper:hover .player-top-bar {
        opacity: 1;
    }
}

.video-wrapper.paused .player-top-bar,
.video-wrapper.menu-open .player-top-bar,
.video-wrapper.controls-visible .player-top-bar {
    opacity: 1;
}

.player-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-ep-badge {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ── Skip Intro / Outro Buttons ── */
.skip-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    pointer-events: none;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    font-family: 'Inter', system-ui, sans-serif;
    white-space: nowrap;
}

.skip-btn.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.skip-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateX(0) scale(1.03);
}

.skip-btn:active {
    transform: translateX(0) scale(0.97);
    background: rgba(255, 255, 255, 0.28);
}

.skip-btn svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* Stack them if both are visible */
#skipOutroBtn {
    bottom: 80px;
}

#skipIntroBtn {
    bottom: 80px;
}

/* When both are shown simultaneously, offset the intro button up */
#skipIntroBtn.show~#skipOutroBtn.show,
#skipOutroBtn.show~#skipIntroBtn.show {
    bottom: 135px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .skip-btn {
        bottom: 70px;
        right: 12px;
        padding: 8px 14px;
        font-size: 0.8rem;
        border-radius: 6px;
        gap: 6px;
    }

    .skip-btn svg {
        width: 14px;
        height: 14px;
    }

    #skipOutroBtn {
        bottom: 70px;
    }

    #skipIntroBtn {
        bottom: 70px;
    }

    #skipIntroBtn.show~#skipOutroBtn.show,
    #skipOutroBtn.show~#skipIntroBtn.show {
        bottom: 120px;
    }
}

/* Fullscreen adjustments */
:fullscreen .skip-btn,
:-webkit-full-screen .skip-btn {
    bottom: 100px;
    right: 30px;
    font-size: 1rem;
    padding: 12px 24px;
}

/* Embed iframe player */
.embed-player-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-lg);
    z-index: 5;
    background: #000;
}

/* Embed fullscreen toggle button */
.embed-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.2s ease, transform 0.15s ease;
    pointer-events: auto;
}

.video-wrapper:hover .embed-fullscreen-btn,
.video-wrapper:fullscreen .embed-fullscreen-btn,
.video-wrapper:-webkit-full-screen .embed-fullscreen-btn {
    opacity: 1;
}

.embed-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.embed-fullscreen-btn:active {
    transform: scale(0.95);
}

/* In fullscreen, bump it to the corner */
.video-wrapper:fullscreen .embed-fullscreen-btn,
.video-wrapper:-webkit-full-screen .embed-fullscreen-btn {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
}

/* Stream Selector — Premium Pill UI */
.stream-selector {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stream-selector-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.stream-selector-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.stream-selector-pills {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.03);
    flex-wrap: wrap;
}

.stream-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
}

.stream-pill:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.stream-pill.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
    text-shadow: none;
}

.stream-pill .pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.stream-pill .pill-badge.badge-hls {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.stream-pill.active .pill-badge.badge-hls,
.stream-pill.active .pill-badge.badge-embed {
    background: rgba(255, 255, 255, 0.2);
    color: var(--bg-primary);
}

.stream-pill .pill-badge.badge-embed {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* ── Server Sections — INTERNAL / EXTERNAL pill layout ──────── */
.server-sections {
    display: flex;
    gap: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-md);
    padding: 14px 18px 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.server-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.server-section+.server-section {
    margin-left: 28px;
    padding-left: 28px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.server-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.server-section-label svg {
    opacity: 0.5;
}

.server-section-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.server-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    white-space: nowrap;
}

.server-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.server-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
    font-weight: 700;
}

/* Loading state: pulse animation during AJAX */
.server-sections.loading {
    pointer-events: none;
    position: relative;
    overflow: hidden;
}

.server-sections.loading .server-section-pills {
    opacity: 0.35;
    transition: opacity 0.2s ease;
}

.server-sections.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    animation: serverShimmer 1.2s ease infinite;
    border-radius: var(--radius-md);
}

@keyframes serverShimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Unavailable pill: dimmed + line-through */
.server-pill.unavailable {
    opacity: 0.3;
    cursor: not-allowed;
    text-decoration: line-through;
}

.server-pill.unavailable:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .stream-selector {
        padding: 8px 12px;
        gap: 12px;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .stream-selector-group {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .stream-selector-pills {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        flex: 1;
        /* Hide scrollbar for a cleaner look */
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }

    .stream-selector-pills::-webkit-scrollbar {
        display: none;
    }

    .stream-selector-label {
        text-align: left;
        font-size: 0.7rem;
        min-width: max-content;
    }

    .stream-pill {
        flex: 0 0 auto;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* Premium Language & Action Buttons */
.lang-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-btn {
    padding: 6px 16px;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lang-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lang-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.premium-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.premium-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.premium-action-btn.watch-together-trigger.active {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.38);
    color: #d1fae5;
}

.watch-together-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.watch-together-modal.is-open {
    display: flex;
}

.watch-together-panel {
    width: min(440px, 100%);
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
    padding: 18px;
    color: var(--text-primary);
}

.watch-together-header,
.watch-together-code-row,
.watch-together-link-row,
.watch-together-members-head,
.watch-together-actions {
    display: flex;
    align-items: center;
}

.watch-together-header {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.watch-together-kicker,
.watch-together-link-label,
.watch-together-members-head {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.watch-together-header h3 {
    margin: 2px 0 0;
    font-size: 1.2rem;
    line-height: 1.2;
}

.watch-together-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
}

.watch-together-icon-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.18);
}

.watch-together-status {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.watch-together-status.error {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.08);
}

.watch-together-status.success {
    color: #d1fae5;
    border-color: rgba(16, 185, 129, 0.28);
    background: rgba(16, 185, 129, 0.08);
}

.watch-together-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.watch-together-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.watch-together-input {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.24);
    color: var(--text-primary);
    font-size: 0.9rem;
    letter-spacing: 0;
    text-transform: none;
    outline: none;
}

.watch-together-input:focus {
    border-color: rgba(255, 255, 255, 0.26);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.watch-together-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.watch-together-active[hidden] {
    display: none;
}

.watch-together-code-row {
    gap: 8px;
}

.watch-together-code {
    font-family: var(--font-mono, monospace);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #fff;
}

.watch-together-role {
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.16);
    color: #bfdbfe;
    font-size: 0.72rem;
    font-weight: 800;
}

.watch-together-link-label {
    display: block;
    margin-bottom: -4px;
}

.watch-together-link-row {
    gap: 8px;
}

.watch-together-link {
    min-width: 0;
    flex: 1;
    height: 38px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.24);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.watch-together-copy,
.watch-together-primary,
.watch-together-secondary {
    height: 38px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 700;
    cursor: pointer;
}

.watch-together-copy {
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.watch-together-members-head {
    justify-content: space-between;
    margin-top: 2px;
}

.watch-together-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
}

.watch-together-member {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.watch-together-member::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #10b981;
    flex: 0 0 auto;
}

.watch-together-member.host {
    color: #fff;
    border-color: rgba(59, 130, 246, 0.25);
}

.watch-together-member span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.watch-together-actions {
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.watch-together-primary,
.watch-together-secondary {
    padding: 0 16px;
}

.watch-together-primary {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.watch-together-primary:disabled {
    opacity: 0.55;
    cursor: wait;
}

.watch-together-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.watch-together-secondary:hover,
.watch-together-copy:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .watch-layout {
        gap: var(--space-md);
        padding: 0;
    }

    .watch-main {
        width: 100%;
    }

    .video-wrapper {
        margin: 0 calc(-1 * var(--space-md));
        width: calc(100% + 2 * var(--space-md));
        border-radius: 0;
    }

    .watch-main>div:last-child {
        padding: var(--space-md) !important;
        margin-top: var(--space-md) !important;
    }

    .watch-main h2 {
        font-size: 1.1rem;
    }

    .time-display {
        display: none;
    }

    .player-title {
        font-size: 0.9rem;
    }

    .controls-bar {
        padding: 0 10px 10px;
    }
}

@media (max-width: 480px) {
    .watch-layout {
        gap: var(--space-sm);
    }

    .video-wrapper {
        margin: 0 calc(-1 * var(--space-sm));
        width: calc(100% + 2 * var(--space-sm));
    }

    .volume-container {
        display: none;
    }
}

/* Fullscreen mode — video-wrapper fills viewport */
.video-wrapper:fullscreen,
.video-wrapper:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    background: #000 !important;
}

.video-wrapper:fullscreen .embed-player-frame,
.video-wrapper:-webkit-full-screen .embed-player-frame {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.video-wrapper:fullscreen #videoContainer,
.video-wrapper:-webkit-full-screen #videoContainer {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
}

.video-wrapper:fullscreen media-player,
.video-wrapper:-webkit-full-screen media-player {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.anime-details-section {
    margin-top: 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.anime-details-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .anime-details-grid {
        grid-template-columns: 1fr;
    }
}

.anime-poster {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    background: var(--bg-elevated);
    object-fit: cover;
    aspect-ratio: 2/3;
}

.anime-title-block {
    margin-bottom: 15px;
}

.anime-title-main {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.anime-title-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.anime-synopsis {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.anime-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    background: var(--bg-primary);
    padding: 15px;
    border-radius: var(--radius-md);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.tag-pill {
    background: rgba(var(--accent-rgb, 128, 90, 213), 0.15);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.section-heading {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

/* Relations */
.relations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.relation-card {
    position: relative;
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 2/3;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.relation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.relation-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.relation-card:hover img {
    transform: scale(1.05);
}

.relation-type {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    z-index: 5;
}

.relation-title-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 10px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
    color: white;
    text-align: center;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.relation-title {
    font-size: 0.85rem;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Characters Horizontal Scroll */
.character-scroll {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-elevated);
}

.character-scroll::-webkit-scrollbar {
    height: 6px;
}

.character-scroll::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 6px;
}

.character-scroll::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 6px;
}

.character-card {
    min-width: 100px;
    max-width: 100px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.character-img {
    width: 100px;
    height: 140px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
}

.character-name {
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.character-role {
    font-size: 0.7rem;
    text-align: center;
    color: var(--text-muted);
}

/* ============================================================
   WATCH PAGE — NAV BAR (Prev/Next + SUB/DUB + Report)
   ============================================================ */

.watch-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.watch-nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.watch-nav-left .btn-primary {
    background: #fff !important;
    color: #000 !important;
    border: none !important;
    font-weight: 600 !important;
}

.watch-nav-left .btn-primary:hover {
    background: #e2e2e2 !important;
    color: #000 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.watch-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Mobile ≤ 600px: full stack layout ──────────────────────── */
@media (max-width: 600px) {

    /* Controls row becomes a column so selector + actions stack */
    #watch-navigation>div:nth-child(2) {
        padding: 10px 12px !important;
        gap: 10px !important;
        border-radius: var(--radius-md) !important;
    }

    /* Stream selector: full-width stacked rows */
    .stream-selector {
        flex-direction: column;
        gap: 6px;
        padding: 8px 10px;
        width: 100%;
        box-sizing: border-box;
        box-shadow: none;
    }

    .stream-selector-group {
        width: 100%;
        gap: 8px;
    }

    .stream-selector-label {
        font-size: 0.64rem;
        min-width: 38px;
    }

    .stream-selector-pills {
        flex: 1;
        overflow-x: auto;
        flex-wrap: nowrap;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .stream-selector-pills::-webkit-scrollbar {
        display: none;
    }

    .stream-pill {
        flex: 0 0 auto;
        padding: 4px 10px;
        font-size: 0.76rem;
        white-space: nowrap;
    }

    /* Server sections: stack on mobile */
    .server-sections {
        flex-direction: column;
        gap: 0;
        padding: 10px 14px;
    }

    .server-section+.server-section {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .server-section-label {
        font-size: 0.62rem;
    }

    .server-pill {
        padding: 5px 10px;
        font-size: 0.76rem;
    }



    .stream-pill .pill-badge {
        font-size: 0.58rem;
        padding: 1px 4px;
    }

    /* Nav bar: compact on mobile */
    .watch-nav-bar {
        padding: 8px 10px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .watch-nav-right {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .lang-toggle {
        padding: 3px;
        border-radius: var(--radius-sm);
    }

    .lang-btn {
        padding: 5px 11px;
        font-size: 0.75rem;
    }

    .premium-action-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* ── Small phones ≤ 380px ───────────────────────────────────── */
@media (max-width: 380px) {
    .stream-selector {
        padding: 6px 8px;
        gap: 5px;
    }

    .stream-pill {
        padding: 3px 8px;
        font-size: 0.72rem;
    }

    .stream-pill .pill-badge {
        display: none;
    }

    .server-pill {
        padding: 4px 8px;
        font-size: 0.7rem;
    }



    .lang-btn {
        padding: 4px 9px;
        font-size: 0.72rem;
    }

    .premium-action-btn {
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    .premium-action-btn svg {
        width: 13px;
        height: 13px;
    }
}

/* ── Tiny phones ≤ 360px: icon-only report ──────────────────── */
@media (max-width: 360px) {

    .premium-action-btn .report-label,
    .premium-action-btn .watch-together-label {
        display: none;
    }

    .premium-action-btn {
        padding: 5px 8px;
    }
}

/* ── Double Tap Seek Zones (Mobile) ──────────────────── */
.dt-zone {
    position: absolute;
    top: 0;
    bottom: 80px;
    /* Leave space for controls bar */
    width: 40%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.dt-zone-left {
    left: 0;
}

.dt-zone-right {
    right: 0;
}

.dt-indicator {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: none;
    pointer-events: none;
}

.dt-indicator span {
    font-size: 0.85rem;
    font-weight: bold;
    margin-top: -5px;
}

.dt-indicator.active {
    opacity: 1;
    transform: scale(1.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dt-indicator.fade-out {
    opacity: 0;
    transform: scale(1);
    transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}

/* ── Settings Menu Overrides for Mobile ──────────────────── */
@media (max-width: 768px) {
    .player-menu {
        position: fixed;
        bottom: 80px;
        right: 15px;
        left: auto;
        min-width: 200px;
        max-width: 250px;
        transform: translateY(100vh);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    }

    .menu-btn-container.active .player-menu {
        transform: translateY(0);
    }
}

/* Thumbnail tooltip layout */
.progress-tooltip {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 4px 4px 6px !important;
    min-width: 50px !important;
    width: auto !important;
}

#tooltipThumbCanvas {
    display: none;
    /* hidden until first frame is captured */
    border-radius: 4px 4px 0 0;
    width: 160px;
    height: 90px;
    background: #111;
    flex-shrink: 0;
}

#tooltipThumbCanvas.has-frame {
    display: block;
}

#tooltipTimeText {
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
}

/* On very small screens, shrink the thumb a bit */
@media (max-width: 480px) {
    #tooltipThumbCanvas {
        width: 120px;
        height: 67px;
    }
}

/* Center Play Button Default Sizing for Static Overlay */
.center-play-pause-static {
    width: 80px;
    height: 80px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.center-play-pause-static svg {
    width: 40px;
    height: 40px;
}

/* Mobile size reduction for center play buttons (when not fullscreen) */
@media (max-width: 768px) {

    .video-wrapper:not(.vjs-fullscreen) .center-play-pause,
    .video-wrapper:not(.vjs-fullscreen) .center-play-pause-static {
        width: 55px !important;
        height: 55px !important;
    }

    .video-wrapper:not(.vjs-fullscreen) .center-play-pause svg,
    .video-wrapper:not(.vjs-fullscreen) .center-play-pause-static svg {
        width: 26px !important;
        height: 26px !important;
    }
}

/* ── closes @media (max-width: 768px) ── */

/* ── Skip Intro / Outro Buttons ── */
.skip-btn {
    position: absolute;
    bottom: 90px;
    right: 20px;
    z-index: 50;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    font-family: inherit;
    pointer-events: none;
}

.skip-btn.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.skip-btn:hover {
    background: var(--accent, #805ad5);
    color: white;
    border-color: var(--accent, #805ad5);
    transform: translateX(0) scale(1.03);
    box-shadow: 0 6px 24px rgba(var(--accent-rgb, 128, 90, 213), 0.4);
}

@media (max-width: 768px) {
    .skip-btn {
        bottom: 80px;
        right: 12px;
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* ── Chapter markers on timeline — highlight intro/outro segments ── */
media-time-slider [data-part="chapter-container"] {
    gap: 2px;
}

media-time-slider [data-part="chapter-track"] {
    border-radius: 3px;
    overflow: hidden;
}

/* ── Vidstack Buffering Indicator — Full Clean Override ── */

/* 1. Pin the indicator dead-center inside the video wrapper — no drift, no translate animation */
media-player [data-media-buffering] media-buffering-indicator {
    animation: none !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 56px !important;
    height: 56px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 2. Kill Vidstack's internal arc-crawl animation on the SVG wrapper */
media-player [data-media-buffering] media-buffering-indicator svg {
    animation: th3-spin 0.9s linear infinite !important;
    width: 56px !important;
    height: 56px !important;
    overflow: visible !important;
    transform-origin: center center !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 3. Freeze the arc at a fixed length — stops the "crawling" stroke-dashoffset change */
media-player [data-media-buffering] media-buffering-indicator circle {
    animation: none !important;
    stroke-dasharray: 120 200 !important;
    /* fixed arc: ~3/4 of circumference */
    stroke-dashoffset: -20 !important;
}

/* 4. The keyframe — pure rotation only */
@keyframes th3-spin {
    from {
        transform: rotate(0deg);
    }

}

/* =========================================
   Episodes Unavailable / Empty State Styles
   ========================================= */

/* Main Player Card Replacement */
.episodes-unavailable-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    overflow: hidden;
}

.eu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.eu-backdrop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(20px) scale(1.1);
    opacity: 0.4;
}

.eu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 100%);
    z-index: 2;
}

.eu-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-xl);
    max-width: 600px;
    animation: fade-in-up 0.6s ease forwards;
}

.eu-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: var(--space-md);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.eu-title {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 var(--space-sm) 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.eu-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-xl) 0;
    line-height: 1.5;
}

.eu-subtitle strong {
    color: #fff;
}

.eu-countdown-wrapper {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-xl);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.eu-countdown-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.eu-countdown-timer {
    display: flex;
    align-items: center;
    gap: 15px;
}

.eu-countdown-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 45px;
}

.eu-countdown-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.eu-countdown-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.eu-countdown-sep {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: -15px;
    font-weight: bold;
}

.eu-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.eu-details-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--accent-rgb), 0.4);
}

/* Sidebar Empty State */
.episodes-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
}

.ee-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.episodes-empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0 0 var(--space-xs) 0;
}

.episodes-empty-state p {
    font-size: 0.9rem;
    margin: 0;
    max-width: 250px;
    line-height: 1.5;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .eu-title {
        font-size: 1.5rem;
    }

    .eu-icon {
        width: 60px;
        height: 60px;
    }

    .eu-countdown-num {
        font-size: 1.4rem;
    }

    .eu-countdown-timer {
        gap: 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════
 *  Custom HLS Player — Black & White Minimalist Theme
 * ═══════════════════════════════════════════════════════════════ */

.yz-player {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.yz-player * {
    box-sizing: border-box;
}

.yz-player video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

/* Buffering spinner */
.yz-buffering {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .35);
    z-index: 10;
    pointer-events: none;
}

.yz-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: yz-spin .75s linear infinite;
}

@keyframes yz-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skip button */
.yz-skip-btn {
    position: absolute;
    bottom: 72px;
    right: 16px;
    z-index: 30;
    padding: 8px 16px;
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.yz-skip-btn:hover {
    background: rgba(255, 255, 255, .22);
    border-color: rgba(255, 255, 255, .6);
}

.skip-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.skip-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.skip-text {
    font-size: 0.95rem;
    line-height: 1.1;
}

.skip-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.1;
    margin-top: 2px;
}

/* Overlay (click to play/pause) */
.yz-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: pointer;
}

/* Pause flash */
.yz-pause-flash {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
}

.yz-pause-flash.yz-flash {
    animation: yz-fade-out .6s ease-out forwards;
}

@keyframes yz-fade-out {
    0% {
        opacity: 1;
        transform: scale(1)
    }

    100% {
        opacity: 0;
        transform: scale(1.3)
    }
}

/* Controls bar */
.yz-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    background: linear-gradient(transparent, rgba(0, 0, 0, .85));
    padding: 32px 12px 10px;
    transition: opacity .25s, transform .25s;
}

.yz-controls.yz-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

/* Progress bar */
.yz-progress-wrap {
    position: relative;
    height: 18px;
    cursor: pointer;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.yz-progress-wrap::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, .2);
    border-radius: 99px;
    top: 50%;
    transform: translateY(-50%);
}

.yz-buf-bar,
.yz-play-bar {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    border-radius: 99px;
    pointer-events: none;
    transition: height .15s;
}

.yz-buf-bar {
    background: rgba(255, 255, 255, .3);
}

.yz-play-bar {
    background: #fff;
    z-index: 1;
}

.yz-progress-wrap:hover .yz-buf-bar,
.yz-progress-wrap:hover .yz-play-bar {
    height: 5px;
}

.yz-seek {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* Progress bar segments (intro/outro) */
.yz-segment {
    position: absolute;
    top: 50%;
    height: 3px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 0;
    transition: height .15s;
}

.yz-progress-wrap:hover .yz-segment {
    height: 5px;
}

.yz-seg-intro {
    background: rgba(255, 235, 59, 0.5);
}

.yz-seg-outro {
    background: rgba(255, 235, 59, 0.5);
}

.yz-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: rgba(12, 12, 18, .92);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.1);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 5;
    text-align: center;
    min-width: 40px;
}

/* Thumbnail preview container inside tooltip */
.yz-thumb-preview {
    display: block;
    background-repeat: no-repeat;
    border: 1px solid rgba(255,255,255,.15);
    box-shadow: 0 4px 16px rgba(0,0,0,.6);
}

/* Control row */
.yz-ctrl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.yz-ctrl-left,
.yz-ctrl-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

.yz-vol-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    transition: gap 0.2s;
}

.yz-vol-wrap:hover,
.yz-vol-wrap:focus-within {
    gap: 4px;
}

/* Buttons */
.yz-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background .15s, transform .1s;
    line-height: 0;
}

.yz-btn:hover {
    background: rgba(255, 255, 255, .12);
}

.yz-btn:active {
    transform: scale(.9);
}

/* Volume slider */
.yz-vol {
    width: 0;
    opacity: 0;
    pointer-events: none;
    height: 3px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #fff calc(var(--pct, 100%)), rgba(255, 255, 255, .25) calc(var(--pct, 100%)));
    border-radius: 99px;
    outline: none;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.yz-vol-wrap:hover .yz-vol,
.yz-vol-wrap:focus-within .yz-vol {
    width: 72px;
    opacity: 1;
    pointer-events: auto;
}

.yz-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

/* Time */
.yz-time {
    color: rgba(255, 255, 255, .8);
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
}

/* Settings panel */
.yz-settings {
    position: absolute;
    bottom: 56px;
    right: 12px;
    z-index: 40;
    background: rgba(12, 12, 18, .92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    min-width: 180px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .6);
}

.yz-sett-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: none;
    border: none;
    color: #fff;
    font-size: .85rem;
    cursor: pointer;
    transition: background .12s;
}

.yz-sett-row:hover {
    background: rgba(255, 255, 255, .07);
}

.yz-sett-val {
    color: rgba(255, 255, 255, .5);
    font-size: .8rem;
}

.yz-sett-back {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .7);
    font-size: .82rem;
    cursor: pointer;
    transition: background .12s;
}

.yz-sett-back:hover {
    background: rgba(255, 255, 255, .06);
}

.yz-sett-opts {
    display: flex;
    flex-direction: column;
}

.yz-opt {
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .75);
    font-size: .83rem;
    text-align: left;
    cursor: pointer;
    transition: background .12s;
}

.yz-opt:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.yz-opt.active {
    color: #fff;
    font-weight: 700;
    background: rgba(255, 255, 255, .06);
}

/* CC / Subtitles button active state */
.yz-cc-btn.yz-cc-active {
    color: #a78bfa;
    background: rgba(167, 139, 250, .15);
    border-radius: 6px;
}

.yz-cc-btn.yz-cc-active svg {
    stroke: #a78bfa;
}

/* Default cue style (overridden by user preferences via JS-injected ::cue) */
::cue {
    font-family: inherit;
    font-size: 100%;
    color: white;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 3px;
    padding: 1px 5px;
}

/* Subtitle Style Settings UI */
.yz-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    outline: none;
    margin: 6px 0;
}
.yz-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
.yz-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.yz-color-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.yz-color-btn:hover {
    transform: scale(1.15);
}
.yz-color-btn.active {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
}


/* Fullscreen adjustments */
.yz-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

.yz-player:fullscreen {
    width: 100vw;
    height: 100vh;
}

#player-area:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
}

#player-area:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
}

/* ── Mobile Double-Tap Seek Zones ─────────────────────────── */
.yz-dt-zone {
    position: absolute;
    top: 0;
    bottom: 60px;
    width: 30%;
    z-index: 6;
    display: none;
    /* hidden on desktop */
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.yz-dt-left {
    left: 0;
}

.yz-dt-right {
    right: 0;
}

@media (hover: none) and (pointer: coarse) {
    .yz-dt-zone {
        display: flex;
    }
}

.yz-dt-indicator {
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border-radius: 50%;
    width: 72px;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0;
    transform: scale(.7);
    pointer-events: none;
    transition: none;
}

.yz-dt-indicator span {
    font-size: .75rem;
    font-weight: 700;
    line-height: 1;
}

.yz-dt-indicator.yz-dt-active {
    opacity: 1;
    transform: scale(1.15);
    transition: opacity .15s, transform .2s cubic-bezier(.175, .885, .32, 1.275);
}

.yz-dt-indicator.yz-dt-fade {
    opacity: 0;
    transform: scale(1);
    transition: opacity .4s ease .15s, transform .4s ease .15s;
}

/* Ripple effect on double-tap zones */
.yz-dt-zone::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, .08) 0%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}

.yz-dt-zone:active::after {
    opacity: 1;
}

/* ── Resume Toast ─────────────────────────────────────────── */
.yz-resume-toast {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
    animation: yz-toast-in .35s cubic-bezier(.16, 1, .3, 1);
    pointer-events: none;
}

@keyframes yz-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ── Mobile Control Bar Tweaks ────────────────────────────── */
@media (max-width: 768px) {
    .yz-controls {
        padding: 24px 8px 8px;
    }

    .yz-vol {
        display: none;
    }

    .yz-time {
        font-size: .7rem;
    }

    .yz-btn {
        padding: 5px;
    }

    .yz-btn svg {
        width: 18px;
        height: 18px;
    }

    .yz-settings {
        bottom: 48px;
        right: 8px;
        min-width: 160px;
    }

    .yz-progress-wrap {
        height: 24px;
        margin-bottom: 4px;
    }

    .yz-progress-wrap::before {
        height: 4px;
    }

    .yz-buf-bar,
    .yz-play-bar {
        height: 4px;
    }

    .yz-skip-btn {
        bottom: 60px;
        right: 10px;
        font-size: .78rem;
        padding: 6px 14px;
    }
}

/* ── Sleek Top Quick Settings & Navigation Bar ── */
.watch-quick-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0c0c0e;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 16px;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #8a8a93;
    user-select: none;
    font-family: inherit;
}

.quick-bar-left {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.quick-bar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Toggles styling */
.quick-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s;
    user-select: none;
}

.quick-toggle input {
    display: none;
}

.quick-toggle .indicator {
    width: 8px;
    height: 8px;
    border-radius: 1px;
    background: #2a2a30;
    margin-right: 6px;
    transition: background-color 0.2s, box-shadow 0.2s;
    display: inline-block;
}

.quick-toggle:hover {
    color: #cbd5e1;
}

.quick-toggle.active {
    color: #ffffff;
    /* Sleek active white color */
}

.quick-toggle.active .indicator {
    background: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.quick-btn {
    background: none;
    border: none;
    color: #8a8a93;
    padding: 0;
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.quick-btn:hover {
    color: #cbd5e1;
}

.quick-btn.active {
    color: #ffffff;
    /* Sleek active white color */
}

/* Nav links styling */
.quick-nav-link {
    color: #8a8a93;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.quick-nav-link:hover:not(.disabled) {
    color: #ffffff;
}

.quick-nav-link.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.quick-current-ep {
    color: #ffffff;
    font-weight: 600;
}

/* Lights Off overlay */
.lights-off-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    z-index: 9990;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

body.lights-off-active .lights-off-overlay {
    pointer-events: auto;
    opacity: 1;
}

body.lights-off-active #video-wrapper,
body.lights-off-active #player-area,
body.lights-off-active .yz-player {
    position: relative;
    z-index: 9995 !important;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.85);
}

@media (max-width: 768px) {
    .watch-quick-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 12px;
    }

    .quick-bar-left {
        gap: 12px;
    }

    .quick-bar-right {
        width: 100%;
        justify-content: space-between;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════
 *  Watch Sidebar Sections — Seasons & Related
 * ═══════════════════════════════════════════════════════════════ */

.watch-sidebar-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-top: 12px;
    overflow: hidden;
}

.watch-sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.watch-sidebar-section-header svg {
    opacity: 0.5;
    flex-shrink: 0;
}

/* ── Seasons Grid ─────────────────────────────────── */
.watch-seasons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.watch-seasons-grid::-webkit-scrollbar {
    width: 5px;
}

.watch-seasons-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.watch-season-card {
    position: relative;
    display: block;
    height: 52px;
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.watch-season-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
}

.watch-season-card:hover .watch-season-card-bg {
    transform: scale(1.08);
}

.watch-season-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease;
}

.watch-season-card:hover .watch-season-card-overlay {
    background: rgba(0, 0, 0, 0.45);
}

.watch-season-card-label {
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    padding: 0 4px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.02em;
}

/* Active / Current Season Styling */
.watch-season-card.current {
    border-color: var(--accent, #805ad5);
    box-shadow: 0 0 10px rgba(var(--accent-rgb, 128, 90, 213), 0.3);
}

.watch-season-card.current .watch-season-card-overlay {
    background: rgba(var(--accent-rgb, 128, 90, 213), 0.2);
    border: 1px solid rgba(var(--accent-rgb, 128, 90, 213), 0.3);
}

.watch-season-card.current .watch-season-card-label {
    color: #fff;
    font-weight: 800;
}

/* ── Related Anime List ──────────────────────────── */
.watch-related-list {
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 2px;
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.watch-related-list::-webkit-scrollbar {
    width: 5px;
}

.watch-related-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.watch-related-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.watch-related-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.watch-related-item img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.watch-related-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.watch-related-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.watch-related-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ── Mobile: Seasons & Related ────────────────────── */
@media (max-width: 1024px) {
    .watch-main {
        display: flex;
        flex-direction: column;
    }

    .watch-sidebar-column,
    .watch-player-column {
        display: contents;
    }

    .video-wrapper {
        order: 1;
    }

    .watch-quick-bar {
        order: 2;
    }

    #watch-navigation {
        order: 3;
    }

    #watch-countdown {
        order: 4;
    }

    .episode-sidebar {
        order: 5;
    }

    .watch-sidebar-section {
        order: 6;
        margin-top: 10px;
    }

    .watch-sidebar-section:has(.watch-related-list) {
        order: 10;
    }

    .anime-details-section {
        order: 7;
        margin-top: 15px !important;
    }

    .episode-reaction-bar {
        order: 8;
        margin-top: 15px !important;
    }

    .comment-section {
        order: 9;
        margin-top: 15px !important;
    }

    #btn-shortcuts {
        display: none;
    }

    #btn-lightsoff {
        display: none;
    }

    #btn-native {
        display: none;
    }

    #btn-toggle-sidebar,
    #btn-flip-layout {
        display: none;
    }

    .watch-seasons-grid {
        max-height: 200px;
    }

    .watch-related-list {
        max-height: 200px;
    }
}

/* Custom Pseudo-Fullscreen and Rotated Fullscreen styles */
#player-area.yz-pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    z-index: 999999 !important;
    background: #000 !important;
}

#player-area.yz-rotated-fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    width: 100vh !important;
    height: 100vw !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
    z-index: 999999 !important;
    background: #000 !important;
}

#player-area.yz-rotated-fullscreen .yz-player {
    width: 100% !important;
    height: 100% !important;
}

/* Glassmorphic Mobile Center Play/Pause button styling */
.yz-center-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 21;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 68px;
    height: 68px;
    display: none;
    /* Only shown on mobile/touch screens when controls are visible */
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.25s, transform 0.1s, background-color 0.2s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.yz-center-play-btn:active {
    transform: translate(-50%, -50%) scale(0.9);
}

.yz-center-play-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

@media (hover: none) and (pointer: coarse),
(max-width: 1200px) {
    .yz-center-play-btn {
        display: flex;
        opacity: 0;
        pointer-events: none;
    }
}

/* ── Speed Indicator (hold-space 2x) ─────────────────────────── */
.yz-speed-indicator {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 32px;
    padding: 7px 16px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.yz-speed-indicator.yz-speed-active {
    opacity: 1;
}

.yz-speed-indicator svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* ── Cast Button ─────────────────────────────────────────────── */
.yz-cast-active {
    color: var(--accent, #6c63ff) !important;
}
