/* ==========================================================================
   EVEREST CINEMA PLAYER • REPRODUCTOR DE VIDEO DEDICADO CINEMATOGRÁFICO
   Inspirado en diseño Pro Camera (ARRI / Leica / Apple TV / DaVinci Resolve)
   ========================================================================== */

:root {
    --cinema-bg: #030508;
    --cinema-deck-bg: rgba(9, 13, 20, 0.88);
    --cinema-border: rgba(255, 255, 255, 0.1);
    --cinema-gold: #f59e0b;
    --cinema-amber: #fbbf24;
    --cinema-red: #ef4444;
    --cinema-cyan: #06b6d4;
    --cinema-accent: #0071e3;
    --cinema-text: #f8fafc;
    --cinema-muted: #94a3b8;
    --cinema-mono: "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

/* Modal / Teatro de Pantalla Completa */
.cinema-player-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: var(--cinema-bg);
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cinema-text);
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    user-select: none;
    -webkit-user-select: none;
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinema-player-modal.is-active {
    display: flex;
    opacity: 1;
}

/* Capa de Ambilight / Resplandor Ambiental Reactivo */
.cinema-ambient-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.35);
    width: 90vw;
    height: 70vh;
    filter: blur(85px) saturate(2) brightness(0.65);
    opacity: 0.65;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.5s ease;
}

.cinema-ambient-glow {
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at center, rgba(245, 158, 11, 0.18) 0%, rgba(6, 182, 212, 0.12) 40%, rgba(3, 5, 8, 0.95) 80%);
    filter: blur(60px);
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.5s ease;
}

.cinema-player-modal.glow-disabled .cinema-ambient-canvas,
.cinema-player-modal.glow-disabled .cinema-ambient-glow {
    opacity: 0 !important;
}

/* Viñeta de Sala Oscura */
.cinema-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(3, 5, 8, 0.85) 100%);
    pointer-events: none;
    z-index: 3;
}

/* Escenario Central del Video */
.cinema-stage {
    position: relative;
    z-index: 10;
    width: 92vw;
    max-width: 1240px;
    background: #000;
    border-radius: 18px;
    box-shadow: 0 35px 80px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--cinema-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Aspect Ratios Cinematográficos */
.cinema-stage[data-ratio="16:9"] {
    aspect-ratio: 16 / 9;
    max-width: 1200px;
}

.cinema-stage[data-ratio="2.39:1"] {
    aspect-ratio: 2.39 / 1;
    max-width: 1380px;
    width: 95vw;
}

.cinema-stage[data-ratio="9:16"] {
    aspect-ratio: 9 / 16;
    max-width: 460px;
    max-height: 86vh;
    width: auto;
}

.cinema-stage[data-ratio="4:3"] {
    aspect-ratio: 4 / 3;
    max-width: 960px;
}

/* Pantalla completa */
.cinema-player-modal.is-fullscreen .cinema-stage {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    aspect-ratio: unset !important;
}

/* Contenedor del Elemento de Video / Iframe */
.cinema-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cinema-native-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: none;
}

@media (min-width: 901px) {
    .cinema-stage[data-ratio="2.39:1"] .cinema-native-video {
        object-fit: cover;
    }
}

.cinema-iframe-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.cinema-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Modo Iframe Embebido (Google Drive / YouTube / Vimeo / Facebook) */
.cinema-stage.is-iframe-mode .cinema-center-trigger,
.cinema-stage.is-iframe-mode .cinema-scrubber-container,
.cinema-stage.is-iframe-mode .cinema-play-btn,
.cinema-stage.is-iframe-mode #cinemaBack10Btn,
.cinema-stage.is-iframe-mode #cinemaFwd10Btn,
.cinema-stage.is-iframe-mode .cinema-volume-cluster,
.cinema-stage.is-iframe-mode .cinema-timecode-box,
.cinema-stage.is-iframe-mode .cinema-speed-picker,
.cinema-stage.is-iframe-mode .cinema-pip-btn {
    display: none !important;
    pointer-events: none !important;
}

.cinema-stage.is-iframe-mode .cinema-controls-deck {
    display: block !important;
    pointer-events: none !important;
    background: linear-gradient(0deg, rgba(3, 5, 8, 0.95) 0%, rgba(3, 5, 8, 0.75) 60%, transparent 100%);
    padding: 1.5rem 1.5rem 1rem;
    position: relative;
    z-index: 25;
}

.cinema-stage.is-iframe-mode .cinema-controls-row {
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cinema-stage.is-iframe-mode .cinema-controls-left,
.cinema-stage.is-iframe-mode .cinema-controls-right {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cinema-stage.is-iframe-mode .cinema-ctrl-btn {
    pointer-events: auto !important;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cinema-stage.is-iframe-mode .cinema-letterbox-top,
.cinema-stage.is-iframe-mode .cinema-letterbox-bottom {
    display: none !important;
}

.cinema-stage.is-iframe-mode .cinema-iframe-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 8;
    pointer-events: auto !important;
}

.cinema-stage.is-iframe-mode .cinema-iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto !important;
}

.cinema-stage.is-iframe-mode .cinema-hud {
    pointer-events: none;
}

.cinema-stage.is-iframe-mode .cinema-header {
    pointer-events: auto;
    background: linear-gradient(180deg, rgba(3, 5, 8, 0.95) 0%, rgba(3, 5, 8, 0.75) 60%, transparent 100%);
}

.cinema-external-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: var(--cinema-amber);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cinema-external-pill:hover {
    background: var(--cinema-gold);
    color: #000;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
    transform: translateY(-1px);
}

.cinema-external-icon {
    font-size: 0.85rem;
    line-height: 1;
}

/* Barras Negras Letterbox Cinematográficas */
.cinema-letterbox-top,
.cinema-letterbox-bottom {
    position: absolute;
    left: 0;
    right: 0;
    background: #000;
    z-index: 15;
    pointer-events: none;
    transition: height 0.4s ease;
    height: 0;
}

.cinema-letterbox-top { top: 0; }
.cinema-letterbox-bottom { bottom: 0; }

.cinema-stage.has-letterbox .cinema-letterbox-top,
.cinema-stage.has-letterbox .cinema-letterbox-bottom {
    height: 6%;
}

/* ==========================================================================
   HUD & BARRAS DE CONTROL CINEMATOGRÁFICAS (OVERLAYS)
   ========================================================================== */

.cinema-hud {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.35s ease;
}

/* Autohide cuando no hay movimiento */
.cinema-stage.is-playing.is-inactive .cinema-hud {
    opacity: 0;
    cursor: none;
}

.cinema-hud > * {
    pointer-events: auto;
}

/* 1. Header Superior del Rodaje (Film Header Bar) */
.cinema-header {
    background: linear-gradient(180deg, rgba(3, 5, 8, 0.92) 0%, rgba(3, 5, 8, 0.6) 60%, transparent 100%);
    padding: 1.25rem 1.75rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.cinema-header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.cinema-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f1f5f9;
    padding: 7px 15px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    white-space: nowrap;
    flex-shrink: 0;
}

.cinema-back-btn:hover {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.55);
    color: #fbbf24;
    transform: translateX(-3px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.cinema-back-btn:active {
    transform: scale(0.95);
}

.cinema-back-arrow {
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.cinema-back-btn:hover .cinema-back-arrow {
    transform: translateX(-2px);
}

.cinema-title-cluster {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.cinema-badge-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cinema-rec-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--cinema-mono);
    font-weight: 700;
}

.cinema-rec-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cinema-red);
    box-shadow: 0 0 8px var(--cinema-red);
    animation: cinemaPulse 1.4s infinite ease-in-out;
}

@keyframes cinemaPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.85); }
}

.cinema-spec-pill {
    color: var(--cinema-muted);
    font-family: var(--cinema-mono);
}

.cinema-video-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

/* Selector de Aspect Ratio y Acciones Superiores */
.cinema-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cinema-ratio-pills {
    display: flex;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--cinema-border);
    border-radius: 10px;
    padding: 3px;
    backdrop-filter: blur(12px);
}

.cinema-ratio-btn {
    background: transparent;
    border: none;
    color: var(--cinema-muted);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-family: var(--cinema-mono);
    font-weight: 600;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cinema-ratio-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.cinema-ratio-btn.is-active {
    background: var(--cinema-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.4);
}

.cinema-icon-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--cinema-border);
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

.cinema-icon-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.06);
    border-color: rgba(255, 255, 255, 0.3);
}

.cinema-icon-btn:active {
    transform: scale(0.94);
}

.cinema-close-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.cinema-close-btn:hover {
    background: var(--cinema-red);
    border-color: var(--cinema-red);
    color: #fff;
    transform: scale(1.08) rotate(90deg);
}

/* 2. Botón Play Central & Animaciones Seek */
.cinema-center-trigger {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(9, 13, 20, 0.7);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(245, 158, 11, 0.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    backdrop-filter: blur(16px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    pointer-events: none;
}

.cinema-stage:not(.is-playing) .cinema-center-trigger,
.cinema-center-trigger.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.cinema-center-trigger:hover {
    transform: translate(-50%, -50%) scale(1.12);
    background: var(--cinema-gold);
    color: #000;
    border-color: var(--cinema-gold);
    box-shadow: 0 10px 45px rgba(245, 158, 11, 0.5);
}

.cinema-center-trigger:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Indicadores de salto ±10s con animación radial */
.cinema-seek-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-family: var(--cinema-mono);
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--cinema-border);
    padding: 12px 18px;
    border-radius: 14px;
    backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 25;
}

.cinema-seek-indicator.seek-left { left: 12%; }
.cinema-seek-indicator.seek-right { right: 12%; }

.cinema-seek-indicator.is-flashing {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* 3. Barra Inferior de Control Pro (Tactile Studio Deck) */
.cinema-controls-deck {
    background: linear-gradient(0deg, rgba(3, 5, 8, 0.98) 0%, rgba(5, 7, 12, 0.88) 55%, transparent 100%);
    padding: 2.5rem 1.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Scrubber Line (Línea de tiempo) */
.cinema-scrubber-container {
    position: relative;
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.cinema-scrubber-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    overflow: hidden;
    transition: height 0.18s ease;
}

.cinema-scrubber-container:hover .cinema-scrubber-track {
    height: 10px;
}

.cinema-scrubber-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.28);
    width: 0%;
    border-radius: 999px;
    transition: width 0.25s linear;
}

.cinema-scrubber-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #f59e0b 0%, #ef4444 70%, #f43f5e 100%);
    width: 0%;
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.cinema-scrubber-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%) scale(0);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.9);
    border: 2px solid #f59e0b;
    pointer-events: none;
    transition: transform 0.18s ease;
}

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

/* Tooltip de tiempo en hover sobre scrubber */
.cinema-timecode-tooltip {
    position: absolute;
    bottom: 26px;
    left: 0;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: var(--cinema-mono);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}

.cinema-scrubber-container:hover .cinema-timecode-tooltip {
    opacity: 1;
}

/* Fila de Controles Inferiores */
.cinema-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cinema-controls-left,
.cinema-controls-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* Botones de Transporte */
.cinema-ctrl-btn {
    background: transparent;
    border: none;
    color: #f1f5f9;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinema-ctrl-btn:hover {
    color: var(--cinema-amber);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.08);
}

.cinema-ctrl-btn:active {
    transform: scale(0.92);
}

.cinema-play-btn {
    width: 44px;
    height: 44px;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--cinema-amber);
}

.cinema-play-btn:hover {
    background: var(--cinema-gold);
    color: #000;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
}

/* Control de Volumen con Slider Deslizante */
.cinema-volume-cluster {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.cinema-volume-slider {
    width: 75px;
    height: 5px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    transition: width 0.25s ease, background 0.2s ease;
}

.cinema-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    border: 1px solid rgba(0,0,0,0.2);
}

.cinema-volume-slider:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Timecode Display de Estudio */
.cinema-timecode-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--cinema-mono);
    font-size: 0.85rem;
    color: var(--cinema-muted);
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cinema-timecode-current {
    color: #fff;
    font-weight: 600;
}

.cinema-timecode-divider {
    opacity: 0.4;
}

/* Menú de Velocidad de Reproducción */
.cinema-speed-picker {
    position: relative;
}

.cinema-speed-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--cinema-border);
    color: #fff;
    padding: 5px 10px;
    border-radius: 8px;
    font-family: var(--cinema-mono);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cinema-speed-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

.cinema-speed-menu {
    position: absolute;
    bottom: 48px;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--cinema-border);
    border-radius: 12px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    z-index: 30;
}

.cinema-speed-menu.is-open {
    display: flex;
}

.cinema-speed-option {
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 6px 12px;
    text-align: left;
    font-family: var(--cinema-mono);
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cinema-speed-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.cinema-speed-option.is-selected {
    background: var(--cinema-gold);
    color: #000;
    font-weight: 700;
}

/* ==========================================================================
   DRAWER DE PLAYLIST / REEL INFERIOR ("UP NEXT")
   ========================================================================== */
.cinema-playlist-drawer {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: rgba(9, 13, 20, 0.95);
    border: 1px solid var(--cinema-border);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(25px);
    display: none;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    z-index: 35;
    animation: cinemaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinema-playlist-drawer.is-open {
    display: flex;
}

@keyframes cinemaSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.cinema-playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cinema-muted);
}

.cinema-playlist-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 6px;
}

.cinema-playlist-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.cinema-playlist-card:hover {
    border-color: var(--cinema-gold);
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
}

.cinema-playlist-card.is-active {
    border-color: var(--cinema-gold);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.cinema-card-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    overflow: hidden;
    background: #000;
}

.cinema-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cinema-card-meta {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cinema-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cinema-card-cat {
    font-size: 0.68rem;
    color: var(--cinema-gold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Fallback para Google Drive con restricción */
.cinema-drive-fallback {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(3, 5, 8, 0.94);
    z-index: 18;
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}

.cinema-drive-fallback.is-active {
    display: flex;
}

.cinema-fallback-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
    transition: transform 0.2s ease;
}

.cinema-fallback-btn:hover {
    transform: scale(1.04);
}

/* ==========================================================================
   RESPONSIVE DESIGN (MÓVILES & TABLETS)
   ========================================================================== */
@media (max-width: 900px) {
    .cinema-player-modal {
        padding: 0;
    }

    .cinema-stage {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        aspect-ratio: unset !important;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .cinema-viewport {
        flex: 1;
        width: 100%;
        height: 100%;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    .cinema-native-video {
        width: 100%;
        height: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    /* Iframe centrado en móvil para respetar aspecto 16:9 de Google Drive / YouTube */
    .cinema-stage.is-iframe-mode .cinema-iframe-wrapper {
        position: absolute;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        width: 100%;
        aspect-ratio: 16 / 9;
        height: auto;
        max-height: 100dvh;
    }

    /* Header Mobile con Safe Areas */
    .cinema-header {
        padding: max(10px, env(safe-area-inset-top, 10px)) 12px 14px;
        gap: 0.6rem;
        background: linear-gradient(180deg, rgba(3, 5, 8, 0.96) 0%, rgba(3, 5, 8, 0.8) 70%, transparent 100%);
        z-index: 30;
    }

    .cinema-header-left {
        gap: 0.6rem;
        flex: 1;
        min-width: 0;
    }

    .cinema-back-btn {
        padding: 7px 12px;
        min-height: 40px;
        border-radius: 999px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .cinema-title-cluster {
        min-width: 0;
        flex: 1;
    }

    .cinema-video-title {
        font-size: 0.88rem;
        font-weight: 600;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
    }

    .cinema-badge-row {
        gap: 0.35rem;
        font-size: 0.65rem;
    }

    .cinema-spec-pill#cinemaSpecs {
        display: none; /* Ocultar especificaciones largas en pantallas pequeñas */
    }

    .cinema-header-actions {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        flex-shrink: 0;
    }

    .cinema-ratio-pills,
    #cinemaGlowToggle {
        display: none !important; /* Ocultar selector de aspecto y toggle ambilight en móvil */
    }

    .cinema-close-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1.1rem;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Deck de Controles Mobile con Safe Areas */
    .cinema-controls-deck {
        padding: 1.25rem 12px max(14px, env(safe-area-inset-bottom, 14px));
        gap: 0.6rem;
        background: linear-gradient(0deg, rgba(3, 5, 8, 0.98) 0%, rgba(5, 7, 12, 0.9) 65%, transparent 100%);
        z-index: 30;
    }

    .cinema-scrubber-container {
        height: 28px;
        padding: 11px 0;
    }

    .cinema-scrubber-track {
        height: 6px;
    }

    .cinema-scrubber-thumb {
        width: 18px;
        height: 18px;
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    .cinema-controls-row {
        gap: 0.4rem;
    }

    .cinema-controls-left,
    .cinema-controls-right {
        gap: 0.4rem;
    }

    .cinema-ctrl-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        font-size: 1rem;
    }

    .cinema-play-btn {
        width: 46px;
        height: 46px;
        min-width: 46px;
        min-height: 46px;
        font-size: 1.2rem;
    }

    .cinema-volume-cluster,
    #cinemaPipBtn {
        display: none !important; /* Ocultar slider de volumen y PiP en móvil */
    }

    .cinema-timecode-box {
        font-size: 0.72rem;
        padding: 4px 7px;
    }

    .cinema-center-trigger {
        width: 68px;
        height: 68px;
        font-size: 1.7rem;
    }

    /* Mobile Playlist Drawer */
    .cinema-playlist-drawer {
        left: 10px;
        right: 10px;
        bottom: max(75px, calc(65px + env(safe-area-inset-bottom, 14px)));
        padding: 12px;
        border-radius: 14px;
        max-height: 50vh;
    }

    .cinema-playlist-items {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
        max-height: 190px;
    }
}

@media (max-width: 480px) {
    .cinema-back-text {
        display: none; /* En teléfonos ultra compactos mostrar únicamente la flecha ← */
    }

    .cinema-back-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0;
        justify-content: center;
    }

    .cinema-video-title {
        max-width: 150px;
        font-size: 0.82rem;
    }
}

/* Modo Horizontal en Móviles (Landscape) */
@media (max-width: 900px) and (orientation: landscape) {
    .cinema-stage.is-iframe-mode .cinema-iframe-wrapper {
        top: 0;
        transform: none;
        height: 100%;
        aspect-ratio: unset;
    }

    .cinema-header {
        padding: 8px max(16px, env(safe-area-inset-right, 16px)) 10px max(16px, env(safe-area-inset-left, 16px));
    }

    .cinema-controls-deck {
        padding: 10px max(16px, env(safe-area-inset-right, 16px)) max(10px, env(safe-area-inset-bottom, 10px)) max(16px, env(safe-area-inset-left, 16px));
    }
}
