/* ==========================================================================
   MVLTD Web Player — "MVLTD Glass" theme (white-label)
   A sellable, brandable web player by Media Ventures LTD (MVLTD).
   Default look: dark glassmorphism, violet (#7c5cff) + cyan (#00e0ff).
   Buyers rebrand via the Admin panel (name, logo, colors) and/or a master-theme
   CSS override that redefines the :root variables below — no code edits needed.
   ========================================================================== */

:root {
    --mv-bg:        #0b0b14;
    --mv-bg-2:      #12121f;
    --mv-panel:     rgba(22, 22, 38, 0.72);
    --mv-panel-2:   rgba(30, 30, 52, 0.66);
    /* Fully OPAQUE variants used by the guide's sticky channel column and
       timeline header so scrolling program cells never bleed through them. */
    --mv-chan-bg:       #161628;
    --mv-chan-bg-hover: #201a3a;
    --mv-timeline-bg:   #14141f;
    --mv-glass:     rgba(255, 255, 255, 0.04);
    --mv-border:    rgba(255, 255, 255, 0.09);
    --mv-border-2:  rgba(124, 92, 255, 0.35);
    --mv-text:      #ececf5;
    --mv-text-dim:  #a4a4c0;
    --mv-text-mute: #6f6f8c;
    --mv-violet:    #7c5cff;
    --mv-violet-2:  #9a80ff;
    --mv-cyan:      #00e0ff;
    --mv-good:      #35d07f;
    --mv-warn:      #ffb020;
    --mv-bad:       #ff5470;
    --mv-radius:    16px;
    --mv-radius-sm: 10px;
    --mv-shadow:    0 18px 50px rgba(0, 0, 0, 0.55);
    --mv-grad:      linear-gradient(135deg, var(--mv-violet), var(--mv-cyan));
    --mv-chan-w:    258px;
    --mv-track-w:   1600px;
    --mv-font:      "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--mv-bg);
    color: var(--mv-text);
    font-family: var(--mv-font);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

body {
    background:
        radial-gradient(1200px 600px at 12% -8%, rgba(124, 92, 255, 0.18), transparent 60%),
        radial-gradient(1000px 520px at 100% 0%, rgba(0, 224, 255, 0.12), transparent 55%),
        linear-gradient(180deg, var(--mv-bg), var(--mv-bg-2));
}

a { color: var(--mv-cyan); text-decoration: none; }
button { font-family: inherit; }

.mv-hidden { display: none !important; }

/* --- scrollbars --------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(124, 92, 255, 0.35);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(124, 92, 255, 0.6); background-clip: content-box; }

/* ==========================================================================
   App shell
   ========================================================================== */
#app { display: flex; flex-direction: column; height: 100vh; }

.mv-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: var(--mv-panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--mv-border);
    z-index: 40;
    flex: 0 0 auto;
}
.mv-brand { display: flex; align-items: center; gap: 11px; }
.mv-brand-logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--mv-grad);
    display: grid; place-items: center;
    font-weight: 800; color: #fff; font-size: .95rem;
    box-shadow: 0 6px 18px rgba(124, 92, 255, 0.45);
    object-fit: cover;
}
.mv-brand-name { font-weight: 800; letter-spacing: .3px; }
.mv-brand-sub  { font-size: .72rem; color: var(--mv-text-dim); margin-top: -2px; }

.mv-nav { display: flex; gap: 4px; margin-left: 10px; }
.mv-nav button {
    background: transparent; color: var(--mv-text-dim);
    border: 1px solid transparent; padding: 8px 15px;
    border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .86rem;
    transition: .15s;
}
.mv-nav button:hover { color: var(--mv-text); background: var(--mv-glass); }
.mv-nav button.active {
    color: #fff; background: rgba(124, 92, 255, 0.18);
    border-color: var(--mv-border-2);
}

.mv-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.mv-acct { text-align: right; font-size: .74rem; color: var(--mv-text-dim); line-height: 1.3; }
.mv-acct b { color: var(--mv-text); }
.mv-btn {
    background: var(--mv-glass); color: var(--mv-text);
    border: 1px solid var(--mv-border); border-radius: 10px;
    padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .84rem;
    transition: .15s;
}
.mv-btn:hover { border-color: var(--mv-border-2); background: rgba(124, 92, 255, 0.12); }
.mv-btn-primary { background: var(--mv-grad); color: #fff; border: none; box-shadow: 0 8px 22px rgba(124, 92, 255, 0.4); }
.mv-btn-primary:hover { filter: brightness(1.08); }
.mv-btn-ghost { background: transparent; }

.mv-main { flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden; }
.mv-view { position: absolute; inset: 0; overflow: auto; padding: 0; }

/* ==========================================================================
   Login screen
   ========================================================================== */
.mv-login {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center; padding: 20px;
    background:
        radial-gradient(900px 500px at 20% 0%, rgba(124, 92, 255, 0.22), transparent 60%),
        radial-gradient(700px 400px at 100% 100%, rgba(0, 224, 255, 0.16), transparent 55%),
        linear-gradient(180deg, var(--mv-bg), var(--mv-bg-2));
    overflow: auto;
}
.mv-login-card {
    width: 100%; max-width: 430px;
    background: var(--mv-panel);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--mv-border);
    border-radius: var(--mv-radius);
    box-shadow: var(--mv-shadow);
    padding: 34px 30px;
}
.mv-login-logo {
    width: 62px; height: 62px; border-radius: 15px; margin: 0 auto 16px;
    background: var(--mv-grad); display: grid; place-items: center;
    font-weight: 800; color: #fff; font-size: 1.5rem;
    box-shadow: 0 12px 30px rgba(124, 92, 255, 0.5);
    object-fit: cover;
}
.mv-login h1 { text-align: center; margin: 0 0 4px; font-size: 1.4rem; }
.mv-login .mv-sub { text-align: center; color: var(--mv-text-dim); font-size: .85rem; margin: 0 0 22px; }

.mv-tabs { display: flex; gap: 6px; background: var(--mv-glass); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.mv-tabs button {
    flex: 1; padding: 9px; border: none; border-radius: 8px; cursor: pointer;
    background: transparent; color: var(--mv-text-dim); font-weight: 700; font-size: .84rem;
    transition: .15s;
}
.mv-tabs button.active { background: rgba(124, 92, 255, 0.22); color: #fff; }

.mv-field { margin-bottom: 14px; }
.mv-field label { display: block; font-size: .76rem; color: var(--mv-text-dim); margin-bottom: 6px; font-weight: 600; letter-spacing: .3px; }
.mv-field input {
    width: 100%; padding: 12px 14px;
    background: rgba(0, 0, 0, 0.28); color: var(--mv-text);
    border: 1px solid var(--mv-border); border-radius: 10px;
    font-size: .92rem; transition: .15s; font-family: inherit;
}
.mv-field input:focus { outline: none; border-color: var(--mv-violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25); }

.mv-login .mv-btn-primary { width: 100%; padding: 13px; font-size: .95rem; margin-top: 6px; }
.mv-login-note { text-align: center; color: var(--mv-text-mute); font-size: .72rem; margin-top: 16px; line-height: 1.5; }
.mv-login-err {
    background: rgba(255, 84, 112, 0.14); border: 1px solid rgba(255, 84, 112, 0.4);
    color: #ffb3c0; padding: 10px 12px; border-radius: 10px; font-size: .82rem; margin-bottom: 14px;
}
.mv-guest-row { text-align: center; margin-top: 14px; }
.mv-guest-row button { background: none; border: none; color: var(--mv-cyan); cursor: pointer; font-size: .82rem; font-weight: 600; }

/* ==========================================================================
   Guide (live) — reuses the suite grid structure
   ========================================================================== */
.mv-live-shell {
    display: grid; grid-template-columns: 340px 1fr;
    height: 100%; min-height: 0;
}
.mv-cats {
    background: var(--mv-panel-2); border-right: 1px solid var(--mv-border);
    overflow-y: auto; padding: 10px 8px;
}
.mv-cats-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; color: var(--mv-text-mute); padding: 8px 10px 6px; }
.mv-cat {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 9px; border-radius: 10px; cursor: pointer;
    color: var(--mv-text-dim); font-size: .84rem; font-weight: 600;
    transition: .12s; margin-bottom: 2px;
}
.mv-cat:hover { background: var(--mv-glass); color: var(--mv-text); }
.mv-cat.active { background: rgba(124, 92, 255, 0.18); color: #fff; border: 1px solid var(--mv-border-2); }
.mv-cat-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-cat-count { flex: 0 0 auto; padding: 2px 6px; font-size: .66rem; border-radius: 20px; background: rgba(255, 255, 255, 0.08); color: var(--mv-text-dim); }

/* Tab-switch loading popup (v1.0.9): a lightweight centered overlay shown
   while a newly opened tab (Movies / Series / Live) fetches its data. */
.mv-tab-loader {
    position: fixed; inset: 0; z-index: 900; display: grid; place-items: center;
    background: rgba(8, 8, 16, 0.55); backdrop-filter: blur(2px);
    transition: opacity .2s ease; opacity: 1;
}
.mv-tab-loader.mv-fade-out { opacity: 0; }
.mv-tab-loader-card {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    padding: 26px 34px; border-radius: 16px;
    background: var(--mv-panel); border: 1px solid var(--mv-border);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.mv-tab-loader-title { font-weight: 700; font-size: 0.98rem; color: var(--mv-text); }

/* Live-category load failure (v1.0.10): retry affordance instead of a dead
   "No channels." message when the provider's connection cap bites. */
.mv-cat-retry { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 460px; margin: 0 auto; line-height: 1.5; }
.mv-cat-retry .mv-btn { min-width: 120px; }

.mv-guide { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
/* "Please wait while we load the guide…" overlay (issue 1). */
.mv-guide-overlay {
    position: absolute; inset: 0; z-index: 20; display: grid; place-items: center;
    background: rgba(8, 8, 16, 0.82); backdrop-filter: blur(3px);
    transition: opacity .3s ease; opacity: 1;
}
.mv-guide-overlay.mv-fade-out { opacity: 0; }
.mv-guide-overlay-card { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 24px; }
.mv-guide-overlay-title { font-weight: 700; font-size: 1.02rem; }
.mv-guide-overlay-sub { color: var(--mv-text-dim); font-size: .84rem; }
.mv-guide-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 16px; border-bottom: 1px solid var(--mv-border);
    background: var(--mv-panel); flex: 0 0 auto;
}
.mv-guide-toolbar .mv-search {
    flex: 1 1 220px; min-width: 160px; padding: 9px 13px;
    background: rgba(0, 0, 0, 0.28); border: 1px solid var(--mv-border);
    border-radius: 10px; color: var(--mv-text); font-size: .85rem;
}
.mv-guide-toolbar select {
    padding: 9px 12px; background: rgba(0, 0, 0, 0.28); color: var(--mv-text);
    border: 1px solid var(--mv-border); border-radius: 10px; font-size: .82rem;
}
.mv-guide-scroll { flex: 1 1 auto; overflow: auto; position: relative; }
.mv-guide-inner {
    --mv-track-w: 1600px; --mv-chan-w: 258px;
    min-width: calc(var(--mv-chan-w) + var(--mv-track-w));
    position: relative;
}
.mv-timeline {
    flex: 0 0 var(--mv-track-w);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--mv-timeline-bg); border-bottom: 1px solid var(--mv-border);
    width: var(--mv-track-w);
}
.mv-time-slot { padding: 8px 10px; font-size: .74rem; color: var(--mv-text-dim); border-left: 1px solid var(--mv-border); font-weight: 600; }
/* Sticky header ROW that holds the opaque top-left corner + the scrolling
   timeline as one unit. It sticks to the top; the corner inside additionally
   sticks to the left. */
.mv-timerow {
    display: flex; position: sticky; top: 0; z-index: 6;
    width: calc(var(--mv-chan-w, 258px) + var(--mv-track-w));
}
/* Opaque top-left CORNER block, sticky-left so it stays pinned in the corner
   while the guide scrolls horizontally, covering the square above the channel
   column. z-index 10 = above the channel column (8) so nothing bleeds through. */
.mv-corner {
    position: sticky; left: 0; z-index: 10;
    flex: 0 0 var(--mv-chan-w, 258px);
    background: var(--mv-chan-bg); border-right: 1px solid var(--mv-border);
    border-bottom: 1px solid var(--mv-border);
}


.mv-row {
    display: grid; grid-template-columns: var(--mv-chan-w, 258px) var(--mv-track-w);
    border-bottom: 1px solid var(--mv-border); min-height: 62px;
}
.mv-chan {
    display: flex; align-items: center; gap: 10px; padding: 8px 11px;
    /* OPAQUE so program cells scrolling left can never show through / behind
       the channel-name column (they used to bleed through the 66%-alpha panel
       and make the names hard to read). z-index 8 keeps this column above both
       the program cells (default) and the sticky timeline header (z-index 6),
       so it stays crisp and readable while scrolling the timeline. */
    background: var(--mv-chan-bg); position: sticky; left: 0; z-index: 8;
    border-right: 1px solid var(--mv-border); cursor: pointer;
}
.mv-chan:hover { background: var(--mv-chan-bg-hover); }
.mv-chan-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: rgba(0, 0, 0, 0.35); flex: 0 0 auto; }
/* ROUND S.2g: initial-letter placeholder tile that shows immediately while the
   real logo is proxied (or if the logo host is dead), so rows never look broken. */
.mv-logo-ph { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mv-logo-ph::before {
    content: attr(data-initial);
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; color: var(--mv-text-dim);
    background: linear-gradient(135deg, rgba(124,92,255,.28), rgba(0,0,0,.35));
}
.mv-chan-logo-img { position: relative; z-index: 1; width: 100%; height: 100%; border-radius: 8px; object-fit: contain; opacity: 0; transition: opacity .2s ease; background: rgba(0,0,0,.35); }
.mv-chan-logo-img.mv-logo-ready { opacity: 1; }
.mv-chan-meta { min-width: 0; }
.mv-chan-name { font-size: .84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-chan-num { font-size: .7rem; color: var(--mv-text-mute); }
.mv-progs { position: relative; }
.mv-prog {
    position: absolute; top: 5px; bottom: 5px;
    background: var(--mv-glass); border: 1px solid var(--mv-border);
    border-radius: 8px; padding: 7px 10px; overflow: hidden; cursor: pointer;
    transition: .12s;
}
.mv-prog:hover { background: rgba(124, 92, 255, 0.16); border-color: var(--mv-border-2); }
.mv-prog.now { border-color: var(--mv-cyan); box-shadow: inset 0 0 0 1px rgba(0, 224, 255, 0.3); }
.mv-prog-title { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-prog-time { font-size: .68rem; color: var(--mv-text-mute); }
.mv-nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--mv-cyan); z-index: 7; box-shadow: 0 0 10px var(--mv-cyan); pointer-events: none; }
.mv-nowline::before { content: ""; position: absolute; top: 0; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--mv-cyan); }

/* ==========================================================================
   VOD / Series grid
   ========================================================================== */
.mv-browse { padding: 18px 22px; }
.mv-browse h2 { margin: 6px 0 2px; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }

/* "VOD" pill shown next to the Movies / Series headings so both On-Demand
   sections read consistently. */
.mv-vod-badge {
    display: inline-flex; align-items: center;
    font-size: .62rem; font-weight: 800; letter-spacing: .8px;
    padding: 3px 9px; border-radius: 999px;
    color: #fff; background: var(--mv-grad);
    box-shadow: 0 3px 10px rgba(124, 92, 255, .35);
    text-transform: uppercase;
}

/* Intuitive search box for Movies / Series (glass theme, focus glow). */
.mv-search {
    position: relative; display: flex; align-items: center;
    margin: 14px 0 4px; max-width: 460px;
}
.mv-search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: .9rem; opacity: .55; pointer-events: none;
}
.mv-search-input {
    width: 100%; padding: 12px 16px 12px 40px;
    background: rgba(0, 0, 0, 0.28); color: var(--mv-text);
    border: 1px solid var(--mv-border); border-radius: 999px;
    font-size: .9rem; font-family: inherit; transition: .16s;
    -webkit-appearance: none; appearance: none;
}
.mv-search-input::placeholder { color: var(--mv-text-mute); }
.mv-search-input:focus {
    outline: none; border-color: var(--mv-violet);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.22);
    background: rgba(0, 0, 0, 0.36);
}
/* Hide the ugly native search "x" clear button in WebKit for a clean look. */
.mv-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.mv-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
.mv-chip {
    padding: 8px 14px; border-radius: 20px; cursor: pointer; font-size: .82rem; font-weight: 600;
    background: var(--mv-glass); border: 1px solid var(--mv-border); color: var(--mv-text-dim);
}
.mv-chip.active { background: rgba(124, 92, 255, 0.2); color: #fff; border-color: var(--mv-border-2); }
.mv-poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.mv-more-wrap { grid-column: 1 / -1; display: flex; justify-content: center; padding: 18px 0 6px; }
.mv-more-btn { padding: 10px 22px; font-size: 14px; border-radius: 8px; cursor: pointer; }
/* Unified-search result sections (Movies row + Series row shown together). */
.mv-result-sec { margin: 6px 0 22px; }
.mv-result-head {
    display: flex; align-items: center; gap: 9px; margin: 4px 0 12px;
    font-size: .82rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; color: var(--mv-text-dim);
}
.mv-result-head::after {
    content: ""; flex: 1 1 auto; height: 1px;
    background: linear-gradient(90deg, var(--mv-border), transparent);
}
.mv-result-count {
    flex: 0 0 auto; min-width: 20px; text-align: center;
    padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700;
    letter-spacing: 0; color: #fff; background: var(--mv-grad);
}
.mv-result-empty { padding: 6px 2px 0; }
.mv-poster {
    background: var(--mv-panel-2); border: 1px solid var(--mv-border); border-radius: 12px;
    overflow: hidden; cursor: pointer; transition: .15s;
}
.mv-poster:hover { transform: translateY(-3px); border-color: var(--mv-border-2); box-shadow: var(--mv-shadow); }
.mv-poster-img { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: #0a0a12; display: block; }
.mv-poster-cap { padding: 9px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Player overlay
   ========================================================================== */
.mv-player-modal {
    position: fixed; inset: 0; z-index: 200; background: rgba(4, 4, 10, 0.92);
    display: flex; flex-direction: column; backdrop-filter: blur(4px);
    /* Lock to the visible viewport so the controls bar is never pushed off the
       bottom of the screen (dvh accounts for mobile browser chrome). The
       explicit width + box-sizing keep the whole modal inside the window on
       desktop even at high zoom levels. */
    width: 100vw; box-sizing: border-box;
    height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
    overflow: hidden;
}
/* top bar + controls never shrink; only the video area flexes. */
.mv-player-top { display: flex; align-items: center; gap: 12px; padding: 12px 18px; flex: 0 0 auto; }
.mv-player-top .title { font-weight: 700; }
.mv-player-top .sub { color: var(--mv-text-dim); font-size: .8rem; }
.mv-player-close { margin-left: auto; }
/* The video area takes ALL remaining height between the top bar and the
   controls, but never more. min-height:0 lets the flex item shrink below the
   video's intrinsic size (critical on Chrome, otherwise the video forces the
   controls off-screen). overflow:hidden clips any residual overflow. */
.mv-video-wrap {
    flex: 1 1 auto; min-height: 0; height: 100%;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; background: #000;
}
/* Default = FIT (letterbox, whole frame visible). .fill = crop-to-fill.
   The video is absolutely positioned and pinned to all four edges so it always
   fills the wrap's box exactly; object-fit:contain then centres the frame
   INSIDE that box (letterbox bars split evenly top/bottom or left/right).
   Absolute + inset:0 guarantees the video can never be top-aligned or leave a
   one-sided black band regardless of the source resolution or flex quirks. */
.mv-video-wrap video {
    position: absolute; inset: 0; margin: auto;
    display: block;
    width: 100%; height: 100%;
    max-width: 100%; max-height: 100%;
    background: #000; object-fit: contain; object-position: center center;
}
.mv-video-wrap.fill video { object-fit: cover; }
.mv-player-loading {
    position: absolute; inset: 0; display: grid; place-items: center; color: var(--mv-text-dim); font-size: .9rem;
    pointer-events: none;
}
.mv-spin { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--mv-cyan); border-radius: 50%; animation: mvspin 0.8s linear infinite; }
@keyframes mvspin { to { transform: rotate(360deg); } }
/* ROUND V: small inline spinner + notice used by catalogue-wide search. */
.mv-spin-inline {
    display: inline-block; width: 13px; height: 13px; border-width: 2px;
    vertical-align: -2px; margin-right: 7px;
}
.mv-search-more {
    padding: 10px 4px 2px; color: var(--mv-text-dim);
    font-size: .82rem; letter-spacing: .2px;
}
.mv-player-loading { flex-direction: column; gap: 14px; }
.mv-load-text { color: var(--mv-text-dim); font-size: .85rem; letter-spacing: .3px; }
/* While "tuning in", keep the raw video hidden so the connect stutter/skip is
   never shown; a black cover + the overlay sit on top until playback stabilises. */
.mv-video-wrap.mv-tuning video { opacity: 0; }
.mv-video-wrap.mv-tuning::before { content: ""; position: absolute; inset: 0; background: #000; }
.mv-video-wrap video { transition: opacity .25s ease; }

.mv-controls {
    display: flex; align-items: center; gap: 14px; padding: 12px 18px;
    background: var(--mv-panel); border-top: 1px solid var(--mv-border);
    /* Stay a single, always-visible row pinned to the bottom. On very narrow
       screens the row scrolls horizontally instead of wrapping off-screen. */
    flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.mv-controls::-webkit-scrollbar { height: 6px; }
.mv-controls::-webkit-scrollbar-thumb { background: var(--mv-border-2); border-radius: 3px; }
.mv-controls > * { flex-shrink: 0; }
.mv-controls .mv-seek { flex-shrink: 1; }
.mv-ctrl-btn {
    background: var(--mv-glass); border: 1px solid var(--mv-border); color: var(--mv-text);
    width: 42px; height: 42px; border-radius: 10px; cursor: pointer; font-size: 1rem;
    display: grid; place-items: center; transition: .12s;
}
.mv-ctrl-btn:hover { border-color: var(--mv-border-2); background: rgba(124, 92, 255, 0.15); }
.mv-seek { flex: 1 1 200px; min-width: 120px; accent-color: var(--mv-violet); }
.mv-time { font-size: .78rem; color: var(--mv-text-dim); font-variant-numeric: tabular-nums; min-width: 96px; text-align: center; }
.mv-vol { width: 90px; accent-color: var(--mv-cyan); }
.mv-track-select { padding: 8px 10px; background: rgba(0,0,0,.3); color: var(--mv-text); border: 1px solid var(--mv-border); border-radius: 9px; font-size: .78rem; max-width: 160px; }
.mv-engine-badge { font-size: .68rem; padding: 3px 8px; border-radius: 20px; background: rgba(0,224,255,.12); color: var(--mv-cyan); border: 1px solid rgba(0,224,255,.3); font-weight: 700; letter-spacing: .5px; }

/* ==========================================================================
   Admin panel
   ========================================================================== */
.mv-admin { max-width: 760px; margin: 0 auto; padding: 24px; }
.mv-admin h2 { margin: 0 0 4px; }
.mv-admin .mv-sub { color: var(--mv-text-dim); font-size: .84rem; margin-bottom: 20px; }
.mv-card {
    background: var(--mv-panel); border: 1px solid var(--mv-border); border-radius: var(--mv-radius);
    padding: 20px 22px; margin-bottom: 18px;
}
.mv-card h3 { margin: 0 0 14px; font-size: .98rem; color: var(--mv-violet-2); }
.mv-admin .mv-field input, .mv-admin .mv-field select { width: 100%; }
.mv-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mv-switch { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: .86rem; }
.mv-diag { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); font-size: .88rem; }

/* "Managed by the MVLTD Theme Suite" notice shown above a field the operator
   can look at but should not edit here. */
.mv-managed { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px;
  background: rgba(46,204,113,.10); border: 1px solid rgba(46,204,113,.35);
  font-size: .86rem; line-height: 1.5; }
.mv-managed b { color: #6ee7a8; }
.mv-managed span { display: block; margin-top: 4px; opacity: .85; }
.mv-managed + .mv-row2 input[disabled],
.mv-managed ~ .mv-row2 input[disabled] { opacity: .65; cursor: not-allowed; }
/* Themed dropdowns — used by the admin selects AND the login service picker so
   every <select> across MVLTD matches the glass theme (custom arrow, no OS
   chrome). */
.mv-admin select,
.mv-field select,
select.mv-select,
#loginService {
    width: 100%; padding: 12px 40px 12px 14px;
    background-color: rgba(0, 0, 0, 0.28);
    color: var(--mv-text);
    border: 1px solid var(--mv-border); border-radius: 10px;
    font-size: .9rem; font-family: inherit; cursor: pointer;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    /* Custom chevron drawn as an SVG data URI in the brand violet. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a80ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: border-color .16s, box-shadow .16s, background-color .16s;
}
.mv-admin select:hover,
.mv-field select:hover,
select.mv-select:hover,
#loginService:hover { border-color: var(--mv-border-2); }
.mv-admin select:focus,
.mv-field select:focus,
select.mv-select:focus,
#loginService:focus {
    outline: none; border-color: var(--mv-violet);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.22);
    background-color: rgba(0, 0, 0, 0.36);
}
/* Ensure the dropdown option list is dark, not white, where the browser honours
   it (Chrome/Edge on most platforms). */
.mv-admin select option,
.mv-field select option,
select.mv-select option,
#loginService option { background: var(--mv-bg-2); color: var(--mv-text); }

/* ---- Login services editor (admin) --------------------------------------- */
.mv-svc-list { display: flex; flex-direction: column; gap: 14px; }
.mv-svc-row {
    border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 14px;
    background: rgba(255,255,255,.025);
}
.mv-svc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mv-svc-head .mv-svc-title { font-size: .82rem; font-weight: 700; color: var(--mv-violet-2); letter-spacing: .3px; }
.mv-svc-del {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 84, 112, 0.08);
    border: 1px solid rgba(255, 139, 160, 0.35); color: #ff9db0;
    border-radius: 999px; padding: 6px 14px; font-size: .76rem; font-weight: 600;
    letter-spacing: .2px; cursor: pointer;
    transition: background .16s, border-color .16s, transform .1s, box-shadow .16s;
}
.mv-svc-del::before { content: "\2715"; font-size: .72rem; opacity: .85; }
.mv-svc-del:hover {
    background: rgba(255, 84, 112, 0.16); border-color: #ff8ba0; color: #ffb6c4;
    box-shadow: 0 4px 14px rgba(255, 84, 112, 0.22);
}
.mv-svc-del:active { transform: translateY(1px); }
.mv-svc-row .mv-row2 { margin-bottom: 10px; }
.mv-svc-add {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 16px; background: rgba(124, 92, 255, 0.10);
    border: 1px solid var(--mv-border-2);
    color: var(--mv-violet-2); border-radius: 999px; padding: 11px 20px;
    font-size: .86rem; font-weight: 700; letter-spacing: .2px; cursor: pointer;
    transition: background .16s, border-color .16s, transform .1s, box-shadow .16s;
}
.mv-svc-add:hover {
    background: rgba(124, 92, 255, 0.2); border-color: var(--mv-violet);
    box-shadow: 0 6px 18px rgba(124, 92, 255, 0.28);
}
.mv-svc-add:active { transform: translateY(1px); }
.mv-svc-empty { color: var(--mv-text-dim); font-size: .84rem; padding: 8px 0; }

/* Per-service tab visibility block (which tabs this service's users may see) */
.mv-svc-vis {
    margin-top: 12px; padding: 12px 14px;
    background: rgba(124, 92, 255, 0.06);
    border: 1px solid var(--mv-border); border-radius: 10px;
}
.mv-svc-vis-label {
    display: block; font-size: .78rem; font-weight: 700;
    color: var(--mv-violet-2); letter-spacing: .3px; margin-bottom: 6px;
}
.mv-svc-vis .mv-switch { margin: 4px 0; }
.mv-svc-vis-note {
    margin-top: 8px; font-size: .76rem; line-height: 1.4;
    color: var(--mv-text-dim);
}
.mv-toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--mv-panel); border: 1px solid var(--mv-border-2); color: var(--mv-text);
    padding: 12px 20px; border-radius: 12px; box-shadow: var(--mv-shadow); z-index: 500;
    font-size: .86rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.mv-toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.mv-toast.err { border-color: var(--mv-bad); }

.mv-empty { text-align: center; color: var(--mv-text-mute); padding: 60px 20px; font-size: .9rem; }

/* ==========================================================================
   Rotate prompt (mobile portrait) — same behaviour as the suite guide
   ========================================================================== */
.mv-rotate {
    position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 30px;
    background: linear-gradient(180deg, var(--mv-bg), var(--mv-bg-2));
}
.mv-rotate-card { text-align: center; max-width: 320px; }
.mv-rotate-icon { font-size: 3rem; display: inline-block; animation: mvRotateSpin 2.4s ease-in-out infinite; }
@keyframes mvRotateSpin { 0%,40% { transform: rotate(0); } 60%,100% { transform: rotate(90deg); } }
.mv-rotate-hint { color: var(--mv-text-dim); font-size: .9rem; margin-top: 12px; line-height: 1.5; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .mv-live-shell { grid-template-columns: 240px 1fr; }
    .mv-guide-inner { --mv-chan-w: 150px; }
    .mv-brand-sub { display: none; }
    .mv-nav button { padding: 8px 11px; font-size: .8rem; }
}
@media (max-width: 640px) {
    .mv-live-shell { grid-template-columns: 190px 1fr; }
    .mv-guide-inner { --mv-chan-w: 132px; }
    .mv-topbar { padding: 10px 12px; gap: 8px; }
    .mv-acct { display: none; }
}
@media (orientation: landscape) and (max-height: 560px) {
    .mv-live-shell { grid-template-columns: 180px 1fr; max-height: none; min-height: 0; }
}

/* ==========================================================================
   ROUND W (v1.0.16) - guide cell load states.
   A channel whose EPG has not arrived yet is visually distinct from one the
   provider genuinely has no data for, and the latter offers a retry.
   ========================================================================== */
.mv-prog-waiting { opacity: .72; }
.mv-prog-pending {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--mv-text-mute);
    font-style: italic;
}
.mv-prog-pending::before {
    content: '';
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    animation: mv-prog-spin .7s linear infinite;
}
@keyframes mv-prog-spin { to { transform: rotate(360deg); } }
.mv-prog-retry {
    margin-left: .4rem;
    padding: .05rem .4rem;
    font: inherit;
    font-size: .66rem;
    line-height: 1.5;
    color: var(--mv-text);
    background: rgba(124, 92, 255, .18);
    border: 1px solid var(--mv-border-2);
    border-radius: 4px;
    cursor: pointer;
}
.mv-prog-retry:hover { background: rgba(124, 92, 255, .34); }
.mv-prog-retry:focus-visible { outline: 2px solid var(--mv-cyan); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
    .mv-prog-pending::before { animation: none; }
}
