/* Prototype theme: a quiet vintage-PC look. Warm light-grey desktop, thin 1px bevels,
   one muted blue accent, Inter for text, and VT323 only for a few small accents (logo, clock,
   channel numbers, the on-screen channel bug). All colors are variables; text pairs are WCAG AA. */
@font-face { font-family: "VT323"; src: url("/fonts/VT323-400.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "InterLocal"; src: url("/fonts/Inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "InterLocal"; src: url("/fonts/Inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "InterLocal"; src: url("/fonts/Inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --desk: #d6d5d0;          /* desktop */
  --face: #e6e5e0;          /* window / button face */
  --field: #ffffff;         /* list boxes, inputs, guide */
  --hi: #ffffff;            /* bevel highlight */
  --line: #9b9a94;          /* 1px borders */
  --line-soft: #cfcec8;     /* grid lines */
  --shadow: #6f6e69;        /* bevel shadow */
  --text: #1c1c1b;          /* 13.5:1 on --face, 11.6:1 on --desk */
  --muted: #4b4a46;         /* 7.0:1 on --face, 6.0:1 on --desk */
  --accent: #2f5878;        /* single accent; white on it 7.5:1, as text on --face 6.0:1 */
  --accent-soft: #e3ebf2;   /* tint for the airing slot; --text on it 14:1 */
  --live: #a3402c;          /* live dot / now line; white on it 6.3:1 */
  --player-bg: #121212;
  --font-ui: "InterLocal", "Segoe UI", Tahoma, sans-serif;
  --font-cg: "VT323", ui-monospace, "Courier New", monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --taskbar-h: calc(48px + env(safe-area-inset-bottom, 0px));
  --logo: #172554;
  --theme-bg: #ffffff;
  --theme-fg: #172554;
}

/* Day / night (Leo). Day is clean white #ffffff and navy #172554; night is black #000 and white.
   Set on <html data-theme="day|night"> by the boot script before first paint. */
html[data-theme="day"] {
  --desk: #ffffff;
  --face: #ffffff;
  --field: #ffffff;
  --hi: #ffffff;
  --line: #d4d4d8;
  --line-soft: #e4e4e7;
  --shadow: #6f6e69;
  --text: #172554;
  --muted: #3b4c7a;          /* 8.40:1 on #fff */
  --accent: #172554;
  --accent-soft: #e8eaf3;
  --logo: #172554;
  --theme-bg: #ffffff;
  --theme-fg: #172554;
  color-scheme: light;
}
html[data-theme="night"] {
  --desk: #000000;
  --face: #000000;
  --field: #000000;
  --hi: #1a1a1a;
  --line: #333333;
  --line-soft: #2a2a2a;
  --shadow: #000000;
  --text: #ffffff;
  --muted: #c8c8c8;          /* 12.55:1 on #000 */
  --accent: #ffffff;
  --accent-soft: #1a1a1a;
  --logo: #ffffff;
  --theme-bg: #000000;
  --theme-fg: #ffffff;
  --player-bg: #000000;
  --live: #ff8a80;           /* 9.5:1-ish on black, still reads as live */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--desk); color: var(--text); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); }
h1, h2, p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.vt { font-family: var(--font-cg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- surfaces: thin, quiet bevels ---- */
.window { background: var(--face); border: 1px solid var(--line); box-shadow: inset 1px 1px 0 var(--hi), 1px 1px 0 rgba(0,0,0,.08); }
.sunken { border: 1px solid var(--line); box-shadow: inset 1px 1px 0 rgba(0,0,0,.12); }
.titlebar { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 10px; border-bottom: 1px solid var(--line-soft); font-weight: 600; font-size: 13px; color: var(--text); }
.titlebar > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-body { padding: 12px; }
.btn, .chip, .tab, .task-btn {
  background: var(--face); color: var(--text); border: 1px solid var(--shadow);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 rgba(0,0,0,.08); text-decoration: none; cursor: pointer;
}
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 4px 14px; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; }
.btn:hover, .chip:hover, .tab:hover { background: #efeee9; }
.btn:active, .chip:active, .task-btn:active { box-shadow: inset 1px 1px 0 rgba(0,0,0,.18); background: #dcdbd6; }
input { font: inherit; color: var(--text); background: var(--field); padding: 6px 8px; min-width: 0; border: 1px solid var(--line); box-shadow: inset 1px 1px 0 rgba(0,0,0,.1); }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* ---- header (the one accent bar) ---- */
.chrome { position: sticky; top: 0; z-index: 40; background: var(--desk); padding: 8px 8px 0; }
.appbar { border-color: var(--line); }
.appbar .titlebar { background: var(--theme-bg, #ffffff); color: var(--theme-fg, #172554); border-bottom: 1px solid var(--line-soft); min-height: 32px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--logo, #172554); text-decoration: none; min-width: 0; }
.logo { align-self: center; }
.wordmark { font-family: var(--font-cg); font-size: 24px; line-height: 1; }
.title-sub { font-weight: 400; font-size: 12px; color: var(--theme-fg, #172554); opacity: .8; white-space: nowrap; }
.tb-controls { display: none; }
.menubar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.tabs { display: flex; gap: 4px; }
.tab { font-size: 13px; font-weight: 600; padding: 5px 14px; color: var(--muted); }
.tab.active { color: var(--text); background: var(--field); box-shadow: inset 0 -2px 0 var(--accent); }
.tray { margin-left: auto; padding: 0 8px; font-family: var(--font-cg); font-size: 20px; line-height: 1.4; color: var(--text); white-space: nowrap; }

.view { width: min(1280px, calc(100% - 16px)); margin: 12px auto 28px; }

/* ---- home ---- */
.hero { margin-bottom: 12px; }
.hero-headline { font-size: clamp(22px, 3vw, 30px); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.hero-sub { margin-top: 6px; max-width: 75ch; color: var(--muted); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ch-card { display: flex; flex-direction: column; color: var(--text); text-decoration: none; }
.ch-card:hover { border-color: var(--shadow); }
.ch-card:hover .ch-name { color: var(--accent); }
.ch-thumb { position: relative; aspect-ratio: 4 / 3; margin: 8px 8px 0; background: #222; border: 1px solid var(--line); overflow: hidden; }
.ch-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Channel card shown when the item has no picture (audio, missing thumbnail): name + number on the accent tone. */
.ch-art { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 10px;
  background: linear-gradient(160deg, var(--accent) 0%, #24465f 100%); color: #fff; }
.ch-art b { font-size: 44px; font-weight: 400; line-height: 1; }
.ch-art span { font-size: 15px; font-weight: 600; }
.ch-thumb.no-pic .ch-img { display: none; }
.ch-thumb.no-pic .ch-art { display: flex; }
.ch-thumb.no-pic .ch-num { display: none; }
.ch-num { position: absolute; right: 6px; top: 4px; font-family: var(--font-cg); font-size: 22px; line-height: 1; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); opacity: .85; }
.ch-body { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.ch-tag, .ch-next { color: var(--muted); font-size: 12px; }
.ch-now { font-weight: 600; }
.eyebrow, .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); display: inline-block; }
/* Q17: small LIVE tag in the info bar, never over the player. */
.watch-live-tag { display: inline-flex; align-items: center; margin-left: 2px; padding: 1px 6px; border-radius: 2px; background: var(--live, #c62828); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; }
.watch-live-tag[hidden] { display: none !important; }
body.tv-mode .watch-live-tag { background: #e53935; color: #fff; font-size: 11px; padding: 2px 7px; }
body.tv-mode .ctl-live.is-earth-live { display: none; } /* the red pill is the live-feed tag; keep only one LIVE in the bar */

.progress { height: 4px; background: var(--line-soft); }
.progress-fill { height: 100%; width: 0; background: var(--accent); }

/* Coming up next: a plain list */
.prevue { position: sticky; top: 104px; }
.prevue-screen { max-height: 560px; overflow-y: auto; background: var(--field); margin: 8px; border: 1px solid var(--line); }
.prevue-row { display: grid; grid-template-columns: 30px 1fr; column-gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); color: var(--text); text-decoration: none; font-size: 13px; }
.prevue-row:last-child { border-bottom: 0; }
.prevue-row:hover { background: var(--accent-soft); }
.prevue-ch { grid-row: span 2; font-family: var(--font-cg); font-size: 22px; line-height: 1; color: var(--muted); }
.prevue-name { font-weight: 600; }
.prevue-line { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prevue-time { margin-right: 6px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- watch ---- */
.channel-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; }
.chip { flex-shrink: 0; padding: 4px 10px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chip .sw { font-family: var(--font-cg); font-size: 17px; line-height: 1; color: var(--muted); }
.chip.active { color: var(--text); background: var(--field); box-shadow: inset 0 -2px 0 var(--accent); }
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.player { position: relative; aspect-ratio: 4 / 3; max-height: calc(100vh - 320px); min-height: 260px; width: 100%; background: var(--player-bg); border: 1px solid var(--shadow); overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 1; }
.bug { font-family: var(--font-cg); font-size: 20px; line-height: 1; color: var(--muted); }
.tapestamp { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #fff; background: var(--live); padding: 2px 6px; }
.tune-in { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 0; padding: 0; cursor: pointer; background: #1a1a1a; color: #fff; font: inherit; }
.tune-in:hover .cg:first-of-type { background: #fff; color: #111; }
.tune-rule { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; opacity: .55;
  background: linear-gradient(90deg, #a9a9a9 0 14.3%, #a9a37a 0 28.6%, #7aa3a5 0 42.9%, #7fa37a 0 57.1%, #9a7aa0 0 71.4%, #a3807a 0 85.7%, #7a82a3 0); }
.cg { font-size: 16px; font-weight: 600; padding: 7px 18px; border: 1px solid rgba(255,255,255,.7); }
.cg.small { font-size: 12px; font-weight: 400; border: 0; padding: 0; color: #d0d0d0; }
.now-meta { display: flex; flex-direction: column; gap: 8px; padding: 12px 2px 2px; }
.now-meta h1 { font-size: 20px; font-weight: 700; }
.meta-row { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint, .license { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.up-next { background: var(--field); padding: 8px 10px; }
.up-next p:last-child { font-weight: 600; }

.chat { display: flex; flex-direction: column; height: min(640px, calc(100vh - 130px)); position: sticky; top: 104px; }
.chat .titlebar .small { font-weight: 400; color: var(--muted); }
.chat-log { list-style: none; margin: 8px; padding: 8px; flex: 1; overflow-y: auto; background: var(--field); display: flex; flex-direction: column; gap: 4px; }
.chat-log li { font-size: 13px; overflow-wrap: anywhere; }
.chat-log .who { font-weight: 600; margin-right: 6px; color: var(--accent); }
.chat-log .empty { color: var(--muted); }
.chat-name, .chat-form { padding: 0 8px 8px; display: flex; gap: 6px; }
.chat-name { flex-direction: column; }
.chat-name label { font-size: 12px; color: var(--muted); }
.chat-name .row { display: flex; gap: 6px; }
.chat-name input, .chat-form input { flex: 1; }
.chat-err { padding: 0 8px 6px; color: var(--muted); min-height: 8px; }

/* ---- guide ---- */
.guide-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.guide-head .btn { margin-left: auto; }
.guide { overflow: auto; background: var(--field); max-height: calc(100vh - 220px); border: 1px solid var(--line); }
.guide-inner { position: relative; }
.g-row { display: flex; height: 54px; border-bottom: 1px solid var(--line-soft); }
.g-row.g-times { height: 28px; position: sticky; top: 0; z-index: 3; background: var(--face); border-bottom-color: var(--line); }
.g-label { position: sticky; left: 0; z-index: 2; flex: 0 0 150px; width: 150px; background: var(--face); color: var(--text); border-right: 1px solid var(--line); padding: 4px 8px; font-size: 12px; font-weight: 600; line-height: 1.2; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.g-label b { font-family: var(--font-cg); font-weight: 400; font-size: 20px; color: var(--muted); min-width: 1.2em; }
.g-label:hover { color: var(--accent); }
.g-times .g-label { font-size: 11px; color: var(--muted); }
.g-track { position: relative; flex: 0 0 auto; }
.g-tick { position: absolute; top: 0; bottom: 0; font-size: 11px; color: var(--muted); padding: 6px 6px; border-left: 1px solid var(--line-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-slot { position: absolute; top: 4px; bottom: 4px; padding: 4px 7px; background: var(--field); border: 1px solid var(--line-soft); overflow: hidden; font-size: 12px; line-height: 1.25; color: var(--text); text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.g-slot:hover { border-color: var(--accent); }
.g-slot.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.g-slot .t { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.g-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--live); z-index: 1; pointer-events: none; }

/* ---- about ---- */
.prose { max-width: 75ch; display: flex; flex-direction: column; gap: 10px; }
.prose h1 { font-size: 26px; }
.prose h2 { font-size: 17px; margin-top: 8px; }
.placeholder { background: var(--field); padding: 8px 10px; }

.site-footer { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 12px 16px 20px; color: var(--muted); font-size: 12px; }

/* ---- phone: bottom taskbar ---- */
.taskbar { display: none; }
@media (max-width: 900px) {
  .tabs, .title-sub { display: none; }
  .menubar { padding: 0; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
  .tray { color: var(--theme-fg, #172554); border: 0; box-shadow: none; font-size: 16px; }
  .theme-toggle { margin-right: 7.5rem; }
  .taskbar { display: flex; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: var(--taskbar-h); padding: 6px 6px calc(6px + var(--safe-bottom));
    background: var(--face); border-top: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--hi); }
  .task-btn { flex: 1 1 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
  .task-btn.active { color: var(--text); background: var(--field); box-shadow: inset 0 -2px 0 var(--accent); }
  body { padding-bottom: var(--taskbar-h); }
  .chrome { padding-bottom: 0; }
  .appbar { position: relative; }
  .home-grid, .watch { grid-template-columns: 1fr; }
  .prevue { position: static; order: -1; }
  .prevue-screen { max-height: 190px; }
  .player { max-height: none; min-height: 0; }
  .chat { position: static; height: 420px; }
  .g-label { flex-basis: 110px; width: 110px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Audio-only items (Radio Theater): a quiet test card fills the screen; archive.org's audio player sits along the bottom. */
.testcard { display: none; }
.player.audio .testcard { display: flex; position: absolute; inset: 0 0 64px 0; align-items: center; justify-content: center; flex-direction: column; gap: 18px;
  background: repeating-linear-gradient(0deg, transparent 0 39px, rgba(255,255,255,.06) 39px 40px), repeating-linear-gradient(90deg, transparent 0 39px, rgba(255,255,255,.06) 39px 40px), #2a2b2d; color: #e9e8e3; }
.player.audio .tc-circle { width: min(42%, 220px); aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(233,232,227,.55); box-shadow: inset 0 0 0 14px rgba(233,232,227,.08), inset 0 0 0 15px rgba(233,232,227,.35); }
.player.audio .tc-label { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 0 16px; }
.player.audio .tc-label .vt { font-size: 22px; letter-spacing: .04em; }
.player.audio .tc-label #tc-title { font-size: 16px; font-weight: 600; }
.player.audio .tc-note { font-size: 13px; color: #c9c8c2; }
.player.audio iframe { top: auto; bottom: 0; height: 64px; }

/* Ad slots (empty containers; shown only when ADS_ENABLED and on schedule/guide pages). Never overlays anything. */
.ad-slot[hidden] { display: none !important; }
.ad-slot { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); background: var(--face); color: var(--muted); font-size: 12px; margin: 10px 0; }
.ad-banner { min-height: 90px; width: 100%; max-width: 728px; margin-left: auto; margin-right: auto; }
.ad-sidebar { min-height: 250px; width: 300px; }

.channel-about { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 1.55; }
.channel-about h2 { font-size: 15px; margin: 0 0 6px; }
.channel-about .blurbs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; }
.channel-about dt { font-weight: 600; } .channel-about dd { margin: 0; color: var(--muted); }

/* Kids page: no chat, no site navigation to the general channels, no ads. */
body.kids .chat, body.kids .taskbar, body.kids .appbar nav, body.kids .ad-slot { display: none !important; }
body.kids .watch { grid-template-columns: 1fr !important; }

/* ---- live-TV player ---- */
.yt-host, .pd-video { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; background: #000; }
.yt-host iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-host[hidden], .pd-video[hidden] { display: none; }
.pd-video { object-fit: contain; }
/* transparent layer over OUR <video> only (never over YouTube's player) */
.pd-shield { position: absolute; inset: 0; z-index: 2; display: none; }
.player:not(.is-yt) .pd-video:not([hidden]) ~ .pd-shield { display: block; }
.player.audio .pd-video { opacity: 0; }
.player.audio .testcard { z-index: 2; }
.test-pattern { position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center; background: #111 center / cover no-repeat; }
.test-pattern[hidden] { display: none; }
.tp-bars { position: absolute; inset: 0 0 25% 0; background: linear-gradient(90deg, #c0c0c0 0 14.28%, #c0c000 0 28.56%, #00c0c0 0 42.84%, #00c000 0 57.12%, #c000c0 0 71.4%, #c00000 0 85.68%, #0000c0 0); opacity: .85; }
.tp-msg { position: relative; margin: 0 0 6%; padding: 6px 14px; background: rgba(0,0,0,.75); color: #fff; font-weight: 600; }
.bumper-slot { position: absolute; inset: 0; z-index: 6; background: #000; }
.bumper-slot[hidden] { display: none; }
.bumper-slot video { width: 100%; height: 100%; object-fit: contain; }
/* "Tap for sound" lives in the control bar (nothing over the picture) and pulses until sound is on. */
.tap-sound { white-space: nowrap; padding: 6px 12px; min-height: 34px; font: 700 13px/1 inherit; font-family: inherit; border-radius: 999px; cursor: pointer;
  color: var(--tv-key-text, inherit); background: var(--tv-key, transparent); border: 2px solid var(--tv-accent, currentColor); animation: sound-pulse 1.6s ease-in-out infinite; }
@keyframes sound-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tv-accent, currentColor) 70%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--tv-accent, currentColor) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tap-sound { animation: none; } }
.tap-sound.hidden { display: none; }
.tv-controls { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--shadow); border-top: 0; background: var(--panel, #e6e3da); }
.tv-controls button { min-width: 40px; min-height: 34px; font: inherit; font-weight: 600; cursor: pointer; }
.tv-controls #ctl-play { min-width: 44px; letter-spacing: .04em; }
.tv-controls input[type=range] { flex: 0 1 140px; }
.tv-controls .ctl-live { margin-left: auto; font-size: 12px; font-weight: 700; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 6px; }
.tv-controls .ctl-sep { width: 1px; height: 22px; background: var(--shadow); margin: 0 4px; }
.tv-frame:fullscreen { display: flex; flex-direction: column; background: #000; }
.tv-frame:fullscreen .player { flex: 1; max-height: none; aspect-ratio: auto; }
@media (max-width: 640px) { .tv-controls input[type=range] { flex-basis: 90px; } }
.watch > *, .player-win, .player-win .window-body, .tv-frame { min-width: 0; max-width: 100%; }
.tv-controls { flex-wrap: wrap; }
.tv-controls button { white-space: nowrap; }
@media (max-width: 640px) { .tv-controls { gap: 6px; padding: 6px; } .tv-controls button { min-width: 36px; padding: 4px 8px; } }
/* channel surfing */
.tv-static { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; image-rendering: pixelated; opacity: .95; }
.tv-static[hidden] { display: none; }
/* Channel number + name sit in the bottom control bar, never over #player / the YouTube iframe. */
.tv-osd { pointer-events: none; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  margin-left: auto; min-height: 34px; padding: 0 8px; color: #2C3A47; line-height: 1.1; }
.tv-osd[hidden] { display: none; }
.tv-osd[hidden] + .ctl-bug { margin-left: auto; }   /* keep the chip on the right when the label is hidden */
.tv-osd b { font-size: 20px; font-weight: 400; line-height: 1; }
.tv-osd span { font-size: 12px; margin-top: 2px; }
.credit { margin: 2px 0 8px; font-size: 14px; color: var(--muted, #555); }
.tonight-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.tonight-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr minmax(140px, 260px); gap: 10px; align-items: baseline; padding: 8px 10px; background: var(--panel, #efece4); border: 1px solid var(--line, #ccc); }
.tonight-ch { font-weight: 600; text-decoration: none; color: inherit; }
.tonight-now small { display: block; font-size: 12px; color: var(--muted, #666); }
.tonight-next { font-size: 13px; color: var(--muted, #555); }
@media (max-width: 640px) { .tonight-row { grid-template-columns: 1fr; gap: 2px; } }
.show-body { max-width: 760px; }
.show-thumb { width: 100%; max-width: 480px; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line, #ccc); }
.airtimes { columns: 2; padding-left: 18px; }
.site-foot { padding: 14px; font-size: 14px; }
.party-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; padding: 6px 8px; font-size: 13px; background: #fff8d6; border-bottom: 1px solid var(--line, #ccc); }
.party-bar.hidden { display: none; }
body.kids #btn-party, body.kids #btn-share { display: none; }
/* brand kit (public/brand): wordmark plaque in the header, channel bug in our control bar, stand-by test pattern */
.brand { align-items: center; }
.brand .logo { width: auto; height: 48px; }
.brand .logo { max-width: min(420px, 100%); }

.brand .logo-svg { display: block; color: var(--logo, #172554); height: 48px; width: auto; max-width: min(420px, 100%); overflow: visible; }
.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 44px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  background: var(--face);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  flex: 0 0 auto;
}
.theme-toggle:hover { background: var(--accent-soft); }
html[data-theme="day"] .theme-toggle-when-night { display: none; }
html[data-theme="night"] .theme-toggle-when-day { display: none; }
.ctl-bug { height: 26px; width: auto; margin-left: 8px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.ctl-bug[hidden] { display: none; }
.ctl-bug:not([hidden]) + .ctl-live { margin-left: 8px; }
.test-pattern { background: #0b0b0c; }
.test-pattern .tp-msg { position: absolute; top: 3%; max-width: 92%; white-space: normal; text-align: center; left: 50%; transform: translateX(-50%); z-index: 4; }
.test-pattern .tp-msg[hidden] { display: none; }
.show-page .brand .logo { height: 52px; }
@media (max-width: 640px) {
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand .logo { height: auto; width: auto; max-width: min(100%, calc(100vw - 120px)); max-height: 56px; }
  .title-sub { display: none; }
  .appbar .titlebar { min-height: 60px; padding-top: 8px; padding-bottom: 8px; gap: 8px; }
  .ctl-bug { height: 20px; }
}
.bumper-slot iframe { width: 100%; height: 100%; border: 0; display: block; }
.marathon-vote { margin: 6px 0 14px; }
.mv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.mv-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--panel, #efece4); border: 1px solid var(--line, #ccc); }
.mv-card small { color: var(--muted, #666); font-size: 12px; }
.mv-card.is-mine { outline: 2px solid #2e5a7a; }

/* ---- TV mode: "/" and "/kids" fill the screen with the live player, like switching on a TV.
   Every TV and remote color comes from Andy's palette (--remote-* in public/brand-hbn/remote/remote.css); public/app.js
   copies those variables from the remote onto <html>. The --tv-* names below only assign palette roles; no colors are
   set in this file, so a new palette drops in with no code change. ---- */
:root {
  --tv-backdrop: var(--remote-rule);          /* around and behind the picture (the kit's dark rule colour) */
  --tv-bar: var(--remote-body);               /* control bar and chat title (the remote's body) */
  --tv-bar-text: var(--remote-button-text);   /* text on the bar (the key legend colour, light on the black body) */
  --tv-key: var(--remote-button);             /* control keys (rubber-key grey) */
  --tv-key-text: var(--remote-button-text);   /* key legends */
  --tv-rule: var(--remote-rule);
  --tv-accent: var(--remote-accent);          /* light blue */
  --tv-led: var(--remote-led);
}
/* Layout. Desktop: [picture + control bar | channel chat]. The pop-up remote docks in its own column beside the
   picture (the picture shrinks), so nothing is ever laid over the YouTube player. Phones: picture, then the remote
   (when open), then the control bar, then the collapsible chat, top to bottom. Kids: no chat column at all. */
body.tv-mode { overflow: hidden; background: var(--tv-backdrop); }
body.tv-mode .appbar, body.tv-mode .taskbar, body.tv-mode .site-footer, body.tv-mode #channel-strip,
body.tv-mode .player-win > .titlebar, body.tv-mode .ad-slot { display: none !important; }
body.tv-mode .player-win .window-body > :not(.tv-frame) { display: none !important; }
body.tv-mode .chrome { padding: 0; margin: 0; max-width: none; }
body.tv-mode .watch { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; align-items: stretch; background: var(--tv-backdrop); }
body.tv-mode.kids .watch { grid-template-columns: minmax(0, 1fr); }
body.tv-mode .player-win, body.tv-mode .player-win > .window-body { margin: 0; padding: 0; border: 0; box-shadow: none; background: var(--tv-backdrop); min-height: 0; height: 100%; }
body.tv-mode .tv-frame { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "pic" "bar"; background: var(--tv-backdrop); }
body.tv-mode .tv-frame.remote-open { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "pic remote" "bar bar"; }
body.tv-mode .player { grid-area: pic; max-height: none; min-height: 0; height: 100%; aspect-ratio: auto; border: 0; }
body.tv-mode .tv-controls { grid-area: bar; }
body.tv-mode .tv-remote { grid-area: remote; position: static; align-self: center; margin: 12px 16px; transform: none; max-height: calc(100% - 24px); }
body.tv-mode .player, body.tv-mode .yt-host, body.tv-mode .pd-video, body.tv-mode .test-pattern { background: var(--tv-backdrop); }
/* channel chat as a side panel, in the TV palette */
body.tv-mode .chat { position: static; height: 100%; margin: 0; border: 0; border-left: 1px solid var(--tv-rule); border-radius: 0; background: var(--tv-key); color: var(--tv-key-text); box-shadow: none; }
body.tv-mode .chat .titlebar { background: var(--tv-bar); color: var(--tv-bar-text); border-bottom: 2px solid var(--tv-accent); }
body.tv-mode :is(.tv-frame, .chat) { --muted: color-mix(in srgb, var(--tv-bar-text) 72%, transparent); }  /* muted text readable on the dark TV colours */
body.tv-mode .chat-log { background: var(--tv-key); color: var(--tv-key-text); border: 1px solid var(--tv-rule); }
body.tv-mode .chat-log .who { color: var(--tv-accent); }
body.tv-mode .chat input { background: var(--tv-key); color: var(--tv-key-text); border: 1px solid var(--tv-rule); }
body.tv-mode .chat .btn { background: var(--tv-key); color: var(--tv-key-text); border: 1px solid var(--tv-rule); }
.chat-toggle { display: none; }
@media (max-width: 760px) {
  body.tv-mode { overflow: auto; }
  body.tv-mode .watch { position: static; display: block; min-height: 100vh; }
  body.tv-mode .player-win, body.tv-mode .player-win > .window-body, body.tv-mode .tv-frame { height: auto; }
  body.tv-mode .tv-frame, body.tv-mode .tv-frame.remote-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "pic" "remote" "bar"; }
  body.tv-mode .player { height: auto; aspect-ratio: 16 / 9; }
  body.tv-mode .tv-remote { justify-self: center; margin: 10px auto; max-height: none; animation: remote-up .22s ease-out; }
  body.tv-mode .chat { height: auto; border-left: 0; border-top: 1px solid var(--tv-rule); }
  body.tv-mode .chat .chat-log { min-height: 180px; max-height: 45vh; }
  body.tv-mode .chat.collapsed > :not(.titlebar) { display: none; }
  .chat-toggle { display: inline-flex; margin-left: auto; padding: 2px 10px; background: var(--tv-key); color: var(--tv-key-text); border: 1px solid var(--tv-rule); border-radius: 8px; font: inherit; font-size: 12px; cursor: pointer; }
}
@keyframes remote-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
body.tv-mode .tv-controls { border: 0; border-top: 2px solid var(--tv-accent); background: var(--tv-bar); color: var(--tv-bar-text); padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); }
body.tv-mode .tv-controls button, body.tv-mode .tv-controls .ctl-guide { background: var(--tv-key); color: var(--tv-key-text); border: 1px solid var(--tv-rule); border-radius: 8px; box-shadow: none; }
body.tv-mode .tv-controls button:focus-visible, body.tv-mode .tv-controls .ctl-guide:focus-visible { outline: 2px solid var(--tv-accent); outline-offset: 2px; }
body.tv-mode .tv-controls input[type=range] { accent-color: var(--tv-accent); }
body.tv-mode .tv-controls .ctl-sep { background: var(--tv-rule); }
body.tv-mode .live-dot { background: var(--tv-led); }
body.tv-mode .tv-osd { color: var(--tv-key); text-shadow: none; }
body.tv-mode .tv-osd b { font-size: 20px; }
body.tv-mode .tap-sound:hover, body.tv-mode .tap-sound:focus-visible { outline: 2px solid var(--tv-accent); outline-offset: 2px; }
body.tv-mode .ctl-bug { filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--tv-backdrop) 60%, transparent)); }
.ctl-keypad, .ctl-guide { font: 600 13px/1 inherit; font-family: inherit; }
.ctl-guide { display: inline-flex; align-items: center; padding: 6px 10px; text-decoration: none; }
body:not(.tv-mode) .ctl-guide { display: none; }
body.kids .ctl-guide { display: none; }   /* no Guide link out of the Kids TV */

/* ---- Pop-up remote: colors, type and key shapes come from Andy's skin (public/brand-hbn/remote/remote.css, class
   "remote" + "remote-btn-*"). This file only places it over the TV and lays out the keys. ---- */
.tv-remote { position: absolute; right: 16px; bottom: calc(var(--tvbar-h, 48px) + 12px); max-height: calc(100% - var(--tvbar-h, 48px) - 24px); overflow: auto; z-index: 60; box-shadow: 0 14px 34px color-mix(in srgb, var(--remote-button-text) 45%, transparent); }
.tv-remote[hidden] { display: none; }
.remote-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.remote-title { flex: 1; font-size: 13px; font-weight: 700; }
.remote-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.remote-keys { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; row-gap: 10px; margin: 14px 0; }
.remote-btn { text-decoration: none; }
.remote-btn:active { filter: brightness(.92); }
body.kids .remote-btn-guide { visibility: hidden; }   /* no Guide link out of the Kids TV */
@media (max-width: 640px) { body:not(.tv-mode) .tv-remote { left: 50%; right: auto; transform: translateX(-50%); } }

.tv-remote .remote-badge[hidden] { display: none; }   /* Andy's hook, unused */
/* Phones: no remote, no keypad, no on-screen CH or volume keys. Swipe up/down to flip; the phone's own buttons set volume
   (mute and Tap for sound stay). Swipe works on the whole picture for our own video and on the bar under YouTube. */
.ctl-swipe { display: none; }
@media (max-width: 760px) {
  body.tv-mode #tv-remote, body.tv-mode #ctl-keypad, body.tv-mode #ctl-chup, body.tv-mode #ctl-chdown, body.tv-mode #ctl-vol, body.tv-mode .tv-controls .ctl-sep { display: none !important; }
  body.tv-mode .tv-frame.remote-open { grid-template-areas: "pic" "bar"; }
  body.tv-mode .player, body.tv-mode .tv-controls { touch-action: none; }   /* a vertical swipe flips the channel instead of scrolling */
  body.tv-mode .tv-controls { min-height: 64px; }
  body.tv-mode .ctl-swipe { display: inline-flex; align-items: center; flex: 1 1 auto; justify-content: center; font-size: 12px; font-weight: 600; letter-spacing: .04em; opacity: .8; }
  body.tv-mode .tv-controls .ctl-live { margin-left: 0; }
}
body.tv-mode .chat .titlebar > :not(button) { color: var(--tv-bar-text); opacity: .9; }   /* "N here" etc. on the bar colour */

/* Phone number pad (L3): a single # key in the bar opens a compact pad in its own row under the picture. */
.ctl-numpad, .tv-numpad { display: none; }
@media (max-width: 760px) {
  body.tv-mode .ctl-numpad { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; font-weight: 800; }
  body.tv-mode .tv-frame.numpad-open { grid-template-areas: "pic" "pad" "bar"; }
  body.tv-mode .tv-numpad:not([hidden]) { display: block; grid-area: pad; padding: 8px 12px; background: var(--tv-bar); color: var(--tv-bar-text); border-top: 2px solid var(--tv-accent); }
  .np-display { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: .12em; margin-bottom: 6px; color: var(--tv-bar-text); }
  .np-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 260px; margin: 0 auto; }
  .np-keys button { min-height: 38px; font: inherit; font-size: 17px; font-weight: 700; background: var(--tv-key); color: var(--tv-key-text); border: 1px solid var(--tv-rule); border-radius: 8px; cursor: pointer; }
  .np-keys .np-ok { background: var(--tv-accent); color: var(--tv-key-text); }
  .np-keys button:active { filter: brightness(.92); }
}

/* Kitchen TV set (batch O). Off: the wrappers are layout-transparent and the decorations hidden. On (main TV only):
   Andy's tvset.css takes over; the set fills the picture area and the remote/chat stay beside or below it. */
.tvset-off, .tvset-pass { display: contents; }
.tvset-deco { display: none; }
body.tv-mode .tv-frame > .tvset { grid-area: pic; min-height: 0; height: 100%; }
@media (max-width: 760px) {
  body.tv-mode .tv-frame > .tvset { height: auto; touch-action: none; }   /* swipe works on the whole set and room too */
}

/* Black 1980s remote (brand/remote/README): wide red key on top, centred 3x3 pad, then CH | MUTE/GUIDE | VOL columns. */
.tv-remote .remote-top { justify-content: center; min-height: 56px; margin-bottom: 8px; }
.tv-remote .remote-row-power { justify-content: center; margin-bottom: 12px; }
.tv-remote .remote-keys { grid-template-columns: repeat(3, auto); justify-content: center; column-gap: 10px; row-gap: 8px; margin: 0 0 14px; }
.tv-remote .remote-pairs { display: flex; justify-content: space-between; align-items: flex-start; }
.tv-remote .remote-col { display: flex; flex-direction: column; gap: 8px; align-items: center; }
/* Headroom: keep the whole cabinet, rabbit ears included, inside the picture area. The stage is 72% of the set's
   height (--tvset-counter-y), so the cabinet may be at most ~88% of that tall: width <= 0.72 * 0.88 * 707/723 = 62cqh. */
/* Kitchen photo, locked (Dacota / Jolie): public/brand-hbn/tvset/kitchen-orange-wide.png, 1400x990, used in place.
   The photo holds the TV, so the cabinet box is the photo itself and the player sits over the screen glass:
   x 473-879, y 473-832 of 1400x990 = left 33.786%, top 47.778%, width 29%, height 36.263%.
   Desktop: cover. The photo is W = max(area width, 1.4141 x area height) wide, top-anchored so the antenna tip
   (about 2% down) always shows, and slid so the TV (centre x = 48.3%) stays centred. Phones: full width. */
body.tv-mode .tv-frame > .tvset {
  container-type: size;
  --tv-photo-w: max(100cqw, 141.41cqh);
  --tvset-bg: none;
  --tvset-cabinet-ratio: 1400 / 990;
  /* Batch O3: the screen box starts at the photo's top-left corner, sized like the glass (384x334 of 1400x990), and app.js fitTvGlass() warps it onto the 4 glass corners with matrix3d (transform-origin 0 0). */
  --tvset-screen-left: 0%; --tvset-screen-top: 0%; --tvset-screen-width: 27.43%; --tvset-screen-height: 33.74%;
  --tvset-screen-radius: 9% / 11%;
}
body.tv-mode .tv-frame > .tvset .tvset-screen { transform-origin: 0 0; will-change: transform; }
/* O3: fill the glass edge to edge. The 16:9 YouTube iframe is as tall as the glass and wider (cover, centred); the
   archive <video> uses object-fit: cover. The .tvset-screen box clips both (overflow hidden + CRT radius): a clip, not an overlay. */
body.tv-mode .tv-frame > .tvset .tvset-screen .yt-host { overflow: hidden; }
body.tv-mode .tv-frame > .tvset .tvset-screen .yt-host iframe { inset: 0 auto 0 50%; height: 100%; width: auto; aspect-ratio: 16 / 9; max-width: none; transform: translateX(-50%); }
body.tv-mode .tv-frame > .tvset .tvset-screen .pd-video { object-fit: cover; }
body.tv-mode .tv-frame > .tvset .tvset-stage { inset: 0; height: 100%; padding: 0; display: block; }
body.tv-mode .tv-frame > .tvset .tvset-cabinet {
  position: absolute; top: 0; width: var(--tv-photo-w); height: auto; filter: none;
  left: min(0px, max(calc(100cqw - var(--tv-photo-w)), calc(50cqw - var(--tv-photo-w) * 0.483)));
}
body.tv-mode .tv-frame > .tvset .tvset-cabinet-art { object-fit: fill; }
body.tv-mode .tv-frame > .tvset .tvset-knobs { display: none; }
@media (max-width: 760px) {
  body.tv-mode .tv-frame > .tvset { height: auto; aspect-ratio: 1400 / 990; max-height: none; }
}
/* (Warm-light overlay dropped: the locked photo has its own sunlight.) */

/* Batch O4: channel-swap filler, inside #player (so inside the warped, clipped .tvset-screen glass). Added on a flip and
   removed from the page the moment the next channel's first frame plays; the old player is stopped before it shows. */
.tv-filler { position: absolute; inset: 0; z-index: 7; pointer-events: none; background: #000; overflow: hidden; }
.tv-filler canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; filter: contrast(1.15) brightness(0.9); }
.tv-filler .tv-filler-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; filter: saturate(0.85) contrast(1.05); }
.player.filler-on .yt-host { visibility: hidden; }   /* O4: the new YouTube program is shown only once it plays, with the filler removed */

/* ---- TV1 screen-only shell (2026-11-21): the TV is the whole page. Slim navy bar on top, the picture below it,
   the control bar under the picture, the remote docked beside it. No TV-frame skin, no chat column, no lists.
   Day = white with navy, night = black with white (html[data-theme]). Nothing is positioned over the player. ---- */
.tv-topbar { display: none; }
html[data-theme="day"] body.tv-mode { --tv-backdrop: #ffffff; --tv-bar: #ffffff; --tv-bar-text: #172554; --tv-key: #ffffff; --tv-key-text: #172554; --tv-rule: #c9cee0; --tv-accent: #172554; --tv-led: #f5a524; }
html[data-theme="night"] body.tv-mode { --tv-backdrop: #000000; --tv-bar: #000000; --tv-bar-text: #ffffff; --tv-key: #000000; --tv-key-text: #ffffff; --tv-rule: #3a3a3a; --tv-accent: #ffffff; --tv-led: #f5a524; }
body.tv-mode .player, body.tv-mode .yt-host, body.tv-mode .pd-video, body.tv-mode .test-pattern { background: #000; }
body.tv-mode .tv-topbar {
  display: flex; align-items: center; gap: 10px; position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 51;
  padding: 0 12px; padding-top: env(safe-area-inset-top); box-sizing: border-box;
  background: var(--tv-bar); color: var(--tv-bar-text); border-bottom: 2px solid var(--tv-bar-text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body.tv-mode .tvb-badge { width: 28px; height: 28px; flex: 0 0 auto; background-color: currentColor;
  -webkit-mask: url(/leo/brand/mark-current.svg) center / contain no-repeat; mask: url(/leo/brand/mark-current.svg) center / contain no-repeat; }
body.tv-mode .tvb-name { font-weight: 800; font-size: 15px; letter-spacing: .04em; white-space: nowrap; }
body.tv-mode .tvb-ch { font-size: 13px; font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
body.tv-mode .tvbar-links { display: flex; gap: 12px; font-size: 12px; }
body.tv-mode .tvbar-links a { color: inherit; text-decoration: none; }
body.tv-mode .tvbar-links a:hover, body.tv-mode .tvbar-links a:focus-visible { text-decoration: underline; }
body.tv-mode .tvb-theme { font: 600 12px "Helvetica Neue", Helvetica, Arial, sans-serif; background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 999px; padding: 3px 10px; cursor: pointer; }
body.tv-mode .watch { inset: 44px 0 0 0; }
body.tv-mode:not(.tv-chat-open) .watch, body.tv-mode.kids .watch { grid-template-columns: minmax(0, 1fr); }
body.tv-mode:not(.tv-chat-open) .chat { display: none !important; }   /* TV1.2b: the Chat button opens it beside the picture */
body.tv-mode .tvbar-links { align-items: center; }
body.tv-mode .tv-controls { border-top: 1px solid var(--tv-rule); }
@media (max-width: 760px) {
  body.tv-mode .tv-topbar { position: relative; height: auto; min-height: 44px; flex-wrap: wrap; row-gap: 2px; padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: 4px; }
  body.tv-mode .tv-topbar { gap: 7px; padding-left: 10px; padding-right: 10px; }
  body.tv-mode .tvb-badge { width: 22px; height: 22px; }
  body.tv-mode .tvb-name { font-size: 11px; letter-spacing: .02em; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  body.tv-mode .tvbar-links { gap: 8px; font-size: 11px; }
  body.tv-mode .tvb-theme { font-size: 11px; padding: 2px 7px; }
  body.tv-mode .tvb-ch { flex-basis: 100%; order: 5; font-size: 12px; }
  body.tv-mode .watch { min-height: 0; }
}
body.tv-mode .tv-topbar .tvb-theme { flex: 0 0 auto; min-height: 0; min-width: 0; height: 24px; line-height: 1; margin: 0; display: inline-flex; align-items: center; }
/* TV1.1 (Dacota): no bottom channel tab. The channel bug chip and the swipe hint leave the control bar; the channel
   number/name lives in the top bar, the number-entry OSD moved into the top bar, and the program credit plus any
   required attribution show in the top bar (full license text on hover). Nothing is drawn over the picture. */
body.tv-mode #tv-bug, body.tv-mode .ctl-swipe { display: none !important; }
body.tv-mode .tvb-credit { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
body.tv-mode .tvb-ch { flex: 0 1 auto; }
body.tv-mode .tvb-osd-slot .tv-osd { position: static; color: inherit; font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif; white-space: nowrap; display: inline-flex; gap: 6px; align-items: baseline; }
body.tv-mode .tvb-osd-slot .tv-osd[hidden] { display: none; }
body.tv-mode .tvb-osd-slot .tv-osd b { font-size: 13px; }
body:not(.tv-mode) .tvb-osd-slot .tv-osd { display: none; }
@media (max-width: 760px) {
  body.tv-mode .tvb-ch { flex: 0 1 auto; flex-basis: auto; order: 5; }
  body.tv-mode .tvb-credit { order: 6; flex: 1 1 0; font-size: 11px; }
  body.tv-mode .tvb-osd-slot { order: 7; }
  body.tv-mode .tv-controls { row-gap: 6px; }
}
.tvb-info, .tvb-info-btn { display: none; }
body.tv-mode .tvb-info-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 24px; height: 24px; min-width: 0; min-height: 0; padding: 0; border-radius: 50%;
  border: 1px solid currentColor; background: transparent; color: inherit; font: italic 700 13px Georgia, serif; cursor: pointer; }
body.tv-mode .tvb-info-btn[aria-expanded="true"] { background: var(--tv-bar-text); color: var(--tv-bar); }
body.tv-mode .tvb-info:not([hidden]) { display: block; position: fixed; top: 44px; left: 0; right: 0; height: 132px; overflow: auto; z-index: 51; box-sizing: border-box;
  padding: 8px 14px; background: var(--tv-bar); color: var(--tv-bar-text); border-bottom: 1px solid var(--tv-rule); font: 12px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif; }
body.tv-mode .tvb-info p { margin: 0 0 4px; }
body.tv-mode .tvb-info-title { font-weight: 700; font-size: 13px; }
body.tv-mode .tvb-info-lic { opacity: .8; }
body.tv-mode.tvb-info-open .watch { inset: 176px 0 0 0; }
@media (max-width: 760px) {
  body.tv-mode .tvb-info:not([hidden]) { position: static; height: auto; max-height: 40vh; }
  body.tv-mode.tvb-info-open .watch { inset: auto; }
}
body.tv-mode .tvb-ch { flex-shrink: 0; }

/* TV1.2a: bar layout. Top: logo, channel, What's Playing (tap = credit strip), Privacy + Contact. Bottom: Remote,
   Guide, playback controls, Night/Day. Same colours and sizes as before. */
body.tv-mode .tvb-now { flex: 1 1 auto; min-width: 0; text-align: left; background: transparent; border: 0; padding: 0; margin: 0; color: inherit; cursor: pointer;
  font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 0; box-shadow: none; }
body.tv-mode .tvb-now:hover, body.tv-mode .tvb-now:focus-visible { text-decoration: underline; }
body.tv-mode .tvb-link { background: transparent; border: 0; padding: 0; margin: 0; color: inherit; font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif; cursor: pointer; min-height: 0; box-shadow: none; }
body.tv-mode .tvb-link:hover, body.tv-mode .tvb-link:focus-visible { text-decoration: underline; }
body.tv-mode .tv-controls .tvb-theme { margin-left: 6px; height: 28px; }
@media (max-width: 760px) {
  body.tv-mode .tv-topbar { flex-wrap: nowrap; }
  body.tv-mode .tvb-name { display: none; }
  body.tv-mode .tvb-ch { order: 0; flex: 0 0 auto; font-size: 12px; }
  body.tv-mode .tvb-now { order: 0; font-size: 11px; }
}
/* Placeholder pop-up frame: a rounded bezel window with a title strip and faint scanlines, brand navy/white. While it
   is open the player is paused and hidden (visibility), so nothing is ever drawn over a visible YouTube player. */
.hbn-pop[hidden] { display: none; }
.hbn-pop { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.hbn-pop-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .82); }
.hbn-pop-win { position: relative; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 64px); display: flex; flex-direction: column;
  background: var(--theme-bg, #fff); color: var(--theme-fg, #172554); border: 3px solid var(--theme-fg, #172554); border-radius: 18px;
  box-shadow: 0 0 0 6px var(--theme-bg, #fff), 0 0 0 8px var(--theme-fg, #172554), 0 0 40px rgba(120, 160, 255, .35); overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.hbn-pop-win::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px); }
.hbn-pop-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--theme-fg, #172554); color: var(--theme-bg, #fff); }
.hbn-pop-back { background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 999px; padding: 4px 12px; font: 600 13px "Helvetica Neue", Helvetica, Arial, sans-serif; cursor: pointer; min-height: 0; box-shadow: none; }
.hbn-pop-title { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hbn-pop-body { padding: 16px 20px 22px; overflow: auto; font-size: 14px; line-height: 1.5; }
.hbn-pop-body h1 { font-size: 20px; margin: 0 0 8px; } .hbn-pop-body h2 { font-size: 15px; margin: 16px 0 6px; }
.hbn-pop-body a { color: inherit; }
body.hbn-pop-open #player { visibility: hidden; }
@media (max-width: 760px) { .hbn-pop { align-items: stretch; } .hbn-pop-win { width: 100vw; max-height: none; height: 100%; border-radius: 0; box-shadow: none; border: 0; } }
body.tv-mode .tvb-osd-slot .tv-osd.osd-dup { display: none !important; }
/* TV1.2a: Privacy pop-up tabs (Privacy / Terms / Copyright), inside Leo's pop-up window. */
.hbn-legal-tabs { display: flex; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.hbn-legal-tab[aria-selected="true"] { font-weight: 800; text-decoration: underline; }
/* TV1.2a: Manifesto pop-up text (approved copy, layout only). */
.hbn-manifesto h1.hbn-mf-title { font-size: 22px; letter-spacing: .06em; margin: 0 0 4px; }
.hbn-manifesto .hbn-mf-sub { font-weight: 700; margin: 0 0 2px; }
.hbn-manifesto .hbn-mf-tag { font-style: italic; margin: 0 0 14px; }
.hbn-manifesto h2 { font-size: 16px; margin: 18px 0 6px; } .hbn-manifesto h3 { font-size: 14px; margin: 12px 0 4px; }
.hbn-manifesto p { margin: 0 0 8px; line-height: 1.5; }

/* TV1.2b (Dacota 12:42): right-side column beside the screen, tabs REMOTE | GUIDE | CHAT. The picture shrinks to make
   room; nothing is drawn over it. iPhone: the column sits under the player. Bottom bar keeps playback + Night only. */
.tv-side { display: none; }
body.tv-mode .watch, body.tv-mode:not(.tv-chat-open) .watch, body.tv-mode.kids .watch { grid-template-columns: minmax(0, 1fr) 320px; }
body.tv-mode .watch > .chat { display: none !important; }
body.tv-mode .tv-side { display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--tv-backdrop); border-left: 1px solid var(--tv-rule); color: var(--tv-bar-text); }
body.tv-mode .tv-side-tabs { display: flex; flex: 0 0 auto; background: var(--tv-bar); border-bottom: 2px solid var(--tv-accent); }
body.tv-mode .tv-side-tabs [role="tab"] { flex: 1 1 0; min-height: 40px; margin: 0; padding: 0 6px; border: 0; border-radius: 0; background: transparent; color: var(--tv-bar-text); box-shadow: none;
  font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; opacity: .7; cursor: pointer; }
body.tv-mode .tv-side-tabs [role="tab"][aria-selected="true"] { opacity: 1; background: var(--tv-key); color: var(--tv-key-text); }
body.tv-mode .tv-side-tabs [role="tab"]:focus-visible { outline: 2px solid var(--tv-accent); outline-offset: -2px; }
body.tv-mode .tv-side-pane { flex: 1 1 auto; min-height: 0; overflow: auto; }
body.tv-mode .tv-side-pane[hidden] { display: none; }
body.tv-mode #tv-side-remote { display: flex; align-items: flex-start; justify-content: center; }
body.tv-mode #tv-side-remote[hidden] { display: none; }
body.tv-mode .tv-side #tv-remote { display: block !important; position: static; transform: none; margin: 14px auto; max-height: none; box-shadow: none; animation: none; }
body.tv-mode .tv-side #tv-remote .remote-row-power { display: none; }
body.tv-mode .tv-frame.remote-open { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pic" "bar"; }
body.tv-mode #tv-side-chat { display: flex; flex-direction: column; }
body.tv-mode #tv-side-chat[hidden] { display: none; }
body.tv-mode .tv-side .chat { display: flex !important; flex-direction: column; flex: 1 1 auto; height: auto; min-height: 0; border-left: 0; }
body.tv-mode .tv-side .chat .chat-log { flex: 1 1 auto; min-height: 120px; overflow: auto; }
body.tv-mode .tv-side .chat .titlebar .chat-toggle { display: none; }
body.tv-mode .tv-side .chat.collapsed > :not(.titlebar) { display: revert; }
body.tv-mode .tv-side-guide { list-style: none; margin: 0; padding: 4px 0; }
body.tv-mode .tv-side-ch { display: flex; gap: 10px; align-items: baseline; width: 100%; margin: 0; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--tv-rule); border-radius: 0;
  background: transparent; color: var(--tv-bar-text); text-align: left; box-shadow: none; min-height: 0; cursor: pointer; font: 13px/1.3 "Helvetica Neue", Helvetica, Arial, sans-serif; }
body.tv-mode .tv-side-ch:hover, body.tv-mode .tv-side-ch:focus-visible { background: var(--tv-key); color: var(--tv-key-text); }
body.tv-mode .tv-side-ch.is-on { background: var(--tv-key); color: var(--tv-key-text); box-shadow: inset 3px 0 0 var(--tv-accent); }
body.tv-mode .tsg-n { flex: 0 0 2.2em; font-weight: 700; opacity: .75; text-align: right; font-variant-numeric: tabular-nums; }
body.tv-mode .tsg-t { display: flex; flex-direction: column; min-width: 0; }
body.tv-mode .tsg-t b { font-weight: 700; }
body.tv-mode .tsg-t span { opacity: .75; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.tv-mode .tsg-empty { padding: 12px; opacity: .75; font-size: 13px; }
@media (max-width: 760px) {
  body.tv-mode .tv-side { height: auto; border-left: 0; border-top: 1px solid var(--tv-rule); }
  body.tv-mode .tv-side-pane { overflow: visible; }
  body.tv-mode #tv-side-guide { max-height: 60vh; overflow: auto; }
  body.tv-mode .tv-side .chat .chat-log { min-height: 180px; max-height: 45vh; }
}
/* TV1.2b gold (Dacota 12:46-12:52): one gold, #D4A537, same as the favicon. Used as a highlight only:
   top-bar and remote starburst badges, active side-tab / guide-channel / pop-up-tab marks, and keyboard focus rings.
   Navy and white stay the base; gold is a border, underline, or fill, not text on white. Hover, CH keys, and the LED are unchanged. */
body.tv-mode { --tv-gold: #D4A537; }
body.tv-mode .tvb-badge { background-color: var(--tv-gold); }
body .tv-remote .remote-mark {
  background-color: #FFB800;
  -webkit-mask: url(/leo/brand/mark-remote.svg?v=gold4) center / contain no-repeat;
  mask: url(/leo/brand/mark-remote.svg?v=gold4) center / contain no-repeat;
}
html[data-theme="day"] .tv-remote .remote-mark { filter: drop-shadow(0 0 1px rgba(80, 50, 0, 0.65)); }
body.tv-mode .tv-side-tabs { border-bottom-color: var(--tv-gold); }
body.tv-mode .tv-side-tabs [role="tab"][aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--tv-gold); color: var(--tv-key-text); }
body.tv-mode .tv-side-ch.is-on { box-shadow: inset 3px 0 0 var(--tv-gold); }
body.tv-mode :focus-visible, body.tv-mode .tv-side-tabs [role="tab"]:focus-visible, body.tv-mode .tv-remote .remote-btn:focus-visible { outline: 2px solid var(--tv-gold); outline-offset: 2px; }
body.tv-mode .tv-side-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.hbn-legal-tab[aria-selected="true"] { text-decoration-color: #D4A537; text-underline-offset: 3px; }

/* NO-BAR (live, Dacota 1:43 PM): no control bar under the picture; every control is on the remote; tune by typing. */
body.tv-mode.tv-nobar #tv-controls { display: none !important; }
body.tv-mode.tv-nobar .tv-frame, body.tv-mode.tv-nobar .tv-frame.remote-open { grid-template-rows: minmax(0, 1fr); grid-template-areas: "pic"; }
body.tv-mode.tv-nobar .tv-remote .remote-row-extra { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
body.tv-mode.tv-nobar .tv-remote .remote-row-live { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 0 10px; min-height: 22px; }
body.tv-mode.tv-nobar .tv-remote .remote-row-extra .remote-btn { min-width: 42px; height: 30px; padding: 0 8px; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; margin: 0; }
body.tv-mode.tv-nobar .tv-remote .remote-btn-night { font: 700 10px "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
body.tv-mode.tv-nobar .tv-remote .remote-btn-sound { font-size: 11px; height: 28px; padding: 0 10px; border-color: #D4A537; color: inherit; }
body.tv-mode.tv-nobar .tv-remote .remote-btn-sound.hidden { display: none; }
body.tv-mode.tv-nobar .tv-remote .ctl-live, body.tv-mode.tv-nobar .tv-remote .watch-live-tag { font: 700 11px "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .08em; }
body.tv-mode.tv-nobar .tv-remote .remote-hint { margin: 0 0 8px; text-align: center; font: 10px "Helvetica Neue", Helvetica, Arial, sans-serif; opacity: .7; }
body.tv-mode.tv-nobar .tv-side-ch.tsg-ro { cursor: default; }
body.tv-mode.tv-nobar .tv-side-ch.tsg-ro:hover { background: transparent; color: var(--tv-bar-text); }
body.tv-mode.tv-nobar .tv-side-ch.tsg-ro.is-on:hover { background: var(--tv-key); color: var(--tv-key-text); }
body.tv-mode.tv-nobar .tsg-n { font: 700 18px "VT323", ui-monospace, monospace; opacity: 1; color: #D4A537; flex-basis: 2.6em; }
/* (Guide hint removed, Dacota 1:52 PM) */
body.tv-mode.tv-nobar .leo-g-row { pointer-events: none; }
/* Digits on screen like a real TV: big, in the top bar's channel slot (never over the picture). */
body.tv-mode.tv-nobar .tvb-osd-slot .tv-osd b { font: 400 30px/1 "VT323", ui-monospace, monospace; color: #D4A537; letter-spacing: .06em; }
body.tv-mode.tv-nobar .tv-remote .remote-row-live { flex-wrap: wrap; gap: 6px; }
body.tv-mode.tv-nobar .tv-remote .remote-btn-sound { font-size: 10px; letter-spacing: .06em; height: 26px; padding: 0 8px; max-width: 100%; white-space: nowrap; }
/* iPhone: the top bar scrolls away with the page instead of sticking over the (scrolled) player. */
@media (max-width: 760px) { body.tv-mode.tv-nobar .tv-topbar { position: relative; } body.tv-mode.tv-nobar .tvb-osd-slot .tv-osd b { font-size: 24px; } }
/* Dacota 1:52 PM: nothing says LIVE, and no Play/Pause on the remote (it never pauses). */
body.tv-mode .ctl-live, body.tv-mode .watch-live-tag, body.tv-mode #ctl-live-tag, body.tv-mode .tapestamp, body.tv-mode #ctl-play { display: none !important; }
/* Dacota 1:55 PM: pop-ups keep only the X (Esc, backdrop and browser Back still close them). */
#leo-pop-back { display: none !important; }
/* Dacota 2:14 PM, iPhone only: Fullscreen + Night above the fold; Contact not cut off (the channel name ellipsizes instead). Desktop unchanged. */
@media (max-width: 760px) {
  body.tv-mode .tv-topbar .tvb-ch { flex: 0 1 auto; min-width: 0; text-overflow: ellipsis; }
  body.tv-mode .tv-topbar .tvb-now { flex: 0 1 0; min-width: 0; }   /* stays squeezed to 0 on iPhone, as before */
  body.tv-mode .tv-side #tv-remote { margin: 4px auto; padding-top: 10px; }
  body.tv-mode .tv-side #tv-remote .remote-top { min-height: 50px; margin-bottom: 4px; }
  body.tv-mode.tv-nobar .tv-side #tv-remote .remote-row-live { margin-bottom: 4px; }
  body.tv-mode .tv-side #tv-remote .remote-keys { row-gap: 4px; margin-bottom: 8px; }
  body.tv-mode.tv-nobar .tv-side #tv-remote .remote-row-extra { margin-top: 6px; }
}
