/* video.sala.company — 70s wood-panel TV + 80s/90s cable guide.
   Desktop: cabinet left, guide right. Phone: no cabinet, video on top, guide below. */
:root {
  --room: #17110c;
  --room2: #21180f;
  --wood1: #6b3f22; --wood2: #7a4a29; --wood3: #5e361c; --wood4: #82512e; --wood-edge: #3d2210;
  --guide: #14106b;
  --guide-deep: #0b0846;
  --row1: #221aa0;
  --row2: #1c1590;
  --num: #3b2fd1;
  --hi: #ffe14d;          /* cable-guide yellow */
  --osd: #7dff8a;         /* on-screen green */
  --text: #f1eee6;
  --muted: #b7b2c9;
  --good: #42ff6b;
  --warn: #ffb03b;
  --bad: #ff5a4f;
  --blocked: #a7a9d6;
  --untested: #7d80c4;
  --pixel: 'VT323', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--room) repeating-linear-gradient(90deg, var(--room) 0 28px, var(--room2) 28px 56px);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
}
button, select, input, textarea {
  font: inherit; color: inherit; background: var(--row2);
  border: 2px solid var(--num); border-radius: 4px; padding: 5px 10px;
}
select option, select optgroup { background: var(--guide); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--untested); }
button, .filebtn { cursor: pointer; }
button:hover, .filebtn:hover { border-color: var(--hi); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .ch:focus-visible { outline: 3px solid var(--hi); outline-offset: 1px; }
button:disabled { opacity: .4; cursor: default; border-color: var(--num); }
button.primary { background: var(--hi); border-color: var(--hi); color: var(--guide); font-weight: 600; }
button.danger { color: var(--bad); }
button.on { background: var(--hi); border-color: var(--hi); color: var(--guide); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; gap: 8px; align-items: center; padding: 8px 14px;
  background: var(--guide-deep); border-bottom: 3px solid var(--hi);
}
.brand { font: 30px/1 var(--pixel); color: var(--hi); letter-spacing: .04em; white-space: nowrap; display: flex; align-items: center; gap: 8px; margin-right: 6px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 8px var(--bad); }
#playlistSelect { min-width: 0; max-width: 300px; flex: 0 1 auto; }
.topbar button { white-space: nowrap; flex: none; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; padding: 18px; min-height: 0; }
.stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow-y: auto; }

/* ---------- wood cabinet ---------- */
.cabinet {
  display: flex; gap: 16px; padding: 20px; border-radius: 24px; flex: none;
  background: repeating-linear-gradient(92deg, var(--wood1) 0 6px, var(--wood2) 6px 9px, var(--wood3) 9px 15px, var(--wood4) 15px 18px);
  box-shadow: inset 0 0 0 3px var(--wood-edge), inset 0 -12px 30px rgba(0,0,0,.35), 0 18px 30px -14px rgba(0,0,0,.7);
}
.bezel {
  flex: 1; min-width: 0; padding: 14px; border-radius: 18px; background: #1d1a17; box-shadow: inset 0 0 0 2px #000, inset 0 0 18px rgba(0,0,0,.9);
  display: flex; flex-direction: column; gap: 12px;
}
.video-wrap { position: relative; background: #000; width: 100%; aspect-ratio: 16 / 9; max-height: 64vh; border-radius: 22px / 18px; overflow: hidden; flex: none; }

/* VCR-style display under the picture: live info, grows into whatever space the cabinet has */
.vfd {
  --vfd: #62f0ff;
  flex: 1; min-height: 64px; display: grid; gap: 4px 6px; align-content: center;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  padding: 8px 10px; border-radius: 8px;
  background: #071012; box-shadow: inset 0 0 0 2px #000, inset 0 0 22px rgba(0, 200, 230, .07);
  font-family: var(--pixel); color: var(--vfd);
}
.vfd-cell {
  display: flex; flex-direction: column; min-width: 0; padding: 3px 8px; text-align: left;
  border: 1px solid rgba(98, 240, 255, .14); border-radius: 4px; background: transparent; font: inherit; color: inherit;
}
.vfd-k { font-size: 14px; line-height: 1; letter-spacing: .1em; color: rgba(98, 240, 255, .55); }
.vfd-cell b { font-weight: normal; font-size: 22px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 6px rgba(98, 240, 255, .55); }
.vfd-main, .vfd-next { grid-column: span 2; }
.vfd-main b { color: var(--hi); text-shadow: 0 0 6px rgba(255, 225, 77, .5); }
button.vfd-cell { cursor: pointer; }
button.vfd-cell:hover { border-color: var(--vfd); background: rgba(98, 240, 255, .06); }
.vfd .lvl-good { color: var(--good); text-shadow: 0 0 6px rgba(66, 255, 107, .5); }
.vfd .lvl-warn { color: var(--warn); text-shadow: 0 0 6px rgba(255, 176, 59, .5); }
.vfd .lvl-bad { color: var(--bad); text-shadow: 0 0 6px rgba(255, 90, 79, .5); }
.vfd .lvl-blocked { color: var(--blocked); }
.vfd.standby b { opacity: .45; }
video { width: 100%; height: 100%; display: block; background: #000; }
/* scanlines + glass curve; never block clicks on the video controls */
.fx .video-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,.45) 100%);
}
.knobs {
  width: 104px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 0; background: #2a2420; border-radius: 12px; box-shadow: inset 0 0 0 2px #120e0b;
}
.knob-lbl { font: 18px var(--pixel); color: #d8c7ae; letter-spacing: .12em; }
.dial {
  width: 78px; height: 78px; border-radius: 50%; position: relative; cursor: pointer; flex: none;
  background: conic-gradient(from 0deg, #d9d4cc, #9d978f, #e8e4dc, #8f8981, #d9d4cc);
  box-shadow: 0 4px 0 #0c0a08, inset 0 0 0 4px #bdb7ad; transition: transform .35s ease-out;
}
.dial::after { content: ""; position: absolute; left: 50%; top: 6px; width: 6px; height: 24px; margin-left: -3px; background: #3a2c22; border-radius: 3px; }
.knob {
  width: 64px; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0 4px;
  border-radius: 10px; border: none; color: #2a2420;
  background: linear-gradient(#efe9df, #a9a39a); box-shadow: 0 3px 0 #0c0a08;
}
.knob b { font-size: 18px; line-height: 1.1; }
.knob small { font: 15px/1 var(--pixel); letter-spacing: .06em; }
.knob:hover { background: linear-gradient(#fff8ea, #bdb6ab); }
.knob:active { transform: translateY(2px); box-shadow: 0 1px 0 #0c0a08; }
.knob.on { background: linear-gradient(var(--hi), #c9a91c); color: var(--guide); }
.grille { width: 74px; flex: 1; min-height: 40px; max-height: 120px; border-radius: 8px; background: repeating-linear-gradient(to bottom, #120e0b 0 3px, #3c3029 3px 6px); }

/* test pattern, static, on-screen display, messages */
.testcard { position: absolute; inset: 0; display: grid; grid-template-rows: 66% 9% 25%; z-index: 1; }
.testcard > div { display: grid; }
.bars, .bars2 { grid-template-columns: repeat(7, 1fr); }
.bars3 { grid-template-columns: 1.25fr 1.25fr 1.25fr 3.25fr; }
.bars i:nth-child(1){background:#c0c0c0}.bars i:nth-child(2){background:#c0c000}.bars i:nth-child(3){background:#00c0c0}.bars i:nth-child(4){background:#00c000}.bars i:nth-child(5){background:#c000c0}.bars i:nth-child(6){background:#c00000}.bars i:nth-child(7){background:#0000c0}
.bars2 i:nth-child(1){background:#0000c0}.bars2 i:nth-child(2){background:#131313}.bars2 i:nth-child(3){background:#c000c0}.bars2 i:nth-child(4){background:#131313}.bars2 i:nth-child(5){background:#00c0c0}.bars2 i:nth-child(6){background:#131313}.bars2 i:nth-child(7){background:#c0c0c0}
.bars3 i:nth-child(1){background:#00214c}.bars3 i:nth-child(2){background:#fff}.bars3 i:nth-child(3){background:#32006a}.bars3 i:nth-child(4){background:#131313}
.testcard-label {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  background: #000; color: #fff; padding: 6px 22px; font: 40px/1 var(--pixel); letter-spacing: .1em; text-align: center; border: 3px solid #fff;
}
.testcard-label small { display: block; font-size: 20px; letter-spacing: .06em; color: #ccc; margin-top: 4px; }
.snow { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; image-rendering: pixelated; opacity: .85; }
.snow.dim { opacity: .35; }
.osd {
  position: absolute; top: 14px; right: 20px; z-index: 4; pointer-events: none; text-align: right;
  font: 44px/1 var(--pixel); color: var(--osd); text-shadow: 2px 2px 0 #000, 0 0 8px rgba(60,200,80,.6);
  opacity: 0; transition: opacity .4s;
}
.osd small { display: block; font-size: 24px; }
.osd.on { opacity: 1; }
.overlay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  background: rgba(20, 16, 107, .94); border: 3px solid var(--hi); border-radius: 6px;
  padding: 12px 18px; max-width: 90%; text-align: center; font: 24px/1.15 var(--pixel); letter-spacing: .02em;
}
.overlay b { color: var(--hi); font-weight: normal; font-size: 28px; }
.overlay .muted { color: var(--text); opacity: .85; font-size: 20px; }
.overlay .acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.overlay .acts button { font: 20px/1 var(--pixel); background: var(--hi); color: var(--guide); border-color: var(--hi); padding: 6px 12px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 8px; border-radius: 50%;
  border: 3px solid var(--num); border-top-color: var(--hi); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- now playing ---------- */
.now {
  display: flex; gap: 14px; align-items: center; padding: 12px 14px; flex-wrap: wrap;
  background: var(--guide); border: 3px solid var(--guide-deep); border-radius: 8px;
}
.now-logo { width: 52px; height: 52px; display: grid; place-items: center; background: #0b0d11; border-radius: 6px; flex: none; }
#nowLogo { max-width: 48px; max-height: 48px; object-fit: contain; }
.now-text { flex: 1; min-width: 180px; }
#nowName { font: 34px/1 var(--pixel); color: var(--hi); letter-spacing: .03em; }
#nowMeta { margin-top: 2px; }
#sourceSel { margin-top: 8px; max-width: 100%; }
.rate { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 0 2px; }
.rate-lbl { font: 20px var(--pixel); color: var(--hi); margin-right: 4px; letter-spacing: .04em; }
.stats { padding: 10px 14px; font-size: 13px; background: rgba(11, 8, 70, .7); border-radius: 8px; }
.stats div { margin: 2px 0; }

/* ---------- cable guide ---------- */
.guide {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--guide); border-radius: 10px; box-shadow: 0 0 0 5px var(--guide-deep), 0 18px 30px -14px rgba(0,0,0,.7);
}
.guide-head { display: flex; justify-content: space-between; align-items: center; padding: 3px 10px; background: var(--hi); color: var(--guide); font: 24px/1 var(--pixel); letter-spacing: .06em; }
.guide-head .count { font-size: 19px; }
.filters { padding: 6px; display: flex; flex-direction: column; gap: 5px; background: var(--guide-deep); }
.filters input, .filters select, .filters button { padding: 3px 6px; font-size: 13px; }
.frow { display: flex; gap: 5px; align-items: center; }
.frow select { flex: 1; min-width: 0; }
#search { flex: 1; min-width: 0; }
#testBtn { white-space: nowrap; }

.list { flex: 1; overflow-y: auto; position: relative; scrollbar-color: var(--num) var(--guide-deep); }
#listInner { position: relative; }
.ch {
  position: absolute; left: 0; right: 0; height: 74px;
  display: flex; align-items: center; gap: 0; cursor: pointer; border-top: 2px solid var(--guide-deep);
  font-family: var(--pixel);
}
.ch-num { width: 62px; align-self: stretch; display: grid; place-items: center; background: var(--num); font-size: 24px; flex: none; }
.ch-body { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 10px; background: var(--row1); }
.ch:nth-child(even) .ch-body { background: var(--row2); }
.ch:hover .ch-body { background: #2c23b8; }
.ch.active .ch-num, .ch.active .ch-body { background: var(--hi); color: var(--guide); }
.ch.active .grp, .ch.active .badge, .ch.active .badge i { color: var(--guide); }
.logo {
  width: 38px; height: 38px; flex: none; border-radius: 4px; overflow: hidden;
  background: #0b0d11; display: grid; place-items: center; color: #3a4150; font-size: 15px;
}
.logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.info { flex: 1; min-width: 0; }
/* Name wraps onto up to two lines; anything longer ends in "…" (full name in the tooltip). */
.name {
  font-size: 21px; line-height: .95; text-transform: uppercase; letter-spacing: .02em;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere;
}
.meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0; }
.grp { color: var(--muted); font-size: 16px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.star { background: none; border: none; font-size: 20px; padding: 4px 6px; color: var(--untested); font-family: system-ui; }
.star:hover { color: var(--hi); }
.star.on { color: var(--hi); }
.ch.active .star, .ch.active .star.on { color: var(--guide); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); font: 22px var(--pixel); }
.empty button { margin-top: 12px; font: 20px var(--pixel); }

/* signal-strength badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font: 17px/1 var(--pixel); color: var(--muted); white-space: nowrap; }
.badge i { font-style: normal; letter-spacing: 1px; color: var(--untested); }
.badge.good, .badge.good i { color: var(--good); }
.badge.warn, .badge.warn i { color: var(--warn); }
.badge.bad, .badge.bad i { color: var(--bad); }
.badge.blocked, .badge.blocked i { color: var(--blocked); }
#nowMeta .badge { font-size: 19px; }

/* One slim footer line: test progress (while testing) + compact legend */
.guide-foot {
  display: flex; align-items: center; gap: 10px; padding: 3px 8px; overflow: hidden; white-space: nowrap;
  background: var(--guide-deep); border-top: 2px solid var(--guide); font: 15px/1.2 var(--pixel);
}
#testProgress { color: var(--hi); flex: none; }
#testProgress:empty { display: none; }
.legend { display: flex; gap: 10px; flex: 1; min-width: 0; overflow: hidden; justify-content: space-between; }
.legend .badge { font-size: 15px; gap: 3px; }
.legend .badge i { letter-spacing: 0; }
.help {
  display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 4px; vertical-align: 2px;
  border-radius: 50%; background: var(--guide); color: var(--hi); font-size: 17px; cursor: help;
}

/* ---------- dialogs ---------- */
dialog {
  background: var(--guide); color: var(--text); border: 3px solid var(--hi); border-radius: 8px;
  padding: 18px; width: min(520px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(5, 3, 30, .75); }
dialog h3 { margin: 4px 0 8px; font: 30px/1 var(--pixel); color: var(--hi); font-weight: normal; letter-spacing: .04em; }
dialog h3 + p { margin-top: 0; }
dialog label { display: block; margin: 12px 0 4px; color: var(--muted); }
dialog label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
dialog input[type=text], dialog input[type=url], dialog input[type=number], dialog textarea, dialog select { width: 100%; }
dialog a { color: var(--hi); }
dialog textarea { min-height: 80px; font: 12px/1.4 ui-monospace, Consolas, monospace; }
.filebtn { display: inline-block; margin: 0 !important; color: var(--text) !important; background: var(--row2); border: 2px solid var(--num); border-radius: 4px; padding: 5px 10px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.err { color: var(--bad); min-height: 1em; margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  background: var(--guide); border: 3px solid var(--hi); border-radius: 6px; padding: 6px 16px;
  font: 22px var(--pixel); letter-spacing: .02em;
}

@media (prefers-reduced-motion: reduce) {
  .dial, .osd { transition: none; }
  .spinner { animation-duration: 2.4s; }
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* ---------- phone: no cabinet, video on top, controls strip, guide below ---------- */
@media (max-width: 820px) {
  body { height: auto; min-height: 100%; background: var(--guide-deep); }
  .topbar { padding: 6px 10px; gap: 6px; }
  .brand { font-size: 24px; } .brand-dot { display: none; }
  .layout { display: block; padding: 0; }
  .stage { display: contents; }
  .cabinet {
    position: sticky; top: 0; z-index: 6; flex-direction: column; gap: 0; padding: 0; border-radius: 0;
    background: #000; box-shadow: none;
  }
  .bezel { padding: 0; border-radius: 0; background: #000; box-shadow: none; gap: 0; }
  /* phone: one slim line with the essentials, so the pinned player stays small */
  .vfd { flex: none; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0 4px; padding: 3px 6px; border-radius: 0; }
  .vfd-main, .vfd-next, .vfd-clock, .vfd-cell:nth-child(3), .vfd-cell:nth-child(4), .vfd-cell:nth-child(6), .vfd-cell:nth-child(7) { display: none; }
  .vfd-cell { flex-direction: row; align-items: baseline; gap: 4px; padding: 0 4px; border: none; }
  .vfd-k { font-size: 12px; }
  .vfd-cell b { font-size: 17px; }
  .video-wrap { max-height: none; border-radius: 0; }
  .knobs { width: auto; flex-direction: row; justify-content: space-around; padding: 4px 6px; gap: 4px; border-radius: 0; background: var(--row1); box-shadow: none; }
  .knob-lbl, .dial, .grille { display: none; }
  .knob { width: auto; flex: 1; flex-direction: row; justify-content: center; gap: 6px; padding: 6px 0; border-radius: 4px; background: var(--row2); color: var(--hi); box-shadow: none; border: 2px solid var(--num); }
  .knob:hover { background: var(--row2); }
  .knob b { font-size: 16px; }
  .now, .rate, .stats { margin: 10px 10px 0; }
  .now { padding: 10px; }
  #nowName { font-size: 28px; }
  .testcard-label { font-size: 30px; } .testcard-label small { font-size: 16px; }
  .osd { font-size: 34px; top: 8px; right: 12px; } .osd small { font-size: 18px; }
  .guide { margin: 12px 0 0; border-radius: 0; box-shadow: none; }
  .list { height: 62vh; flex: none; }
  .ch-num { width: 50px; font-size: 20px; }
}

/* guide highlight for keyboard / remote navigation */
.ch.cursor .ch-body, .ch.cursor .ch-num { box-shadow: inset 0 0 0 3px var(--hi); }
.ch.cursor:not(.active) .ch-body { background: #3127c4; }
.list:focus { outline: none; }
.list:focus-visible { box-shadow: inset 0 0 0 2px var(--hi); }
/* playlist warnings: geo-blocked, part-time */
.tag { font: 14px/1 var(--pixel); color: var(--hi); border: 1px solid currentColor; border-radius: 3px; padding: 1px 4px; letter-spacing: .04em; flex: none; }
.ch.active .tag { color: var(--guide); }
#nowMeta .tag { font-size: 16px; vertical-align: 2px; }

/* Broken / offline / blocked channels: a dead, greyed-out row. Working and untested stay guide blue. */
.ch.dead .ch-num { background: #4a4a56; color: #b4b4bf; }
.ch.dead .ch-body { background: #3a3a45; color: #a9a9b4; }
.ch.dead:nth-child(even) .ch-body { background: #34343e; }
.ch.dead:hover .ch-body { background: #44444f; }
.ch.dead .grp { color: #8d8d99; }
.ch.dead .logo img { filter: grayscale(1); opacity: .55; }
.ch.dead .star:not(.on) { color: #6c6c78; }
.ch.dead.cursor:not(.active) .ch-body { background: #4a4a56; }

/* Every row starts grey; it turns guide blue once it has proven to stream well. */
.ch.lit .ch-body, .ch.lit .ch-num { animation: lightup 1.2s ease-out both; animation-delay: var(--lit-delay, 0ms); }
@keyframes lightup {
  0%   { background-color: #3a3a45; box-shadow: inset 0 0 0 2px var(--good); }
  60%  { box-shadow: inset 0 0 0 2px var(--good); }
}
/* While the tester works on a row */
.badge.checking { color: var(--hi); }
.badge.queued, .badge.queued i { color: #9a9ab0; }
.mini-spin {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none;
  border: 2px solid rgba(255, 225, 77, .3); border-top-color: var(--hi); animation: spin .8s linear infinite;
}
.ch.checking .ch-num { animation: numpulse 1s ease-in-out infinite; }
@keyframes numpulse { 50% { color: var(--hi); } }
/* Scanning bar above the guide while channels are being checked */
.scanbar { height: 3px; background: var(--guide-deep); position: relative; overflow: hidden; flex: none; }
.scanbar.on::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 35%; left: -35%;
  background: linear-gradient(90deg, transparent, var(--hi), transparent);
  animation: scan 1.3s linear infinite;
}
@keyframes scan { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .ch.lit .ch-body, .ch.lit .ch-num, .ch.checking .ch-num { animation: none; }
  .scanbar.on::after { animation: none; left: 0; width: 100%; opacity: .6; }
  .mini-spin { animation-duration: 2.4s; }
}

/* Header name: full "video.sala.company" on desktop, the domain part slightly quieter */
.brand-dom { color: #c9b54a; }
.testcard-label { white-space: nowrap; }
@media (max-width: 820px) {
  .brand { font-size: 20px; letter-spacing: 0; }
  .brand-dom { font-size: 15px; }
  .testcard-label { font-size: 22px; padding: 5px 12px; }
}
@media (max-width: 820px) {
  /* phone: the name gets its own line so the playlist controls fit beside each other */
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .brand { flex-basis: 100%; font-size: 22px; }
  .brand-dom { font-size: inherit; }
  #playlistSelect { flex: 1 1 0; width: 0; max-width: none; }
  .topbar .spacer { display: none; }
}

/* Header icon: the old-style TV (same as the favicon) */
.brand-icon { width: 30px; height: 30px; flex: none; }
@media (max-width: 820px) { .brand-icon { width: 24px; height: 24px; } }

/* Sleep timer knob: countdown fits on the knob face */
#sleepBtn small { font-size: 14px; letter-spacing: .02em; }

/* Country flags: Windows has no flag emojis, so load a flags-only font (used only for flag characters) */
@font-face {
  font-family: 'Twemoji Country Flags';
  src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.8/dist/TwemojiCountryFlags.woff2') format('woff2');
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
  font-display: swap;
}
body, button, select, input, textarea { font-family: 'Twemoji Country Flags', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root { --pixel: 'Twemoji Country Flags', 'VT323', ui-monospace, Consolas, monospace; }
.flag { margin-right: .35em; font-size: .9em; vertical-align: 1px; }
/* sort sits beside the search box now */
#sortSel.sort { flex: 0 1 auto; width: auto; min-width: 0; max-width: 34%; }

/* ---------- compact guide rows (more channels on screen, same readability) ---------- */
.ch { height: 58px; }
.ch-num { width: 50px; font-size: 20px; }
.ch-body { gap: 8px; padding: 0 2px 0 8px; }
.logo { width: 32px; height: 32px; }
.name { font-size: 19px; line-height: .92; }
.meta { margin-top: 2px; gap: 6px; }
.grp { font-size: 15px; }
.badge { font-size: 15px; gap: 4px; }
.star { font-size: 18px; padding: 2px 6px; }
/* drawn signal meter: 4 rising bars, unlit ones dimmed */
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; flex: none; font-style: normal; }
.sig b { width: 3px; border-radius: 1px; background: currentColor; }
.sig b:nth-child(1) { height: 4px; } .sig b:nth-child(2) { height: 6px; }
.sig b:nth-child(3) { height: 8px; } .sig b:nth-child(4) { height: 11px; }
.sig b.off { opacity: .28; }
.sig-x { height: auto; font: 12px/1 system-ui, sans-serif; }
.legend .sig { height: 9px; } .legend .sig b:nth-child(4) { height: 9px; } .legend .sig b:nth-child(3) { height: 7px; }
#nowMeta .sig { height: 13px; } #nowMeta .sig b:nth-child(4) { height: 13px; } #nowMeta .sig b:nth-child(3) { height: 10px; }
@media (max-width: 820px) { .ch-num { width: 44px; font-size: 18px; } }

/* ---------- compact VCR display (all 9 fields, 3 columns) + slimmer knob column ---------- */
@media (min-width: 821px) {
  .vfd { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 4px; padding: 5px 6px; min-height: 0; }
  .vfd-main { grid-column: span 2; }
  .vfd-clock { order: 1; }                    /* TIME joins ON FOR and SOURCE on one row */
  .vfd-next { order: 2; grid-column: 1 / -1; } /* NEXT gets the full last row */
  .vfd-cell { padding: 2px 6px; }
  .vfd-k { font-size: 11px; }
  .vfd-cell b { font-size: 17px; line-height: 1.05; }
  .vfd-main b { font-size: 18px; }
  .bezel { gap: 8px; padding: 12px; }
  .knobs { gap: 7px; padding: 9px 0; }
  .knob-lbl { font-size: 16px; }
  .dial { width: 62px; height: 62px; }
  .dial::after { top: 5px; height: 19px; }
  .knob { padding: 4px 0 3px; }
  .knob b { font-size: 15px; }
  .grille { min-height: 0; }
}
/* drawn meters inside the VCR display */
.vfd .sig { height: 12px; vertical-align: -1px; }
.vfd .sig b:nth-child(4) { height: 12px; } .vfd .sig b:nth-child(3) { height: 9px; }
.bufm { display: inline-flex; gap: 2px; vertical-align: 0; font-style: normal; }
.bufm b { width: 6px; height: 11px; border-radius: 1px; background: currentColor; }
.bufm b.off { opacity: .22; }
@media (max-width: 820px) { .bufm b { width: 5px; height: 10px; } }
