/* ============================================================
   MoodPlaylist station: full-screen music TV, late at night.
   Layers, bottom to top: ambient fill → video → CRT glass → touch layer → panels → dock → sheets.
   Bottom of the screen, top to bottom: tuner, buttons + song banner, progress bar.
   ============================================================ */

:root {
  --ink: #f6f3ee;
  --dim: rgba(246, 243, 238, .72);
  --glass-panel: rgba(12, 10, 16, .55);
  --panel: rgba(30, 26, 34, .72);
  --yellow: #ffe14d;
  --heart: #ff3b6b;
  --led-on: #5dff8f;
  --led-wait: #ffb02e;
  --dial-glow: #ffb547;            /* warm backlight of the YEAR dial */
  --year-bubble: #c9dbe6;          /* "Back in 1984" facts: faded TV-guide blue */
  --dock: 260px;                   /* set by JavaScript to the dock's real height */
  --fade-out: .6s;
  --vcr: "VT323", ui-monospace, monospace;
  --body: "Archivo", system-ui, sans-serif;
  --marker: "Permanent Marker", "Archivo", cursive;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { color: var(--ink); font-family: var(--body); -webkit-tap-highlight-color: transparent; }

a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, #scrubber:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- The picture ---------- */
#tv { position: fixed; inset: 0; overflow: hidden; background: #000; animation: power-on .8s ease-out; }
/* --picture goes 1 → 0 over the last seconds of a song (fade to black), then back up */
.screen { position: absolute; pointer-events: none; opacity: var(--picture, 1); transition: opacity .7s ease; }
.screen iframe, #yt { display: block; width: 100%; height: 100%; border: 0; }
#tv.fading .screen, #tv.fading #ambient { transition: none; }
@keyframes power-on {
  0% { transform: scale(.6, .004); filter: brightness(6); }
  45% { transform: scale(1, .004); filter: brightness(4); }
  100% { transform: none; filter: none; }
}

/* 4:3 videos on a wide screen: the sides glow with a blurred copy of the picture
   instead of hard black bars (nothing is cropped) */
#ambient {
  position: absolute; inset: -8%; opacity: 0; background: center / cover no-repeat;
  filter: blur(48px) brightness(.42) saturate(1.3); transition: opacity .7s ease;
}
#tv.contained #ambient { opacity: calc(var(--picture, 1) * 1); }

/* CRT glass: scanlines and dark scrims so text reads on any video (no frame: the picture runs to the edges) */
#glass {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px),
    linear-gradient(to bottom, rgba(0, 0, 0, .5), transparent 16%, transparent 58%, rgba(0, 0, 0, .78)),
    radial-gradient(ellipse at center, transparent 72%, rgba(0, 0, 0, .28) 100%);
}
#screen { position: fixed; inset: 0; z-index: 2; }

/* ---------- Top: the channel bug and three buttons ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none;
  display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 26px;
}
.top > * { pointer-events: auto; }
#bug { display: block; width: 168px; opacity: .62; text-decoration: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45)); }
#bug svg { display: block; width: 100%; height: auto; overflow: visible; }
.bug-mood { font-family: var(--body); font-stretch: 62%; font-weight: 900; font-size: 74px; fill: #fff; letter-spacing: -2px; }
.bug-playlist { font-family: var(--marker); font-size: 36px; fill: #fff; transform: rotate(-6deg); transform-origin: 40px 100px; }
.top-actions { display: flex; gap: 8px; }
.top-actions button {
  border: 1px solid rgba(255, 255, 255, .16); background: var(--glass-panel); backdrop-filter: blur(8px);
  border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 600; min-width: 38px;
}
.top-actions button:hover { border-color: var(--yellow); }
#btn-help { font-weight: 800; font-size: 15px; padding: 9px 0; width: 38px; }

/* ---------- Facts (left) and comments (right): TV-style commentary in the lower middle ---------- */
.side {
  position: fixed; z-index: 9; width: 320px;
  /* Just below the middle of the screen, but always clear of the dock */
  bottom: max(calc(var(--dock) + 28px), 26vh);
  max-height: 36vh; display: flex; flex-direction: column; justify-content: flex-end;
}
#facts { left: 4vw; }
#comments { right: 4vw; width: 330px; }
body.no-facts #facts, body.no-comments #comments { display: none; }
.side:has(> div:empty) { visibility: hidden; }

/* Small ✕: switches the whole feature off */
.side-close {
  position: absolute; top: -12px; right: -10px; z-index: 2; width: 26px; height: 26px; padding: 0;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(12, 10, 16, .75);
  color: var(--dim); font-size: 12px; line-height: 1; opacity: 0; transition: opacity .2s;
}
.side:hover .side-close, .side:focus-within .side-close { opacity: 1; }
@media (hover: none) { .side-close { opacity: .85; } }

.fact-bubble {
  --bubble: var(--yellow);
  position: relative; margin: 0 0 14px; background: var(--bubble); color: #111;
  border-radius: 22px; padding: 12px 17px; font-weight: 700; font-size: 16px; line-height: 1.35;
  box-shadow: 4px 6px 0 rgba(0, 0, 0, .5);
  display: flex; gap: 12px; align-items: center;
  animation: pop .32s cubic-bezier(.3, 1.7, .5, 1);
}
.fact-bubble::after {
  content: ""; position: absolute; left: 26px; bottom: -13px;
  border: 14px solid transparent; border-top-color: var(--bubble); border-bottom: 0; border-left: 0;
}
.fact-thumb {
  flex: none; width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(0, 0, 0, .75); box-shadow: 0 2px 0 rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .15);
}
.fact-words { min-width: 0; }
.fact-tag { display: block; font-family: var(--vcr); font-weight: 400; font-size: 17px; letter-spacing: .06em; line-height: 1; margin-bottom: 4px; opacity: .8; }
/* "Back in 1984": the period, not the artist. Muted blue with an inked edge, like an old listings card */
.fact-bubble.year { --bubble: var(--year-bubble); border-radius: 14px; box-shadow: 4px 6px 0 rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(20, 40, 60, .25); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

#comment-box { display: flex; flex-direction: column; gap: 12px; }
.comment {
  display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.35;
  background: var(--glass-panel); backdrop-filter: blur(8px); border-radius: 14px; padding: 10px 12px;
  animation: rise .4s ease-out;
}
.comment p { margin: 0; }
.comment b { color: var(--yellow); }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; object-fit: cover; }
.avatar.letter { display: grid; place-items: center; color: #111; font-weight: 800; font-size: 14px; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- The dock ---------- */
#dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  padding: 0 26px;
}

#dock-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin-top: 14px; }

/* MTV/VH1-style lower third */
#banner { min-width: 0; }
.lower-third {
  display: inline-flex; max-width: 100%; align-items: stretch;
  background: var(--yellow); color: #111; border-radius: 3px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.now-tag { display: grid; place-items: center; padding: 0 12px; background: #111; color: var(--yellow); font-family: var(--vcr); font-size: 22px; }
.now-text { min-width: 0; display: flex; flex-direction: column; padding: 8px 16px 9px 14px; }
#now-artist, #now-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#now-artist { font-stretch: 78%; font-weight: 900; font-size: 22px; line-height: 1.1; }
#now-title { font-style: normal; font-stretch: 88%; font-weight: 500; font-size: 18px; line-height: 1.2; }
body.is-tuning #now-artist::after { content: "  ·  tuning…"; font-weight: 500; }

.banner-actions { display: flex; gap: 8px; justify-content: flex-end; }
.banner-actions button {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16);
  background: var(--glass-panel); backdrop-filter: blur(8px); font-size: 20px; line-height: 1;
}
.banner-actions button:hover { border-color: var(--yellow); }
#btn-fav { color: var(--heart); font-size: 24px; }
#btn-fav[aria-pressed="true"] { background: rgba(255, 59, 107, .22); border-color: var(--heart); }

/* Hi-fi playback buttons */
#controls { display: flex; align-items: center; gap: 18px; }
.hifi {
  position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; color: #1a1714;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 42%),
    conic-gradient(from 210deg, #d9d6d1, #9e9a93, #f0eeea, #8f8b85, #d9d6d1);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .55), inset 0 -3px 6px rgba(0, 0, 0, .25), inset 0 2px 2px rgba(255, 255, 255, .7), 0 0 0 4px #121014;
  transition: transform .12s ease;
}
.hifi svg { width: 24px; height: 24px; fill: currentColor; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .6)); }
.hifi:hover { transform: translateY(-2px); }
.hifi:active { transform: translateY(1px); }
.hifi.big { width: 78px; height: 78px; box-shadow: 0 6px 14px rgba(0, 0, 0, .55), inset 0 -3px 6px rgba(0, 0, 0, .25), inset 0 2px 2px rgba(255, 255, 255, .7), 0 0 0 4px #121014, 0 0 0 7px #2b2622; }
.hifi.big svg { width: 32px; height: 32px; }
body.is-playing .hifi.big { box-shadow: 0 6px 14px rgba(0, 0, 0, .55), inset 0 -3px 6px rgba(0, 0, 0, .25), inset 0 2px 2px rgba(255, 255, 255, .7), 0 0 0 4px #121014, 0 0 0 7px var(--led-on), 0 0 22px rgba(93, 255, 143, .35); }
body.is-buffering .hifi.big, body.is-tuning .hifi.big { animation: ring 1s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 6px 14px rgba(0, 0, 0, .55), 0 0 0 4px #121014, 0 0 0 7px var(--led-wait), 0 0 22px rgba(255, 176, 46, .4); } }

/* The big button shows what pressing it will do: play, pause, or turn the sound on */
#btn-play svg { display: none; }
#btn-play[data-mode="play"] .icon-play,
#btn-play[data-mode="pause"] .icon-pause,
#btn-play[data-mode="unmute"] .icon-unmute { display: block; }
#btn-play .icon-unmute { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#btn-play .icon-unmute path:first-child { fill: currentColor; }
/* Playing, but silent: a gentle yellow pulse says "press me for sound" */
#btn-play[data-mode="unmute"] { animation: wants-sound 1.8s ease-in-out infinite; }
@keyframes wants-sound {
  50% { box-shadow: 0 6px 14px rgba(0, 0, 0, .55), inset 0 -3px 6px rgba(0, 0, 0, .25), inset 0 2px 2px rgba(255, 255, 255, .7), 0 0 0 4px #121014, 0 0 0 7px var(--yellow), 0 0 26px rgba(255, 225, 77, .5); }
}

/* Sound and Lyrics: smaller smoked-glass keys either side of the chrome buttons, the same width */
.knob-btn {
  width: 72px; height: 42px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2);
  background: var(--glass-panel); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14px; font-weight: 700; padding: 0 10px;
}
.knob-btn:hover { border-color: var(--yellow); }
.knob-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.knob-btn svg path:first-child { fill: currentColor; stroke: none; }
#btn-sound .icon-sound { display: none; }
#btn-sound[aria-pressed="true"] .icon-sound { display: block; }
#btn-sound[aria-pressed="true"] .icon-muted { display: none; }
.led { width: 7px; height: 7px; border-radius: 50%; background: #3a3540; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6); flex: none; }
#btn-lyrics[aria-pressed="true"] .led { background: var(--led-on); box-shadow: 0 0 8px var(--led-on); }
/* This video has no captions: the key says so (struck through), and still works for the next video */
#btn-lyrics.none .lyrics-word { text-decoration: line-through; opacity: .55; }
#btn-lyrics.none[aria-pressed="true"] .led { background: var(--led-wait); box-shadow: 0 0 8px var(--led-wait); }

#admin-bar { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
#admin-bar[hidden] { display: none; }
#admin-bar button { border: 1px dashed var(--led-wait); background: rgba(0, 0, 0, .6); border-radius: 8px; padding: 5px 10px; font-size: 13px; color: var(--led-wait); }

/* ---------- Progress bar with a scrubber, along the very bottom ---------- */
#progress-row {
  display: flex; align-items: center; gap: 12px; margin: 10px -26px 0;
  padding: 0 26px max(6px, env(safe-area-inset-bottom));
}
.time { flex: none; font-family: var(--vcr); font-size: 18px; color: var(--dim); min-width: 42px; text-shadow: 0 1px 3px #000; }
#time-total { text-align: right; }
/* 30px tall to grab with a finger; the visible bar is only 4px */
#scrubber { position: relative; flex: 1; height: 30px; cursor: pointer; touch-action: none; border-radius: 4px; }
#scrubber .track { position: absolute; left: 0; right: 0; top: 13px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .16); overflow: hidden; }
#buffered { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 255, 255, .22); }
#progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--yellow); }
#knob {
  position: absolute; top: 15px; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #d9d6d1 45%, #8f8b85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .7), 0 0 0 2px var(--yellow);
  transition: transform .12s ease;
}
#scrubber:hover #knob, #scrubber.dragging #knob { transform: scale(1.3); }
#scrubber:hover .track, #scrubber.dragging .track { height: 6px; top: 12px; }

/* ---------- The tuner ---------- */
#tuner { max-width: 1060px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.rail-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rail {
  flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  scroll-behavior: smooth; cursor: grab; user-select: none; -webkit-user-select: none; padding: 4px 2px;
}
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { cursor: grabbing; scroll-behavior: auto; }
.paddle {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16);
  background: var(--glass-panel); font-size: 20px; line-height: 1;
}

/* Era: the glass window of an old radio dial, warmly backlit, with a red needle */
.dial {
  position: relative; padding: 4px 6px 0 4px; border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(255, 181, 71, .1), rgba(255, 181, 71, .02) 60%, rgba(0, 0, 0, .1)),
    rgba(14, 11, 9, .62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -8px 18px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .07), 0 4px 14px rgba(0, 0, 0, .35);
  backdrop-filter: blur(6px);
}
/* Engraved band label, like FM / MW */
.scale-label {
  flex: none; align-self: center; padding: 5px 8px 4px; border-radius: 4px;
  font-family: var(--body); font-stretch: 70%; font-weight: 800; font-size: 12px; letter-spacing: .28em; text-indent: .28em;
  color: rgba(246, 243, 238, .55); background: rgba(0, 0, 0, .35);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .06);
}
.scale {
  justify-content: space-between; padding-bottom: 16px;
  /* Long ticks at each decade, short ticks between, a fine baseline */
  background:
    repeating-linear-gradient(90deg, rgba(255, 228, 180, .5) 0 1px, transparent 1px 60px) left bottom / 100% 13px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 228, 180, .22) 0 1px, transparent 1px 12px) left bottom / 100% 6px no-repeat,
    linear-gradient(rgba(255, 228, 180, .3), rgba(255, 228, 180, .3)) left bottom / 100% 1px no-repeat;
}
.scale button {
  position: relative; flex: 1 0 auto; min-width: 58px; border: 0; background: none; color: rgba(255, 233, 196, .62);
  font-family: var(--vcr); font-size: 28px; line-height: 1; padding: 4px 8px; text-shadow: 0 2px 6px rgba(0, 0, 0, .8);
  transition: color .2s, text-shadow .2s;
}
.scale button:hover { color: #fff2d6; }
.scale button[aria-checked="true"] { color: var(--yellow); text-shadow: 0 0 12px rgba(255, 225, 77, .65), 0 0 2px rgba(255, 181, 71, .9); }
.scale button[aria-checked="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: -18px; width: 3px; height: 26px; margin-left: -1.5px;
  background: linear-gradient(#ff6b5b, #e42b2b); box-shadow: 0 0 8px #ff3b3b, 0 0 2px #fff; border-radius: 2px;
  animation: needle .35s cubic-bezier(.3, 1.6, .5, 1);
}
@keyframes needle { from { transform: scaleY(.3); opacity: .4; } to { transform: none; opacity: 1; } }

.switch { flex: none; display: flex; background: var(--glass-panel); backdrop-filter: blur(8px); border-radius: 999px; padding: 3px; border: 1px solid rgba(255, 255, 255, .14); }
.switch button { border: 0; background: none; border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 700; color: var(--dim); }
.switch button[aria-selected="true"] { background: var(--ink); color: #111; }

.pill {
  flex: none; border: 0; border-radius: 10px; padding: 10px 14px 10px 16px; white-space: nowrap;
  background: var(--panel); backdrop-filter: blur(8px); font-weight: 700; font-size: 15px;
  box-shadow: inset 4px 0 0 var(--accent);
}
.pill:hover { background: rgba(60, 54, 66, .85); }
.pill[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 35%, rgba(30, 26, 34, .85)); box-shadow: inset 4px 0 0 var(--accent), 0 0 0 2px var(--accent); }

#prompt-form { flex: 1; display: flex; gap: 8px; }
#prompt {
  flex: 1; min-width: 0; border: 1px solid rgba(255, 255, 255, .2); background: var(--glass-panel); backdrop-filter: blur(8px);
  color: var(--ink); border-radius: 999px; padding: 12px 18px; font: inherit; font-size: 16px;
}
#prompt::placeholder { color: rgba(246, 243, 238, .6); }
#prompt-form button { border: 0; border-radius: 999px; padding: 12px 20px; background: var(--yellow); color: #111; font-weight: 800; }
#prompt-chip { flex: none; display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .6); border: 1px solid var(--yellow); border-radius: 999px; padding: 6px 8px 6px 14px; font-weight: 700; max-width: 45%; }
#prompt-chip[hidden] { display: none; }
#prompt-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#prompt-chip button { border: 0; background: none; color: var(--yellow); font-size: 16px; }

/* ---------- Idle: after a few still seconds the controls fade so the video takes over.
   Banner, progress bar, facts and comments stay. Fading keeps the space, so nothing jumps.
   visibility: hidden (after the fade) stops hidden buttons being clicked or tabbed to. ---------- */
.top-actions, #controls, .banner-actions, #tuner, #admin-bar {
  transition: opacity .25s ease, visibility 0s;
}
body.idle .top-actions, body.idle #controls, body.idle .banner-actions, body.idle #tuner, body.idle #admin-bar {
  opacity: 0; visibility: hidden; transition: opacity var(--fade-out) ease, visibility 0s linear var(--fade-out);
}
body.idle, body.idle #screen { cursor: none; }

.heart {
  position: fixed; z-index: 30; font-size: 70px; color: var(--heart); pointer-events: none;
  transform: translate(-50%, -50%); animation: heart-up 1.1s ease-out forwards; text-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
@keyframes heart-up {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  25% { transform: translate(-50%, -60%) scale(1.15); }
  100% { transform: translate(-50%, -170%) scale(1); opacity: 0; }
}

/* ---------- Lyrics mode: captions showing. The picture moves up out from under the dock,
   the tuner steps aside, and the bottom scrim lightens so captions read clearly. ---------- */
body.lyrics-mode #tuner, body.lyrics-mode #admin-bar { display: none; }
body.lyrics-mode #glass { background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .12) 0 1px, transparent 1px 3px), linear-gradient(to bottom, rgba(0, 0, 0, .45), transparent 14%); }
body.lyrics-mode #dock { background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, .85) 30%); }

/* ---------- Sheets, help, toast, support ---------- */
.sheet {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 50; width: min(420px, 100%); overflow-y: auto;
  background: #141117; border-left: 1px solid rgba(255, 255, 255, .1); padding: 20px; box-shadow: -20px 0 60px rgba(0, 0, 0, .6);
}
.sheet[hidden] { display: none; }
.sheet header { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { margin: 0; font-size: 22px; }
.sheet h3 { font-size: 15px; color: var(--dim); margin: 22px 0 8px; }
.sheet-close { border: 0; background: #2a2530; width: 40px; height: 40px; border-radius: 50%; flex: none; }
.video-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.video-row { display: flex; gap: 10px; align-items: center; text-align: left; border: 0; background: #1e1a22; border-radius: 12px; padding: 8px; }
.video-row:hover { background: #2a2530; }
.video-row img { width: 80px; height: 45px; object-fit: cover; border-radius: 6px; flex: none; }
.video-row span { display: flex; flex-direction: column; min-width: 0; }
.video-row b, .video-row i { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-row i { font-style: normal; color: var(--dim); font-size: 14px; }
.placeholder { color: var(--dim); font-size: 14px; margin: 0; }
.toggle, .slider { display: flex; align-items: center; gap: 10px; margin: 16px 0; font-weight: 600; }
.toggle input { width: 20px; height: 20px; accent-color: var(--yellow); flex: none; }
.slider input { flex: 1; accent-color: var(--yellow); }
.hint { color: var(--dim); font-size: 14px; }
.sheet-links { margin-top: 26px; font-size: 14px; color: var(--dim); line-height: 1.8; }
#reset { margin-top: 10px; border: 1px solid var(--heart); background: none; color: var(--heart); border-radius: 999px; padding: 10px 16px; font-weight: 700; }

/* Help: a small card in the middle, like the station ident on an old TV guide page */
.sheet.modal {
  top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 0; border-radius: 18px;
  padding: 22px 24px 24px; background: #17131a; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 80px rgba(0, 0, 0, .7), inset 0 4px 0 var(--yellow);
}
.help-lead { font-family: var(--marker); font-size: 26px; color: var(--yellow); margin: 14px 0 6px; transform: rotate(-1.5deg); transform-origin: left; }
.modal p { line-height: 1.5; margin: 0 0 14px; }
.help-list { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 9px; }
.help-list li { display: flex; gap: 12px; align-items: center; font-size: 15px; line-height: 1.35; }
.help-icon {
  flex: none; width: 38px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  background: #241f29; font-size: 17px; color: var(--ink);
}
.dial-icon { font-family: var(--vcr); font-size: 19px; color: var(--yellow); box-shadow: inset 0 -3px 0 #e42b2b; }
.pill-icon::before { content: ""; width: 22px; height: 12px; border-radius: 4px; background: #3a3440; box-shadow: inset 3px 0 0 #5ce1ff; }
.heart-icon { color: var(--heart); }
.help-go { width: 100%; border: 0; border-radius: 999px; padding: 13px; background: var(--yellow); color: #111; font-weight: 800; font-size: 16px; }

#toast {
  position: fixed; left: 50%; top: 84px; transform: translate(-50%, -12px); z-index: 70;
  background: var(--ink); color: #111; padding: 12px 18px; border-radius: 14px; font-weight: 600;
  max-width: 90vw; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#support {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 80;
  width: min(420px, 90vw); background: #fff; color: #111; border-radius: 18px; padding: 20px; line-height: 1.45;
}
#support[hidden] { display: none; }
#support a { color: #1a4fd6; font-weight: 700; }
#support button { border: 0; background: #111; color: #fff; border-radius: 999px; padding: 9px 16px; }

/* ---------- Medium screens ---------- */
@media (max-width: 1200px) {
  .side { width: 290px; }
  #comments { width: 300px; }
}

/* ---------- Phones: video full screen, a compact dock at the bottom ---------- */
@media (max-width: 900px) {
  .top { padding: max(12px, env(safe-area-inset-top)) 12px 0; }
  #bug { width: 112px; }
  .top-actions { gap: 6px; }
  .top-actions button { padding: 8px 11px; font-size: 13px; }
  #btn-help { width: 34px; padding: 8px 0; }

  /* One extra at a time, floating just above the dock */
  .side { left: 12px; right: 12px; width: auto; bottom: calc(var(--dock) + 10px); max-height: 30vh; }
  #comments { width: auto; right: 12px; }
  #facts, #comments { display: none; }
  body.show-fact #facts { display: flex; }
  body.show-comment #comments { display: flex; }
  body.no-facts #facts, body.no-comments #comments { display: none; }
  body.lyrics-mode #facts, body.lyrics-mode #comments { display: none; }
  .side-close { right: -4px; }
  .fact-bubble { font-size: 15px; margin-bottom: 12px; padding: 10px 14px; gap: 10px; }
  .fact-thumb { width: 36px; height: 36px; }

  #dock { padding: 0 10px; }
  /* Buttons on their own row, dead centre; banner (with ♥ ⚑) right above the progress bar */
  #dock-top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "controls controls" "banner actions"; gap: 10px 8px; margin-top: 10px; }
  #banner { grid-area: banner; min-width: 0; }
  #controls { grid-area: controls; justify-self: center; gap: 10px; }
  .banner-actions { grid-area: actions; gap: 6px; }
  .lower-third { display: flex; }
  .now-tag { padding: 0 8px; font-size: 18px; }
  .now-text { padding: 6px 10px 7px; }
  #now-artist { font-size: 18px; }
  #now-title { font-size: 15px; }
  .hifi { width: 50px; height: 50px; }
  .hifi.big { width: 64px; height: 64px; }
  .hifi.big svg { width: 28px; height: 28px; }
  .knob-btn { width: 64px; height: 40px; font-size: 13px; padding: 0 8px; gap: 5px; }
  .knob-btn svg { width: 20px; height: 20px; }
  .banner-actions button { width: 42px; height: 42px; font-size: 18px; }
  #btn-share { display: none; }

  #progress-row { margin: 6px -10px 0; padding: 0 12px max(4px, env(safe-area-inset-bottom)); gap: 8px; }
  .time { font-size: 16px; min-width: 34px; }

  #tuner { gap: 8px; }
  .paddle { display: none; }
  .scale-label { font-size: 10px; padding: 4px 5px 3px; letter-spacing: .2em; text-indent: .2em; }
  .scale button { min-width: 48px; font-size: 24px; }
  .pill { padding: 9px 12px 9px 14px; font-size: 14px; }
  .switch button { padding: 6px 10px; font-size: 13px; }
  #prompt { padding: 11px 14px; font-size: 15px; }
  #prompt-chip { max-width: 40%; }

  .sheet { top: auto; left: 0; width: 100%; max-height: 80vh; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .1); border-radius: 20px 20px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .sheet.modal { top: 50%; left: 50%; bottom: auto; border-radius: 18px; max-height: calc(100vh - 32px); padding-bottom: 22px; }
}

/* Short landscape phones: one row of buttons and banner, no vibe box, and the controls
   fade on their own like a computer's. Facts appear only while the controls are hidden,
   sitting just above the banner. */
@media (max-height: 520px) and (orientation: landscape) {
  .top { padding-top: max(8px, env(safe-area-inset-top)); }
  #tuner { gap: 6px; }
  #tuner .rail-row:nth-child(3) { display: none; }
  .scale button { font-size: 21px; }
  .pill { padding: 7px 11px 7px 13px; }
  #dock-top { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "banner controls actions"; margin-top: 8px; }
  .hifi { width: 44px; height: 44px; }
  .hifi.big { width: 54px; height: 54px; }
  .knob-btn { width: 58px; height: 36px; }
  #progress-row { margin-top: 2px; }
  .side { bottom: 96px; max-height: 34vh; }
  body:not(.idle) #facts, body:not(.idle) #comments { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
