/**
 * 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;
}

/* ── 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 — ported 1:1 from tv.dart _channelList() ──────────────
   When browsing, the player shrinks to the top-right quadrant; the LEFT half
   is categories | channels, the BOTTOM-RIGHT is the now-bar + EPG list, and
   the TOP-RIGHT is transparent so the (shrunken) player shows through. */
/* Must override the base width/height:100% — otherwise the element keeps its
   full-screen size anchored at the quadrant corner and spills off-screen. */
#tv-page.tv-browsing #tv-video {
    top: 0; right: 0; bottom: 50%; left: 50%;          /* top:0 right:0 bottom:50% left:50% */
    width: 50%;
    height: 50%;
}

.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 */
}

/* LEFT half — categories (240) | divider | channels, over black */
.tvb-left {
    width: 50%;
    display: flex;
    background: #000;
}
.tvb-cats {
    width: 240px; min-width: 240px;
    overflow-y: auto;
}
.tvb-col-divider { width: 1px; background: #252525; }
.tvb-chans { flex: 1; overflow-y: auto; }

/* 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; }
.tvb-cat-item.focused {
    background: var(--brand-focus-soft);
    border-left: var(--tv-focus-border) solid var(--brand-color);
    transform: none !important; box-shadow: none !important;
}
.tvb-cat-item.focused .tvb-cat-name { color: var(--brand-color); font-weight: 600; }
.tvb-cat-item.focused .tvb-cat-ic.tv { filter: none; opacity: 1;
    background: url(../assets/images/main_tv.png) center/contain no-repeat; }

/* 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); }
/* Full-width list rows carry their OWN focus indicator (background + accent).
   Cancel the GLOBAL .focused scale + box-shadow ring so the row never zooms
   past the container edge. */
.tvb-chan-item.focused { background: var(--brand-color); border-left-color: var(--brand-color); transform: none !important; box-shadow: none !important; z-index: auto; }
.tvb-chan-item.focused .tvb-chan-logo { background: #D0D0D0; }
.tvb-chan-item.focused .tvb-chan-logo-num { color: #616161; }
.tvb-chan-item.focused .tvb-chan-name { color: var(--bg-dark); }
.tvb-chan-item.focused .tvb-chan-play { color: rgba(0,0,0,0.54); }
.tvb-chan-item.focused .tvb-chan-meta { color: rgba(0,0,0,0.38); }
.tvb-empty { padding: 24px; color: rgba(255,255,255,0.6); }

/* RIGHT half — transparent player space | now bar | EPG list */
.tvb-right { width: 50%; display: flex; flex-direction: column; }
.tvb-right-spacer { height: calc(50% - var(--tv-target-md)); }   /* shrunken player shows here */

.tvb-nowbar {
    height: var(--tv-target-md); flex-shrink: 0;
    background: rgba(17,17,17,0.85);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px;
}
.tvb-nowbar-num {
    border: 2px solid var(--brand-accent); border-radius: 8px;
    padding: 4px 12px;
    color: #fff; font-size: 20px; font-weight: 600;
}
.tvb-nowbar-name {
    flex: 1; min-width: 0;
    color: #fff; font-size: 24px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 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); }
.tvb-epgi.focused { background: var(--brand-color); border-left: var(--tv-focus-border) solid var(--brand-color); transform: none !important; box-shadow: none !important; z-index: auto; }
.tvb-epgi.focused .tvb-epgi-hm,
.tvb-epgi.focused .tvb-epgi-date,
.tvb-epgi.focused .tvb-epgi-title { color: #fff; }
.tvb-epgi.focused .tvb-epgi-sub { color: rgba(255,255,255,0.80); }
.tvb-epgi.focused .tvb-epgi-progfill { background: #fff; }

/* ── 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; }

/* ── Cinematic live-player presentation ─────────────────────────────────── */
#tv-page.tv-browsing #tv-video {
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100%;
}

/* Transport / information glass */
.tv-info-bar {
    left: var(--tv-safe-x);
    right: var(--tv-safe-x);
    bottom: var(--tv-safe-y);
    height: 276px;
    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: 430px;
    background: linear-gradient(to top, rgba(1,5,15,.96) 0%, rgba(2,8,24,.72) 52%, transparent 100%);
    pointer-events: none;
}
.tvib-card {
    position: relative;
    height: 100%;
    display: flex;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(118deg, rgba(5,14,36,.94), rgba(8,22,52,.76));
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 18px 54px rgba(0,0,0,.46);
}
.tvib-logo {
    width: 230px;
    padding: 28px;
    background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.12), transparent 68%);
}
.tvib-logo-img { max-width: 176px; max-height: 138px; }
.tvib-logo-empty::after { font-family: var(--font-brand); color: rgba(255,255,255,.48); }
.tvib-main {
    padding: 24px 28px 22px;
    gap: 14px;
    background: linear-gradient(90deg, rgba(0,0,0,.08), rgba(0,0,0,.2));
}
.tvib-top { min-width: 0; }
.tvib-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.tvib-num {
    min-width: 52px; height: 38px; padding: 0 11px;
    border: 1px solid rgba(255,255,255,.35); border-radius: 12px;
    font-size: 20px; color: rgba(255,255,255,.9);
}
.tvib-title-wrap { min-width: 0; }
.tvib-name {
    font-family: var(--font-brand);
    font-size: 34px; font-weight: 700; letter-spacing: -.4px;
}
.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: 13px; font-weight: 800; letter-spacing: .8px;
}
.tvib-live { color: #fff; background: rgba(46,204,64,.78); }
.tvib-live i, .tvb-live-pill i, .tvb-chan-live i {
    width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,.8);
}
.tvib-quality { color: var(--brand-navy); background: #fff; }
.tvib-category { color: rgba(255,255,255,.68); background: rgba(255,255,255,.08); }
.tvib-epg { flex: 1; display: grid; grid-template-columns: 1fr; 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: 12px; font-weight: 800; letter-spacing: 1.5px; }
.tvib-next-row .tvib-kicker { color: rgba(255,255,255,.45); }
.tvib-now, .tvib-next { display: block; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvib-next { color: rgba(255,255,255,.64); }
.tvib-time.t-now, .tvib-time.t-next { color: inherit; }
.tvib-progress { height: 6px; margin-left: 94px; background: rgba(255,255,255,.14); }
.tvib-progress-fill { background: linear-gradient(90deg, var(--success), #7dff9c); box-shadow: 0 0 12px rgba(46,204,64,.5); }
.tvib-actions { display: flex; gap: 10px; pointer-events: auto; }
.tvib-ic {
    width: auto; min-width: 52px; height: 48px; padding: 0 16px; gap: 8px;
    border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
    background: rgba(255,255,255,.07); color: rgba(255,255,255,.85);
    font-size: 19px; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.tvib-ic-label { font-size: 15px; font-weight: 700; white-space: nowrap; }
.tvib-ic.focused {
    transform: scale(1.08); color: #fff; background: rgba(255,122,0,.2);
    border: 3px solid var(--tv-focus-color); box-shadow: 0 0 0 3px rgba(255,122,0,.2), 0 0 28px rgba(255,122,0,.48);
}
.tvib-ic.chip-favorite.active { color: #ffd84a; border-color: rgba(255,216,74,.7); }
.tvib-ic.chip-startup.active { background: rgba(46,204,64,.2); color: #8cff9d; border-color: var(--success); }
.tvib-ic.chip-play { background: linear-gradient(135deg, var(--brand-color), var(--brand-accent)); border-color: rgba(255,255,255,.28); color: #fff; }

/* Full-screen cinematic browse: filter + centered reel + focused EPG card. */
.tv-browse {
    display: block;
    background:
        linear-gradient(90deg, rgba(1,5,16,.88) 0%, rgba(1,5,16,.34) 34%, transparent 52%),
        linear-gradient(270deg, rgba(1,5,16,.97) 0%, rgba(1,5,16,.76) 36%, transparent 72%);
}
.tv-browse::after {
    content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,.42), transparent 18%, transparent 76%, rgba(0,0,0,.62));
}
.tvb-left {
    position: absolute; z-index: 2;
    top: var(--tv-safe-y); right: var(--tv-safe-x); bottom: var(--tv-safe-y);
    width: 690px; display: flex; flex-direction: column;
    background: transparent;
}
.tvb-left-body { flex: 1; min-height: 0; display: flex; gap: 26px; }
.tvb-lang-strip {
    height: 68px; padding: 0 4px 12px; gap: 9px;
    background: transparent; border: 0;
}
.tvb-lang-chip { min-height: 44px; padding: 0 20px; background: rgba(4,12,31,.72); border-radius: 999px; }
.tvb-lang-chip.focused { color: #fff; background: rgba(255,122,0,.2); border-color: var(--tv-focus-color); box-shadow: 0 0 18px rgba(255,122,0,.36); }
.tvb-cats {
    width: 230px; min-width: 230px; padding: 10px 6px;
    border: 1px solid rgba(255,255,255,.1); border-radius: 20px;
    background: rgba(3,11,29,.72); box-shadow: 0 22px 48px rgba(0,0,0,.4);
}
.tvb-col-divider { display: none; }
.tvb-cat-item {
    height: 64px; margin: 3px 0; padding: 0 14px;
    border: 0; border-radius: 14px; color: rgba(255,255,255,.46);
}
.tvb-cat-item.current { border-left: 3px solid var(--brand-accent); background: rgba(255,255,255,.05); }
.tvb-cat-item.focused { border: 2px solid var(--tv-focus-color); border-left-width: 4px; border-radius: 14px; background: rgba(255,122,0,.16); box-shadow: 0 0 24px rgba(255,122,0,.28) !important; }
.tvb-cat-item.focused .tvb-cat-name { color: #fff; }
.tvb-chans {
    flex: 1; padding: calc(50vh - var(--tv-safe-y) - 75px) 12px;
    overflow-y: auto; scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent);
}
.tvb-chans::-webkit-scrollbar { display: none; }
.tvb-chan-item {
    height: 118px; margin: 10px 0; padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.08); border-radius: 20px;
    background: rgba(5,14,35,.62); opacity: .34;
    transform: scale(.91); transform-origin: center right;
    transition: opacity .2s ease, transform .25s ease, background .2s ease, box-shadow .2s ease;
}
.tvb-chan-item.playing { border-left: 3px solid var(--brand-accent); opacity: .55; }
.tvb-chan-item.focused {
    opacity: 1; transform: scale(1); z-index: 3;
    color: #fff; background: linear-gradient(100deg, rgba(10,27,61,.96), rgba(16,35,72,.88));
    border: 3px solid var(--tv-focus-color); border-left-width: 3px;
    border-radius: 22px; box-shadow: 0 0 0 5px rgba(255,122,0,.14), 0 0 38px rgba(255,122,0,.46), 0 20px 42px rgba(0,0,0,.48) !important;
    animation: tv-lock-pulse 1.7s ease-in-out infinite;
}
@keyframes tv-lock-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255,122,0,.12), 0 0 28px rgba(255,122,0,.32), 0 20px 42px rgba(0,0,0,.48); }
    50% { box-shadow: 0 0 0 7px rgba(255,122,0,.19), 0 0 46px rgba(255,122,0,.58), 0 20px 42px rgba(0,0,0,.48); }
}
.tvb-chan-logo { width: 88px; height: 88px; border-radius: 17px; background: rgba(255,255,255,.9); }
.tvb-chan-item.focused .tvb-chan-logo { background: #fff; }
.tvb-chan-copy { min-width: 0; flex: 1; margin-left: 14px; }
.tvb-chan-name { margin-left: 0; font-size: 22px; color: #fff; }
.tvb-chan-item.focused .tvb-chan-name { color: #fff; }
.tvb-chan-live { display: inline-flex; align-items: center; margin-top: 8px; color: var(--success); font-size: 11px; font-weight: 800; letter-spacing: 1px; }
.tvb-chan-live i { background: var(--success); box-shadow: 0 0 9px var(--success); }
.tvb-chan-meta { color: rgba(255,255,255,.58); font-size: 24px; }
.tvb-chan-item.focused .tvb-chan-meta, .tvb-chan-item.focused .tvb-chan-play { color: var(--brand-accent); }
.tvb-empty { color: rgba(255,255,255,.6); }

.tvb-right {
    position: absolute; z-index: 2;
    left: var(--tv-safe-x); top: 50%; width: 560px;
    transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px;
}
.tvb-right-spacer { display: none; }
.tvb-nowbar {
    height: auto; min-height: 290px; padding: 24px;
    display: block; border: 1px solid rgba(255,255,255,.14); border-radius: 24px;
    background: linear-gradient(135deg, rgba(4,13,34,.92), rgba(11,28,61,.77));
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 26px 70px rgba(0,0,0,.52);
}
.tvb-card-head { display: flex; align-items: center; gap: 16px; }
.tvb-card-logo { width: 82px; height: 82px; flex: 0 0 82px; display: flex; align-items: center; justify-content: center; padding: 8px; border-radius: 17px; background: #fff; overflow: hidden; }
.tvb-card-logo-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tvb-card-logo-fallback { color: var(--brand-navy); font-size: 22px; font-weight: 800; }
.tvb-card-id { min-width: 0; flex: 1; }
.tvb-nowbar-num { display: inline-block; padding: 3px 8px; border: 1px solid rgba(255,255,255,.24); border-radius: 8px; color: rgba(255,255,255,.72); font-size: 14px; }
.tvb-nowbar-name { margin-top: 7px; color: #fff; font-family: var(--font-brand); font-size: 27px; font-weight: 700; }
.tvb-live-pill { display: flex; align-items: center; padding: 7px 11px; border-radius: 999px; color: #fff; background: rgba(46,204,64,.78); font-size: 11px; font-weight: 800; letter-spacing: 1px; }
.tvb-card-program { margin-top: 24px; }
.tvb-card-kicker { color: var(--success); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; }
.tvb-card-kicker.next { display: block; margin-top: 20px; color: rgba(255,255,255,.42); }
.tvb-card-title { margin-top: 6px; color: #fff; font-size: 25px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvb-card-time, .tvb-card-next { margin-top: 5px; color: rgba(255,255,255,.62); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvb-card-progress { height: 6px; margin-top: 14px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.tvb-card-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--success), #86ffa0); box-shadow: 0 0 12px var(--success); }
.tvb-card-empty { padding: 24px 0; color: rgba(255,255,255,.5); }
.tvb-epg-list {
    max-height: 270px; height: auto; padding: 8px;
    border: 1px solid rgba(255,255,255,.1); border-radius: 20px;
    background: rgba(3,10,26,.8); box-shadow: 0 18px 50px rgba(0,0,0,.42);
}
.tvb-epgi { height: 72px; border: 0; border-radius: 12px; }
.tvb-epgi.focused { background: rgba(255,122,0,.18); border: 2px solid var(--tv-focus-color); border-left-width: 4px; border-radius: 12px; box-shadow: 0 0 20px rgba(255,122,0,.3) !important; }

/* Cinematic timeshift transport, still driven by the existing controller. */
.tv-ts-label { top: var(--tv-safe-y); right: var(--tv-safe-x); border-radius: 999px; background: rgba(46,204,64,.78); font-size: 14px; letter-spacing: 1.4px; }
.tv-ts-controls {
    height: 220px; border: 1px solid rgba(255,255,255,.14); border-radius: 24px;
    background: linear-gradient(118deg, rgba(5,14,36,.95), rgba(8,22,52,.8));
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 24px 60px rgba(0,0,0,.58);
}
.tv-ts-logo { width: 210px; padding: 28px; background: radial-gradient(circle, rgba(255,255,255,.1), transparent 70%); }
.tv-ts-divider { width: 1px; margin: 22px 0; background: rgba(255,255,255,.12); }
.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; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: currentColor; }
.tv-ts-bar { height: 7px; background: rgba(255,255,255,.12); }
.tv-ts-bar-fill { background: linear-gradient(90deg, var(--brand-accent), var(--success)); }
.tv-ts-btn { min-height: 46px; border-color: rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.06); }
.tv-ts-btn.focused { color: #fff; background: rgba(255,122,0,.2); border: 3px solid var(--tv-focus-color); box-shadow: 0 0 22px rgba(255,122,0,.4); }

@media (prefers-reduced-motion: reduce) {
    .tvb-chan-item, .tvib-ic { transition: none; }
    .tvb-chan-item.focused { animation: 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; }
