:root {
    --primary-color: #8b5cf6; /* Violet */
    --primary-glow: rgba(139, 92, 246, 0.5);
    --bg-dark: #000;
    --text-white: #fff;
    --glass-bg: rgba(20, 20, 20, 0.7);
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0f0f0f;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: var(--font-main);
    overflow: hidden;
}

/* --- Container --- */
.player-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    overflow: hidden;
}

/* --- Video.js Engine Reset --- */
.video-js {
    width: 100% !important;
    height: 100% !important;
}

.video-js .vjs-control-bar,
.video-js .vjs-big-play-button,
.video-js .vjs-loading-spinner,
.video-js .vjs-error-display,
.video-js .vjs-modal-dialog {
    display: none !important; /* Hide Default UI */
}

/* --- Custom UI Overlay --- */
.custom-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* center passes through to gesture; children (controls) catch taps */
    z-index: 10;
    opacity: 1;
    transition: opacity 0.18s ease;
    font-size: 16px !important;
    line-height: normal !important;
}

.custom-ui.ui-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Gesture Layer — #custom-ui এর বাইরে (sibling), opacity fade প্রভাব ফেলে না */
.gesture-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    /* Never cover bottom control bar — double-tap works, controls stay clickable */
    bottom: 140px;
    height: auto;
    z-index: 6;
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background: transparent;
}

.player-wrapper.ui-gone .gesture-layer {
    /* Never steal taps when controls hidden — side zones handle double-tap */
    z-index: 1 !important;
    pointer-events: none !important;
}
.player-wrapper.ui-gone .tap-zone {
    z-index: 40 !important;
    pointer-events: auto !important;
    display: block !important;
}

/* --- Spinner Layer: independent of .custom-ui opacity fade, always visible --- */
/* exclusive spinners: dotted OR ring, never both */
#loading-spinner:not(.hidden) ~ #buffer-spinner,
#buffer-spinner:not(.hidden) {
  /* buffer shown alone when not hidden */
}
.spinner-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Same as play button: 14px above true center (progress mistouch / visual align) */
    transform: translate(-50%, calc(-50% - 14px));
    width: 88px;
    height: 88px;
    z-index: 15;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Center Controls --- */
.center-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    /* Stay clear of progress + control bar */
    bottom: 110px;
    transform: none !important;
    z-index: 15;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.center-controls .play-loader-wrap,
.center-controls .big-play-btn {
    pointer-events: auto !important;
    position: relative;
    z-index: 16;
    transform: none !important;
}
.player-wrapper:fullscreen .center-controls,
.player-wrapper:-webkit-full-screen .center-controls,
.video-js.vjs-fullscreen .center-controls {
    z-index: 15;
    bottom: 120px;
}
.player-wrapper:fullscreen .center-controls .play-loader-wrap,
.player-wrapper:fullscreen .center-controls .big-play-btn,
.player-wrapper:-webkit-full-screen .center-controls .play-loader-wrap,
.video-js.vjs-fullscreen .center-controls .play-loader-wrap {
    transform: none !important;
}

.play-loader-wrap {
    position: relative;
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    cursor: pointer;
    z-index: 16;
    margin: 0;
}
.big-play-btn {
    pointer-events: auto !important;
}
.player-wrapper:fullscreen .play-loader-wrap,
.player-wrapper:-webkit-full-screen .play-loader-wrap,
.video-js.vjs-fullscreen .play-loader-wrap,
.player-wrapper:fullscreen .big-play-btn,
.player-wrapper:-webkit-full-screen .big-play-btn,
.video-js.vjs-fullscreen .big-play-btn {
    pointer-events: auto !important;
    z-index: 100 !important;
}


/* ── Blurred Thumbnail Overlay ── */
.blur-thumb-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.blur-thumb-overlay.hidden {
    opacity: 0;
}

.blur-thumb-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #0d0d0d;
    filter: blur(18px);
    transform: scale(1.08);
}

/* ── Dot Spinner: initial loading ── */
.loader {
    position: absolute;
    z-index: 5;
    color: #fff;
    font-size: 10px;
    width: 1em;
    height: 1em;
    border-radius: 50%;
    text-indent: -9999em;
    animation: mulShdSpin 1.3s infinite linear;
    transform: translateZ(0);
    pointer-events: none;
}

@keyframes mulShdSpin {
    0%, 100% {
        box-shadow: 0 -3em 0 0.2em,
        2em -2em 0 0em, 3em 0 0 -1em,
        2em 2em 0 -1em, 0 3em 0 -1em,
        -2em 2em 0 -1em, -3em 0 0 -1em,
        -2em -2em 0 0;
    }
    12.5% {
        box-shadow: 0 -3em 0 0, 2em -2em 0 0.2em,
        3em 0 0 0, 2em 2em 0 -1em, 0 3em 0 -1em,
        -2em 2em 0 -1em, -3em 0 0 -1em,
        -2em -2em 0 -1em;
    }
    25% {
        box-shadow: 0 -3em 0 -0.5em,
        2em -2em 0 0, 3em 0 0 0.2em,
        2em 2em 0 0, 0 3em 0 -1em,
        -2em 2em 0 -1em, -3em 0 0 -1em,
        -2em -2em 0 -1em;
    }
    37.5% {
        box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em,
        3em 0em 0 0, 2em 2em 0 0.2em, 0 3em 0 0em,
        -2em 2em 0 -1em, -3em 0em 0 -1em, -2em -2em 0 -1em;
    }
    50% {
        box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em,
        3em 0 0 -1em, 2em 2em 0 0em, 0 3em 0 0.2em,
        -2em 2em 0 0, -3em 0em 0 -1em, -2em -2em 0 -1em;
    }
    62.5% {
        box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em,
        3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 0,
        -2em 2em 0 0.2em, -3em 0 0 0, -2em -2em 0 -1em;
    }
    75% {
        box-shadow: 0em -3em 0 -1em, 2em -2em 0 -1em,
        3em 0em 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em,
        -2em 2em 0 0, -3em 0em 0 0.2em, -2em -2em 0 0;
    }
    87.5% {
        box-shadow: 0em -3em 0 0, 2em -2em 0 -1em,
        3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em,
        -2em 2em 0 0, -3em 0em 0 0, -2em -2em 0 0.2em;
    }
}

/* ── Buffer/Seek Ring: normal spinner ── */
.buffer-circle {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 64px;
    height: 64px;
    pointer-events: none;
    z-index: 3;
    animation: smooth-spin 0.85s linear infinite;
}

.buffer-track {
    fill: none;
    stroke: rgba(139,92,246,0.2);
    stroke-width: 5;
}

.buffer-arc {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 125.6;
    stroke-dashoffset: 31; /* ~75% arc */
}

/* ── 2nd server indicator: spinner color → amber ── */
body.server-fallback .loader {
    color: #f59e0b; /* amber — ২য় সার্ভার ট্রাই চলছে */
}
body.server-fallback .buffer-arc {
    stroke: #f59e0b;
}
body.server-fallback .buffer-track {
    stroke: rgba(245, 158, 11, 0.25);
}
/* Same amber for play button when on 2nd server */
body.server-fallback .big-play-btn,
body.server-fallback #big-play-btn {
    background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 45%, #d97706 100%) !important;
    background-color: #f59e0b !important;
    border: none !important;
    box-shadow:
        0 0 16px rgba(245, 158, 11, 0.95),
        0 0 34px rgba(217, 119, 6, 0.55),
        0 4px 18px rgba(0,0,0,0.4) !important;
}
body.server-fallback .big-play-btn::after {
    border-color: rgba(251, 191, 36, 0.95) !important;
    box-shadow:
        0 0 22px rgba(245, 158, 11, 1),
        0 0 44px rgba(217, 119, 6, 0.65) !important;
}
body.server-fallback .big-play-btn svg {
    stroke: #fff !important;
}
body.server-fallback .big-play-btn.resume-mode {
    background: rgba(245, 158, 11, 0.22) !important;
    border: 2.5px solid rgba(251, 191, 36, 0.95) !important;
    box-shadow: 0 0 18px rgba(245,158,11,0.55), 0 4px 16px rgba(0,0,0,0.35) !important;
}
body.server-fallback .big-play-btn.resume-mode svg {
    stroke: #fbbf24 !important;
}
body.server-fallback .big-play-btn.resume-mode::after {
    border-color: rgba(251, 191, 36, 0.9) !important;
    opacity: 0.85 !important;
}

@keyframes smooth-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Big Play Button — Solid Fill (আপলোড করা কালার) + Ring Pulse ── */
.big-play-btn {
    position: absolute;
    z-index: 4;
    background: linear-gradient(145deg, #60a5fa 0%, #3b82f6 42%, #1d4ed8 100%) !important;
    background-color: #3b82f6 !important;
    opacity: 1 !important;
    border: none;
    border-radius: 50%;
    width: 76px;
    height: 76px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow:
        0 0 16px rgba(59,130,246,0.95),
        0 0 34px rgba(37,99,235,0.6),
        0 0 56px rgba(59,130,246,0.35),
        0 4px 18px rgba(0,0,0,0.4);
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    animation: btn-breathing 2.2s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    will-change: transform;
}

.big-play-btn:hover  { animation-play-state: paused; transform: scale(1.08); }
.big-play-btn:active { animation-play-state: paused; transform: scale(0.92); transition-duration: 0.08s; }

@keyframes btn-breathing {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.03); }
}

.big-play-btn.resume-mode {
    animation: none !important;
    will-change: auto;
    /* 14px higher than center — away from progress bar (mistouch pause) */
    transform: translateY(-14px) !important;
    background: rgba(20,20,28,0.55) !important;
    border: 1.5px solid rgba(255,255,255,0.35) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35) !important;
}

.big-play-btn.resume-mode::after {
    animation: none !important;
    opacity: 0 !important;
    box-shadow: none !important;
}

/* D — Soft halo disc pulse (no hard ring border) */
.big-play-btn::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: none;
    background: rgba(59, 130, 246, 0.4);
    box-shadow: none;
    opacity: 0.55;
    transform: scale(0.85);
    animation: halo-pulse 2s ease-out infinite;
    animation-delay: 0.28s;
    pointer-events: none;
    z-index: 0;
}

@keyframes halo-pulse {
    0%   { opacity: 0.55; transform: scale(0.85); }
    100% { opacity: 0;    transform: scale(1.5); }
}

body.server-fallback .big-play-btn::after,
body.server-fallback .player-wrapper.is-awaiting-play #big-play-btn::after,
body.server-fallback #big-play-btn::after {
    background: rgba(245, 158, 11, 0.45) !important;
    border: none !important;
    box-shadow: none !important;
}

.big-play-btn svg,
.big-play-btn i {
    position: relative;
    z-index: 1;
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}

/* ── Resume state: মাঝপথে pause করলে (প্রথমবারের CTA নয়) — শান্ত/কম distracting ── */
.big-play-btn.resume-mode {
    background: rgba(20,20,28,0.55) !important;
    border: 1.5px solid rgba(255,255,255,0.35);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    transform: translateY(-14px) !important;
    animation: none !important;
}

.big-play-btn.resume-mode::after {
    animation: none;
    box-shadow: none;
}

.big-play-btn.resume-mode svg {
    animation: none;
}

/* Pop-in: scale only — no vertical slide */
/* Soft appear — no big scale clash with halo */
.big-play-btn.pop-in {
    animation: btn-pop-in 0.28s ease-out forwards;
}
@keyframes btn-pop-in {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}
    70%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}

/* Pop-out: play হওয়া মাত্র disappear */
.big-play-btn.pop-out {
    animation: btn-pop-out 0.16s ease-in forwards;
}
@keyframes btn-pop-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.8); }
}
    100% { transform: scale(1.4); opacity: 0; }
}

.big-play-btn.hidden { display: none !important; }


.hidden { display: none !important; }

/* --- Seek Overlays --- */
.seek-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 80 !important;
    pointer-events: none !important;
    visibility: hidden;
}

.seek-overlay.left { left: 0; border-radius: 0 50% 50% 0; }
.seek-overlay.right { right: 0; border-radius: 50% 0 0 50%; }

.seek-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Still visible when parent .custom-ui is faded out */
.custom-ui.ui-hidden .seek-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.icon-box {
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 50%;
    text-align: center;
    color: white;
}
.icon-box i { display: block; font-size: 24px; margin-bottom: 5px; }
.icon-box span { font-size: 12px; font-weight: 600; }


/* --- Bottom Controls Panel --- */
.bottom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6) 50%, rgba(0,0,0,0));
    padding: 30px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100 !important; /* always above center play hit area */
    pointer-events: auto !important;
    transition: transform 0.18s ease;
    will-change: transform;
}
.bottom-controls button,
.bottom-controls input,
.bottom-controls .progress-container,
.bottom-controls .volume-container,
.bottom-controls .icon-btn {
    pointer-events: auto !important;
    touch-action: manipulation;
}

.custom-ui.ui-hidden .bottom-controls {
    transform: translateY(100%);
    pointer-events: none !important;
}
.custom-ui.ui-hidden .bottom-controls * {
    pointer-events: none !important;
}
.custom-ui:not(.ui-hidden) .bottom-controls,
.custom-ui:not(.ui-hidden) .bottom-controls * {
    pointer-events: auto !important;
}

/* Row 1: Progress (now on top) */
.progress-row {
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
}

/* Row 2: Time (now below progress bar) */
.time-row {
    font-size: 13px;
    color: #ccc;
    font-weight: 500;
    display: flex;
    gap: 5px;
    user-select: none;
}
.progress-container {
    position: relative;
    z-index: 101 !important;
    pointer-events: auto !important;

    pointer-events: auto !important;
    touch-action: none; /* allow scrub without page scroll */
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s;
}

.progress-container:hover { height: 6px; }

/* First-time loading shimmer — active until initial video load completes */
.progress-container.progress-loading {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.15) 25%,
        rgba(255,255,255,0.35) 50%,
        rgba(255,255,255,0.15) 75%
    );
    background-size: 200% 100%;
    animation: progressShimmer 1.3s ease-in-out infinite;
}

@keyframes progressShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    border-radius: 2px;
    position: relative;
    z-index: 2;
}

.progress-handle {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.2s;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.progress-container:hover .progress-handle { transform: translateY(-50%) scale(1); }

.buffered-bar {
    height: 100%;
    background: rgba(255,255,255,0.3);
    width: 0%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border-radius: 2px;
}

/* Row 3: Buttons */
.buttons-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-buttons, .right-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
}
.buttons-row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 32px !important; /* Optimized Desktop Size */
    width: 45px !important;
    height: 45px !important;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.control-btn i {
    font-size: 32px !important; /* Optimized Icon Size */
    line-height: 1 !important;
    display: block;
    width: 100%;
    height: auto;
}


.control-btn:focus,
.control-btn:focus-visible {
    outline: none !important;
}
.control-btn:active,
.control-btn.is-pressed {
    opacity: 1 !important;
    color: var(--primary-color, #a855f7) !important;
    transform: scale(0.88);
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.7));
    transition: transform .1s ease, color .1s ease, filter .1s ease;
}
.control-btn.is-pressed i,
.control-btn:active i {
    color: var(--primary-color, #a855f7) !important;
}
@media (hover: hover) and (pointer: fine) {
    .control-btn:hover {
        opacity: 1;
        color: var(--primary-color, #a855f7);
        transform: scale(1.08);
    }
}


/* Volume — button must always receive taps (slider must not cover it) */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 120;
    pointer-events: auto !important;
}
#btn-volume {
    position: relative;
    z-index: 121;
    pointer-events: auto !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-width: 40px;
    min-height: 40px;
}
#btn-volume i {
    pointer-events: none;
}

#volume-slider {
    width: 0;
    opacity: 0;
    max-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
    overflow: hidden;
    pointer-events: none; /* collapsed: never steal clicks from mute button */
    transition: width 0.25s ease, opacity 0.25s ease, max-width 0.25s ease;
    appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.volume-container:hover #volume-slider,
.volume-container:focus-within #volume-slider {
    width: 60px;
    max-width: 60px;
    opacity: 1;
    pointer-events: auto;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

/* Mobile — large icons, tight side gaps, no middle void, fullscreen stays visible */
@media (max-width: 768px) {
    .bottom-controls {
        left: 0;
        right: 0;
        bottom: 0;
        padding: 18px 8px 10px 8px;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    .buttons-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        max-width: 100%;
        gap: 0;
        box-sizing: border-box;
    }

    .left-buttons, .right-buttons {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 6px;
        min-width: 0;
    }

    .left-buttons {
        flex: 0 1 auto;
        justify-content: flex-start;
    }

    .right-buttons {
        flex: 0 0 auto;
        justify-content: flex-end;
        margin-left: 4px;
        padding-right: 2px;
        gap: 6px;
    }

    .volume-container input { display: none; }

    .control-btn {
        font-size: 28px !important;
        width: 42px !important;
        height: 42px !important;
        padding: 0 !important;
        flex-shrink: 0;
    }

    .control-btn i {
        font-size: 28px !important;
    }

    .big-play-btn {
        width: 70px !important;
        height: 70px !important;
    }
    .big-play-btn svg {
        width: 28px !important;
        height: 28px !important;
    }
}

/* Narrow phones: slightly smaller only if needed to fit */
@media (max-width: 360px) {
    .bottom-controls {
        padding: 14px 4px 8px 4px;
    }
    .left-buttons, .right-buttons {
        gap: 3px;
    }
    .control-btn {
        font-size: 24px !important;
        width: 36px !important;
        height: 36px !important;
    }
    .control-btn i {
        font-size: 24px !important;
    }
}

@media (min-width: 769px) {
    .left-buttons, .right-buttons {
        gap: 15px;
    }
    .control-btn {
        font-size: 32px !important;
        width: 45px !important;
        height: 45px !important;
    }
}

/* --- Horizontal Speed Bar --- */
.settings-menu,
.speed-bar-menu {
    position: absolute;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: auto;
    max-width: calc(100% - 16px);
    background: rgba(18, 18, 24, 0.55);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-radius: 999px;
    overflow: visible;
    z-index: 120 !important;
    pointer-events: auto !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.18);
    padding: 6px 8px;
}
.settings-menu .close-btn { display: none !important; }


.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px; /* Reduced Padding */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
}

.settings-header span {
    font-weight: 600;
    font-size: 13px; /* Reduced Font */
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 22px;
    padding: 10px;
    margin: -10px -6px -10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    pointer-events: auto !important;
    position: relative;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
}
.close-btn:hover { color: white; }

.speed-options {
    list-style: none;
    padding: 0;
    margin: 0;
}

.speed-options li {
    padding: 8px 12px; /* Reduced Padding */
    cursor: pointer;
    font-size: 12px; /* Reduced Font */
    color: #ddd;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
}


.speed-options li:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.speed-options li.active {
    color: var(--primary-color);
    font-weight: 600;
}

.speed-options li.active::after {
    content: '✓';
}

/* Mobile: keep horizontal speed bar centered */
@media (max-width: 768px), (max-height: 450px) {
    .settings-menu,
    .speed-bar-menu {
        bottom: 64px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: auto;
        max-width: calc(100% - 12px);
        max-height: none;
        overflow: visible;
        background: rgba(12, 12, 16, 0.92);
        border-radius: 999px;
        padding: 5px 6px;
    }
}

/* --- Resume Modal --- */
.resume-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200 !important;
    pointer-events: auto !important;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.resume-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.resume-content {
    background: rgba(30, 30, 30, 0.65); /* Glassy Background */
    backdrop-filter: blur(15px); /* Strong blur for premium feel */
    -webkit-backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.1); /* Glow & Depth */
    border: 1px solid rgba(255,255,255,0.15); /* Subtle border */
}

.resume-content h3 {
    margin: 0 0 8px 0;
    color: white;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.resume-content p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 25px 0;
    font-size: 14px;
    line-height: 1.5;
}

.resume-actions {
    display: flex;
    gap: 25px;
    justify-content: center;
    transform: translateY(15px); /* 👈 forcefully নিচে নামাবে */
}

.resume-btn {
    padding: 12px 26px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-main);
    letter-spacing: 0.5px;
    pointer-events: auto !important;
    position: relative;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.resume-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.resume-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
    filter: brightness(1.1);
}

.resume-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.1);
    color: #eee;
    backdrop-filter: blur(5px);
}

.resume-btn.secondary:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: white;
    transform: translateY(-2px);
}

/* Mobile & Small Screen Adjustments for Resume Modal */
@media (max-width: 768px), (max-height: 450px) {
    .resume-content {
        padding: 20px 15px;
        width: 85%;
        max-width: 300px;
        border-radius: 12px;
    }
    
    .resume-content h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .resume-content p {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .resume-btn {
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .resume-actions {
        gap: 25px;
    }
}

/* Landscape / সাধারণ — ফ্রেম ভর্তি */
.video-js {
    position: relative !important;
    overflow: hidden !important;
}

video,
.video-js video,
.video-js .vjs-tech,
.video-js.vjs-fullscreen:not(.portrait) video,
.video-js.vjs-fullscreen:not(.portrait) .vjs-tech,
.player-wrapper:fullscreen:not(.is-portrait) video,
.player-wrapper:-webkit-full-screen:not(.is-portrait) video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    margin: 0 !important;
}

/* Portrait ছোট মোড — cover */
.video-js.portrait:not(.vjs-fullscreen) video,
.video-js.portrait:not(.vjs-fullscreen) .vjs-tech {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
}

/* Portrait ফুলস্ক্রিন — ফোন portrait থাকলে */
.player-wrapper.is-portrait:fullscreen,
.player-wrapper.is-portrait:-webkit-full-screen {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #000 !important;
}
.player-wrapper.is-portrait:fullscreen:not(.fs-force-portrait) video,
.player-wrapper.is-portrait:-webkit-full-screen:not(.fs-force-portrait) video,
.video-js.portrait.vjs-fullscreen video,
.video-js.portrait.vjs-fullscreen .vjs-tech {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    margin: 0 auto !important;
}

/* Portrait ভিডিও + ফোন landscape → ৯০° ঘুরিয়ে স্ক্রিন ভর্তি */
.player-wrapper.is-portrait.fs-force-portrait:fullscreen,
.player-wrapper.is-portrait.fs-force-portrait:-webkit-full-screen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    width: 100vh !important;
    height: 100vw !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
    display: block !important;
    background: #000 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}
.player-wrapper.is-portrait.fs-force-portrait:fullscreen .video-js,
.player-wrapper.is-portrait.fs-force-portrait:-webkit-full-screen .video-js {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    inset: 0 !important;
}
.player-wrapper.is-portrait.fs-force-portrait:fullscreen video,
.player-wrapper.is-portrait.fs-force-portrait:-webkit-full-screen video,
.player-wrapper.is-portrait.fs-force-portrait:fullscreen .vjs-tech,
.player-wrapper.is-portrait.fs-force-portrait:-webkit-full-screen .vjs-tech {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    margin: 0 !important;
    transform: none !important;
}
.player-wrapper.is-portrait.fs-force-portrait:fullscreen .custom-ui,
.player-wrapper.is-portrait.fs-force-portrait:-webkit-full-screen .custom-ui,
.player-wrapper.is-portrait.fs-force-portrait:fullscreen .gesture-layer,
.player-wrapper.is-portrait.fs-force-portrait:-webkit-full-screen .gesture-layer {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
}
/* --- Broken Video Error Screen --- */
.error-countdown {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(12px, 2.8vw, 15px);
    font-weight: 600;
    margin: 0 0 clamp(10px, 2%, 18px) 0;
    letter-spacing: 0.02em;
}
.error-countdown.hidden,
.error-btn.hidden { display: none !important; }
.error-btn.ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.22);
    color: rgba(255,255,255,0.75);
}
.error-btn.ghost:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.error-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 10, 16, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200; /* above gesture + custom-ui fade */
    pointer-events: auto;
    overflow: hidden;
    opacity: 1 !important;
    visibility: visible;
}

.error-screen.hidden {
    display: none !important;
}

.error-content {
    text-align: center;
    padding: clamp(10px, 3%, 30px) clamp(8px, 4%, 20px);
    max-width: min(360px, 95%);
    width: 95%;
    box-sizing: border-box;
}

.error-icon {
    font-size: clamp(24px, 6vw, 56px);
    color: #ef4444;
    margin-bottom: clamp(6px, 2%, 16px);
    line-height: 1;
}

.error-content h2 {
    color: #fff;
    font-size: clamp(13px, 3.5vw, 20px);
    font-weight: 700;
    margin: 0 0 clamp(4px, 1.5%, 10px) 0;
}

.error-content p {
    color: rgba(255, 255, 255, 0.65);
    font-size: clamp(10px, 2.5vw, 13px);
    line-height: 1.5;
    margin: 0 0 clamp(8px, 2%, 24px) 0;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-btn {
    padding: clamp(6px, 1.5%, 10px) clamp(12px, 3%, 22px);
    border-radius: 50px;
    font-size: clamp(10px, 2.5vw, 13px);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-main);
    transition: all 0.25s ease;
}

.error-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #eee;
}

.error-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.error-btn.primary {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

.error-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.5);
}

@media (max-width: 400px) {
    .error-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* Broken / missing video — never leave a bare black frame */
body.vg-player-error #error-screen {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 200 !important;
  pointer-events: auto !important;
  background: rgba(8, 10, 16, 0.96);
}
body.vg-player-error .video-js video,
body.vg-player-error .vjs-tech {
  opacity: 0 !important;
}
body.vg-player-error #loading-spinner,
body.vg-player-error #buffer-spinner {
  display: none !important;
}


/* anti-download: block long-press save on video (esp. when paused) */
video,
.video-js video,
.video-js .vjs-tech,
.player-wrapper video {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}
.player-wrapper,
.player-wrapper * {
    -webkit-touch-callout: none;
}

#wpst-no-dl-shield {
    position: absolute;
    inset: 0;
    z-index: 4;
    background: transparent;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}


/* Dedicated left/right double-tap zones */
.tap-zone {
    position: absolute;
    top: 0;
    bottom: 22%;
    z-index: 10;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto !important;
}
.tap-zone-left { left: 0; width: 33%; }
.tap-zone-right { right: 0; left: auto; width: 33%; }
.tap-zone-center {
    left: 33%;
    width: 34%;
    z-index: 11;
}
.gesture-layer {
    pointer-events: none !important;
}
.player-wrapper.ui-gone .gesture-layer {
    pointer-events: none !important;
    z-index: 1 !important;
}


/* Speed SVG — match other control icon size/weight */
.control-btn .speed-icon-svg {
    width: 1em;
    height: 1em;
    font-size: inherit;
    display: block;
    color: inherit;
    fill: currentColor;
    pointer-events: none;
    flex-shrink: 0;
}

/* Center 20% has no zone — single taps go to gesture / video for play-pause */

.speed-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 0;
}
.speed-chip {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    pointer-events: auto !important;
    position: relative;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}
.speed-chip:active { transform: scale(0.94); }
.speed-chip:hover { background: rgba(255,255,255,0.1); }
.speed-chip.active {
    background: var(--primary-color, #7c3aed);
    color: #fff;
}
@media (max-width: 380px) {
    .speed-chip { padding: 7px 9px; font-size: 12px; }
}

/* Progress always clickable above center play */
.bottom-controls,
.bottom-controls .progress-container,
.progress-container {
    z-index: 100 !important;
    pointer-events: auto !important;
}
.center-controls {
    z-index: 15 !important;
}


/* ===== ONLY bottom control-area reveal (no other gesture changes) ===== */
#ui-reveal-strip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 22%;
    min-height: 90px;
    max-height: 160px;
    z-index: 1;
    pointer-events: none;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
/* Active only when controls are hidden — works in normal + fullscreen */
.player-wrapper.ui-gone #ui-reveal-strip,
.player-wrapper:fullscreen.ui-gone #ui-reveal-strip,
.player-wrapper:-webkit-full-screen.ui-gone #ui-reveal-strip,
.video-js.vjs-fullscreen ~ #ui-reveal-strip,
.video-js.vjs-fullscreen #ui-reveal-strip {
    z-index: 45 !important;
    pointer-events: auto !important;
}
.player-wrapper.ui-gone #ui-reveal-strip {
    z-index: 45 !important;
    pointer-events: auto !important;
}




/* ===== Speed label button — bold text same weight as sibling icons ===== */
.control-btn.speed-label-btn {
    font-size: 32px !important;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.control-btn.speed-label-btn .speed-label-text,
#speed-meter-value.speed-label-text {
    display: block;
    font-size: 0.55em; /* relative to control-btn 32px → ~18px, reads like icon weight */
    font-weight: 800;
    line-height: 1;
    color: inherit;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}
@media (max-width: 768px) {
    .control-btn.speed-label-btn {
        font-size: 28px !important;
    }
    .control-btn.speed-label-btn .speed-label-text,
    #speed-meter-value.speed-label-text {
        font-size: 0.58em;
    }
}


/* wpst server-fallback button force — beat is-awaiting-play blue fill */
body.server-fallback .player-wrapper.is-awaiting-play #big-play-btn,
body.server-fallback .player-wrapper #big-play-btn,
body.server-fallback .wpst-center-cta #big-play-btn,
body.server-fallback #big-play-btn {
    background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 42%, #d97706 100%) !important;
    background-color: #f59e0b !important;
    border: none !important;
    box-shadow:
        0 0 18px rgba(245,158,11,0.95),
        0 0 36px rgba(217,119,6,0.6),
        0 4px 18px rgba(0,0,0,0.4) !important;
}
body.server-fallback .player-wrapper.is-awaiting-play #big-play-btn::after,
body.server-fallback #big-play-btn::after {
    background: rgba(245, 158, 11, 0.45) !important;
    border: none !important;
    box-shadow: none !important;
}


/* Playing must never leave poster over the video */
.player-wrapper.is-playing #poster-blur-bg,
.player-wrapper.is-playing .poster-blur-bg {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.player-wrapper.is-playing .video-js video,
.player-wrapper.is-playing .vjs-tech {
    opacity: 1 !important;
}


/* volume click fix — never blocked by center CTA / awaiting-play */
.player-wrapper.is-awaiting-play #custom-ui .bottom-controls,
.player-wrapper.is-awaiting-play #custom-ui .bottom-controls *,
.player-wrapper.is-awaiting-play #btn-volume,
.player-wrapper.is-awaiting-play .volume-container {
    pointer-events: auto !important;
}
#wpst-center-cta {
    pointer-events: none !important;
}
#wpst-center-cta #big-play-btn,
#wpst-center-cta .play-loader-wrap {
    pointer-events: auto !important;
}
