/* ══════════════════════════════════════════════════════
   StreamFlow Player — Clean Consumer UI
   ══════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    background: #000; overflow: hidden;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
body { display: flex; align-items: center; justify-content: center; color: #fff; }

/* ═══ Video container ══════════════════════════════════ */
.player-container {
    width: 100%; height: 100%;
    position: relative; background: #000; cursor: none;
    display: flex; align-items: center; justify-content: center;
}
.player-container.chrome-active { cursor: default; }

/* ═══ Video.js ═════════════════════════════════════════ */
.video-js {
    width: 100%; height: 100%;
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}
.video-js video { width: 100%; height: 100%; object-fit: contain; }
.video-js .vjs-big-play-button,
.video-js .vjs-control-bar,
.video-js .vjs-loading-spinner,
.video-js .vjs-error-display,
.video-js .vjs-modal-dialog,
.video-js .vjs-seek-to-live-control {
    display: none !important; opacity: 0 !important;
    visibility: hidden !important; pointer-events: none !important;
}
.video-js.vjs-fullscreen {
    position: fixed; inset: 0; max-width: none; max-height: none;
}
.video-js .vjs-menu-button-popup .vjs-menu {
    background: rgba(10,12,20,0.98);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}
.video-js .vjs-menu li {
    padding: 9px 14px; font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.video-js .vjs-menu li:last-child { border-bottom: none; }
.video-js .vjs-menu li:hover,
.video-js .vjs-menu li.vjs-selected { background: rgba(255,255,255,0.07); }

/* ═══ Enhancement canvas ═══════════════════════════════ */
.main-video-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    display: none; object-fit: contain; pointer-events: none; z-index: 4;
}
.mv-slot.main-enhanced-active .video-js video { opacity: 0.02; }

/* ═══ Loading spinner ══════════════════════════════════ */
.loading-spinner {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    display: none; z-index: 120; text-align: center; pointer-events: none;
}
.loading-spinner.active { display: block; }
.spinner {
    width: 28px; height: 28px;
    border: 2px solid rgba(255,255,255,0.06);
    border-top-color: rgba(255,255,255,0.6);
    border-radius: 50%;
    animation: sf-spin 0.7s linear infinite;
    margin: 0 auto 10px;
}
.loading-text {
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: rgba(255,255,255,0.28);
    animation: sf-pulse 1.6s ease-in-out infinite;
}
@keyframes sf-spin  { to { transform: rotate(360deg); } }
@keyframes sf-pulse { 0%,100% { opacity: 0.28; } 50% { opacity: 0.7; } }

/* ═══ Error overlay ════════════════════════════════════ */
.error-message {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    background: rgba(8,10,18,0.96);
    border: 1px solid rgba(239,68,68,0.18);
    border-radius: 14px; padding: 28px 36px;
    max-width: 380px; text-align: center;
    display: none; z-index: 121;
}
.error-message.active { display: block; }
.error-message::before {
    content: ''; display: block;
    width: 34px; height: 34px; margin: 0 auto 14px;
    border: 1px solid rgba(239,68,68,0.22); border-radius: 50%;
}
.error-message-text { font-size: 14px; line-height: 1.55; color: #fca5a5; }

/* ═══ Volume HUD (hardware key feedback) ══════════════ */
.sf-volume-hud {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.88);
    background: rgba(0,0,0,0.72);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; padding: 16px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    min-width: 100px;
    z-index: 110; pointer-events: none;
    opacity: 0; transition: opacity 0.15s, transform 0.15s;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.sf-volume-hud.visible {
    opacity: 1; transform: translate(-50%, -50%) scale(1);
}
.sf-volume-hud svg {
    width: 28px; height: 28px; fill: #fff; opacity: 0.9; flex-shrink: 0;
}
.sf-volume-hud-bar {
    width: 80px; height: 4px; border-radius: 999px;
    background: rgba(255,255,255,0.2); overflow: hidden;
}
.sf-volume-hud-fill {
    height: 100%; border-radius: 999px;
    background: #fff; transition: width 0.1s;
}
.sf-volume-hud-label {
    font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.7);
    letter-spacing: 0.04em;
}

/* ═══ Tap to unmute ════════════════════════════════════ */
.tap-unmute-overlay {
    position: absolute; inset: 0; z-index: 100;
    display: flex; align-items: flex-end; justify-content: center;
    padding-bottom: 80px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tap-unmute-pill {
    display: flex; align-items: center; gap: 8px;
    background: rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px; padding: 10px 20px;
    font-size: 13px; font-weight: 500; pointer-events: none;
    animation: sf-slideup 0.3s ease;
}
.tap-unmute-pill svg { width: 17px; height: 17px; fill: #fff; flex-shrink: 0; }
@keyframes sf-slideup {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══ Cast / AirPlay ═══════════════════════════════════ */
.vjs-cast-btn .vjs-icon-placeholder {
    display: flex; align-items: center; justify-content: center;
    position: absolute; inset: 0;
}
.vjs-cast-btn .vjs-icon-placeholder::before { content: none !important; }
.vjs-cast-btn svg { width: 16px; height: 16px; fill: currentColor; }
.vjs-cast-btn:hover svg { opacity: 0.6; }
.vjs-cast-btn.casting svg { fill: #60a5fa; }
.vjs-quality-btn .vjs-icon-placeholder {
    display: flex; align-items: center; justify-content: center;
    position: absolute; inset: 0;
}
.vjs-quality-btn .vjs-icon-placeholder::before { content: none !important; }
.vjs-quality-btn .quality-label {
    font-size: 10px; font-weight: 700;
    color: rgba(255,255,255,0.65); line-height: 1;
}
.vjs-quality-btn:hover .quality-label { color: #fff; }
.quality-menu {
    display: none; position: absolute; bottom: 100%; right: 0; margin-bottom: 8px;
    background: rgba(10,12,20,0.98); border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    min-width: 120px; padding: 4px 0; z-index: 100;
}
.quality-menu.open { display: block; }
.quality-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px; font-size: 13px; color: rgba(255,255,255,0.65);
    cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.quality-menu-item:last-child { border-bottom: none; }
.quality-menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.quality-menu-item.active { color: #fff; }
.quality-menu-item.active::before { content: '\2713'; font-size: 11px; }

/* ═══════════════════════════════════════════════════════
   PLAYER CHROME
   ═══════════════════════════════════════════════════════ */
.sf-player-chrome {
    position: absolute; inset: 0; z-index: 12;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 22px 24px;
    pointer-events: none; opacity: 0;
    transition: opacity 0.18s ease;
}
.player-container.chrome-active .sf-player-chrome { opacity: 1; }
.sf-player-surface { pointer-events: auto; }

/* Gradient vignettes */
.sf-player-topbar,
.sf-player-bottombar { position: relative; }

.sf-player-topbar::before,
.sf-player-bottombar::before {
    content: ''; position: absolute; left: -32px; right: -32px; z-index: -1; pointer-events: none;
}
.sf-player-topbar::before {
    top: -22px; height: 200px;
    background: linear-gradient(to bottom,
        rgba(0,0,0,0.88) 0%,
        rgba(0,0,0,0.48) 50%,
        transparent 100%);
}
.sf-player-bottombar::before {
    bottom: -22px; height: 280px;
    background: linear-gradient(to top,
        rgba(0,0,0,0.92) 0%,
        rgba(0,0,0,0.68) 30%,
        rgba(0,0,0,0.28) 65%,
        transparent 100%);
}

/* ── Top bar ───────────────────────────────────────────── */
.sf-player-topbar {
    display: flex; align-items: center; gap: 14px;
}
.sf-player-heading {
    display: flex; align-items: center; gap: 12px; min-width: 0;
}

/* Back button */
.sf-player-back {
    width: 36px; height: 36px;
    border: none; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.sf-player-back:hover { background: rgba(255,255,255,0.16); color: #fff; }
.sf-player-back svg { width: 18px; height: 18px; fill: currentColor; }

/* Channel logo */
.sf-player-logo {
    width: 44px; height: 44px; border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.sf-player-logo img { width: 100%; height: 100%; object-fit: contain; padding: 7px; }
.sf-player-logo-fallback {
    font-size: 14px; font-weight: 700;
    color: rgba(255,255,255,0.5); letter-spacing: 0.05em;
}

/* Title group */
.sf-player-title-group { min-width: 0; }

.sf-player-title-row {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}
.sf-player-title {
    font-size: clamp(15px, 1.9vw, 26px);
    font-weight: 700; line-height: 1.1; color: #fff;
    letter-spacing: -0.02em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Live badge */
.sf-live-badge {
    flex-shrink: 0;
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    color: #fff;
    background: rgba(239,68,68,0.85);
    border-radius: 4px; padding: 2px 7px;
    animation: sf-live-pulse 2s ease-in-out infinite;
    white-space: nowrap;
}
@keyframes sf-live-pulse {
    0%,100% { background: rgba(239,68,68,0.85); }
    50%      { background: rgba(239,68,68,0.55); }
}

.sf-player-subtitle {
    margin-top: 3px; font-size: 12px; color: rgba(255,255,255,0.4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: min(55vw, 640px);
}

/* ── Bottom bar ────────────────────────────────────────── */
.sf-player-bottombar {
    display: flex; align-items: flex-end;
    justify-content: space-between; gap: 16px;
}

/* Program info */
.sf-player-program {
    min-width: 0; max-width: min(42vw, 600px);
}
.sf-player-program-title {
    font-size: 16px; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: -0.02em; line-height: 1.15;
}
.sf-player-program-meta {
    margin-top: 4px; font-size: 12px; color: rgba(255,255,255,0.4);
}

/* Controls row */
.sf-player-actions {
    display: flex; align-items: center;
    gap: 2px; flex-shrink: 0;
}

/* Separator between groups */
.sf-sep {
    display: block;
    width: 1px; height: 18px;
    background: rgba(255,255,255,0.1);
    margin: 0 6px; flex-shrink: 0;
    align-self: center;
}

/* ── Action buttons ────────────────────────────────────── */
.sf-player-action {
    width: 40px; height: 40px; padding: 0;
    border: none; border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.62);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-family: inherit; flex-shrink: 0;
    transition: background 0.14s, color 0.14s;
    -webkit-tap-highlight-color: transparent;
}
.sf-player-action svg { width: 18px; height: 18px; fill: currentColor; }
.sf-player-action:hover,
.sf-player-action:focus-visible {
    background: rgba(255,255,255,0.09); color: #fff; outline: none;
}
.sf-player-action:active { background: rgba(255,255,255,0.05); }

/* Play/pause: slightly more prominent */
.sf-player-action-primary {
    background: rgba(255,255,255,0.10); color: #fff;
    border-radius: 10px;
}
.sf-player-action-primary:hover { background: rgba(255,255,255,0.18); }
.sf-player-action-primary svg { width: 20px; height: 20px; }

.sf-player-action.active { color: #60a5fa; background: rgba(59,130,246,0.10); }
.sf-player-action:disabled {
    opacity: 0.2; cursor: not-allowed;
    background: transparent !important;
}

/* ── Volume control ────────────────────────────────────── */
.sf-player-volume-control {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 10px; border-radius: 8px;
    background: transparent; color: rgba(255,255,255,0.62);
    transition: background 0.14s, color 0.14s;
    flex-shrink: 0;
}
.sf-player-volume-control:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.sf-player-volume-control svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }

.sf-player-volume-mute {
    width: 22px; height: 22px; border: none;
    background: transparent; color: inherit; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: color 0.14s;
}
.sf-player-volume-mute:hover { color: #fff; }
.sf-player-volume-control.is-muted .sf-player-volume-mute { color: #f87171; }

.sf-player-volume-slider {
    appearance: none; width: 80px; height: 3px;
    border-radius: 999px; background: rgba(255,255,255,0.18);
    outline: none; cursor: pointer;
}
.sf-player-volume-slider::-webkit-slider-thumb {
    appearance: none; width: 11px; height: 11px;
    border-radius: 50%; background: #fff;
}
.sf-player-volume-slider::-moz-range-thumb {
    width: 11px; height: 11px; border: none; border-radius: 50%; background: #fff;
}

/* ── More menu ─────────────────────────────────────────── */
.sf-more-wrap { position: relative; }

.sf-more-menu {
    position: absolute; bottom: calc(100% + 10px); right: 0;
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    box-shadow: 0 20px 56px rgba(0,0,0,0.85), 0 0 0 1px rgba(0,0,0,0.5);
    min-width: 230px;
    overflow: hidden;
    z-index: 50;
    animation: sf-menu-in 0.14s ease;
}
.sf-more-menu[hidden] { display: none; }
@keyframes sf-menu-in {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sf-more-item {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    background: transparent; border: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 500;
    cursor: pointer; text-align: left; font-family: inherit;
    transition: background 0.12s, color 0.12s;
}
.sf-more-item:last-child { border-bottom: none; }
.sf-more-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sf-more-item svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; opacity: 0.55; }

/* Enhancement inline submenu — no native select */
.sf-more-item-enhance {
    flex-direction: column;
    padding: 0;
    cursor: default;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sf-more-item-enhance:hover { background: transparent; }
.sf-more-item-enhance:last-child { border-bottom: none; }

.sf-enhance-header {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    background: transparent; border: none; border-radius: 0;
    color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 500;
    cursor: pointer; text-align: left; font-family: inherit;
    transition: background 0.12s, color 0.12s;
}
.sf-enhance-header:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sf-enhance-header:disabled { cursor: not-allowed; }
.sf-enhance-header svg:first-child { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; opacity: 0.55; }

.sf-enhance-badge {
    margin-left: auto;
    font-size: 11px; font-weight: 600;
    color: rgba(255,255,255,0.42);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.sf-enhance-chevron {
    width: 18px; height: 18px; fill: currentColor;
    flex-shrink: 0; opacity: 0.35;
    transition: transform 0.16s;
}
.sf-enhance-header[aria-expanded="true"] .sf-enhance-chevron { transform: rotate(180deg); }

.sf-enhance-options {
    display: flex; flex-direction: column;
    padding: 4px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.25);
}
.sf-enhance-options[hidden] { display: none; }

.sf-enhance-option {
    display: flex; align-items: center;
    padding: 9px 16px 9px 44px;
    background: transparent; border: none;
    color: rgba(255,255,255,0.5); font-size: 12px; font-weight: 500;
    cursor: pointer; text-align: left; font-family: inherit;
    transition: background 0.1s, color 0.1s;
    position: relative;
}
.sf-enhance-option:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.sf-enhance-option.active { color: #fff; }
.sf-enhance-option.active::before {
    content: '✓';
    position: absolute; left: 22px;
    font-size: 11px; opacity: 0.65;
}

/* ── Panel backdrop ────────────────────────────────────── */
.sf-panel-backdrop {
    display: none;
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 15; pointer-events: none;
}
@media (max-width: 600px) {
    .sf-panel-backdrop.visible {
        display: block; pointer-events: auto;
        animation: sf-fade-in 0.22s ease forwards;
    }
}
@keyframes sf-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Side panel ────────────────────────────────────────── */
.sf-player-sidepanel {
    position: absolute; top: 76px; right: 22px; bottom: 92px;
    width: min(340px, calc(100vw - 44px));
    border-radius: 14px;
    background: rgba(8,10,18,0.97);
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    display: flex; flex-direction: column; overflow: hidden;
    pointer-events: auto; opacity: 0; transform: translateX(10px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 20;
}
.sf-player-sidepanel:not(.open) { pointer-events: none; }
.sf-player-sidepanel.open { opacity: 1; transform: translateX(0); }

.sf-player-panel-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sf-player-panel-title {
    font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
    text-transform: uppercase; color: rgba(255,255,255,0.32);
}
.sf-player-panel-close {
    width: 26px; height: 26px; border-radius: 6px; border: none;
    background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 13px;
    transition: background 0.14s, color 0.14s;
}
.sf-player-panel-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

.sf-player-panel-scroll {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 12px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sf-player-panel-scroll::-webkit-scrollbar { width: 4px; }
.sf-player-panel-scroll::-webkit-scrollbar-track { background: transparent; }
.sf-player-panel-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08); border-radius: 4px;
}

.sf-player-panel-controls { display: flex; gap: 6px; }
.sf-player-panel-select {
    flex: 1; height: 32px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05); color: #fff;
    font-size: 12px; padding: 0 10px; font-family: inherit; outline: none; cursor: pointer;
}
.sf-player-panel-select option { background: #0d1117; }

.sf-player-panel-section { display: flex; flex-direction: column; gap: 6px; }
.sf-player-panel-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sf-player-panel-heading strong {
    font-size: 10px; letter-spacing: 0.12em;
    text-transform: uppercase; color: rgba(255,255,255,0.3);
}
.sf-player-panel-muted { font-size: 12px; color: rgba(255,255,255,0.36); }

.sf-player-panel-list { display: flex; flex-direction: column; gap: 4px; }
.sf-player-panel-card {
    width: 100%; text-align: left; padding: 11px 13px;
    border-radius: 8px; border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03); color: #fff; cursor: pointer;
    transition: background 0.14s, border-color 0.14s;
}
.sf-player-panel-card:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.1); }
.sf-player-panel-card.active { border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); }
.sf-player-panel-card-title { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sf-player-panel-card-meta,
.sf-player-panel-card-copy { margin-top: 4px; font-size: 12px; color: rgba(255,255,255,0.4); line-height: 1.4; }

.sf-player-panel-inline-actions { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.sf-player-panel-inline-actions button {
    height: 26px; padding: 0 10px; border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.6);
    font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: background 0.14s, color 0.14s;
}
.sf-player-panel-inline-actions button:hover { background: rgba(255,255,255,0.1); color: #fff; }

.sf-player-empty {
    padding: 16px; border-radius: 8px;
    border: 1px dashed rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.28); font-size: 13px; line-height: 1.5;
}

/* panel card row with + button */
.sf-player-panel-card-row { display: flex; gap: 4px; align-items: stretch; }
.sf-player-panel-card-row .sf-player-panel-card { flex: 1; min-width: 0; }
.sf-player-panel-add {
    flex-shrink: 0; width: 28px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.35);
    font-size: 18px; font-weight: 300; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.14s, color 0.14s;
}
.sf-player-panel-add:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: #fff; }
.sf-player-panel-add:disabled { opacity: 0.15; cursor: default; }

/* ═══ Debug overlay ════════════════════════════════════ */
.sf-player-debug-overlay {
    position: absolute; left: 12px; bottom: 12px; z-index: 130;
    display: none; pointer-events: none;
    background: rgba(0,0,0,0.85); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 6px 10px;
    font-size: 10px; line-height: 1.4; color: #93c5fd;
    font-family: ui-monospace, monospace; white-space: pre-line;
}

/* ═══ Multiview grid ═══════════════════════════════════ */
#mv-grid {
    position: absolute; inset: 0; display: grid; gap: 1px; background: #000;
}
#mv-grid.mv-mode-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; gap: 0; }
#mv-grid.mv-mode-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
#mv-grid.mv-mode-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
#mv-grid.mv-mode-3 .mv-slot:first-child { grid-row: 1 / -1; }
#mv-grid.mv-mode-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.mv-slot { position: relative; overflow: hidden; background: #000; min-width: 0; min-height: 0; }
.mv-slot .video-js { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; }
.mv-slot-active { outline: 2px solid rgba(255,255,255,0.2); outline-offset: -2px; }
.mv-mode-1 .mv-slot-active { outline: none; }

.mv-slot-overlay {
    position: absolute; inset: 0; z-index: 10; cursor: pointer;
    display: flex; align-items: flex-end; padding: 6px 8px;
    background: linear-gradient(transparent 55%, rgba(0,0,0,0.55));
    opacity: 0; transition: opacity 0.15s;
}
.mv-slot:not(.mv-slot-active):hover .mv-slot-overlay { opacity: 1; }
.mv-slot-active .mv-slot-overlay { pointer-events: none; }

.mv-slot-label {
    flex: 1; color: #fff; font-size: 11px; font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mv-slot-close {
    position: absolute; top: 6px; right: 6px;
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.75); color: rgba(255,255,255,0.65);
    font-size: 11px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 40; pointer-events: auto;
    opacity: 0; transform: scale(0.85);
    transition: opacity 0.14s, transform 0.14s, color 0.14s;
    line-height: 1;
}
.player-container.chrome-active .mv-slot-close { opacity: 0.5; transform: scale(1); }
.mv-slot:hover .mv-slot-close,
.mv-slot-close:hover,
.mv-slot-close:focus-visible { opacity: 1; color: #fff; outline: none; }
.mv-mode-1 .mv-slot-close { display: none; }
.player-container.multiview-active .mv-slot-close { opacity: 0.8; }

/* Multiview chrome overrides */
.player-container.multiview-active .sf-player-chrome { padding: 12px 14px; }
.player-container.multiview-active .sf-player-topbar::before { height: 80px; }
.player-container.multiview-active .sf-player-bottombar::before { height: 110px; }
.player-container.multiview-active .sf-player-logo { width: 34px; height: 34px; border-radius: 8px; }
.player-container.multiview-active .sf-player-title { font-size: clamp(13px, 1.5vw, 19px); }
.player-container.multiview-active .sf-player-subtitle { font-size: 11px; }
.player-container.multiview-active .sf-player-program { display: none; }
.player-container.multiview-active .sf-player-bottombar { justify-content: flex-end; gap: 4px; }
.player-container.multiview-active .sf-player-actions { gap: 2px; }
.player-container.multiview-active .sf-player-action { width: 34px; height: 34px; border-radius: 6px; }
.player-container.multiview-active .sf-player-action-primary { width: 40px; }
.player-container.multiview-active .sf-player-volume-control { height: 34px; padding: 0 8px; }
.player-container.multiview-active .sf-sep { display: none; }

/* ═══ Tablet ≤920px ════════════════════════════════════ */
@media (max-width: 920px) {
    .sf-player-chrome { padding: 16px 18px; }
    .sf-player-topbar::before, .sf-player-bottombar::before { left: -24px; right: -24px; }
    .sf-player-subtitle { max-width: none; }
    .sf-player-actions { flex-wrap: wrap; justify-content: flex-end; }
    .sf-player-program { max-width: 40vw; }
    .sf-player-volume-slider { width: 60px; }
    .sf-player-sidepanel { right: 16px; left: 16px; bottom: 86px; width: auto; }
}

/* ═══ Mobile ≤600px ════════════════════════════════════ */
@media (max-width: 600px) {
    .sf-player-chrome {
        padding: 12px 14px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }

    /* Top */
    .sf-player-topbar { gap: 8px; align-items: center; }
    .sf-player-topbar::before { height: 130px; }
    .sf-player-heading { gap: 8px; align-items: center; flex: 1; min-width: 0; }
    .sf-player-back { width: 36px; height: 36px; }
    .sf-player-logo { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
    .sf-player-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sf-live-badge { font-size: 9px; padding: 2px 5px; }
    .sf-player-subtitle { display: none; }

    /* Hide program info */
    .sf-player-program { display: none; }

    /* Bottom */
    .sf-player-bottombar { align-items: center; justify-content: center; }
    .sf-player-bottombar::before { height: 160px; }

    /* Action bar — larger targets, proper spacing, no overflow */
    .sf-player-actions { gap: 4px; flex-wrap: nowrap; justify-content: center; }
    .sf-player-action { width: 46px; height: 46px; border-radius: 12px; }
    .sf-player-action svg { width: 20px; height: 20px; }
    .sf-player-action-primary { width: 54px; }
    .sf-player-action-primary svg { width: 22px; height: 22px; }

    /* Tactile press feedback */
    .sf-player-action:active {
        transform: scale(0.87);
        background: rgba(255,255,255,0.14);
        transition: transform 0.08s, background 0.08s;
    }
    .sf-player-action-primary:active { transform: scale(0.92); }

    /* Hide secondary buttons — available in ⋯ menu */
    #sf-player-chromecast,
    #sf-player-pip { display: none; }

    /* Volume: mute-only tap area */
    .sf-player-volume-control {
        padding: 0; background: transparent;
        width: 46px; height: 46px; justify-content: center;
        border-radius: 12px;
    }
    .sf-player-volume-control:active { background: rgba(255,255,255,0.12); }
    .sf-player-volume-slider { display: none; }

    /* Separators hidden */
    .sf-sep { display: none; }

    /* Side panel → bottom sheet */
    .sf-player-sidepanel {
        top: auto;
        bottom: 0; left: 0; right: 0; width: 100%;
        max-height: 72vh; min-height: 280px;
        border-radius: 20px 20px 0 0;
        transform: translateY(calc(100% + 2px));
        opacity: 1;
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        z-index: 20;
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    .sf-player-sidepanel.open { transform: translateY(0); opacity: 1; }

    /* Drag handle */
    .sf-player-sidepanel::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: rgba(255,255,255,0.22);
        border-radius: 999px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }

    /* Bigger close button */
    .sf-player-panel-close {
        width: 36px; height: 36px;
        border-radius: 10px; font-size: 15px;
    }

    /* More menu — clamp to screen */
    .sf-more-menu {
        right: 0; left: auto;
        min-width: 220px;
        max-width: calc(100vw - 28px);
    }

    /* Error message — fit phone */
    .error-message {
        max-width: calc(100vw - 32px);
        padding: 22px 20px; border-radius: 16px;
    }

    /* Tap-unmute: keep above controls */
    .tap-unmute-overlay { padding-bottom: 80px; }
}

/* ── Custom DVR Bar ── */
.sf-dvr-bar {
    position: absolute; bottom: 86px; left: 24px; right: 24px;
    height: 36px; z-index: 20; pointer-events: auto;
    display: flex; flex-direction: column; justify-content: center;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
}
.player-container.chrome-active .sf-dvr-bar { opacity: 1; transform: translateY(0); }

.sf-dvr-rail {
    position: relative; width: 100%; height: 4px;
    background: rgba(255,255,255,0.15); border-radius: 999px;
    cursor: pointer; transition: height 0.15s ease;
}
.sf-dvr-bar:hover .sf-dvr-rail { height: 6px; }

.sf-dvr-buffer {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: rgba(255,255,255,0.2); border-radius: 999px;
}
.sf-dvr-progress {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: #fff; border-radius: 999px;
}
.sf-dvr-knob {
    position: absolute; top: 50%; right: -6px; transform: translateY(-50%);
    width: 12px; height: 12px; background: #fff; border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.15s;
}
.sf-dvr-bar:hover .sf-dvr-knob { opacity: 1; }

.sf-dvr-labels {
    display: flex; justify-content: space-between; margin-top: 6px;
    font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.4);
    font-variant-numeric: tabular-nums;
}
.sf-dvr-live-btn {
    cursor: pointer; color: rgba(255,255,255,0.4); transition: color 0.15s;
}
.sf-dvr-live-btn.is-live { color: #ef4444; }
.sf-dvr-live-btn:hover { color: #fff; }

@media (max-width: 600px) {
    .sf-dvr-bar { bottom: 74px; left: 14px; right: 14px; }
}

/* Force custom DVR bar to stay at the right position and show only when chrome is active */
.sf-dvr-bar {
    display: none; /* Hidden by default, JS shows it when duration > 10s */
    position: absolute;
    bottom: 84px !important;
    left: 24px !important;
    right: 24px !important;
    height: 30px !important;
    z-index: 9999 !important;
}

.player-container.chrome-active .sf-dvr-bar {
    opacity: 1 !important;
    transform: translateY(0) !important;
}
