/* ═══════════════════════════════════════════════════════════
   MelonCast — Premium Streaming UI
   Inspired by Netflix · Apple TV+ · Disney+
   Dark cinema theme · Emerald accent
   ═══════════════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────────────── */
:root {
    --bg:           #0a0a0a;
    --bg2:          #141414;
    --bg3:          #1e1e1e;
    --bg4:          #282828;

    --surface:      rgba(255,255,255,0.05);
    --surface-h:    rgba(255,255,255,0.09);
    --surface-a:    rgba(255,255,255,0.14);
    --border:       rgba(255,255,255,0.07);
    --border-h:     rgba(255,255,255,0.13);

    --accent:       #10b981;
    --accent-dim:   rgba(16,185,129,0.15);
    --accent-mid:   rgba(16,185,129,0.25);
    --accent-glow:  rgba(16,185,129,0.35);
    --accent-text:  #ffffff;

    --ua-color:     #60a5fa;
    --ua-bg:        rgba(96,165,250,0.12);
    --ua-border:    rgba(96,165,250,0.22);
    --orig-color:   #10b981;
    --orig-bg:      rgba(16,185,129,0.10);
    --orig-border:  rgba(16,185,129,0.22);

    --danger:       #ef4444;
    --danger-bg:    rgba(239,68,68,0.12);
    --danger-border:rgba(239,68,68,0.22);

    --yellow:       #fbbf24;
    --yellow-bg:    rgba(251,191,36,0.13);
    --gray-badge:   rgba(255,255,255,0.1);
    --gray-text:    rgba(255,255,255,0.4);

    --text:         #ffffff;
    --text-dim:     rgba(255,255,255,0.55);
    --text-muted:   rgba(255,255,255,0.32);

    --r-xs:  6px;
    --r-sm:  10px;
    --r:     14px;
    --r-lg:  18px;
    --r-xl:  24px;

    --shadow-sm: 0 2px 12px rgba(0,0,0,0.4);
    --shadow:    0 6px 28px rgba(0,0,0,0.55);
    --shadow-lg: 0 16px 56px rgba(0,0,0,0.70);

    --ease:  cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --dur:   0.26s;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue',
                 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
    overflow: hidden;
}

::-webkit-scrollbar { width: 0; height: 0; }

/* ─── Screen System ──────────────────────────────────────── */
.screen {
    display: none;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: block;
    animation: screenIn var(--dur) var(--ease) both;
}

.screen.slide-back {
    animation: screenBack var(--dur) var(--ease) both;
}

@keyframes screenIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0);    }
}

@keyframes screenBack {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0);     }
}

/* Remote screen flex override */
.remote-screen {
    overflow: hidden !important;
}
.remote-screen.active {
    display: flex !important;
    flex-direction: column;
}

/* ─── Navigation Bar ─────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(to bottom, var(--bg) 70%, transparent);
}

.top-bar-transparent {
    background: linear-gradient(to bottom,
        rgba(10,10,10,0.8) 0%,
        transparent 100%);
    backdrop-filter: none;
}

.top-bar-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ─── Back Button ────────────────────────────────────────── */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dur), transform 0.1s;
}

.back-btn:active {
    background: var(--surface-a);
    transform: scale(0.88);
}

.back-btn-blur {
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-color: rgba(255,255,255,0.14);
}


/* ═══════════════════════════════════════════════════════════
   SEARCH SCREEN
   ═══════════════════════════════════════════════════════════ */

#screen-search {
    background: var(--bg);
}

.search-screen-inner {
    padding: 0 20px 40px;
    padding-top: env(safe-area-inset-top, 20px);
}

/* Logo */
.search-header {
    text-align: center;
    padding: 36px 0 32px;
}

.search-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 40px;
    line-height: 1;
    filter: drop-shadow(0 0 16px rgba(16,185,129,0.5));
}

.logo-text {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1.4px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 45%, #6ee7b7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-tagline {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.1px;
}

/* Search form */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.search-field input {
    width: 100%;
    background: var(--bg2);
    border: 1.5px solid var(--border-h);
    border-radius: var(--r-lg);
    padding: 15px 46px 15px 48px;
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
    caret-color: var(--accent);
}

.search-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    background: var(--bg3);
}

.search-field input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.search-clear-btn {
    position: absolute;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg4);
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.search-clear-btn:active {
    background: var(--surface-a);
    transform: scale(0.88);
}

.search-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--r-lg);
    padding: 15px 24px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.12s, box-shadow 0.2s;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.search-submit-btn:active {
    opacity: 0.88;
    transform: scale(0.97);
    box-shadow: 0 2px 10px var(--accent-glow);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px 24px;
}

.empty-icon {
    font-size: 68px;
    margin-bottom: 18px;
    opacity: 0.5;
    filter: grayscale(0.3);
}

.empty-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}

.empty-sub {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.55;
}


/* ═══════════════════════════════════════════════════════════
   PICK SCREEN — Search Results
   ═══════════════════════════════════════════════════════════ */

.pick-list {
    padding: 4px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Movie card (generated by app.js with class="movie-card") */
.movie-card {
    display: flex;
    align-items: stretch;
    height: 120px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s var(--ease),
                background 0.15s,
                box-shadow 0.15s;
    position: relative;
}

.movie-card:active {
    transform: scale(0.97);
    background: var(--bg3);
    box-shadow: var(--shadow);
}

/* Poster column */
.mc-poster {
    width: 80px;
    flex-shrink: 0;
    background: var(--bg3);
    position: relative;
    overflow: hidden;
}

.mc-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
}

.mc-poster-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-muted);
    pointer-events: none;
}

/* When poster loads successfully, hide placeholder */
.mc-poster img + .mc-poster-ph {
    display: none;
}

/* Body */
.mc-body {
    flex: 1;
    padding: 14px 14px 14px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.mc-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mc-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Inline badges (mc-badge) */
.mc-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 100px;
    line-height: 1;
    letter-spacing: 0.1px;
}

.mc-badge.ua {
    background: var(--ua-bg);
    color: var(--ua-color);
}

.mc-badge.rating {
    background: rgba(251,191,36,0.12);
    color: var(--yellow);
}

/* Chevron on the right */
.movie-card::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14' fill='none'%3E%3Cpath d='M1 1l6 6-6 6' stroke='rgba(255,255,255,0.25)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════
   BLURRED BACKGROUND (Seasons / Episodes screens)
   ═══════════════════════════════════════════════════════════ */

.screen-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center 20%;
    background-repeat: no-repeat;
    filter: blur(32px) brightness(0.22) saturate(1.6);
    transform: scale(1.15);
    transition: background-image 0.5s;
}

.screen-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        180deg,
        rgba(10,10,10,0.35) 0%,
        rgba(10,10,10,0.60) 30%,
        rgba(10,10,10,0.88) 65%,
        #0a0a0a 100%
    );
}

.screen-content {
    position: relative;
    z-index: 2;
    min-height: 100dvh;
    padding-bottom: 32px;
}


/* ─── Media Banner (inside Seasons / Episodes) ───────────── */

.media-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 4px 20px 24px;
}

.media-banner-art {
    width: 76px;
    height: 114px;      /* 2:3 aspect ratio */
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg3);
    box-shadow: 0 8px 28px rgba(0,0,0,0.65),
                0 0 0 1px rgba(255,255,255,0.08);
}

.media-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-banner-text {
    flex: 1;
    min-width: 0;
}

.media-banner-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.25;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-banner-hint {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ─── Grid (Seasons / Episodes) ──────────────────────────── */

.grid-section {
    padding: 0 16px;
}

.grid-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
}

.pill-grid {
    display: grid;
    gap: 8px;
}

.seasons-grid  { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.episodes-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }

/* Pill buttons (class="pill", generated by app.js) */
.pill {
    background: var(--surface);
    border: 1.5px solid var(--border-h);
    border-radius: 100px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s,
                border-color 0.15s,
                transform 0.12s,
                box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    line-height: 1;
}

/* Seasons: bigger */
.seasons-grid .pill {
    min-height: 80px;
    padding: 20px 8px;
}

/* Episodes: compact */
.episodes-grid .pill {
    min-height: 52px;
    padding: 14px 6px;
    font-size: 14px;
}

.pill:active,
.pill.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: scale(0.92);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 4px 16px var(--accent-glow);
}


/* ═══════════════════════════════════════════════════════════
   VOICES SCREEN
   ═══════════════════════════════════════════════════════════ */

.voices-list {
    padding: 4px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Voice card (generated by app.js, class="voice-card ua/orig") */
.voice-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 15px 16px;
    cursor: pointer;
    transition: transform 0.15s var(--ease),
                background 0.15s,
                border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.voice-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.voice-card.ua {
    border-color: var(--ua-border);
}
.voice-card.ua::before {
    background: var(--ua-color);
    opacity: 1;
}

.voice-card.orig {
    border-color: var(--orig-border);
}
.voice-card.orig::before {
    background: var(--orig-color);
    opacity: 1;
}

.voice-card:active {
    transform: scale(0.97);
    background: var(--bg3);
}

/* Icon (vc-icon) */
.vc-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

/* Body (vc-body, vc-name, vc-source) */
.vc-body {
    flex: 1;
    min-width: 0;
}

.vc-name {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    letter-spacing: -0.1px;
}

.vc-source {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Quality badge (vc-quality) */
.vc-quality {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 100px;
    flex-shrink: 0;
    letter-spacing: 0.2px;
    /* Default (auto/unknown) */
    background: var(--gray-badge);
    color: var(--gray-text);
}

/* 1080p — green */
.vc-quality.q-hd {
    background: var(--accent-dim);
    color: var(--accent);
}

/* 720p — yellow */
.vc-quality.q-md {
    background: var(--yellow-bg);
    color: var(--yellow);
}

/* 480p / 360p — gray (default, no extra class needed) */
.vc-quality.q-sd {
    background: var(--gray-badge);
    color: var(--gray-text);
}


/* ═══════════════════════════════════════════════════════════
   DEVICES SCREEN
   ═══════════════════════════════════════════════════════════ */

.section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 16px 12px;
}

.devices-list {
    padding: 0 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Device card (generated by app.js, class="device-card") */
.device-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 18px 20px;
    cursor: pointer;
    transition: transform 0.15s var(--ease),
                background 0.15s,
                border-color 0.2s;
    font-size: 16px;
    font-weight: 600;
}

.device-card:active {
    transform: scale(0.97);
    background: var(--bg3);
    border-color: var(--accent);
}

/* Device icon SVG (class="device-icon" set in innerHTML) */
.device-icon {
    color: var(--accent);
    opacity: 0.85;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════
   REMOTE CONTROL SCREEN  ← WOW SCREEN
   ═══════════════════════════════════════════════════════════ */

.remote-screen {
    overflow: hidden;
}

/* Cinematic blurred background */
.remote-bg-wrap {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.remote-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(40px) brightness(0.20) saturate(1.8);
    transform: scale(1.18);
    transition: opacity 0.6s;
}

/* Gradient overlay */
.remote-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(10,10,10,0.15) 0%,
        rgba(10,10,10,0.45) 30%,
        rgba(10,10,10,0.82) 58%,
        rgba(10,10,10,0.97) 78%,
        #0a0a0a 100%
    );
}

/* Inner layout */
.remote-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: 0 22px;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

/* Top bar */
.remote-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    padding-bottom: 6px;
    flex-shrink: 0;
}

.remote-device-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(255,255,255,0.09);
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 7px 13px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.12);
    max-width: 200px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Poster artwork */
.remote-artwork {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 14px;
    min-height: 0;
    max-height: 260px;
}

.remote-poster-wrap {
    height: 100%;
    max-height: 220px;
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.75),
        0 0 0 1px rgba(255,255,255,0.07);
    background: var(--bg3);
    position: relative;
    flex-shrink: 0;
}

.remote-poster-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.remote-poster-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 44px;
}

.remote-poster-wrap.no-poster .remote-poster-img { display: none; }
.remote-poster-wrap.no-poster .remote-poster-placeholder { display: flex; }

/* Track info */
.remote-info {
    text-align: center;
    padding: 0 6px 12px;
    flex-shrink: 0;
}

.remote-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.25;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.remote-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Seekbar ─────────────────────────────────────────────── */
.seekbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.time-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 36px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
}

.seekbar {
    flex: 1;
    padding: 14px 0;
    cursor: pointer;
    touch-action: none;
}

.seekbar-track {
    height: 3px;
    background: rgba(255,255,255,0.16);
    border-radius: 2px;
    position: relative;
}

.seekbar-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.35s linear;
    pointer-events: none;
}

.seekbar-knob {
    position: absolute;
    top: 50%; left: 0%;
    transform: translate(-50%, -50%);
    width: 13px; height: 13px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,0.4);
    transition: left 0.35s linear;
    pointer-events: none;
}

/* ─── Player Controls ─────────────────────────────────────── */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-bottom: 14px;
    flex-shrink: 0;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text);
    transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

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

/* Small controls */
.ctrl-sm {
    width: 50px; height: 50px;
    background: rgba(255,255,255,0.09);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.10);
}

.ctrl-sm:active {
    background: rgba(255,255,255,0.17);
}

/* Big play/pause */
.ctrl-play {
    width: 68px; height: 68px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 24px var(--accent-glow), 0 0 0 6px var(--accent-dim);
}

.ctrl-play:active {
    transform: scale(0.88);
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* ─── Volume ──────────────────────────────────────────────── */
.volume-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    flex-shrink: 0;
}

.vol-icon {
    opacity: 0.38;
    flex-shrink: 0;
}

.vol-track-wrap { flex: 1; }

.vol-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: rgba(255,255,255,0.16);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,0.4);
}

.vol-slider::-moz-range-thumb {
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    border: 3px solid var(--accent);
    cursor: pointer;
}

/* ─── Remote Action Buttons ───────────────────────────────── */
.remote-actions {
    display: flex;
    gap: 10px;
    padding-bottom: 6px;
    flex-shrink: 0;
}

.remote-act-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.1px;
    padding: 13px 10px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.12s, background 0.15s;
}

.remote-act-btn:active {
    background: rgba(255,255,255,0.15);
    transform: scale(0.96);
}

.remote-act-accent {
    color: var(--accent);
    border-color: rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.1);
}

.remote-act-accent:active {
    background: rgba(16,185,129,0.22);
}

.remote-act-danger {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-bg);
}

.remote-act-danger:active {
    background: rgba(239,68,68,0.22);
}

/* Safe area spacer */
.safe-spacer {
    height: 6px;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════ */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-card {
    background: var(--bg2);
    border: 1px solid var(--border-h);
    border-radius: var(--r-xl);
    padding: 34px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
}

.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--surface-h);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
    letter-spacing: -0.1px;
}

/* ─── Recents Section ────────────────────────────────────── */

.recents-section {
    margin-top: 28px;
    margin-bottom: 0;
}

.recents-scroll {
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 12px;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.recents-scroll::-webkit-scrollbar {
    display: none;
}

.recent-card {
    flex-shrink: 0;
    width: 100px;
    scroll-snap-align: start;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.15s var(--ease);
}

.recent-card:active {
    transform: scale(0.93);
}

.recent-poster {
    width: 100px;
    height: 150px; /* 2:3 */
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg3);
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5),
                0 0 0 1px rgba(255,255,255,0.06);
    position: relative;
}

.recent-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
}

.recent-poster-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-muted);
}

.recent-poster img + .recent-poster-ph {
    display: none;
}

.recent-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* ─── My Files Section ───────────────────────────────────── */

.my-files-section {
    margin-top: 28px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.my-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    transition: all 0.15s;
}

.file-card:active {
    background: var(--surface-a);
    transform: scale(0.98);
}

.file-thumb {
    width: 72px;
    height: 48px;
    border-radius: 8px;
    background: var(--bg3);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.file-thumb-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.file-body {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.file-cast-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.file-cast-btn:active {
    transform: scale(0.9);
}

.file-cast-btn svg {
    color: var(--accent-text);
}

.file-del-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(248,113,113,0.15);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.file-del-btn:active {
    transform: scale(0.9);
}

.file-del-btn svg {
    color: #f87171;
}
