/**
 * TV Page Styles - Live Channels (player-first, like Android tv.dart)
 */

/* Player fills the page; the browse overlay sits on top of the video.
   NOTE: do NOT set position here — .page is already position:absolute (top:0),
   which both keeps the page in place and is the containing block for the
   absolutely-positioned #tv-video below. Overriding to relative dropped the
   page into normal flow and pushed the video a full screen off-screen. */
#tv-page { background: #000; }

#tv-video {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    background: #000;
    z-index: 0;
}

/* Controles inyectados para mouse, Magic Remote y touch. */
.tv-player-controls {
    position: absolute;
    left: 50%; bottom: var(--tv-safe-y);
    z-index: 25;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    max-width: calc(100% - 40px); padding: 10px;
    border: 1px solid rgba(255,255,255,.18); border-radius: 18px;
    background: rgba(2,9,24,.88); box-shadow: 0 16px 42px rgba(0,0,0,.58);
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translate(-50%, 14px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.tv-player-controls.visible {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translate(-50%, 0);
}
.tv-control-btn {
    min-height: 48px; padding: 0 17px;
    border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
    background: rgba(255,255,255,.09); color: #fff;
    font: inherit; font-size: 15px; font-weight: 700; white-space: nowrap;
    cursor: pointer;
}
.tv-control-btn:hover, .tv-control-btn:focus-visible {
    border-color: var(--tv-focus-color); background: rgba(255,122,0,.25);
    outline: none; box-shadow: 0 0 20px rgba(255,122,0,.35);
}

#tv-page:fullscreen, #tv-page:-webkit-full-screen {
    width: 100vw; height: 100vh; background: #000;
}
#tv-page:fullscreen #tv-video, #tv-page:-webkit-full-screen #tv-video {
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%; height: 100%; object-fit: contain;
}

@media (max-width: 900px) {
    .tv-player-controls { flex-wrap: wrap; width: calc(100% - 28px); }
    .tv-control-btn { flex: 1 1 auto; padding: 0 12px; font-size: 13px; }
}

/* ── Channel info bar (auto-hides) — ported 1:1 from tv.dart _channelInfoBar.
   Android: Positioned(left:60,right:60,bottom:30,height:155). A category tab
   on top, then a card: logo | gradient divider | (number+name+actions) over a
   green progress bar and now/next EPG lines. Scaled up for the 1920px canvas. */
.tv-info-bar {
    position: absolute;
    left: var(--tv-safe-x); right: var(--tv-safe-x); bottom: var(--tv-safe-y);
    height: 240px;
    z-index: 20;
    display: flex; flex-direction: column;
    pointer-events: none;
}

/* Category tab — grey800@0.9, top corners only */
.tvib-cat {
    align-self: flex-start;
    background: rgba(66,66,66,0.9);
    color: rgba(255,255,255,0.70);
    font-size: 18px; font-weight: 500;
    padding: 7px 18px;
    border-radius: 8px 8px 0 0;
}

/* Main card — grey200@0.7 → grey700@0.8 gradient; only top-left square */
.tvib-card {
    flex: 1; min-height: 0;
    display: flex;
    overflow: hidden;
    border-radius: 0 8px 8px 8px;
    background: linear-gradient(to bottom, rgba(238,238,238,0.7), rgba(97,97,97,0.8));
}

/* Logo cell */
.tvib-logo {
    width: 200px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 10px;
}
.tvib-logo-img { max-width: 180px; max-height: 100%; object-fit: scale-down; }
.tvib-logo-empty::after {
    content: "TV";
    color: rgba(255,255,255,0.6); font-size: 28px; font-weight: 700;
}

/* Black gradient divider (Android width:10, black 0→0.8) */
.tvib-divider {
    width: 16px; flex-shrink: 0;
    background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.8));
}

/* Info area — black@0.5 */
.tvib-main {
    flex: 1; min-width: 0;
    background: rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    padding: 12px 16px;
    gap: 8px;
}

.tvib-top { display: flex; align-items: center; gap: 14px; }
.tvib-num {
    flex-shrink: 0;
    min-width: 60px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; border-radius: 12px;
    color: #fff; font-size: 24px; font-weight: 500;
    padding: 0 10px;
}
.tvib-name {
    flex: 1; min-width: 0;
    color: #fff; font-size: 30px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tvib-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tvib-ic {
    display: flex; align-items: center; justify-content: center;
    width: var(--tv-target-min); height: var(--tv-target-min);
    border: 1px solid #fff; border-radius: 4px;
    color: #fff; font-size: 20px; line-height: 1;
}
.tvib-ic.fav { background: #ffea00; border-color: #ffea00; color: #000; }
.tvib-ic.focused {
    transform: scale(1.18);
    border-color: var(--tv-focus-color);
}

/* Green now-progress bar (Android LinearProgressIndicator green/grey) */
.tvib-progress {
    height: 8px; border-radius: 4px;
    background: #9e9e9e; overflow: hidden;
}
.tvib-progress-fill { height: 100%; width: 0; background: var(--success); transition: width .3s ease; }

/* Now / next EPG lines */
.tvib-epg {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column; justify-content: space-evenly;
    color: #fff;
}
.tvib-now, .tvib-next {
    font-size: 22px; font-weight: 400; line-height: 1.2;
    overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tvib-time { font-weight: 700; }
.tvib-time.t-now  { color: var(--success); }
.tvib-time.t-next { color: #ff4136; }
.tvib-sub { font-weight: 200; font-size: 15px; color: rgba(255,255,255,0.85); }
.tvib-noinfo { color: rgba(255,255,255,0.6); font-style: italic; }

/* ── Browse overlay: base estructural compartida con la capa cinematic. ── */
.tv-browse {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    z-index: 30;
    display: flex;                 /* row: left half | right half */
    background: transparent;       /* player shows through the top-right */
}

/* Category row — standard TV list target. */
.tvb-cat-item {
    height: var(--tv-target-md);
    display: flex; align-items: center;
    padding: 0 14px;
    cursor: pointer;
    color: rgba(255,255,255,0.60);
    border-left: 3px solid transparent;
    border-bottom: 0.5px solid #252525;
}
.tvb-cat-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.tvb-cat-ic-img { max-width: 28px; max-height: 28px; object-fit: contain; }
.tvb-cat-ic.tv {
    width: 28px; height: 28px;
    background: url(../assets/images/main_tv.png) center/contain no-repeat;
    filter: brightness(0) invert(1);
    opacity: 0.45;
}
.tvb-cat-ic.star { color: var(--brand-star); font-size: 20px; }
.tvb-cat-name {
    flex: 1; margin-left: 10px;
    font-size: 20px; font-weight: 300;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tvb-cat-item.current { border-left-color: var(--brand-color); }
.tvb-cat-item.current .tvb-cat-name { color: #fff; font-weight: 600; }
/* LEGACY (lista clásica): las reglas .focused de categorías vivían aquí pero el
   bloque GANADOR es el dock/carrusel (~ln 591). Se eliminaron para que no haya
   dos definiciones .focused compitiendo en la cascada. */

/* Channel row — accent marks playback, orange marks remote focus. */
.tvb-chan-item {
    height: var(--tv-target-md);
    display: flex; align-items: center;
    padding: 0 12px;
    cursor: pointer;
    border-left: 4px solid transparent;
    border-bottom: 0.5px solid #252525;
}
.tvb-chan-logo {
    width: 72px; height: 72px; flex-shrink: 0;
    border-radius: 8px;
    background: #1E1E1E;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.tvb-chan-logo-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tvb-chan-logo-num {
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.38); font-weight: 700; font-size: 18px;
}
.tvb-chan-name {
    flex: 1; min-width: 0; margin-left: 12px;
    display: flex; align-items: center; gap: 6px;
    color: #fff; font-size: 22px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tvb-chan-play { color: var(--brand-accent); font-size: 16px; flex-shrink: 0; }
.tvb-chan-meta { color: rgba(255,255,255,0.38); font-size: 16px; flex-shrink: 0; }
.tvb-chan-item.playing { border-left-color: var(--brand-accent); }
/* LEGACY (lista clásica): las reglas .focused de la fila de canal vivían aquí.
   El bloque GANADOR es el dock/carrusel (~ln 606). Eliminadas para no competir
   en la cascada con una definición muerta. */
.tvb-empty { padding: 24px; color: rgba(255,255,255,0.6); }

/* EPG list (EpgWidget; itemExtent 56 → 76) */
.tvb-epg-list {
    height: 50%; overflow-y: auto;
    background: #111;
}
.tvb-epg-loading, .tvb-epg-empty {
    padding: 24px; color: rgba(255,255,255,0.6); font-style: italic;
}
.tvb-epgi {
    height: var(--tv-target-md);
    display: flex; align-items: center;
    padding: 0 14px;
    cursor: pointer;
    border-bottom: 0.5px solid #252525;
}
.tvb-epgi-time { width: 100px; flex-shrink: 0; }
.tvb-epgi-hm   { font-size: 20px; font-weight: 300; color: rgba(255,255,255,0.70); }
.tvb-epgi-date { font-size: 14px; font-weight: 300; color: rgba(255,255,255,0.70); }
.tvb-epgi-prog {
    margin-top: 4px; height: 3px; border-radius: 2px;
    background: rgba(255,255,255,0.24); overflow: hidden;
}
.tvb-epgi-progfill { height: 100%; background: var(--brand-accent); }
.tvb-epgi-info { flex: 1; min-width: 0; margin-left: 10px; }
.tvb-epgi-title { font-size: 20px; font-weight: 300; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvb-epgi-sub { font-size: 15px; font-weight: 300; color: rgba(255,255,255,0.38);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tvb-epgi.now .tvb-epgi-hm,
.tvb-epgi.now .tvb-epgi-date { color: var(--brand-accent); font-weight: 600; }
.tvb-epgi.now .tvb-epgi-title { font-weight: 500; }
.tvb-epgi.past .tvb-epgi-hm,
.tvb-epgi.past .tvb-epgi-date,
.tvb-epgi.past .tvb-epgi-title { color: rgba(255,255,255,0.38); }
/* LEGACY (lista clásica): las reglas .focused del item EPG vivían aquí.
   El bloque GANADOR es el dock/carrusel (~ln 680). Eliminadas para no competir
   en la cascada con una definición muerta. */

/* ── Channel-number entry — ported from tv.dart ChannelNumberDialog ──────── */
.tv-numpad-overlay {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    z-index: 40;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.54);
}
.tv-numpad {
    width: 440px;
    background: var(--bg-medium);
    border: 2px solid #444;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 60px var(--brand-focus-soft);
    overflow: hidden;
}
.tv-np-header {
    position: relative;
    background: #242424;
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.tv-np-tv { font-size: 24px; }
.tv-np-title { font-family: var(--font-brand); color: #fff; font-size: 30px; font-weight: 700; letter-spacing: 6px; }
.tv-np-close {
    position: absolute; right: 18px;
    color: rgba(255,255,255,0.38); font-size: 22px; cursor: pointer;
}
.tv-np-display { display: flex; justify-content: center; gap: 12px; padding: 18px 0; }
.tv-np-box {
    width: 56px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    background: #2A2A2A; border: 2px solid rgba(255,255,255,0.24); border-radius: 10px;
    color: rgba(255,255,255,0.30); font-size: 30px; font-weight: 700;
}
.tv-np-box.filled { background: var(--brand-focus-soft); border-color: var(--brand-color); color: #fff; }
.tv-np-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; padding: 0 22px 22px;
}
.tv-np-key {
    height: 72px;
    display: flex; align-items: center; justify-content: center;
    background: #2A2A2A; border: 1px solid #3A3A3A; border-radius: 10px;
    color: rgba(255,255,255,0.70); font-size: 28px; font-weight: 400;
    cursor: pointer;
}
.tv-np-key.confirm { color: var(--success); }
.tv-np-key.focused { background: var(--brand-color); border-color: var(--brand-color); color: var(--brand-navy); font-weight: 700; }
.tv-np-key.focused.confirm { color: #fff; }
.tv-np-svg { width: 30px; height: 30px; display: block; }

/* ── Language strip (tv.dart _languageStrip) — left half, above categories ── */
.tvb-left { flex-direction: column; }          /* override row → column */
.tvb-left-body { flex: 1; min-height: 0; display: flex; }
.tvb-lang-strip {
    height: 88px; flex-shrink: 0;
    display: flex; align-items: center; gap: 8px;
    padding: 0 12px;
    background: #1E1E1E;
    border-bottom: 1px solid #333;
    overflow-x: auto;
}
.tvb-lang-chip {
    flex-shrink: 0;
    min-height: var(--tv-target-min); padding: 0 24px;
    display: flex; align-items: center;
    border: 1px solid rgba(255,255,255,0.24);
    border-radius: 18px;
    color: rgba(255,255,255,0.70);
    font-size: 18px; font-weight: 400;
    white-space: nowrap; cursor: pointer;
}
.tvb-lang-chip.selected {
    background: var(--brand-focus-soft);
    border-color: var(--brand-color); color: var(--brand-color); font-weight: 600;
}
.tvb-lang-chip.focused {
    background: var(--brand-color);
    border: var(--tv-focus-border) solid var(--tv-focus-color); color: var(--brand-navy); font-weight: 600;
}

/* ── PIN panel (tv.dart PinPanelWidget) — reuses .tv-numpad chrome ───────── */
.tv-pin-title { letter-spacing: 2px !important; font-size: 24px !important; }
.tv-pin-dots {
    display: flex; justify-content: center; gap: 22px;
    padding: 24px 0;
}
.tv-pin-dot {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.30);
    background: transparent;
}
.tv-pin-dot.filled { background: var(--brand-color); border-color: var(--brand-color); }
.tv-pin-grid > div:empty { background: transparent; border: none; cursor: default; }

/* ── Info-bar action chips: lock / startup / favorite ────────────────────── */
.tvib-chip-svg { width: 24px; height: 24px; display: block; }
.tvib-ic.chip-lock.active    { color: var(--error); border-color: var(--error); }
.tvib-ic.chip-startup.active { background: var(--success); border-color: var(--success); color: #000; }

/* ── Timeshift / catch-up — TIMESHIFT/PAUSED label + seek controller ─────── */
.tv-ts-label {
    position: absolute; top: 28px; right: 36px; z-index: 25;
    background: rgba(46,204,64,0.85);
    color: #fff; font-size: 22px; font-weight: 700; letter-spacing: 1px;
    padding: 8px 18px; border-radius: 8px;
}
.tv-ts-label.paused { background: rgba(255,82,82,0.9); }

/* Controller — ported from tv.dart _timeshiftController: grey-gradient card,
   logo | divider | info area with a seek row and an expand-on-focus button row. */
.tv-ts-controls {
    position: absolute; left: var(--tv-safe-x); right: var(--tv-safe-x); bottom: var(--tv-safe-y);
    height: 200px;
    z-index: 25;
    display: flex; overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(to bottom, rgba(238,238,238,0.7), rgba(97,97,97,0.85));
    /* This outer card measures reliably; the seek row is positioned against it
       (webOS mis-sizes the inner .tv-ts-main box). */
}
.tv-ts-logo {
    width: 180px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 10px;
}
.tv-ts-logo-img { max-width: 160px; max-height: 100%; object-fit: scale-down; }
.tv-ts-logo-tv { color: rgba(255,255,255,0.7); font-size: 28px; font-weight: 700; }
.tv-ts-divider { width: 16px; flex-shrink: 0;
    background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.8)); }
.tv-ts-main {
    flex: 1; min-width: 0;
    background: rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    padding: 14px 20px; gap: 10px;
    overflow: hidden;          /* never let a row spill past the card */
}
.tv-ts-head { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.tv-ts-title { flex: 0 1 auto; font-size: 26px; font-weight: 600; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-ts-range { flex: 0 1 auto; font-size: 16px; color: rgba(255,255,255,0.70);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* position / duration — pushed to the right edge of the head row */
.tv-ts-time { flex: 0 0 auto; margin-left: auto; font-size: 18px; color: #fff;
    white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Seek row — rewind · bar · forward in normal flex flow, inset with simple
   margins (the row is inside the .tv-ts-main div, so margins constrain it; no
   absolute positioning needed). Icons are clickable (LG Magic-Remote pointer). */
.tv-ts-seekrow { display: flex; align-items: center; gap: 12px;
    margin: 20px 30px 0; height: 30px; }
.tv-ts-seekic { flex: 0 0 26px; width: 26px; height: 26px; color: #fff;
    opacity: 0.6; cursor: pointer; }
.tv-ts-seekrow.focused .tv-ts-seekic { opacity: 1; }
.tv-ts-seekic svg { width: 100%; height: 100%; display: block; }
.tv-ts-bar { flex: 1 1 auto; min-width: 0; height: 7px; border-radius: 4px;
    background: rgba(255,255,255,0.20); overflow: hidden; cursor: pointer; }
.tv-ts-seekrow.focused .tv-ts-bar { height: 11px; }
.tv-ts-bar-fill { height: 100%; background: #2ecc40; transition: width .25s linear; }
.tv-ts-seekrow.focused .tv-ts-bar-fill { background: #39e75f; }

/* Button row (focus row 1) — icon only, label appears on focus */
.tv-ts-btnrow { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.tv-ts-btn {
    display: flex; align-items: center; gap: 6px;
    min-height: var(--tv-target-min); min-width: var(--tv-target-min); padding: 0 var(--tv-btn-pad-x);
    border: 1px solid #fff; border-radius: 4px;
    color: #fff; background: transparent;
    overflow: hidden; cursor: pointer;
}
.tv-ts-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.tv-ts-btn-lbl { display: none; font-size: var(--tv-font-caption); font-weight: 500; white-space: nowrap; }
.tv-ts-btn.focused { background: var(--brand-color); color: var(--brand-navy); border-color: var(--brand-color); }
.tv-ts-btn.focused .tv-ts-btn-lbl { display: inline; }

/* ─── On-screen clock overlay (Settings → Clock in TV mode) ─── */
.tv-clock {
    position: absolute; z-index: 60;
    font-family: var(--font-brand);
    color: #fff; font-size: 34px; font-weight: 700;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9);
    pointer-events: none;
}
.tv-clock.hidden { display: none; }
.tv-clock.tl { top: 28px;    left: 36px; }
.tv-clock.tr { top: 28px;    right: 36px; }
.tv-clock.bl { bottom: 28px; left: 36px; }
.tv-clock.br { bottom: 28px; right: 36px; }

/* ── Reproductor cinematográfico TELCO ────────────────────────────────────
   Segunda pasada visual: conserva el DOM/IDs y deja la lógica D-pad intacta. */
#tv-page.tv-browsing #tv-video {
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Barra informativa legacy: misma piel TELCO mientras cede protagonismo al rail. */
.tv-info-bar {
    left: var(--tv-safe-x); right: var(--tv-safe-x); bottom: var(--tv-safe-y);
    height: 250px; display: block;
    filter: drop-shadow(0 26px 52px rgba(0,0,0,.62));
}
.tv-info-bar::before {
    content: ""; position: absolute;
    left: calc(var(--tv-safe-x) * -1); right: calc(var(--tv-safe-x) * -1);
    bottom: calc(var(--tv-safe-y) * -1); height: 410px;
    background: linear-gradient(to top, rgba(13,10,20,.97), rgba(18,14,28,.58) 55%, transparent);
    pointer-events: none;
}
.tvib-card {
    position: relative; height: 100%; display: flex; overflow: hidden;
    border: 1px solid rgba(255,255,255,.1); border-radius: 20px;
    background: rgba(13,10,20,.66);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
    box-shadow: inset 0 1px rgba(255,255,255,.07), 0 18px 54px rgba(0,0,0,.46);
}
.tvib-logo { width: 210px; padding: 26px; background: radial-gradient(circle, rgba(251,183,96,.12), transparent 70%); }
.tvib-logo-img { max-width: 168px; max-height: 128px; }
.tvib-logo-empty::after { font-family: var(--font-brand); color: var(--text-secondary); }
.tvib-main { padding: 22px 26px; gap: 12px; background: linear-gradient(90deg, rgba(13,10,20,.12), rgba(32,28,50,.24)); }
.tvib-top { min-width: 0; }
.tvib-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.tvib-num { min-width: 52px; height: 36px; padding: 0 11px; border: 1px solid rgba(122,63,242,.55); border-radius: 10px; color: var(--brand-accent); font-family: var(--font-brand); font-size: 18px; }
.tvib-title-wrap { min-width: 0; }
.tvib-name { font-family: var(--font-brand); color: var(--text-primary); font-size: 30px; font-weight: 700; }
.tvib-meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.tvib-live, .tvib-quality, .tvib-category { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .8px; }
.tvib-live { color: var(--text-primary); background: rgba(127,195,75,.18); }
.tvib-live i, .tvb-live-pill i, .tvb-chan-live i { width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--brand-live-glow); }
.tvib-quality { color: var(--brand-navy); background: var(--text-primary); }
.tvib-category { color: var(--text-secondary); background: rgba(255,255,255,.08); }
.tvib-epg { flex: 1; display: grid; gap: 6px; justify-content: center; }
.tvib-now-row, .tvib-next-row { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.tvib-kicker { width: 80px; flex: 0 0 80px; color: var(--success); font-size: 11px; font-weight: 800; letter-spacing: 1.2px; }
.tvib-next-row .tvib-kicker { color: var(--brand-accent); }
.tvib-now, .tvib-next { display: block; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvib-next { color: var(--text-secondary); }
.tvib-time.t-now, .tvib-time.t-next { color: inherit; }
.tvib-progress { height: 6px; margin-left: 94px; background: var(--brand-bar-track); }
.tvib-progress-fill { background: linear-gradient(90deg, var(--brand-color), var(--brand-accent)); box-shadow: 0 0 12px rgba(122,63,242,.42); }
.tvib-actions { display: flex; gap: 10px; pointer-events: auto; }
.tvib-ic { width: auto; min-width: 48px; height: 44px; padding: 0 15px; gap: 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text-primary); font-size: 18px; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.tvib-ic-label { font-size: 14px; font-weight: 700; white-space: nowrap; }
.tvib-ic.focused { transform: scale(1.06); color: #fff; background: rgba(247,147,30,.18); border: 2.5px solid var(--tv-focus-color); box-shadow: 0 0 25px var(--brand-focus-glow); }
.tvib-ic.chip-favorite.active { color: var(--brand-star); border-color: var(--brand-star); }
.tvib-ic.chip-startup.active { color: var(--success); border-color: var(--success); }
.tvib-ic.chip-play { color: #fff; background: var(--brand-gradient); border-color: rgba(255,255,255,.24); }

/* Overlay y drawer de canales. */
.tv-browse { display: block; background: linear-gradient(270deg, rgba(13,10,20,.58), transparent 62%); }
.tv-browse::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,.24), transparent 20%, transparent 78%, rgba(0,0,0,.42)); }
.tvb-left {
    position: absolute; z-index: 2; top: 0; right: 0; bottom: 0;
    width: var(--tv-drawer-width); min-width: 520px; display: flex; flex-direction: column;
    padding: 54px 16px 16px;
    border-left: 1.2px solid rgba(247,147,30,.72);
    border-radius: 24px 0 0 24px;
    background: linear-gradient(135deg, rgba(18,14,28,.28), rgba(13,10,20,.16));
    -webkit-backdrop-filter: blur(50px) saturate(1.4); backdrop-filter: blur(50px) saturate(1.4);
    box-shadow: -14px 0 36px rgba(0,0,0,.4), -5px 0 28px rgba(247,147,30,.14);
}
.tvb-left::before { content: "Canales"; position: absolute; top: 18px; left: 22px; color: var(--text-primary); font-family: var(--font-brand); font-size: 13px; font-weight: 700; letter-spacing: .7px; }
.tvb-left-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.tvb-lang-strip { height: 42px; flex: 0 0 42px; padding: 0 0 6px; gap: 7px; overflow-x: auto; background: transparent; border: 0; }
.tvb-lang-chip { min-height: 34px; padding: 0 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(0,0,0,.14); color: var(--text-secondary); }
.tvb-lang-chip.selected { background: rgba(247,147,30,.28); border-color: var(--brand-color); color: #fff; }
.tvb-lang-chip.focused { color: #fff; background: var(--brand-color); border-color: var(--brand-color); box-shadow: 0 0 18px rgba(247,147,30,.36); }
.tvb-cats {
    width: 100%; min-width: 0; height: 38px; flex: 0 0 38px;
    display: flex; align-items: stretch; gap: 7px; padding: 0;
    overflow-x: auto; overflow-y: hidden;
    background: transparent; border: 0; box-shadow: none; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}
.tvb-cats::-webkit-scrollbar { display: none; }
.tvb-col-divider { display: none; }
.tvb-cat-item { height: 38px; flex: 0 0 auto; margin: 0; padding: 0 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(0,0,0,.14); color: var(--text-secondary); }
.tvb-cat-icon { width: 22px; height: 22px; }
.tvb-cat-name { margin-left: 7px; font-size: 12px; font-weight: 500; }
.tvb-cat-item.current { border: 1px solid var(--brand-color); background: rgba(247,147,30,.28); color: #fff; }
.tvb-cat-item.focused { border: 1px solid var(--brand-color); background: var(--brand-color); color: #fff; transform: none !important; box-shadow: var(--tv-focus-glow) !important; z-index: 2; }
.tvb-cat-item.current .tvb-cat-name, .tvb-cat-item.focused .tvb-cat-name { color: #fff; font-weight: 700; }

/* Dock de carrete: el objetivo queda fijo y los tiles viajan por detrás. */
.tvb-chans {
    position: relative; align-self: flex-end; width: var(--tv-dock-width); flex: 1; min-height: 0;
    margin-top: 8px; padding: calc(50vh - 90px) 21px;
    overflow-y: auto; overflow-x: visible; scroll-behavior: smooth;
    border: 1px solid rgba(255,255,255,.12); border-radius: 22px;
    background: rgba(13,10,20,.12);
    -webkit-backdrop-filter: blur(38px) saturate(1.4); backdrop-filter: blur(38px) saturate(1.4);
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 11%, #000 89%, transparent);
}
.tvb-chans::-webkit-scrollbar { display: none; }
.tvb-chan-item {
    position: relative; width: var(--tv-dock-tile); height: var(--tv-dock-tile); min-height: var(--tv-dock-tile);
    margin: 10px 0; padding: 0; display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,.08); border-radius: 16px;
    background: rgba(0,0,0,.55); opacity: .4;
    transform: none; transition: opacity .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.tvb-chan-item:hover { opacity: .72; }
.tvb-chan-item.playing { opacity: 1; border: 2.5px solid var(--brand-color); box-shadow: 0 0 22px rgba(247,147,30,.48); }
.tvb-chan-item.focused { opacity: 1; transform: none !important; border: var(--tv-focus-border) solid var(--brand-color); border-radius: 16px; background: rgba(0,0,0,.55); box-shadow: var(--tv-focus-glow) !important; z-index: 2; }
.tvb-chan-logo { width: 48px; height: 48px; border-radius: 14px; background: rgba(0,0,0,.18); overflow: hidden; }
.tvb-chan-item.focused .tvb-chan-logo { background: rgba(0,0,0,.18); }
.tvb-chan-logo-img { max-width: 88%; max-height: 88%; object-fit: contain; }
.tvb-chan-logo-num { color: var(--text-primary); font-family: var(--font-brand); font-size: 22px; font-weight: 700; }
.tvb-chan-item.focused .tvb-chan-logo-num { color: var(--text-primary); }
.tvb-chan-copy, .tvb-chan-meta { display: none; }
.tvb-chan-num, .tvb-chan-number { position: absolute; top: -4px; right: -5px; min-width: 19px; height: 17px; padding: 0 4px; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: rgba(0,0,0,.86); color: var(--text-primary); font-size: 10px; font-weight: 700; z-index: 3; }
.tvb-empty { width: 100%; padding: 24px 4px; color: var(--text-secondary); font-style: italic; text-align: center; }
.tvb-dock-chevron { position: sticky; left: 0; width: 54px; height: 28px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-secondary); font-size: 24px; z-index: 9; pointer-events: auto; cursor: pointer; }
.tvb-dock-chevron:hover, .tvb-dock-chevron:focus-visible { outline: 0; color: var(--text-primary); }
.tvb-dock-chevron.up { top: 0; margin-bottom: -28px; transform: translateY(-34px); }
.tvb-dock-chevron.down { bottom: 0; margin-top: -28px; transform: translateY(34px); }
.tvb-dock-target {
    position: sticky; top: calc(50% - 34px); left: -7px; width: 68px; height: 68px;
    margin: 0 0 -68px -7px; z-index: 8; pointer-events: none;
    opacity: .82; animation: tvb-target-pulse 820ms ease-in-out infinite alternate;
    filter: drop-shadow(0 0 12px rgba(247,147,30,.82));
}
.tvb-corner { position: absolute; width: 17px; height: 17px; border-color: var(--brand-color); border-style: solid; border-width: 0; }
.tvb-corner.tl { top: 0; left: 0; border-top-width: 2.6px; border-left-width: 2.6px; border-radius: 10px 0 0; }
.tvb-corner.tr { top: 0; right: 0; border-top-width: 2.6px; border-right-width: 2.6px; border-radius: 0 10px 0 0; }
.tvb-corner.bl { bottom: 0; left: 0; border-bottom-width: 2.6px; border-left-width: 2.6px; border-radius: 0 0 0 10px; }
.tvb-corner.br { right: 0; bottom: 0; border-right-width: 2.6px; border-bottom-width: 2.6px; border-radius: 0 0 10px; }
.tvb-dock-target.lock-on { animation: tvb-target-lock-on 420ms cubic-bezier(.22,1,.36,1) both; }
@keyframes tvb-target-pulse { from { opacity: .55; transform: scale(.94); } to { opacity: 1; transform: scale(1.06); } }
@keyframes tvb-target-lock-on { 0% { opacity: .55; transform: scale(1.32); filter: drop-shadow(0 0 18px rgba(247,147,30,1)); } 100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 8px rgba(247,147,30,.78)); } }

/* Tarjeta EPG flotante, anclada a la izquierda del dock. */
.tvb-right { position: absolute; z-index: 3; top: 50%; right: calc(var(--tv-dock-width) + 22px); width: 322px; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }
.tvb-right-spacer { display: none; }
.tvb-nowbar {
    height: auto; min-height: 0; padding: 18px; display: block;
    border: 1px solid rgba(255,255,255,.12); border-radius: 18px;
    background: rgba(13,10,20,.05);
    -webkit-backdrop-filter: blur(52px) saturate(1.45); backdrop-filter: blur(52px) saturate(1.45);
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 22px 54px rgba(0,0,0,.34);
    text-shadow: 0 1px 10px rgba(0,0,0,.45);
    animation: tvb-card-enter 260ms ease-out both;
}
@keyframes tvb-card-enter { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
.tvb-card-head { display: flex; align-items: center; gap: 11px; }
.tvb-card-logo { width: 50px; height: 50px; flex: 0 0 50px; display: flex; align-items: center; justify-content: center; padding: 5px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(0,0,0,.18); overflow: hidden; }
.tvb-card-logo-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tvb-card-logo-fallback { color: var(--text-primary); font-family: var(--font-brand); font-size: 17px; font-weight: 800; }
.tvb-card-id { min-width: 0; flex: 1; }
.tvb-nowbar-num { display: inline-flex; padding: 2px 7px; border: 1px solid rgba(122,63,242,.55); border-radius: 7px; background: rgba(122,63,242,.22); color: var(--brand-accent); font-size: 11px; font-weight: 700; }
.tvb-nowbar-name { margin-top: 5px; color: var(--text-primary); font-family: var(--font-brand); font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvb-live-pill { display: flex; align-items: center; color: var(--text-primary); font-family: var(--font-brand); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.tvb-card-program { margin-top: 10px; }
.tvb-card-kicker { color: var(--success); font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.tvb-card-kicker.next { display: block; margin-top: 12px; color: var(--brand-accent); }
.tvb-card-title { margin-top: 4px; color: var(--text-primary); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvb-card-time { margin-top: 2px; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.tvb-card-next { margin-top: 12px; color: var(--text-primary); font-size: 12.5px; font-weight: 500; }
.tvb-card-next .tvb-card-kicker { display: block; color: var(--brand-accent); }
.tvb-card-next .tvb-card-title { font-size: 12.5px; font-weight: 500; }
.tvb-card-next .tvb-card-time { font-size: 11px; }
.tvb-card-progress { position: relative; height: 6px; margin-top: 10px; border-radius: 999px; background: var(--brand-bar-track); overflow: hidden; }
.tvb-card-progressfill, .tvb-card-progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-color), var(--brand-accent)); box-shadow: 0 0 10px rgba(122,63,242,.46); }
.tvb-card-pct { float: right; margin-top: 4px; color: var(--text-secondary); font-size: 10px; font-variant-numeric: tabular-nums; }
.tvb-card-empty { padding: 15px 0; color: var(--text-secondary); font-size: 13px; font-style: italic; }
.tvb-epg-list { max-height: 230px; height: auto; padding: 7px; overflow-y: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(18,14,28,.16); -webkit-backdrop-filter: blur(40px) saturate(1.4); backdrop-filter: blur(40px) saturate(1.4); }
.tvb-epgi { height: 62px; border: 1px solid transparent; border-radius: 11px; }
.tvb-epgi.now .tvb-epgi-hm, .tvb-epgi.now .tvb-epgi-date { color: var(--success); }
.tvb-epgi.focused { background: var(--brand-focus-soft); border: var(--tv-focus-border) solid var(--brand-color); border-radius: 11px; box-shadow: var(--tv-focus-glow) !important; z-index: 2; }

/* Barra de transporte rica inyectada por JS. */
.tv-player-controls {
    left: 50%; bottom: var(--tv-safe-y); min-width: min(1120px, calc(100% - 2 * var(--tv-safe-x)));
    min-height: 74px; padding: 10px 16px; gap: 10px;
    border: 1px solid rgba(255,255,255,.12); border-radius: 20px;
    background: rgba(13,10,20,.24);
    -webkit-backdrop-filter: blur(44px) saturate(1.4); backdrop-filter: blur(44px) saturate(1.4);
    box-shadow: 0 10px 28px rgba(0,0,0,.32);
    transform: translate(-50%, 18px); transition: opacity .24s ease, transform .24s cubic-bezier(.22,1,.36,1), visibility .24s;
}
.tv-player-controls.visible { transform: translate(-50%, 0); }
.tvp-round { width: 42px; height: 42px; flex: 0 0 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--text-primary); font: inherit; font-size: 19px; cursor: pointer; }
.tvp-round.sm { width: 36px; height: 36px; flex-basis: 36px; font-size: 17px; }
.tvp-round.md { width: 42px; height: 42px; flex-basis: 42px; }
.tvp-round.lg { width: 48px; height: 48px; flex-basis: 48px; }
.tvp-round.emph, .tvp-play { width: 52px; height: 52px; flex: 0 0 52px; color: #fff; font-size: 28px; background: var(--brand-gradient); box-shadow: 0 0 18px rgba(122,63,242,.5); }
.tvp-round:hover { background-color: var(--bg-hover); }
.tvp-round:focus-visible, .tvp-round.focused { outline: 0; border: 2.5px solid var(--brand-color); box-shadow: 0 0 20px var(--brand-focus-glow) !important; }
.tvp-seek-back, .tvp-seek-fwd, .tvp-list, .tvp-fav, .tvp-fullscreen { color: var(--text-primary); }
.tvp-seek-back small, .tvp-seek-fwd small { margin-left: -3px; font-size: 8px; font-weight: 800; }
.tvp-seek-back[hidden], .tvp-seek-fwd[hidden] { display: none; }
.tvp-live { display: inline-flex; align-items: center; gap: 7px; color: var(--text-primary); font-family: var(--font-brand); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; white-space: nowrap; }
.tvp-live-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--brand-live-glow); }
.tvp-vol { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.tvp-vol-icon { color: var(--text-secondary); font-size: 18px; }
.tvp-vol-slider { width: 108px; height: 4px; accent-color: var(--brand-accent); cursor: pointer; }
.tvp-vol-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--brand-bar-track); }
.tvp-vol-slider::-webkit-slider-thumb { width: 13px; height: 13px; margin-top: -4.5px; border: 0; border-radius: 50%; background: var(--brand-accent); -webkit-appearance: none; box-shadow: 0 0 8px rgba(122,63,242,.62); }
.tvp-clock { margin-left: auto; color: var(--text-primary); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tvp-directo { min-height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; font-weight: 700; }
.tvp-directo.active { color: var(--brand-accent); border-color: rgba(122,63,242,.55); background: rgba(122,63,242,.22); }
.tvp-fav.active { color: var(--brand-star); }
.tvp-quality { min-width: 38px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 7px; background: rgba(255,255,255,.07); color: var(--text-primary); font-size: 11px; font-weight: 800; text-align: center; }
/* Botones de navegación para puntero/TV: Anterior · Siguiente · Buscar · Atrás.
   Usan la base .tv-control-btn; aquí solo se acentúan los de cambio de canal. */
.tvp-chan { display: inline-flex; align-items: center; gap: 6px; }
.tvp-prev, .tvp-next { color: #fff; background: rgba(122,63,242,.2); border-color: rgba(122,63,242,.5); }
.tvp-prev:hover, .tvp-next:hover, .tvp-prev:focus-visible, .tvp-next:focus-visible, .tvp-prev.focused, .tvp-next.focused { background: rgba(122,63,242,.32); border-color: var(--brand-color); box-shadow: 0 0 18px var(--brand-focus-glow); outline: 0; }

/* Timeshift existente con la misma piel TELCO. */
.tv-ts-label { top: var(--tv-safe-y); right: var(--tv-safe-x); border-radius: 999px; background: rgba(127,195,75,.2); color: var(--success); font-size: 14px; letter-spacing: 1.4px; }
.tv-ts-controls { height: 220px; border: 1px solid rgba(255,255,255,.1); border-radius: 20px; background: rgba(13,10,20,.72); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 24px 60px rgba(0,0,0,.58); }
.tv-ts-logo { width: 210px; padding: 28px; background: radial-gradient(circle, rgba(251,183,96,.1), transparent 70%); }
.tv-ts-divider { width: 1px; margin: 22px 0; background: rgba(255,255,255,.1); }
.tv-ts-main { padding: 20px 26px; gap: 8px; background: transparent; }
.tv-ts-title { font-family: var(--font-brand); font-size: 28px; }
.tv-ts-seekrow { margin: 18px 18px 0; }
.tv-ts-seekic { position: relative; width: 34px; height: 34px; flex-basis: 34px; }
.tv-ts-seekic b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: currentColor; }
.tv-ts-bar { height: 7px; background: var(--brand-bar-track); }
.tv-ts-bar-fill { background: var(--brand-progress-gradient); }
.tv-ts-btn { min-height: 46px; border-color: rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.06); }
.tv-ts-btn.focused { color: #fff; background: rgba(247,147,30,.18); border: 2.5px solid var(--tv-focus-color); box-shadow: 0 0 22px rgba(247,147,30,.4); }

@media (prefers-reduced-motion: reduce) {
    .tvb-dock-target, .tvb-dock-target.lock-on, .tvb-nowbar { animation: none; }
    .tvb-chans { scroll-behavior: auto; }
    .tvb-chan-item, .tvib-ic, .tv-player-controls { transition: none; }
}

/* Chrome 79 flex-gap fallback. Values follow the final cascade above. */
html.no-flex-gap .tvib-main > * + * { margin-top: 14px; }
html.no-flex-gap .tvib-top > * + * { margin-left: 14px; }
html.no-flex-gap .tvib-actions > * + * { margin-left: 10px; }
html.no-flex-gap .tvib-ic > * + * { margin-left: 8px; }
html.no-flex-gap .tvb-chan-name > * + * { margin-left: 6px; }
html.no-flex-gap .tvb-right > * + * { margin-top: 14px; }
html.no-flex-gap .tv-np-header > * + * { margin-left: 10px; }
html.no-flex-gap .tv-np-display > * + * { margin-left: 12px; }
html.no-flex-gap .tvb-left-body > * + * { margin-left: 26px; }
html.no-flex-gap .tvb-lang-strip > * + * { margin-left: 9px; }
html.no-flex-gap .tv-pin-dots > * + * { margin-left: 22px; }
html.no-flex-gap .tv-ts-main > * + * { margin-top: 8px; }
html.no-flex-gap .tv-ts-head > * + * { margin-left: 16px; }
html.no-flex-gap .tv-ts-seekrow > * + * { margin-left: 12px; }
html.no-flex-gap .tv-ts-btnrow > * + * { margin-left: 10px; }
html.no-flex-gap .tv-ts-btn > * + * { margin-left: 6px; }
html.no-flex-gap .tvib-identity > * + * { margin-left: 16px; }
html.no-flex-gap .tvib-meta > * + * { margin-left: 10px; }
html.no-flex-gap .tvib-now-row > * + *,
html.no-flex-gap .tvib-next-row > * + * { margin-left: 14px; }
html.no-flex-gap .tvb-card-head > * + * { margin-left: 16px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MasTV — identidad LIMA + NEGRO con MÁS CRISTAL. Todo gateado a
   html[data-brand="mastv"], por lo que el build telco (naranja, EN VIVO) no se
   toca. Aquí sólo:
     1) re-tokenizamos los literales naranja y violeta heredados del skin
        telco → lima de marca
        (var(--brand-color) = #B9EF00, glow var(--brand-focus-glow), ambos ya
        re-pintados por theme.js para mastv).
     2) subimos el cristal: paneles negros translúcidos + backdrop-filter, con
        fallback sólido para Chromium viejo.
     3) arreglamos recortes responsive del dock y de la barra de controles
        (botón de pantalla completa visible).
   El foco lima (borde 4px + glow) manda: el cristal es el fondo, nunca difumina
   el indicador de foco.
   ──────────────────────────────────────────────────────────────────────────*/

/* Variables de cristal de marca (negro real translúcido). */
html[data-brand="mastv"] {
    --mastv-glass-bg: rgba(10,10,10,.55);
    --mastv-glass-bg-strong: rgba(10,10,10,.72);
    --mastv-glass-line: rgba(255,255,255,.10);
    --mastv-lime-soft: rgba(185,239,0,.16);
    --mastv-lime-tint: rgba(185,239,0,.24);
}

/* 1) Naranja → lima en el overlay de canales y la barra de info. */
html[data-brand="mastv"] .tv-control-btn:hover,
html[data-brand="mastv"] .tv-control-btn:focus-visible {
    border-color: var(--tv-focus-color);
    background: var(--mastv-lime-soft);
    box-shadow: 0 0 20px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvib-num {
    border-color: rgba(185,239,0,.45);
    color: var(--brand-color);
}
html[data-brand="mastv"] .tvib-ic.focused {
    background: var(--mastv-lime-soft);
    box-shadow: 0 0 25px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvib-progress-fill {
    box-shadow: 0 0 12px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvb-left {
    border-left: 1.2px solid var(--mastv-glass-line);
    background: linear-gradient(135deg, rgba(10,10,10,.42), rgba(10,10,10,.24));
    box-shadow: -14px 0 36px rgba(0,0,0,.5), -5px 0 30px rgba(185,239,0,.10);
}
html[data-brand="mastv"] .tvb-lang-chip.selected {
    background: var(--mastv-lime-tint);
    border-color: var(--brand-color);
}
html[data-brand="mastv"] .tvb-lang-chip.focused {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: var(--brand-navy);
    box-shadow: 0 0 18px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvb-cat-item.current {
    background: var(--mastv-lime-tint);
    border-color: var(--brand-color);
}
html[data-brand="mastv"] .tvb-cat-item.focused {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: var(--brand-navy);
}
html[data-brand="mastv"] .tvb-chan-item.playing {
    box-shadow: 0 0 22px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvb-dock-target {
    filter: drop-shadow(0 0 12px var(--brand-focus-glow));
}
html[data-brand="mastv"] .tvb-dock-target.lock-on {
    animation-name: mastv-target-lock-on;
}
@keyframes mastv-target-lock-on {
    0%   { opacity: .55; transform: scale(1.32); filter: drop-shadow(0 0 18px rgba(185,239,0,1)); }
    100% { opacity: 1;   transform: scale(1);    filter: drop-shadow(0 0 8px rgba(185,239,0,.82)); }
}

/* El "2" morado → lima. Era el único acento morado del overlay. */
html[data-brand="mastv"] .tvb-nowbar-num {
    border-color: rgba(185,239,0,.45);
    background: var(--mastv-lime-tint);
    color: var(--brand-color);
}
html[data-brand="mastv"] .tvb-card-progressfill,
html[data-brand="mastv"] .tvb-card-progress > i {
    box-shadow: 0 0 10px var(--brand-focus-glow);
}

/* Barra de transporte: morado → lima en énfasis, botones de canal y volumen. */
html[data-brand="mastv"] .tvp-round.emph,
html[data-brand="mastv"] .tvp-play {
    color: var(--brand-navy);
    box-shadow: 0 0 18px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvp-vol-slider::-webkit-slider-thumb {
    box-shadow: 0 0 8px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tvp-directo.active {
    color: var(--brand-color);
    border-color: rgba(185,239,0,.45);
    background: var(--mastv-lime-tint);
}
html[data-brand="mastv"] .tvp-prev,
html[data-brand="mastv"] .tvp-next {
    color: var(--brand-navy);
    background: var(--mastv-lime-tint);
    border-color: rgba(185,239,0,.5);
}
html[data-brand="mastv"] .tvp-prev:hover,
html[data-brand="mastv"] .tvp-next:hover,
html[data-brand="mastv"] .tvp-prev:focus-visible,
html[data-brand="mastv"] .tvp-next:focus-visible,
html[data-brand="mastv"] .tvp-prev.focused,
html[data-brand="mastv"] .tvp-next.focused {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: var(--brand-navy);
    box-shadow: 0 0 18px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tv-ts-btn.focused {
    background: var(--mastv-lime-soft);
    border-color: var(--tv-focus-color);
    box-shadow: 0 0 22px var(--brand-focus-glow);
}

/* 2) MÁS CRISTAL — paneles negros translúcidos coherentes (negro real). */
html[data-brand="mastv"] .tvib-card {
    background: var(--mastv-glass-bg);
    -webkit-backdrop-filter: blur(28px) saturate(1.3); backdrop-filter: blur(28px) saturate(1.3);
    box-shadow: inset 0 1px rgba(255,255,255,.07), 0 18px 54px rgba(0,0,0,.55);
}
html[data-brand="mastv"] .tvb-chans {
    background: rgba(10,10,10,.28);
    -webkit-backdrop-filter: blur(38px) saturate(1.35); backdrop-filter: blur(38px) saturate(1.35);
}
html[data-brand="mastv"] .tvb-nowbar {
    background: rgba(10,10,10,.30);
    -webkit-backdrop-filter: blur(48px) saturate(1.4); backdrop-filter: blur(48px) saturate(1.4);
}
html[data-brand="mastv"] .tvb-epg-list {
    background: rgba(10,10,10,.32);
    -webkit-backdrop-filter: blur(40px) saturate(1.35); backdrop-filter: blur(40px) saturate(1.35);
}
/* ─────────────────────────────────────────────────────────────────────────
   OSD UNIFICADA de reproducción (mastv). UNA sola barra de cristal inferior
   con TRES zonas — identidad · EPG · transporte — que reemplaza el esquema
   telco de dos overlays encimados (#tv-info-bar + #tv-player-controls). La
   barra de botones flotantes del skin telco se retira por completo en mastv;
   la OSD vive en #tv-info-bar y la pinta _renderOsd().
   ──────────────────────────────────────────────────────────────────────── */

/* Retira la barra flotante telco: en mastv la OSD ES la barra de transporte. */
html[data-brand="mastv"] #tv-player-controls { display: none !important; }

/* Contenedor: siempre en el DOM (anulamos el display:none de .hidden) para que
   la OSD pueda ENTRAR/SALIR con una transición suave en vez de un corte seco.
   El scrim inferior (::before) solo se pinta cuando la OSD está presente. */
html[data-brand="mastv"] #tv-info-bar {
    display: block !important;
    height: auto;
    left: var(--tv-safe-x); right: var(--tv-safe-x); bottom: var(--tv-safe-y);
    pointer-events: none;
    filter: none;
}
html[data-brand="mastv"] #tv-info-bar::before {
    height: 360px; opacity: 0;
    background: linear-gradient(to top, rgba(0,0,0,.92), rgba(0,0,0,.42) 52%, transparent);
    transition: opacity .22s ease;
}
html[data-brand="mastv"] #tv-info-bar:not(.hidden)::before { opacity: 1; }

/* La barra de cristal. */
html[data-brand="mastv"] .tv-osd {
    position: relative;
    display: flex; align-items: center; gap: 26px;
    min-height: 112px; padding: 18px 28px;
    border: 1px solid var(--mastv-glass-line); border-radius: 22px;
    background: var(--mastv-glass-bg);
    -webkit-backdrop-filter: blur(34px) saturate(1.3); backdrop-filter: blur(34px) saturate(1.3);
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 22px 60px rgba(0,0,0,.6);
    pointer-events: auto;
    transition: opacity .18s ease, transform .2s cubic-bezier(.22,1,.36,1);
}
html[data-brand="mastv"] #tv-info-bar.hidden .tv-osd {
    opacity: 0; transform: translateY(18px); pointer-events: none;
}

/* ── Zona IZQUIERDA: identidad del canal ── */
html[data-brand="mastv"] .osd-identity {
    display: flex; align-items: center; gap: 18px;
    flex: 0 1 auto; min-width: 0; max-width: 33%;
}
html[data-brand="mastv"] .osd-logo {
    width: 92px; height: 92px; flex: 0 0 92px;
    display: flex; align-items: center; justify-content: center; padding: 10px;
    border: 1px solid rgba(255,255,255,.08); border-radius: 18px;
    background: rgba(255,255,255,.05);
}
html[data-brand="mastv"] .osd-logo-img { max-width: 100%; max-height: 100%; object-fit: contain; }
html[data-brand="mastv"] .osd-logo-empty { background: var(--mastv-lime-soft); }
html[data-brand="mastv"] .osd-logo-empty::after {
    content: "TV"; color: var(--brand-color);
    font-family: var(--font-brand); font-size: 24px; font-weight: 800; letter-spacing: 1px;
}
html[data-brand="mastv"] .osd-id-text { min-width: 0; }
html[data-brand="mastv"] .osd-id-row { display: flex; align-items: center; gap: 12px; }
html[data-brand="mastv"] .osd-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 46px; height: 32px; padding: 0 10px;
    border: 1.5px solid rgba(185,239,0,.5); border-radius: 9px;
    color: var(--brand-color); font-family: var(--font-brand);
    font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums;
}
html[data-brand="mastv"] .osd-live {
    display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px;
    border-radius: 999px; background: rgba(72,215,159,.16);
    color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .9px;
}
html[data-brand="mastv"] .osd-live i {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success); box-shadow: 0 0 10px var(--brand-live-glow);
}
html[data-brand="mastv"] .osd-name {
    margin-top: 7px; color: #fff; font-family: var(--font-brand);
    font-size: 26px; font-weight: 700; line-height: 1.1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-brand="mastv"] .osd-sub { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
html[data-brand="mastv"] .osd-cat, html[data-brand="mastv"] .osd-quality {
    display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
    border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .5px;
    white-space: nowrap;
}
html[data-brand="mastv"] .osd-cat { background: rgba(255,255,255,.08); color: var(--text-secondary); }
html[data-brand="mastv"] .osd-quality { background: var(--brand-color); color: var(--brand-navy); }

/* ── Zona CENTRO: EPG compacto en una franja (AHORA / progreso / SIGUIENTE) ── */
html[data-brand="mastv"] .osd-epg {
    flex: 1 1 auto; min-width: 0;
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
    padding: 0 26px; margin: 4px 0;
    border-left: 1px solid rgba(255,255,255,.08);
    border-right: 1px solid rgba(255,255,255,.08);
}
html[data-brand="mastv"] .osd-epg-row { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
html[data-brand="mastv"] .osd-kicker {
    flex: 0 0 72px; width: 72px;
    color: var(--success); font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
}
html[data-brand="mastv"] .osd-kicker-next { color: var(--brand-color); }
html[data-brand="mastv"] .tv-osd .tvib-now {
    flex: 1; min-width: 0; display: block;
    color: #fff; font-size: 18px; font-weight: 600; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-brand="mastv"] .tv-osd .tvib-next {
    flex: 1; min-width: 0; display: block;
    color: var(--text-secondary); font-size: 14px; font-weight: 500; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-brand="mastv"] .tv-osd .tvib-time { font-weight: 800; color: inherit; }
html[data-brand="mastv"] .tv-osd .tvib-noinfo { color: var(--text-secondary); font-style: italic; }
html[data-brand="mastv"] .tv-osd .tvib-sub { display: none; }
html[data-brand="mastv"] .tv-osd .tvib-progress {
    height: 4px; margin: 1px 0 1px 84px; border-radius: 999px;
    background: var(--brand-bar-track); overflow: hidden;
}
html[data-brand="mastv"] .tv-osd .tvib-progress-fill {
    height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-color), var(--success));
    box-shadow: 0 0 10px var(--brand-focus-glow);
    transition: width .3s ease;
}

/* ── Zona DERECHA: transporte + acciones (reusa .tvib-ic / #tvib-chip-i) ── */
html[data-brand="mastv"] .osd-controls {
    flex: 0 0 auto; display: flex; align-items: center; gap: 9px; pointer-events: auto;
}
html[data-brand="mastv"] .tv-osd .tvib-ic {
    width: auto; min-width: 0; height: 48px; padding: 0 14px; gap: 8px;
    border: 1.5px solid rgba(255,255,255,.16); border-radius: 999px;
    background: rgba(255,255,255,.06); color: #fff; font-size: 17px;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
html[data-brand="mastv"] .tv-osd .tvib-ic-label { font-size: 13px; font-weight: 700; white-space: nowrap; }
html[data-brand="mastv"] .tv-osd .tvib-chip-svg { width: 22px; height: 22px; }
/* Clúster de transporte = redondos icónicos (prev · play · next), sin texto. */
html[data-brand="mastv"] .tv-osd .chip-prev,
html[data-brand="mastv"] .tv-osd .chip-next {
    width: 48px; flex: 0 0 48px; padding: 0; justify-content: center;
}
html[data-brand="mastv"] .tv-osd .chip-prev .tvib-ic-label,
html[data-brand="mastv"] .tv-osd .chip-next .tvib-ic-label,
html[data-brand="mastv"] .tv-osd .chip-play .tvib-ic-label { display: none; }
html[data-brand="mastv"] .tv-osd .chip-play {
    width: 58px; height: 58px; flex: 0 0 58px; padding: 0; margin: 0 2px;
    justify-content: center; border: 0;
    background: var(--brand-color); color: var(--brand-navy);
    box-shadow: 0 0 20px var(--brand-focus-glow);
}
html[data-brand="mastv"] .tv-osd .chip-play .tvib-chip-svg { width: 26px; height: 26px; }
/* Pequeño separador entre el clúster de transporte y las acciones. */
html[data-brand="mastv"] .tv-osd .chip-live { margin-left: 6px; }
html[data-brand="mastv"] .tv-osd .chip-live.active {
    border-color: rgba(185,239,0,.5); background: var(--mastv-lime-tint); color: var(--brand-color);
}
html[data-brand="mastv"] .tv-osd .chip-favorite.active { color: var(--brand-star); border-color: var(--brand-star); }
html[data-brand="mastv"] .tv-osd .chip-favorite.active { background: rgba(255,209,102,.14); }

/* Foco LIMA inequívoco: borde 4px + glow + escala. Manda sobre el cristal. */
html[data-brand="mastv"] .tv-osd .tvib-ic.focused {
    transform: scale(1.06);
    background: var(--mastv-lime-soft); color: #fff;
    border: 4px solid var(--brand-color);
    box-shadow: 0 0 28px var(--brand-focus-glow);
    z-index: 2;
}
html[data-brand="mastv"] .tv-osd .chip-play.focused {
    transform: scale(1.08);
    background: var(--brand-color); color: var(--brand-navy);
    border: 4px solid #fff;
    box-shadow: 0 0 32px var(--brand-focus-glow);
}

/* Responsive real (dispositivos a <1400px de ancho físico): compacta las
   acciones a icono para no recortar la zona derecha. El EPG ya trunca. */
@media (max-width: 1400px) {
    html[data-brand="mastv"] .tv-osd { gap: 18px; padding: 16px 20px; }
    html[data-brand="mastv"] .osd-epg { padding: 0 18px; }
    html[data-brand="mastv"] .tv-osd .chip-live .tvib-ic-label,
    html[data-brand="mastv"] .tv-osd .chip-guide .tvib-ic-label,
    html[data-brand="mastv"] .tv-osd .chip-browse .tvib-ic-label,
    html[data-brand="mastv"] .tv-osd .chip-favorite .tvib-ic-label,
    html[data-brand="mastv"] .tv-osd .chip-fullscreen .tvib-ic-label { display: none; }
    html[data-brand="mastv"] .tv-osd .tvib-ic { min-width: 48px; justify-content: center; padding: 0; width: 48px; }
    html[data-brand="mastv"] .tv-osd .chip-play { width: 56px; flex-basis: 56px; }
}
@media (max-width: 1100px) {
    html[data-brand="mastv"] .osd-identity { max-width: 30%; }
    html[data-brand="mastv"] .osd-logo { width: 72px; height: 72px; flex-basis: 72px; }
    html[data-brand="mastv"] .osd-name { font-size: 22px; }
}

/* Reduced-motion: sin deslizamientos ni escalas animadas. */
@media (prefers-reduced-motion: reduce) {
    html[data-brand="mastv"] .tv-osd,
    html[data-brand="mastv"] .tv-osd .tvib-ic,
    html[data-brand="mastv"] #tv-info-bar::before { transition: none; }
}

/* Fallback de cristal (Chromium viejo sin backdrop-filter) → negro sólido. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    html[data-brand="mastv"] .tv-osd { background: var(--mastv-glass-bg-strong); }
}

/* Fallback flex-gap (Chrome 79 de webOS): márgenes equivalentes a los gaps. */
html.no-flex-gap[data-brand="mastv"] .tv-osd > * + * { margin-left: 26px; }
html.no-flex-gap[data-brand="mastv"] .osd-identity > * + * { margin-left: 18px; }
html.no-flex-gap[data-brand="mastv"] .osd-id-row > * + * { margin-left: 12px; }
html.no-flex-gap[data-brand="mastv"] .osd-sub > * + * { margin-left: 8px; }
html.no-flex-gap[data-brand="mastv"] .osd-epg-row > * + * { margin-left: 12px; }
html.no-flex-gap[data-brand="mastv"] .osd-controls > * + * { margin-left: 9px; }

/* El dock de números y su retícula no tocan el borde derecho: margen de
   respiro para que el foco lima (borde 4px + glow) quepa completo. */
html[data-brand="mastv"] .tvb-left {
    padding-right: 26px;
}
html[data-brand="mastv"] .tvb-chans {
    overflow-x: visible;
}
html[data-brand="mastv"] .tvb-dock-target {
    left: 0;
    margin-left: 0;
}

/* Fallback de cristal: sin backdrop-filter (Chromium muy viejo) → negro sólido
   legible, el foco lima sigue mandando. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    html[data-brand="mastv"] .tvib-card { background: var(--mastv-glass-bg-strong); }
    /* .tv-player-controls queda 100% transparente (solo botones) también sin backdrop-filter. */
    html[data-brand="mastv"] .tvb-chans,
    html[data-brand="mastv"] .tvb-nowbar,
    html[data-brand="mastv"] .tvb-epg-list { background: rgba(10,10,10,.82); }
    html[data-brand="mastv"] .tvb-left { background: rgba(10,10,10,.8); }
}

/* RedHogar / Conexión Hogar: re-tokenize the inherited Telco literals. */
html[data-brand="redhogar"] {
    --redhogar-focus-soft: rgba(240,107,174,.18);
    --redhogar-focus-tint: rgba(240,107,174,.26);
    --redhogar-accent-soft: rgba(212,34,126,.20);
    --redhogar-glass-line: rgba(240,107,174,.24);
}
html[data-brand="redhogar"] .tv-control-btn:hover,
html[data-brand="redhogar"] .tv-control-btn:focus-visible,
html[data-brand="redhogar"] .tvib-ic.focused,
html[data-brand="redhogar"] .tv-ts-btn.focused {
    border-color: var(--brand-focus);
    background: var(--redhogar-focus-soft);
    box-shadow: 0 0 24px var(--brand-focus-glow);
}
html[data-brand="redhogar"] .tvib-logo,
html[data-brand="redhogar"] .tv-ts-logo {
    background: radial-gradient(circle, var(--redhogar-accent-soft), transparent 70%);
}
html[data-brand="redhogar"] .tvib-num,
html[data-brand="redhogar"] .tvb-nowbar-num {
    border-color: rgba(240,107,174,.48);
    color: var(--brand-focus);
}
html[data-brand="redhogar"] .tvb-nowbar-num {
    background: var(--redhogar-focus-soft);
}
html[data-brand="redhogar"] .tvib-progress-fill,
html[data-brand="redhogar"] .tvb-card-progressfill,
html[data-brand="redhogar"] .tvb-card-progress > i,
html[data-brand="redhogar"] .tvp-round.emph,
html[data-brand="redhogar"] .tvp-play,
html[data-brand="redhogar"] .tvp-vol-slider::-webkit-slider-thumb {
    box-shadow: 0 0 16px var(--brand-focus-glow);
}
html[data-brand="redhogar"] .tvb-left {
    border-left-color: var(--redhogar-glass-line);
    background: linear-gradient(135deg, rgba(37,33,63,.72), rgba(21,19,41,.50));
    box-shadow: -14px 0 36px rgba(0,0,0,.42), -5px 0 30px rgba(212,34,126,.16);
}
html[data-brand="redhogar"] .tvb-lang-chip.selected,
html[data-brand="redhogar"] .tvb-cat-item.current,
html[data-brand="redhogar"] .tvp-directo.active {
    color: var(--brand-focus);
    border-color: var(--brand-focus);
    background: var(--redhogar-focus-tint);
}
html[data-brand="redhogar"] .tvb-lang-chip.focused,
html[data-brand="redhogar"] .tvb-cat-item.focused,
html[data-brand="redhogar"] .tvp-prev:hover,
html[data-brand="redhogar"] .tvp-next:hover,
html[data-brand="redhogar"] .tvp-prev:focus-visible,
html[data-brand="redhogar"] .tvp-next:focus-visible,
html[data-brand="redhogar"] .tvp-prev.focused,
html[data-brand="redhogar"] .tvp-next.focused {
    color: var(--brand-navy);
    border-color: var(--brand-focus);
    background: var(--brand-focus);
    box-shadow: 0 0 20px var(--brand-focus-glow);
}
html[data-brand="redhogar"] .tvb-chan-item.playing,
html[data-brand="redhogar"] .tvb-dock-target {
    box-shadow: 0 0 22px var(--brand-focus-glow);
}
html[data-brand="redhogar"] .tvb-dock-target {
    filter: drop-shadow(0 0 12px var(--brand-focus-glow));
}
html[data-brand="redhogar"] .tvb-dock-target.lock-on { animation-name: redhogar-target-lock-on; }
@keyframes redhogar-target-lock-on {
    0% { opacity: .55; transform: scale(1.32); filter: drop-shadow(0 0 18px rgba(240,107,174,1)); }
    100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 8px rgba(240,107,174,.82)); }
}
html[data-brand="redhogar"] .tvp-prev,
html[data-brand="redhogar"] .tvp-next {
    color: var(--brand-focus);
    border-color: rgba(240,107,174,.48);
    background: var(--redhogar-focus-soft);
}
