:root {
    --player-purple: #7c3aed;
    --player-purple-dark: #6d28d9;
    --player-purple-soft: #a78bfa;
    --radius-thumb: 16px;
    --radius-chip: 14px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --divider: #e5e7eb;
    --btn-solid-bg: #7c3aed;
    --btn-solid-text: #ffffff;
    --btn-solid-hover: #6d28d9;
    --btn-muted-bg: #f5f3ff;
    --btn-subscribed-bg: #f3f4f6;
    --btn-subscribed-text: #111827;
    --btn-subscribed-border: #e5e7eb;
    --btn-subscribed-hover: #e5e7eb;
}

.player {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #0f0f12;
    border-radius: var(--radius-thumb);
    overflow: hidden;
    margin-bottom: 0;
    direction: ltr;
    user-select: none;
    container-type: size;
    container-name: player;
}

/* استیج باید با absolute پر شود — height:100% زیر aspect-ratio گاهی صفر می‌شد و پلیر/لیست می‌پرید */
.player__stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    background: #000;
}

/* خارج فول‌اسکرین: لیست را روی استیج overlay کن — grid + aspect-ratio:auto
   با container-type:size ارتفاع را صفر می‌کرد و ویدیو محو می‌شد */
.player.player--has-playlist.player--playlist-open:not(:fullscreen):not(:-webkit-full-screen):not(.player--fullscreen) {
    display: block;
    aspect-ratio: 16 / 9;
}

.player.player--has-playlist.player--playlist-open:not(:fullscreen):not(:-webkit-full-screen):not(.player--fullscreen) .player__stage {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    height: 100%;
    width: 100%;
}

.player.player--has-playlist.player--playlist-open:not(:fullscreen):not(:-webkit-full-screen):not(.player--fullscreen) .player__playlist {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(280px, 42%);
    height: 100%;
    min-height: 0;
    z-index: 18;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
}

.player__video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: auto;
}

/* Course intro idle: cover + play only, until first interaction */
.player__poster {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: #0f0f12;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

.player--idle .player__poster {
    display: block;
}

.player:not(.player--idle) .player__poster {
    display: none;
}

.player--idle .player__controls,
.player--idle .player__sub-overlay,
.player--idle .player__quality-panel,
.player--idle .player__speed-panel,
.player--idle .player__sub-panel,
.player--idle .player__seek-zone,
.player--idle .player__feedback,
.player--idle .player__guest-gate,
.player--idle .player__buffering,
.player--idle .player__playlist,
.player--idle .player__nextup {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden;
}

.player--idle.player--paused .player__controls,
.player--idle.player--controls-visible .player__controls {
    opacity: 0 !important;
    pointer-events: none !important;
}

.player--idle .player__play {
    opacity: 1;
    pointer-events: auto;
    z-index: 3;
}

.player--idle .player__play-ring {
    opacity: 1;
    animation: playerPlayIdlePulse 2.6s ease-out infinite;
}

.player--idle:has(.player__poster) .player__video {
    opacity: 0;
}

.player__buffering {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.18);
}

.player__buffering[hidden] {
    display: none !important;
}

.player__buffering-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: playerBufferSpin 0.75s linear infinite;
}

@keyframes playerBufferSpin {
    to { transform: rotate(360deg); }
}

/* Center play — compact glass so poster/cover stays readable */
.player__play {
    --play-size: 48px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: var(--play-size);
    height: var(--play-size);
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: #fff;
    display: grid;
    place-items: center;
    z-index: 2;
    cursor: pointer;
    transition: transform var(--transition), opacity var(--transition), filter var(--transition);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

.player__play-ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.2);
}

.player__play-core {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06)),
        rgba(18, 16, 28, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(12px) saturate(1.25);
    -webkit-backdrop-filter: blur(12px) saturate(1.25);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 6px 18px rgba(0, 0, 0, 0.28);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.player__play-icon {
    display: block;
    /* optical center for triangle */
    transform: translateX(1.5px);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
    margin-left: -2px;
}

.player--playing .player__play {
    opacity: 0;
    pointer-events: none;
}

.player__play:hover {
    transform: translate(-50%, -50%) scale(1.06);
}

.player__play:hover .player__play-core {
    background:
        linear-gradient(145deg, rgba(167, 139, 250, 0.55), rgba(124, 58, 237, 0.55)),
        rgba(18, 16, 28, 0.35);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 8px 22px rgba(124, 58, 237, 0.35);
}

.player__play:focus-visible {
    outline: none;
}

.player__play:focus-visible .player__play-core {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 0 3px rgba(167, 139, 250, 0.55),
        0 8px 22px rgba(0, 0, 0, 0.3);
}

.player__play:active {
    transform: translate(-50%, -50%) scale(0.96);
}

@keyframes playerPlayIdlePulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
        border-color: rgba(255, 255, 255, 0.32);
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.28);
    }
    70% {
        transform: scale(1.35);
        opacity: 0;
        border-color: rgba(167, 139, 250, 0.15);
        box-shadow: 0 0 0 10px rgba(167, 139, 250, 0);
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .player--idle .player__play-ring {
        animation: none;
        opacity: 0.55;
    }
}

@container player (max-width: 420px) {
    .player__play {
        --play-size: 42px;
    }

    .player__play-icon {
        width: 18px;
        height: 18px;
    }
}

@container player (min-width: 900px) {
    .player__play {
        --play-size: 52px;
    }
}

/* Center play/pause feedback pop */
.player__feedback {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.player__feedback[hidden] {
    display: none !important;
}

.player__feedback-bubble {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(15, 14, 20, 0.55);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transform: scale(0.55);
}

.player__feedback.is-pop .player__feedback-bubble {
    animation: playerFeedbackPop 0.55s cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
}

.player__feedback-icon.is-hidden {
    display: none;
}

@keyframes playerFeedbackPop {
    0% {
        opacity: 0;
        transform: scale(0.45);
    }
    28% {
        opacity: 1;
        transform: scale(1.08);
    }
    55% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.15);
    }
}

.player__controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75) 40%, rgba(0, 0, 0, 0.9));
    padding: 20px 12px 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 5;
}

.player--controls-visible .player__controls,
.player--paused .player__controls {
    opacity: 1;
    pointer-events: auto;
}

/* Custom subtitle overlay â€” scales with player size */
.player__sub-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 28px;
    text-align: center;
    padding: 0 3%;
    z-index: 4;
    pointer-events: none;
    transition: bottom 0.25s ease, opacity 0.25s ease;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

.player--controls-visible .player__sub-overlay,
.player--paused .player__sub-overlay {
    bottom: 62px;
}

.player__sub-overlay:empty {
    display: none;
}

.player__sub-text {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.2cqw 0.55cqw;
    border-radius: 0.2cqw;
    font-family: var(--bs-font, 'Dana', Tahoma, sans-serif);
    line-height: 1.35;
    direction: rtl;
    unicode-bidi: isolate;
    text-align: start;
    font-size: clamp(0.85rem, 1.85cqw, 2.2rem);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}

/* یک جزیرهٔ LTR برای کل عبارت انگلیسی — نه هر کلمه جدا */
.player__sub-ltr {
    unicode-bidi: isolate;
    direction: ltr;
    display: inline;
    white-space: pre-wrap;
}

/* Hide native browser captions */
.player__video::cue {
    opacity: 0;
}

/* Subtitle preset styles â€” scaled to player, distinct sizes */
.player.sub-preset-default .player__sub-text {
    color: #fff;
    background: rgba(0, 0, 0, 0.78);
    font-size: clamp(0.85rem, 1.85cqw, 2.2rem);
    font-weight: 500;
    padding: 0.25cqw 0.65cqw;
}

.player.sub-preset-large .player__sub-text {
    color: #fff;
    background: transparent;
    font-size: clamp(1rem, 2.45cqw, 2.8rem);
    font-weight: 800;
    padding: 0.1cqw 0.3cqw;
    text-shadow:
        0.1cqw 0.1cqw 0 #000,
        -0.1cqw 0.1cqw 0 #000,
        0.1cqw -0.1cqw 0 #000,
        -0.1cqw -0.1cqw 0 #000,
        0 0 0.5cqw #000;
}

.player.sub-preset-cinema .player__sub-text {
    color: #ffc107;
    background: transparent;
    font-size: clamp(0.9rem, 2.05cqw, 2.4rem);
    font-weight: 700;
    font-style: normal;
    letter-spacing: 0;
    padding: 0.1em 0.2em;
    -webkit-text-stroke: clamp(2px, 0.22cqw, 6px) #000;
    paint-order: stroke fill;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.player.sub-preset-glass .player__sub-text {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    font-size: clamp(0.8rem, 1.65cqw, 2rem);
    font-weight: 400;
    padding: 0.35cqw 0.9cqw;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.5cqw;
    text-shadow: 0 0.06cqw 0.15cqw rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
}

.player.sub-preset-contrast .player__sub-text {
    color: #fff;
    background: #000;
    font-size: clamp(1rem, 2.35cqw, 2.65rem);
    font-weight: 700;
    padding: 0.35cqw 0.85cqw;
    /* border: 2px solid #fff; */
}

.player--controls-hidden {
    cursor: none;
}

.player--controls-hidden.player--paused {
    cursor: default;
}

/* Fullscreen — fill viewport and scale subtitles with vmin (mobile-safe) */
.player:fullscreen,
.player:-webkit-full-screen,
.player--fullscreen {
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    border-radius: 0;
    margin: 0;
    background: #000;
}

.player:fullscreen.player--playlist-open,
.player:-webkit-full-screen.player--playlist-open,
.player--fullscreen.player--playlist-open {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.player:fullscreen .player__stage,
.player:-webkit-full-screen .player__stage,
.player--fullscreen .player__stage {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    height: 100%;
    width: 100%;
}

.player:fullscreen.player--playlist-open .player__stage,
.player:-webkit-full-screen.player--playlist-open .player__stage,
.player--fullscreen.player--playlist-open .player__stage {
    position: relative;
    inset: auto;
    height: 100%;
    aspect-ratio: auto;
}

.player:fullscreen .player__video,
.player:-webkit-full-screen .player__video,
.player--fullscreen .player__video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #000;
}

.player:fullscreen .player__sub-overlay,
.player:-webkit-full-screen .player__sub-overlay,
.player--fullscreen .player__sub-overlay {
    bottom: clamp(20px, 3.5vmin, 36px);
}

.player:fullscreen.player--controls-visible .player__sub-overlay,
.player:-webkit-full-screen.player--controls-visible .player__sub-overlay,
.player--fullscreen.player--controls-visible .player__sub-overlay,
.player:fullscreen.player--paused .player__sub-overlay,
.player:-webkit-full-screen.player--paused .player__sub-overlay,
.player--fullscreen.player--paused .player__sub-overlay {
    bottom: clamp(64px, 9vmin, 104px);
}

.player:fullscreen .player__sub-text,
.player:-webkit-full-screen .player__sub-text,
.player--fullscreen .player__sub-text {
    font-size: clamp(1.15rem, 5vmin, 3.5rem) !important;
    padding: 0.35em 0.65em;
}

.player:fullscreen.sub-preset-default .player__sub-text,
.player:-webkit-full-screen.sub-preset-default .player__sub-text,
.player--fullscreen.sub-preset-default .player__sub-text {
    font-size: clamp(1.15rem, 5vmin, 3.5rem) !important;
}

.player:fullscreen.sub-preset-large .player__sub-text,
.player:-webkit-full-screen.sub-preset-large .player__sub-text,
.player--fullscreen.sub-preset-large .player__sub-text {
    font-size: clamp(1.35rem, 6.2vmin, 4.25rem) !important;
}

.player:fullscreen.sub-preset-cinema .player__sub-text,
.player:-webkit-full-screen.sub-preset-cinema .player__sub-text,
.player--fullscreen.sub-preset-cinema .player__sub-text {
    font-size: clamp(1.15rem, 5.4vmin, 3.75rem) !important;
    -webkit-text-stroke: clamp(2px, 0.42vmin, 8px) #000;
}

.player:fullscreen.sub-preset-glass .player__sub-text,
.player:-webkit-full-screen.sub-preset-glass .player__sub-text,
.player--fullscreen.sub-preset-glass .player__sub-text {
    font-size: clamp(1.05rem, 4.6vmin, 3.25rem) !important;
}

.player:fullscreen.sub-preset-contrast .player__sub-text,
.player:-webkit-full-screen.sub-preset-contrast .player__sub-text,
.player--fullscreen.sub-preset-contrast .player__sub-text {
    font-size: clamp(1.2rem, 5.4vmin, 3.75rem) !important;
}

@media (max-width: 656px) {
    .player__sub-overlay {
        bottom: 14px;
    }

    .player--controls-visible .player__sub-overlay,
    .player--paused .player__sub-overlay {
        bottom: 46px;
    }

    .player:fullscreen .player__sub-overlay,
    .player:-webkit-full-screen .player__sub-overlay,
    .player--fullscreen .player__sub-overlay {
        bottom: clamp(16px, 3vmin, 28px);
    }

    .player:fullscreen.player--controls-visible .player__sub-overlay,
    .player:-webkit-full-screen.player--controls-visible .player__sub-overlay,
    .player--fullscreen.player--controls-visible .player__sub-overlay,
    .player:fullscreen.player--paused .player__sub-overlay,
    .player:-webkit-full-screen.player--paused .player__sub-overlay,
    .player--fullscreen.player--paused .player__sub-overlay {
        bottom: clamp(56px, 8.5vmin, 84px);
    }

    .player__sub-text,
    .player.sub-preset-default .player__sub-text,
    .player.sub-preset-contrast .player__sub-text {
        font-size: clamp(0.85rem, 3.6cqw, 1.25rem);
    }

    .player.sub-preset-large .player__sub-text {
        font-size: clamp(0.9rem, 4cqw, 1.35rem);
    }

    .player.sub-preset-cinema .player__sub-text {
        font-size: clamp(0.85rem, 3.7cqw, 1.3rem);
        -webkit-text-stroke: clamp(1px, 0.2cqw, 3px) #000;
    }

    .player.sub-preset-glass .player__sub-text {
        font-size: clamp(0.8rem, 3.3cqw, 1.2rem);
    }
}

/* Mobile portrait â€” keep subtitles inside the player bounds */
@media (max-width: 656px) and (orientation: portrait) {
    .player__sub-overlay {
        padding: 0 4%;
    }

    .player__sub-text,
    .player.sub-preset-default .player__sub-text,
    .player.sub-preset-contrast .player__sub-text {
        font-size: clamp(0.8rem, 3.4cqw, 1.05rem);
    }

    .player.sub-preset-large .player__sub-text {
        font-size: clamp(0.85rem, 3.8cqw, 1.15rem);
    }

    .player.sub-preset-cinema .player__sub-text {
        font-size: clamp(0.8rem, 3.5cqw, 1.1rem);
        -webkit-text-stroke: clamp(1px, 0.18cqw, 3px) #000;
    }

    .player.sub-preset-glass .player__sub-text {
        font-size: clamp(0.75rem, 3.2cqw, 1rem);
    }

    .player:fullscreen .player__sub-text,
    .player:-webkit-full-screen .player__sub-text,
    .player--fullscreen .player__sub-text,
    .player:fullscreen.sub-preset-default .player__sub-text,
    .player:-webkit-full-screen.sub-preset-default .player__sub-text,
    .player--fullscreen.sub-preset-default .player__sub-text,
    .player:fullscreen.sub-preset-contrast .player__sub-text,
    .player:-webkit-full-screen.sub-preset-contrast .player__sub-text,
    .player--fullscreen.sub-preset-contrast .player__sub-text {
        font-size: clamp(0.85rem, 3.6vmin, 1.35rem) !important;
    }

    .player:fullscreen.sub-preset-large .player__sub-text,
    .player:-webkit-full-screen.sub-preset-large .player__sub-text,
    .player--fullscreen.sub-preset-large .player__sub-text {
        font-size: clamp(0.9rem, 4vmin, 1.5rem) !important;
    }

    .player:fullscreen.sub-preset-cinema .player__sub-text,
    .player:-webkit-full-screen.sub-preset-cinema .player__sub-text,
    .player--fullscreen.sub-preset-cinema .player__sub-text {
        font-size: clamp(0.85rem, 3.7vmin, 1.4rem) !important;
        -webkit-text-stroke: clamp(1px, 0.22vmin, 4px) #000;
    }

    .player:fullscreen.sub-preset-glass .player__sub-text,
    .player:-webkit-full-screen.sub-preset-glass .player__sub-text,
    .player--fullscreen.sub-preset-glass .player__sub-text {
        font-size: clamp(0.8rem, 3.3vmin, 1.25rem) !important;
    }
}

/* Progress bar */
.player__progress-wrap {
    padding: 8px 0 4px;
    cursor: pointer;
    touch-action: none;
}

.player__progress {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: height 0.1s ease;
    touch-action: none;
}

.player__progress-wrap:hover .player__progress,
.player--scrubbing .player__progress {
    height: 6px;
}

.player--scrubbing .player__progress-thumb {
    transform: translateY(-50%) scale(1);
}

.player__progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.35);
    width: 0;
    pointer-events: none;
}

.player__progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--player-purple);
    width: 0;
    pointer-events: none;
}

.player__progress-thumb {
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    background: var(--player-purple);
    border-radius: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.1s ease;
}

.player__progress-wrap:hover .player__progress-thumb {
    transform: translateY(-50%) scale(1);
}

/* Double-tap seek zones (YouTube-style) */
.player__seek-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 38%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player__seek-zone--left {
    left: 0;
}

.player__seek-zone--right {
    right: 0;
}

.player__seek-zone:not([hidden]) {
    opacity: 1;
}

.player__seek-zone-ring {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    transform: scale(0.85);
    transition: transform 0.25s ease;
}

.player__seek-zone--pulse .player__seek-zone-ring {
    animation: playerSeekPulse 0.55s ease;
}

.player__seek-zone-amount {
    position: relative;
    z-index: 1;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
    font-family: Roboto, Arial, sans-serif;
}

.player__seek-zone--left .player__seek-zone-amount::before {
    content: '-';
    margin-inline-end: 2px;
}

.player__seek-zone--right .player__seek-zone-amount::after {
    content: '+';
    margin-inline-start: 2px;
}

@keyframes playerSeekPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.35;
    }
    45% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.08);
        opacity: 0;
    }
}

/* Bottom controls row */
.player__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
}

.player__left,
.player__right {
    display: flex;
    align-items: center;
}

.player__left {
    gap: 0;
    flex-shrink: 0;
}

.player__tools {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.player__tool-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.player__tool-group--subs {
    gap: 0;
}

.player__tool-sep {
    width: 1px;
    height: 16px;
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
    border-radius: 1px;
}

.player__ctrl-btn,
.player__sub-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: background 0.12s ease, color 0.12s ease;
    padding: 0;
    position: relative;
}

.player__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.player__icon.is-hidden {
    display: none !important;
}

.player__tools .player__ctrl-btn,
.player__tools .player__sub-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.player__tools .player__chip-btn {
    width: auto;
    min-width: 34px;
    padding: 0 8px;
    border-radius: 8px;
}

.player__ctrl-btn:hover,
.player__sub-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.player__download-btn {
    color: #fff;
}

.player__download-btn.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.player__download-btn--locked {
    opacity: 0.72;
}

.player__download-btn--locked::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    inset-inline-end: 6px;
    top: 6px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.player__sub-btn--active {
    color: var(--player-purple-soft);
}

.player__quality-btn {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.2px;
    min-width: 36px;
}

.player__quality-label {
    line-height: 1;
    pointer-events: none;
}

.player__speed-btn {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.player__speed-label {
    line-height: 1;
    pointer-events: none;
}

.player__quality-panel {
    position: absolute;
    bottom: 52px;
    right: 10px;
    left: auto;
    width: min(200px, calc(100% - 20px));
    max-height: min(280px, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(12, 12, 12, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    z-index: 10;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.player__quality-panel[hidden] {
    display: none;
}

.player__quality-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.player__quality-panel-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin: 0;
}

.player__quality-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    background: transparent;
    border: none;
    cursor: pointer;
}

.player__quality-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.player__quality-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player__quality-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    cursor: pointer;
    transition: background 0.15s ease;
}

.player__quality-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.player__quality-option--active {
    color: var(--player-purple-soft);
    background: rgba(124, 58, 237, 0.15);
}

@media (max-width: 640px) {
    .player__quality-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: min(50vh, 360px);
        border-radius: 16px 16px 0 0;
        z-index: 1400;
    }

    .player:fullscreen .player__quality-panel,
    .player:-webkit-full-screen .player__quality-panel,
    .player--fullscreen .player__quality-panel {
        position: absolute;
        max-height: 60%;
        z-index: 20;
    }
}

/* Autoplay toggle â€” YouTube style */
.player__autoplay {
    position: relative;
    width: 52px !important;
    height: 36px !important;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 2px;
}

.player__autoplay:hover {
    background: rgba(255, 255, 255, 0.2);
}

.player__autoplay-label {
    position: absolute;
    font-size: 8px;
    font-weight: 700;
    font-family: Roboto, Arial, sans-serif;
    bottom: 6px;
    right: 7px;
    line-height: 1;
    pointer-events: none;
    letter-spacing: -0.3px;
}

.player__autoplay svg {
    width: 20px;
    height: 20px;
    margin-top: -2px;
}

.player__autoplay--on {
    color: var(--player-purple-soft);
    background: rgba(124, 58, 237, 0.2);
}

/* Volume */
.player__volume {
    display: flex;
    align-items: center;
}

.player__volume-slider {
    width: 0;
    overflow: hidden;
    transition: width 0.15s ease;
    display: flex;
    align-items: center;
}

.player__volume:hover .player__volume-slider,
.player__volume:focus-within .player__volume-slider {
    width: 52px;
    padding: 0 8px 0 4px;
}

.player__volume-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 52px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.player__volume-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.player__volume-slider input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.player__time {
    font-size: 12px;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    font-family: Roboto, Arial, sans-serif;
    padding: 0 4px;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: clip;
}

/* Subtitle settings panel — compact popover inside player */
.player__sub-panel {
    position: absolute;
    bottom: 44px;
    right: 8px;
    left: auto;
    width: min(252px, calc(100% - 16px));
    max-height: min(270px, calc(100% - 52px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: rgba(12, 12, 12, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 0;
    z-index: 12;
    box-sizing: border-box;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.player__sub-panel:not([hidden]) {
    display: flex;
}

.player__sub-panel[hidden] {
    display: none !important;
}

.player__sub-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 6px;
    margin: 0;
    padding: 7px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.player__sub-panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.player__sub-panel-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    transition: background var(--transition);
    flex-shrink: 0;
}

.player__sub-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.player__sub-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 6px 7px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sub-sync {
    margin: 0 0 10px;
    padding: 10px 10px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sub-sync__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.sub-sync__titles {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.sub-sync__title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.01em;
}

.sub-sync__hint {
    display: none;
}

.sub-sync__reset {
    flex: 0 0 auto;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.75);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.sub-sync__reset:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.sub-sync__reset[hidden] {
    display: none;
}

.sub-sync__row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
    direction: ltr;
}

.sub-sync__btn {
    flex: 0 0 auto;
    min-width: 30px;
    height: 30px;
    padding: 0 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.sub-sync__btn--main {
    min-width: 34px;
    font-size: 16px;
    line-height: 1;
}

.sub-sync__btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.sub-sync__value-wrap {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    min-width: 52px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.32);
}

.player--sub-sync-active .sub-sync__value-wrap {
    background: rgba(124, 58, 237, 0.28);
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.4);
}

.sub-sync__value {
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #fff;
    line-height: 1;
    direction: ltr;
}

.sub-sync__unit {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
}

.sub-sync__slider-wrap {
    display: grid;
    grid-template-columns: 14px 1fr 14px;
    align-items: center;
    gap: 6px;
    direction: ltr;
}

.sub-sync__edge {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    line-height: 1;
}

.sub-sync__slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
    direction: ltr;
}

.sub-sync__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
    border: none;
}

.sub-sync__slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
}

.sub-presets {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sub-preset-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 7px;
    border-radius: 7px;
    border: none;
    background: transparent;
    text-align: right;
    width: 100%;
    cursor: pointer;
}

.sub-preset-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sub-preset-card--active {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset -2px 0 0 #fff;
}

.sub-preset-card__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.sub-preset-card__preview {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 11px;
    font-family: var(--bs-font, 'Dana', Tahoma, sans-serif);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sub-preset-card--default .sub-preset-card__preview {
    background: rgba(0, 0, 0, 0.78);
    font-weight: 500;
}

.sub-preset-card--large .sub-preset-card__preview {
    font-size: 13px;
    font-weight: 800;
    background: transparent;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 0 0 4px #000;
}

.sub-preset-card--cinema .sub-preset-card__preview {
    color: #ffc107;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    -webkit-text-stroke: 2px #000;
    paint-order: stroke fill;
}

.sub-preset-card--glass .sub-preset-card__preview {
    background: rgba(255, 255, 255, 0.18);
    font-weight: 400;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.sub-preset-card--contrast .sub-preset-card__preview {
    background: #000;
    font-weight: 700;
    font-size: 12px;
}

.sub-preset-card__name {
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.sub-preset-card__desc {
    display: none;
}

.player:fullscreen .player__sub-panel,
.player:-webkit-full-screen .player__sub-panel,
.player--fullscreen .player__sub-panel {
    right: 14px;
    width: min(270px, calc(100% - 28px));
    max-height: min(320px, calc(100% - 72px));
    bottom: 56px;
}

/* Title & Meta */
.watch__title {
    font-size: 20px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 12px;
}

.watch__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.watch__channel {
    display: flex;
    align-items: center;
    gap: 12px;
}

.watch__channel-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.watch__channel-name {
    display: block;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
}

.watch__channel-name:hover {
    color: var(--text-primary);
}

.watch__channel-subs {
    font-size: 12px;
    color: var(--text-secondary);
}

.watch__subscribe {
    padding: 10px 16px;
    border-radius: var(--radius-chip);
    background: var(--btn-solid-bg);
    color: var(--btn-solid-text);
    font-size: 14px;
    font-weight: 500;
    margin-right: 8px;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.watch__subscribe:hover {
    background: var(--btn-solid-hover);
    color: var(--btn-solid-text);
}

.watch__subscribe--active {
    background: var(--btn-subscribed-bg);
    color: var(--btn-subscribed-text);
    border-color: var(--btn-subscribed-border);
}

.watch__subscribe--active:hover {
    background: var(--btn-subscribed-hover);
    color: var(--btn-subscribed-text);
}

.watch__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.watch__action-group {
    display: flex;
    align-items: center;
    background: var(--btn-muted-bg);
    border: 1px solid var(--divider);
}

/* Guest gate */
.player__guest-gate[hidden] { display: none !important; }

.player__guest-gate {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 18, 0.92);
    text-align: center;
    padding: 24px;
    backdrop-filter: blur(6px);
}

.player__guest-gate-inner h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: #fff;
    font-family: var(--bs-font, 'Dana', Tahoma, sans-serif);
}

.player__guest-gate-inner p {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    margin-bottom: 20px;
    font-family: var(--bs-font, 'Dana', Tahoma, sans-serif);
}

.player__guest-gate-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.player__guest-gate-btn {
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.player__guest-gate-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.player__guest-gate-btn--primary {
    background: var(--player-purple);
    border-color: var(--player-purple);
}

.player--guest-blocked .player__controls {
    pointer-events: none;
    opacity: 0.5;
}

/* ---- Mobile player controls ---- */
@media (max-width: 656px) {
    .player {
        border-radius: 0;
    }

    .player__sub-panel {
        bottom: 40px;
        right: 6px;
        left: auto;
        width: min(240px, calc(100% - 12px));
        max-height: min(250px, calc(100% - 48px));
        border-radius: 10px;
        z-index: 12;
    }

    .player__sub-panel:not([hidden])::before {
        content: none;
    }

    .player__sub-panel-header {
        padding: 7px 9px;
    }

    .player__sub-panel-body {
        padding: 6px 7px 8px;
    }

    .sub-sync__btn {
        min-width: 30px;
        height: 30px;
    }

    .sub-sync__btn--main {
        min-width: 34px;
        font-size: 16px;
    }

    .player:fullscreen .player__sub-panel,
    .player:-webkit-full-screen .player__sub-panel,
    .player--fullscreen .player__sub-panel {
        position: absolute;
        left: auto;
        right: 12px;
        bottom: 52px;
        width: min(260px, calc(100% - 24px));
        max-height: min(300px, calc(100% - 68px));
        z-index: 20;
    }

    .player__volume-slider {
        display: none;
    }

    .player__ctrl-btn,
    .player__sub-btn {
        width: 34px;
        height: 34px;
    }

    .player__bottom {
        height: 36px;
    }

    .player__time {
        font-size: 11px;
        padding: 0 2px;
    }

    .player__controls {
        padding: 16px 8px 4px;
    }

    .player__tools {
        gap: 0;
        padding: 0;
    }

    .player__tool-sep {
        margin: 0 2px;
        height: 14px;
    }

    .player__tools .player__ctrl-btn,
    .player__tools .player__sub-btn {
        width: 32px;
        height: 32px;
    }

    .player__tools .player__chip-btn {
        min-width: 32px;
        padding: 0 6px;
    }
}

@media (max-width: 656px) and (orientation: portrait) {
    .player__sub-panel {
        max-height: min(240px, calc(100% - 48px));
    }
}

/* ---- In-player playlist dock ---- */
.player__playlist {
    display: none;
    flex-direction: column;
    min-height: 0;
    background: linear-gradient(180deg, #14131a 0%, #0d0c11 100%);
    border-inline-end: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
    z-index: 6;
}

.player--playlist-open .player__playlist {
    display: flex;
}

.player__playlist-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.player__playlist-eyebrow {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 800;
    color: rgba(167, 139, 250, 0.95);
    letter-spacing: 0.02em;
}

.player__playlist-course {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.92);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.player__playlist-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.player__playlist-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.player__playlist-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.player__playlist-item {
    margin: 0 0 2px;
}

.player__playlist-link {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease;
}

.player__playlist-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.player__playlist-item.is-active .player__playlist-link {
    background: rgba(124, 58, 237, 0.22);
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.35);
}

.player__playlist-item.is-locked .player__playlist-link {
    opacity: 0.55;
}

.player__playlist-num {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
}

.player__playlist-item.is-active .player__playlist-num {
    background: rgba(124, 58, 237, 0.45);
    color: #fff;
}

.player__playlist-item.is-done .player__playlist-num {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.player__playlist-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player__playlist-title {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player__playlist-dur {
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
}

.player__playlist-now {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.player__playlist-now span {
    width: 2px;
    border-radius: 2px;
    background: #c4b5fd;
    animation: playerPlaylistBars 0.9s ease-in-out infinite;
}

.player__playlist-now span:nth-child(1) { height: 6px; animation-delay: 0s; }
.player__playlist-now span:nth-child(2) { height: 11px; animation-delay: 0.15s; }
.player__playlist-now span:nth-child(3) { height: 7px; animation-delay: 0.3s; }

@keyframes playerPlaylistBars {
    0%, 100% { transform: scaleY(0.55); opacity: 0.65; }
    50% { transform: scaleY(1); opacity: 1; }
}

.player__playlist-lock {
    color: rgba(255, 255, 255, 0.35);
    display: grid;
    place-items: center;
}

#playlist-btn.is-active {
    color: var(--player-purple-soft);
    background: rgba(124, 58, 237, 0.2);
}

/* ---- Next-up soft CTA ---- */
.player__nextup {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 16px;
    width: auto;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.player__nextup.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.player__nextup[hidden] {
    display: none !important;
}

.player__nextup-card {
    display: grid;
    gap: 0;
    width: min(360px, 100%);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(16, 14, 24, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
}

.player__nextup-rail {
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
}

.player__nextup-rail-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    transition: width 0.2s linear;
}

.player__nextup-body {
    padding: 12px 14px 4px;
    text-align: right;
}

.player__nextup-kicker {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 800;
    color: #c4b5fd;
}

.player__nextup-title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.player__nextup-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 12px 12px;
}

.player__nextup-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    background: #7c3aed;
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.4);
    transition: background 0.15s ease, transform 0.15s ease;
}

.player__nextup-go:hover {
    background: #6d28d9;
    transform: translateY(-1px);
}

.player__nextup-dismiss {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.player__nextup-dismiss:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.player:fullscreen .player__nextup,
.player:-webkit-full-screen .player__nextup,
.player--fullscreen .player__nextup {
    padding: clamp(16px, 3vmin, 28px);
}

.player:fullscreen .player__nextup-card,
.player:-webkit-full-screen .player__nextup-card,
.player--fullscreen .player__nextup-card {
    width: min(400px, 100%);
}

@media (max-width: 900px) {
    .player.player--has-playlist.player--playlist-open:not(:fullscreen):not(:-webkit-full-screen):not(.player--fullscreen) {
        display: block;
        aspect-ratio: 16 / 9;
    }

    .player.player--has-playlist.player--playlist-open:not(:fullscreen):not(:-webkit-full-screen):not(.player--fullscreen) .player__stage {
        aspect-ratio: auto;
        height: 100%;
    }

    .player.player--has-playlist.player--playlist-open:not(:fullscreen):not(:-webkit-full-screen):not(.player--fullscreen) .player__playlist {
        position: absolute;
        inset: 0 auto 0 0;
        width: min(82vw, 300px);
        z-index: 18;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
    }

    .player:fullscreen.player--playlist-open,
    .player:-webkit-full-screen.player--playlist-open,
    .player--fullscreen.player--playlist-open {
        display: block;
    }

    .player:fullscreen .player__playlist,
    .player:-webkit-full-screen .player__playlist,
    .player--fullscreen .player__playlist {
        position: absolute;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        height: 100%;
        z-index: 18;
        box-shadow: 16px 0 48px rgba(0, 0, 0, 0.5);
    }
}
