:root {
  --bezel: #151311;
  --ink: #e9e3d6;
  --dim: #8d867a;
  --phosphor: #7dff9b;
  --accent: #f2b544;
  --line: #2e2924;
  --raised: #221e1a;
  --mono: "VT323", "Courier New", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bezel); color: var(--ink); }
body { font: 16px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
button { font: inherit; cursor: pointer; }

/* The cabinet: a warm dark plastic bezel around a rounded tube. */
#tv {
  display: flex; flex-direction: column; height: 100dvh; padding: 18px 18px 12px; gap: 12px;
  background:
    radial-gradient(120% 90% at 50% 0%, #2a241f 0%, #171411 55%, #0f0d0b 100%);
}

#screen {
  position: relative; flex: 1; min-height: 0;
  background: #000; border-radius: 28px / 22px; overflow: hidden;
  box-shadow:
    0 0 0 1px #000,
    0 0 0 7px #0b0a09,
    0 0 0 8px #3a332c,
    0 18px 50px rgba(0,0,0,.7);
}
/* Switching on: the picture opens out from a bright line, like a tube warming up. */
body.on-anim #screen { animation: tv-on .6s cubic-bezier(.2,.8,.2,1); }
@keyframes tv-on {
  0% { clip-path: inset(49.6% 0 49.6% 0); filter: brightness(3); }
  35% { clip-path: inset(49.6% 0 49.6% 0); filter: brightness(3); }
  100% { clip-path: inset(0 0 0 0); filter: brightness(1); }
}
#screen > * { position: absolute; inset: 0; width: 100%; height: 100%; }
#screen { container-type: size; }
.deck { background: #000; }
.archive-deck video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
/* The whole picture, always. Embedded players are sized to exactly their 16:9
   picture, so the black space around them is ours: swipes there change channel.
   (A swipe on YouTube's own picture goes to YouTube; its rules forbid catching it.) */
.yt-deck, .frame-deck { overflow: hidden; }
.yt-deck iframe, .frame-deck iframe {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 0;
  width: min(100cqw, calc(100cqh * 16 / 9)); height: min(100cqh, calc(100cqw * 9 / 16));
}
.hidden { visibility: hidden; }

/* Flipping slides the picture: up moves it up and the next channel comes from below. */
.slide-in-up, .slide-in-down { z-index: 2; animation: .28s cubic-bezier(.2,.7,.2,1) both; }
.slide-out-up, .slide-out-down { z-index: 1; animation: .28s cubic-bezier(.2,.7,.2,1) both; }
.slide-in-up { animation-name: slide-in-up; }
.slide-in-down { animation-name: slide-in-down; }
.slide-out-up { animation-name: slide-out-up; }
.slide-out-down { animation-name: slide-out-down; }
@keyframes slide-in-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slide-in-down { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes slide-out-up { from { transform: none; } to { transform: translateY(-100%); } }
@keyframes slide-out-down { from { transform: none; } to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .slide-in-up, .slide-in-down, .slide-out-up, .slide-out-down { animation: none; } }

/* "Turn sideways": shown over the channel info in the bar for a few seconds
   whenever a wide picture comes on while the phone is upright. */
#bar-text { position: relative; }
#bar-text #rotate-hint {
  position: absolute; inset: 0; display: none; align-items: center; gap: 8px;
  max-width: none; background: #17140f; color: var(--dim); font-size: 13px; line-height: 1.25; white-space: nowrap; overflow: hidden;
}
#rotate-hint .rh-text { overflow: hidden; text-overflow: ellipsis; }
#rotate-hint b { color: var(--accent); font-weight: 600; }
#rotate-hint .phone { color: var(--accent); }
#rotate-hint .phone { flex: none; animation: turn-phone 2s ease-in-out infinite; }
@keyframes turn-phone { 0%, 20% { transform: rotate(0); } 55%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) { body.on.rotate-hint #bar-text #rotate-hint { display: flex; animation: osd-in .3s ease-out; } }
@media (prefers-reduced-motion: reduce) { #rotate-hint .phone { animation: none; transform: rotate(-90deg); } }

/* Power off: the picture collapses to a line, then a dot. */
body.off-anim #screen::after {
  content: ""; position: absolute; inset: 0; z-index: 5; background: #000;
  animation: tv-off .45s ease-in forwards;
}
@keyframes tv-off {
  0% { clip-path: inset(0 0 0 0); background: #fff; opacity: .9; }
  45% { clip-path: inset(49.5% 0 49.5% 0); background: #fff; }
  80% { clip-path: inset(49.5% 49.5% 49.5% 49.5%); background: #fff; }
  100% { clip-path: inset(50% 50% 50% 50%); background: #000; }
}

#static-wrap { background: #000; }
#static { width: 100%; height: 100%; image-rendering: pixelated; filter: contrast(1.1) brightness(.9); }
#osd {
  position: absolute; top: 7%; right: 7%; left: 7%; display: flex; flex-direction: column; align-items: flex-end;
  font-family: var(--mono); color: var(--phosphor); text-align: right;
  text-shadow: 0 0 8px rgba(125,255,155,.75), 3px 3px 0 #000, -1px -1px 0 #000;
}
#osd-number { font-size: clamp(64px, 16vmin, 150px); font-weight: 700; line-height: .9; letter-spacing: .04em; }
#osd-name { font-size: clamp(18px, 4vmin, 34px); margin-top: .25em; text-transform: uppercase; letter-spacing: .08em; }
#osd-title:empty { display: none; }
#osd-title {
  font-size: clamp(16px, 3.6vmin, 26px); margin-top: .5em; color: #fff; max-width: min(100%, 22em);
  font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 600; line-height: 1.25;
  background: rgba(0,0,0,.72); padding: .25em .5em; border-radius: 4px; text-shadow: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

#power {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7vh;
  text-align: center; padding: 28px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, #26221f 0%, #0b0a0a 72%);
}
body.on #power { display: none; }
/* Ye Ol'TV: an old-print italic "Ye" leaning on a wood-type "Ol'TV", warm like a valve set glowing. */
.wordmark {
  margin: 0; display: flex; align-items: baseline; justify-content: center; gap: .18em;
  color: var(--accent); line-height: 1; font-weight: 400;
  text-shadow: 0 0 18px rgba(242,181,68,.35), 0 2px 0 #6b4a12;
}
.wordmark .ye { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: clamp(34px, 9vmin, 72px); color: #e9d3a6; transform: translateY(-.08em); }
.wordmark .oltv { font-family: "Rye", Georgia, serif; font-size: clamp(52px, 14vmin, 120px); letter-spacing: .02em; }
.tagline { margin: 0; color: var(--ink); font-size: 17px; max-width: 22em; text-wrap: balance; }
.hint { margin: 0; color: var(--dim); font-size: 14px; max-width: 30em; text-wrap: balance; }
.hint kbd {
  font: 12px/1 ui-monospace, monospace; padding: 2px 5px; border-radius: 4px;
  border: 1px solid #4a433b; border-bottom-width: 2px; color: var(--ink);
}
@media (pointer: coarse) { .mouse-only { display: none; } }
@media (pointer: fine) { .touch-only { display: none; } }
/* The big round knob: about 30% of the phone's width upright, of its height sideways. */
#btn-power {
  margin: 10px 0 4px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  width: min(72vmin, 480px); height: min(72vmin, 480px); min-width: 160px; min-height: 160px;
  display: grid; place-items: center; color: #2a1c06;
  filter: drop-shadow(0 8px 26px rgba(242,181,68,.22));
  transition: transform .12s ease, filter .2s ease;
}
/* A different old-TV knob is drawn in here on every load (js/knobs.js). */
#btn-power svg { width: 100%; height: 100%; display: block; }
#btn-power { flex: none; aspect-ratio: 1; }
/* Phones on their side: name and knob side by side. */
@media (max-height: 500px) and (orientation: landscape) {
  #power { flex-direction: row; gap: 6vw; padding: 12px 24px; }
  #power #btn-power { margin: 0; width: min(70vh, 460px); height: min(70vh, 460px); }
}
#power-status { margin: 4px 0 0; color: var(--dim); font-size: 14px; }

/* ---- the power knob comes alive (js/knobs.js draws it; app.js adds .switching on press) ---- */
#btn-power .knob :is(.k-turn, .k-press, .k-pull, .k-lever, .k-top, .k-bot, .k-glow) { transform-box: view-box; transform-origin: 100px 100px; }
.knob .k-glow { opacity: 0; }
.knob .k-ring { opacity: 0; }
.knob .k-turn { transition: transform .55s cubic-bezier(.25, 1.5, .45, 1); }
.knob .k-press, .knob .k-pull { transition: transform .14s ease-out, filter .14s ease-out; }
#btn-power .knob .k-lever { transform-origin: 100px 104px; transition: transform .16s cubic-bezier(.5, 1.8, .6, 1); }
.knob .k-top, .knob .k-bot { transition: filter .12s; }
.knob .k-bot { filter: brightness(.9); }
/* Idle: the knob invites a turn now and then; lamps and LEDs flicker like old bulbs. */
#btn-power:not(:disabled):not(.switching) .k-turn { animation: k-invite 7s ease-in-out 2s infinite; }
#btn-power:not(:disabled):not(.switching) .k-pull { animation: k-tug 7s ease-in-out 2s infinite; }
#btn-power:not(:disabled):not(.switching) .k-lever { animation: k-nudge 7s ease-in-out 2s infinite; }
.knob .k-lamp { animation: k-flicker 4.3s steps(1) infinite; }
#btn-power:disabled .k-lamp { animation: none; opacity: .25; }
@keyframes k-invite { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-7deg); } 93% { transform: rotate(5deg); } 96% { transform: rotate(-2deg); } }
@keyframes k-tug { 0%, 86%, 100% { transform: scale(1); } 90% { transform: scale(1.04); } 94% { transform: scale(.99); } }
@keyframes k-nudge { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(6deg); } 95% { transform: rotate(-4deg); } }
@keyframes k-flicker {
  0% { opacity: .95; } 7% { opacity: .55; } 8% { opacity: .95; } 31% { opacity: .85; } 33% { opacity: .35; }
  34% { opacity: .9; } 61% { opacity: 1; } 62% { opacity: .5; } 63% { opacity: .95; } 64% { opacity: .7; } 66% { opacity: 1; } 90% { opacity: .8; }
}
/* Pressed: twist, pull, push, flip or rock, then the light comes up with a warm-up flicker. */
#btn-power.switching .k-turn { transform: rotate(95deg); }
#btn-power.switching .k-wide { transform: rotate(120deg); }
#btn-power.switching .k-press { transform: scale(.92); filter: brightness(.88); }
#btn-power.switching .k-pull { transform: scale(1.12); filter: drop-shadow(0 10px 8px rgba(0,0,0,.55)); transition-duration: .3s; }
#btn-power.switching .k-lever { transform: scaleY(-1); }
#btn-power.switching .k-top { filter: brightness(.6); }
#btn-power.switching .k-bot { filter: brightness(1.35); }
#btn-power.switching .k-lamp { animation: k-warm .5s linear forwards; }
#btn-power.switching .k-glow, #btn-power.switching .k-ring { animation: k-warm .55s linear .12s forwards; }
@keyframes k-warm { 0% { opacity: .1; } 20% { opacity: .9; } 30% { opacity: .2; } 45% { opacity: 1; } 55% { opacity: .5; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #btn-power .knob * { animation: none !important; transition-duration: .01s !important; }
}

#btn-power:not(:disabled):hover { filter: drop-shadow(0 8px 30px rgba(242,181,68,.4)) brightness(1.06); }
#btn-power.switching { transform: none !important; }
#btn-power:not(:disabled):active { transform: scale(.97); }
#btn-power:disabled { opacity: .55; cursor: wait; }
#btn-power:focus-visible { outline-offset: 6px; }
button.secondary { padding: 8px 18px; border-radius: 999px; border: 1px solid #4a443c; background: transparent; color: var(--ink); }
button.secondary:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#bar {
  position: relative; display: flex; align-items: center; gap: 8px; height: 60px; flex: none;
}
/* Small see-through icons floating over the right end of the channel line. */
#bar-ctl { position: absolute; top: 2px; right: 4px; display: flex; align-items: center; gap: 2px; z-index: 2; }
#bar button.icon {
  height: 36px; min-width: 40px; padding: 0 6px; border-radius: 10px; border: 0;
  background: transparent; color: var(--ink); opacity: .9;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.9));
  transition: background .15s ease, transform .08s ease, opacity .15s;
}
#bar button.icon svg { display: block; flex: none; }
#bar button.icon:hover { background: rgba(255,255,255,.07); opacity: 1; }
#bar button.icon:active { transform: scale(.9); background: rgba(255,255,255,.12); }
#bar-guide .label { display: none; }
#bar-text .l1 { padding-right: 180px; }
#bar-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0 4px; }
#bar-number {
  font-family: var(--mono); font-size: 34px; line-height: 1; font-weight: 700; color: var(--phosphor);
  min-width: 2ch; text-shadow: 0 0 8px rgba(125,255,155,.45);
}
body:not(.on) #bar-number { color: #3d5a44; text-shadow: none; }
#bar-text {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  text-align: left; background: none; border: 0; padding: 2px 0; color: var(--ink); line-height: 1.25;
}
#bar-text > span { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bar-text .l1 { font-size: 13px; color: var(--dim); line-height: 34px; }
#bar-text .l2 { font-size: 16px; color: var(--ink); }
#bar-channel { color: var(--phosphor); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
#bar-left:not(:empty)::before { content: " · "; }
#bar-note { color: var(--accent); font-style: normal; }
#bar-note:not(:empty)::before { content: " · "; color: var(--dim); }
body:not(.on) #bar-text .l2 { color: var(--dim); }
body:not(.on) #bar-ctl > :not(#bar-guide), body:not(.on) #bar-info { opacity: .35; pointer-events: none; }
.chan-pair { display: inline-flex; gap: 2px; }
/* The Guide takes the whole screen: no bar under it. */
body.panel-guide #bar { display: none; }
/* Tap the picture's black space: controls go away (and the page goes full screen). */
body.on.bare #bar { display: none; }
body.on.bare #tv { padding: 0; gap: 0; }
body.on.bare #screen { border-radius: 0; box-shadow: none; }

/* After a flip the info glows for a moment, like an on-screen display. */
#bar.fresh #bar-number { animation: osd-glow 4s ease-out; }
#bar.fresh #bar-text .l2 { animation: osd-in .35s ease-out; }
@keyframes osd-glow {
  0%, 60% { text-shadow: 0 0 14px rgba(125,255,155,.95), 0 0 2px #fff; transform: scale(1.12); }
  100% { text-shadow: 0 0 8px rgba(125,255,155,.45); transform: scale(1); }
}
@keyframes osd-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px), (max-height: 500px) {
  #tv { padding: 0; gap: 0; background: #0f0d0b; }
  #screen { border-radius: 0; box-shadow: none; }
  #bar {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); height: auto; gap: 6px;
    border-top: 1px solid var(--line); background: linear-gradient(#1b1815, #12100e);
  }
  #bar #bar-full { display: none; }
  #bar-text .l1 { padding-right: 132px; }
  #bar-info { gap: 8px; padding: 0; }
  #bar-number { font-size: 30px; }
  #bar-text .l2 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  body.on-anim #screen, #bar.fresh #bar-number, #bar.fresh #bar-text .l2 { animation: none; }
}

/* ---------- panels: guide, settings, details ----------
   They replace the picture: the deck underneath is hidden (sound keeps playing). */
body.panel-open .deck, body.panel-open #static-wrap { visibility: hidden !important; }
.panel {
  z-index: 4; display: flex; flex-direction: column; background: #0f0d0c;
  font-size: 15px; color: var(--ink); animation: panel-in .18s ease-out;
}
@keyframes panel-in { from { opacity: 0; } to { opacity: 1; } }
.panel[hidden] { display: none; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid #2a2622; flex: none;
}
.panel .close { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); flex: none; }
.panel .close:hover { border-color: var(--accent); color: var(--accent); }
.tabs { display: flex; gap: 6px; }
.tabs button { width: 48px; height: 40px; padding: 0; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid #3a352f; background: transparent; color: var(--dim); }
.panel-actions { display: inline-flex; gap: 8px; }
.panel .close.power-off { display: inline-grid; place-items: center; color: #e86a5c; }
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 700; }
.tab-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.tab-body[hidden] { display: none; }
.dim { color: var(--dim); }

/* the grid */
#grid { --name-w: 132px; position: relative; min-width: 560px; }
.g-times, .g-row { display: grid; grid-template-columns: var(--name-w) 1fr; }
.g-times { position: sticky; top: -12px; z-index: 2; background: #0d0c0b; padding: 4px 0 6px; }
.g-times .track { position: relative; height: 20px; color: var(--dim); font-size: 13px; }
.g-times .track span { position: absolute; top: 0; transform: translateX(2px); white-space: nowrap; }
.g-row { border-top: 1px solid #1f1c19; cursor: pointer; }
.g-row:hover .g-name, .g-row:hover .cell { background: #1b1916; }
.g-row.current .g-name { color: var(--phosphor); }
.g-row.current .cell.now { border-color: var(--phosphor); }
.g-name { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 2px; height: 52px; overflow: hidden; }
.g-name b { font-family: "Courier New", ui-monospace, monospace; color: var(--phosphor); min-width: 2ch; }
.g-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row .track { position: relative; height: 52px; }
.cell {
  position: absolute; top: 4px; bottom: 4px; padding: 4px 8px; overflow: hidden;
  background: #171513; border: 1px solid #2a2622; border-radius: 6px; font-size: 13px; line-height: 1.25;
}
.cell .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .s { color: var(--dim); font-size: 12px; }
.cell.now { background: #1f1c18; }
.g-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 1; pointer-events: none; }

/* settings */
#tab-settings h2 { margin: 4px 0 12px; font-size: 18px; }
.source { border: 1px solid var(--line); background: #151210; border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; max-width: 560px; }
.source p { margin: 6px 0; }
.source-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source.soon { opacity: .6; }
.switch { display: inline-flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 44px; height: 26px; border-radius: 999px; background: #3a342e; position: relative;
  transition: background .2s ease;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #d8d1c4; box-shadow: 0 1px 3px rgba(0,0,0,.5); transition: transform .2s ease;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); background: #fff8e8; }
.switch input:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* details */
#details-channel { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
#details-channel b { font-family: "Courier New", ui-monospace, monospace; color: var(--phosphor); font-size: 22px; }
#details-body { max-width: 680px; }
#details-body h2 { margin: 2px 0 4px; font-size: 22px; }
.meta { color: var(--dim); margin: 0 0 12px; }
.progress { height: 6px; background: #2a2622; border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.progress i { display: block; height: 100%; background: var(--accent); }
.desc { white-space: pre-line; margin: 14px 0; }
#details-body h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 18px 0 6px; }
#details-body ul { list-style: none; margin: 0; padding: 0; }
#details-body li { padding: 6px 0; border-top: 1px solid #1f1c19; display: flex; gap: 12px; }
#details-body li .when { color: var(--dim); min-width: 5.5em; font-variant-numeric: tabular-nums; }
#details-body li button { all: unset; cursor: pointer; color: var(--ink); }
#details-body li button:hover { color: var(--accent); }
#details-body a { color: var(--accent); }
.g-row.dead { opacity: .45; }
#details-scrub { height: 14px; cursor: pointer; border-radius: 7px; }
.skip-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.skip-row p { margin: 4px 0; }
.skip-row button { padding: 6px 12px; }

/* guide as a list (phones) */
#grid.list { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.l-row {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: #151210;
}
.l-row:active { background: #1d1a16; }
.l-row:focus-visible { outline: 2px solid var(--accent); }
.l-row.current { border-color: rgba(125,255,155,.5); background: #131a14; }
.l-row.dead { opacity: .45; }
.l-num { font-family: var(--mono); font-size: 30px; line-height: 1; color: var(--phosphor); min-width: 2ch; font-weight: 700; }
.l-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.l-body > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-name { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.l-name em { font-style: normal; color: var(--phosphor); margin-left: .6em; }
.l-name em::before { content: "● "; font-size: 9px; vertical-align: 1px; }
.l-now { font-size: 16px; color: var(--ink); }
.l-prog { height: 3px; border-radius: 2px; background: #2e2924; overflow: hidden; margin: 3px 0 2px; }
.l-prog i { display: block; height: 100%; background: var(--accent); }
.l-next { font-size: 13px; color: var(--dim); }
.l-next b { font-weight: 600; color: #b9b1a3; margin-right: .4em; font-variant-numeric: tabular-nums; }

/* details: description and source */
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.desc a { word-break: break-all; }
button.more { all: unset; cursor: pointer; color: var(--accent); font-size: 14px; margin: -8px 0 8px; display: inline-block; }
button.more[hidden] { display: none; }
.source-link { color: var(--dim); font-size: 13px; margin-top: 18px; padding-top: 12px; border-top: 1px solid #1f1c19; }
#details-body h2 { font-size: 20px; line-height: 1.25; text-wrap: balance; }

/* streaming services, Dailymotion, Twitch (settings) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip { all: unset; cursor: pointer; padding: 7px 12px; border-radius: 999px; border: 1px solid #3a342e; color: var(--dim); font-size: 14px; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: #2a221a; }
.chip[aria-pressed="true"]::before { content: "✓ "; color: var(--accent); }
.chip.more-svc { border-style: dashed; }
.chip.has-logo { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; }
.chip.has-logo img { width: 24px; height: 24px; border-radius: 6px; flex: none; }
.chip.has-logo[aria-pressed="true"]::before { content: none; }
.chip.has-logo[aria-pressed="true"] img { outline: 2px solid var(--accent); outline-offset: 1px; }
.svc-search { box-sizing: border-box; width: 100%; margin: 10px 0 2px; background: #14120f; color: var(--ink); border: 1px solid #3a342e; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; }
.svc-search::placeholder { color: var(--dim); opacity: .8; }
.svc-search:focus { outline: none; border-color: var(--accent); }
.svc-from { margin: 8px 0 0 !important; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.field { display: flex; gap: 8px; margin-top: 8px; }
.field input, .field select, select.inline { flex: 1; min-width: 0; background: #14120f; color: var(--ink); border: 1px solid #3a342e; border-radius: 8px; padding: 8px 10px; font: inherit; }
select.inline { flex: none; padding: 4px 8px; }
.picklist { list-style: none; margin: 8px 0 0; padding: 0; }
.picklist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid #1f1c19; }
.picklist li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picklist button { all: unset; cursor: pointer; color: var(--accent); padding: 2px 6px; }
.fineprint { font-size: 11px; color: var(--dim); opacity: .7; }
.fineprint a { color: inherit; }
.source p.dim:empty { display: none; }

/* details: continue watching on a service */
.watch-on { margin: 14px 0; padding: 12px 14px; border: 1px solid #3a342e; border-radius: 12px; }
.watch-on p { margin: 0 0 8px; }
.watch-on .row a { display: inline-block; padding: 10px 16px; border-radius: 8px; background: var(--accent); color: #111 !important; text-decoration: none; font-weight: 600; }

/* No grey/blue tap square on phones (Android/iOS tap highlight, focus ring after a tap). */
html { -webkit-tap-highlight-color: transparent; }
button, a, label, input { -webkit-tap-highlight-color: transparent; }
#btn-power:focus:not(:focus-visible) { outline: none; box-shadow: none; }
#btn-power { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Settings: picked services as one row of logos; tap to open the full list */
.svc-picked { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; width: 100%; margin: 10px 0 2px; padding: 6px 4px; min-height: 48px; border-radius: 12px; }
.svc-picked:focus-visible { outline: 2px solid var(--accent); }
.svc-picked img, .svc-picked .svc-ini { width: 40px; height: 40px; border-radius: 10px; flex: none; box-shadow: 0 0 0 2px #151210; background: #2a221a; }
.svc-picked .svc-ini { display: grid; place-items: center; color: var(--ink); font-weight: 700; font-size: 18px; }
.svc-picked > :not(:first-child):not(.svc-caret) { margin-left: 6px; }
.svc-picked.crowded > :not(:first-child):not(.svc-caret) { margin-left: -14px; }
.svc-picked .svc-caret { margin-left: auto; color: var(--dim); flex: none; }

/* Guide: search box; the filter and clear icons only show while it is in use */
.guide-search { flex: 1; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0 4px 0 10px; height: 40px; box-sizing: border-box; background: #14120f; border: 1px solid #3a342e; border-radius: 12px; }
.guide-search.active { border-color: var(--accent); }
.guide-search .gs-glass { color: var(--dim); flex: none; }
.guide-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--ink); font: inherit; font-size: 15px; padding: 6px 4px; }
.guide-search input::-webkit-search-cancel-button { display: none; }
.guide-search .gs-btn { all: unset; cursor: pointer; display: none; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--ink); flex: none; }
.guide-search.active .gs-btn { display: grid; }
.guide-search #guide-filter { color: var(--accent); }
.guide-search .gs-btn:active { background: rgba(255,255,255,.1); }

/* Top bar, far right: remove the filter (orange) */
#topbar { position: relative; }
#topbar #bar-unfilter { all: unset; cursor: pointer; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; color: #ff8a1f; border: 1px solid #ff8a1f; -webkit-tap-highlight-color: transparent; }
#topbar #bar-unfilter svg { width: 18px; height: 18px; }
#topbar #bar-unfilter:active { transform: translateY(-50%) scale(.94); }
#bar-unfilter[hidden] { display: none !important; }
@media (max-width: 420px) { body.filtered #topbar { justify-content: flex-start; padding-right: 50px; } }

/* Quick filters: a slim row above the picture (never over it: YouTube's rules) */
#topbar { display: flex; justify-content: center; gap: 8px; flex: none; margin: -6px 0 -2px; }
#topbar .qf { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; border: 1px solid #3a342e; color: var(--dim); font-size: 13px; letter-spacing: .02em; -webkit-tap-highlight-color: transparent; }
#topbar .qf svg { flex: none; }
#topbar .qf[aria-pressed="true"] { border-color: var(--accent); color: #111; background: var(--accent); }
#topbar .qf:active { transform: scale(.96); }
body:not(.on) #topbar, body.bare #topbar { display: none; }
@media (max-width: 640px), (max-height: 500px) {
  #topbar { margin: 0; padding: 8px 8px 6px; background: #0d0b0a; }
  #topbar .qf { padding: 5px 11px; font-size: 12.5px; }
}
@media (max-height: 500px) { #topbar { padding: 4px 8px; } #topbar .qf span { display: none; } }
/* Platform icons (where the video is from, and where the full title streams) */
.platforms { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
.platforms #details-watch { display: contents; }
.pf { width: 34px; height: 34px; border-radius: 9px; display: block; }
.pf-link { display: inline-block; border-radius: 10px; line-height: 0; }
.pf-link:active { transform: scale(.94); }
.pf-other { opacity: .45; line-height: 0; }
#bar-note .pf { width: 18px; height: 18px; border-radius: 4px; display: inline-block; vertical-align: -4px; margin-right: 3px; }
body.panel-open #topbar { display: none; }

/* Guide search sits in the header between the tabs and the power/close buttons. */
#guide .panel-head { gap: 8px; }
#guide.on-settings .guide-search { visibility: hidden; }
@media (max-width: 420px) { .guide-search.active .gs-glass { display: none; } .guide-search input { font-size: 14px; } }

/* Details: where to watch. The video's own platform first and a bit bigger, then the others, each named underneath. */
.platforms { gap: 10px 12px; align-items: flex-start; }
.platforms a.pf-item, .pf-item { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; width: 62px; text-decoration: none; color: var(--dim); line-height: 1.15; }
.pf-item .pf-name { font-size: 10.5px; text-align: center; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pf-item.pf-src { width: 68px; }
.pf-item.pf-src .pf { width: 44px; height: 44px; border-radius: 11px; }
.pf-item.pf-src .pf-name { color: var(--ink); }
.pf-item.dim-pf .pf { opacity: .45; }
.pf-item:active .pf { transform: scale(.94); }
#bar-note .pf.pf-src { width: 21px; height: 21px; }
#details-body a.pf-item { color: var(--dim); }
#details-body a.pf-item.pf-src { color: var(--ink); }
.platforms { margin-bottom: 10px; }

/* Home screen: no bottom bar, only the name and the knob (Leo, 2026-11-20). */
body:not(.on) #bar { display: none; }

/* TMDB credit: their official logo, unmodified, smaller than ours (TMDB terms). */
.fineprint .tmdb-logo { display: block; width: max-content; margin: 0 0 6px; line-height: 0; }
.fineprint .tmdb-logo img { height: 12px; width: auto; }

/* Settings: a thin moving bar while a card is loading (never a frozen look). */
.busy { position: relative; height: 3px; margin: 10px 0 2px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.busy[hidden] { display: none; }
.busy i { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: inherit; background: var(--accent); animation: busy 1.1s ease-in-out infinite; }
@keyframes busy { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .busy i { animation-duration: 3s; } }
/* Picked services: each icon reveals that service in the list */
.svc-pick { display: inline-block; flex: none; border-radius: 12px; line-height: 0; transition: transform .12s; }
.svc-pick.revealed { box-shadow: 0 0 0 2px var(--accent); transform: translateY(-2px); }
.svc-picked > .svc-pick:not(:first-child) { margin-left: 6px; }
.svc-picked.crowded > .svc-pick:not(:first-child) { margin-left: -14px; }

/* ---------- upright phones, on trial (?vertical=1; js/vertical.js) ----------
   The picture sits at the top in a box of its own shape; below it is the stage. */
#vstage { display: none; }
body.vertical.on #bar { display: none; }
body.vertical .yt-deck iframe, body.vertical .frame-deck iframe, body.vertical .archive-deck video {
  top: 0; left: 50%; width: var(--pw, 100cqw); height: var(--ph, 56.25cqw); object-fit: cover;
  /* the camera (js/vertical.js): a sideways shift and a scale, animated by the browser */
  transform: translateX(calc(-50% + var(--cx, 0px))) scale(var(--cs, 1)); transition: transform var(--ct, 0ms) ease-in-out; will-change: transform;
}
body.vertical #screen > .deck { height: var(--ph); overflow: hidden; }
body.vertical #screen > #static-wrap { height: var(--pic-h); }
/* No page scrolling or pull-to-refresh while swiping over our own pictures. */
body.vertical #screen, body.vertical .archive-deck { touch-action: none; }
html:has(body.vertical) { overscroll-behavior: none; }
body.vertical.on:not(.panel-open) #screen > #vstage {
  display: block; top: var(--pic-h); height: auto; z-index: 3; overflow: hidden;
  background: #0b0a09; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: top .22s cubic-bezier(.2,.7,.2,1);
}
#vglow { position: absolute; left: -25%; top: -25%; width: 150%; height: 150%; filter: blur(26px) saturate(1.35); opacity: .5; pointer-events: none; }
#vstage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(11,10,9,.25), rgba(11,10,9,.72)); }
#vreel { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: center; padding: 0 14px; }
#vreel button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 12px; flex: none; -webkit-tap-highlight-color: transparent; }
.vrow { height: 58px; padding: 0 6px; opacity: .55; }
.vrow.far { opacity: .25; }
.vrow b { font: 30px/1 var(--mono); color: var(--phosphor); width: 44px; text-align: center; }
.vrow span { font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .06em; }
.vrow:active { opacity: .9; }
.vcur { padding: 12px 6px; margin: 4px 0; border-top: 1px solid rgba(255,255,255,.09); border-bottom: 1px solid rgba(255,255,255,.09); }
.vcur .num { font: 54px/1 var(--mono); color: var(--phosphor); width: 64px; text-align: center; text-shadow: 0 0 10px rgba(125,255,155,.5); flex: none; }
.vcur .vtxt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; padding-right: 40px; }
.vcur .ch { color: var(--phosphor); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.vcur .ttl { font-size: 18px; line-height: 1.25; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcur .note { font-size: 13px; line-height: 1.3; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcur .note:empty { display: none; }
.vcur .note .pf { width: 18px; height: 18px; border-radius: 4px; display: inline-block; vertical-align: -4px; margin-right: 3px; }
.vcur .prog { display: block; height: 3px; border-radius: 2px; background: rgba(255,255,255,.14); margin-top: 5px; overflow: hidden; }
.vcur .prog[hidden] { display: none; }
.vcur .prog i { display: block; height: 100%; background: var(--accent); }
#vguide { all: unset; cursor: pointer; position: absolute; z-index: 2; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; color: var(--ink); background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); -webkit-tap-highlight-color: transparent; }
#vguide:active { transform: scale(.92); }

/* ---- home page footer: quiet links on big screens, a pull-up tray on phones ---- */
section#power > footer#home-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; padding: 0 0 max(18px, env(safe-area-inset-bottom)); pointer-events: none; }
#home-foot > * { pointer-events: auto; }
#foot-links { display: flex; gap: 18px; font: 13px/1 ui-sans-serif, system-ui, sans-serif; }
#foot-links a { color: var(--dim); text-decoration: none; opacity: .75; padding: 6px 2px; }
#foot-links a:hover, #foot-links a:focus-visible { color: var(--ink); opacity: 1; }
#foot-handle { display: none; }
@media (max-width: 760px), (pointer: coarse) {
  #foot-handle {
    display: inline-flex; align-items: center; gap: 5px; margin-bottom: 6px; padding: 6px 12px; cursor: pointer;
    font: 12px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .02em; color: var(--dim);
    background: rgba(20,17,14,.55); border: 1px solid rgba(141,134,122,.28); border-radius: 999px;
  }
  #foot-handle svg { transition: transform .25s ease; }
  #foot-handle[aria-expanded="true"] { color: var(--ink); }
  #foot-handle[aria-expanded="true"] svg { transform: rotate(180deg); }
  #foot-links {
    gap: 0; width: min(100%, 420px); justify-content: space-around; box-sizing: border-box;
    background: rgba(20,17,14,.94); border: 1px solid var(--line); border-radius: 14px;
    padding: 2px 12px; margin: 0 16px;
    transform: translateY(12px); opacity: 0; visibility: hidden; transition: transform .2s ease, opacity .2s ease, visibility 0s .2s;
  }
  #foot-links a { font-size: 15px; padding: 12px 10px; opacity: .9; }
  #home-foot.open #foot-links { transform: none; opacity: 1; visibility: visible; transition: transform .2s ease, opacity .2s ease; }
  #home-foot:not(.open) #foot-links { position: absolute; bottom: 0; }
}
/* "A Digitnix Technologies product": its own line under the links. */
#foot-links { flex-wrap: wrap; justify-content: center; }
#foot-links .by-digitnix { flex-basis: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding-top: 2px; }
#foot-links .by-digitnix img { opacity: .9; }
@media (max-width: 760px), (pointer: coarse) {
  #foot-links .by-digitnix { font-size: 13px; padding: 4px 0 12px; border-top: 1px solid var(--line); padding-top: 10px; }
}

/* Full screen on an upright phone: only the picture, in the middle of the screen, and the way out. */
#vfull { all: unset; cursor: pointer; position: absolute; z-index: 2; right: 10px; bottom: calc(64px + env(safe-area-inset-bottom)); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; color: var(--ink); background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); -webkit-tap-highlight-color: transparent; }
#vfull:active { transform: scale(.92); }
#vfull .out, body.bare #vfull .in { display: none; }
body.bare #vfull .out { display: block; }
body.vertical.bare #screen > .deck, body.vertical.bare #screen > #static-wrap { top: calc((100% - var(--pic-h)) / 2); }
body.vertical.bare.on:not(.panel-open) #screen > #vstage { top: 0; background: none; pointer-events: none; transition: none; }
body.vertical.bare #vstage > :not(#vfull), body.vertical.bare #vstage::after { display: none; }
body.vertical.bare #vfull { pointer-events: auto; bottom: calc(10px + env(safe-area-inset-bottom)); opacity: .55; }

/* Camera holes and notches: keep the top of the page clear of them. The app
   shells may set --safe-top when the web view reports no inset of its own. */
:root { --sat: max(env(safe-area-inset-top, 0px), var(--safe-top, 0px)); }
@media (max-width: 600px), (max-height: 500px) {
  body.on:not(.bare) #tv { padding-top: var(--sat); }
}

/* Upright phones: play the programme from its beginning, above the full screen button. */
#vrestart { all: unset; cursor: pointer; position: absolute; z-index: 2; right: 10px; bottom: calc(118px + env(safe-area-inset-bottom)); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; color: var(--ink); background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); -webkit-tap-highlight-color: transparent; }
#vrestart:active { transform: scale(.92); }

/* Upright phones: the three stage buttons sit in one row, centred at the bottom; the channel list keeps clear of them. */
#vrestart, #vfull, #vguide { right: auto; bottom: calc(10px + env(safe-area-inset-bottom)); }
#vrestart { left: calc(50% - 76px); }
#vfull { left: calc(50% - 22px); }
#vguide { left: calc(50% + 32px); }
#vreel { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

/* Settings: a provider's connect / disconnect action is an icon beside its switch. */
.src-acts { display: inline-flex; align-items: center; gap: 10px; }
.src-act { all: unset; cursor: pointer; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; color: var(--accent); border: 1px solid var(--line); -webkit-tap-highlight-color: transparent; }
.src-act.off { color: var(--dim); }
.src-act[hidden] { display: none; }
.src-act:disabled { opacity: .4; cursor: default; }
.src-act:active { transform: scale(.94); }

/* Phone held sideways: restart and full screen in the bar; flipping is by swipe, so no arrows. */
#bar #bar-restart { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  #bar #bar-restart, #bar #bar-full { display: inline-grid; }
  #bar .chan-pair { display: none; }
  /* Same order as the upright stage: restart, full screen, guide. */
  #bar #bar-restart { order: 1; }
  #bar #bar-full { order: 2; }
  #bar #bar-guide { order: 3; }
}

/* Connecting a provider: the connect icon becomes a spinner and the switch waits out of sight. */
.source.connecting .src-act:not(.off) { opacity: 1; pointer-events: none; border-color: transparent; position: relative; }
.source.connecting .src-act:not(.off) svg { visibility: hidden; }
.source.connecting .src-act:not(.off)::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.18); border-top-color: var(--accent); animation: src-spin .8s linear infinite; }
.source.connecting .switch { display: none; }
@keyframes src-spin { to { transform: rotate(360deg); } }
