@font-face {
  font-family: "CG Mono";
  src: url("/fonts/roboto-mono-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-display: block;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --band: #c9cbce;
  --band-hi: #e2e3e5;
  --band-lo: #a9acb1;
  --blue: #1d4fe0;
  --blue-deep: #1640c2;
  --ink: #101010;
  --text: #f4f6ff;
  --shadow: #071660;
  --logo: #13379a;
  --chip: #c8102e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: #000;
  color: #ddd;
  font-family: Inter, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 4:3 picture, as big as the window allows */
.tv {
  position: relative;
  width: min(100vw, calc((100vh - 26px) * 4 / 3));
  width: min(100vw, calc((100dvh - 26px) * 4 / 3));
}
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  container-type: inline-size;
  background: var(--blue);
  overflow: hidden;
  user-select: none;
}
:fullscreen .tv, .tv:fullscreen { width: min(100vw, calc(100vh * 4 / 3)); }
.tv:fullscreen { display: flex; align-items: center; justify-content: center; background: #000; }
.tv:fullscreen .stage { width: min(100vw, calc(100vh * 4 / 3)); }
.tv:fullscreen + .credit { display: none; }

/* ---------- top band */
.band {
  position: absolute;
  inset: 0 0 auto 0;
  height: 24%;
  background: linear-gradient(180deg, var(--band-hi) 0%, var(--band) 55%, var(--band-lo) 100%);
  border-bottom: 0.35cqw solid #7e8288;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4.5cqw 0 8cqw;
}
.logo { height: 12cqw; width: auto; }
.logo-tile { fill: #0c0c0d; }
.logo-z { fill: #fff; }
.logo-word { font: 800 62px Inter, sans-serif; fill: #0c0c0d; letter-spacing: -2.5px; }
.logo-sub { font: 800 21px Inter, sans-serif; fill: var(--logo); letter-spacing: 9.4px; }
.clock {
  align-self: flex-start;
  margin-top: 5.2cqw;
  text-align: right;
  color: var(--ink);
  font: 500 2.75cqw/1.22 Inter, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ---------- blue field */
.blue {
  position: absolute;
  inset: 24% 0 0 0;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue) 70%, var(--blue-deep) 100%);
}
.screen {
  position: absolute;
  left: 11%;
  right: 6%;
  top: 9%;
  height: calc(6 * 5.6cqw);
  overflow: hidden;
}
.rows { will-change: transform; }
.rows.roll { transition: transform 160ms linear; }
.row {
  height: 5.6cqw;
  white-space: pre;
  font: 600 4.15cqw/5.6cqw "CG Mono", ui-monospace, monospace;
  color: var(--text);
  text-shadow: 0.32cqw 0.32cqw 0 var(--shadow), 0 0 0.5cqw rgba(255, 255, 255, 0.25);
  letter-spacing: 0.02em;
}

/* ---------- Claude spark: a station bug, and an ident card between some segments */
.spark-rays { stroke: #d97757; stroke-width: 8.5; stroke-linecap: round; fill: none; }
.bug {
  position: absolute;
  right: 3.2%;
  bottom: 23.5%;
  width: 5.2cqw;
  height: 5.2cqw;
  opacity: 0.8;
  filter: drop-shadow(0.25cqw 0.25cqw 0 rgba(7, 22, 96, 0.8));
  animation: bug-turn 24s linear infinite;
}
@keyframes bug-turn { to { transform: rotate(360deg); } }
.ident {
  position: absolute;
  inset: 0 0 21% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3cqw;
  background: var(--blue);
}
.ident-spark {
  width: 17cqw;
  height: 17cqw;
  filter: drop-shadow(0.5cqw 0.5cqw 0 var(--shadow));
  animation: ident-in 3.6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes ident-in {
  0% { transform: scale(0.2) rotate(-120deg); opacity: 0; }
  25% { transform: scale(1) rotate(0deg); opacity: 1; }
  85% { transform: scale(1) rotate(40deg); opacity: 1; }
  100% { transform: scale(1.05) rotate(50deg); opacity: 0; }
}
.ident-text {
  white-space: pre;
  text-align: center;
  font: 600 3.4cqw/1.4 "CG Mono", ui-monospace, monospace;
  color: var(--text);
  text-shadow: 0.3cqw 0.3cqw 0 var(--shadow);
  min-height: 9.6cqw;
}

/* ---------- crawl */
.crawl {
  position: absolute;
  left: 0;
  right: 0;
  top: 84.5%;
  height: 7.4%;
  background: #000;
  overflow: hidden;
  border-top: 0.25cqw solid #050505;
}
.crawl-track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: pre;
  font: 800 4.5cqw/1 Inter, sans-serif;
  letter-spacing: 0.01em;
  color: #fff;
  will-change: transform;
}
.foot { position: absolute; left: 0; right: 0; top: 91.9%; bottom: 0; background: var(--blue-deep); }

/* ---------- CRT glass: scan lines, vignette, a touch of bloom */
.glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0) 45%, rgba(0,0,0,0.38) 100%),
    repeating-linear-gradient(180deg, rgba(0,0,0,0.16) 0 1px, rgba(0,0,0,0) 1px 3px);
  mix-blend-mode: multiply;
}
.nocrt .glass { display: none; }
.stage .band, .stage .blue, .stage .crawl { filter: saturate(1.08) contrast(1.02); }

/* ---------- tune-in card */
.tune {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 7cqw;
}
.tune form { width: 78%; }
.tune-label {
  display: block;
  font: 600 4.15cqw/1.3 "CG Mono", monospace;
  color: var(--text);
  text-shadow: 0.32cqw 0.32cqw 0 var(--shadow);
  margin-bottom: 2cqw;
}
.tune-row { display: flex; gap: 2cqw; }
.tune input {
  flex: 1;
  min-width: 0;
  font: 600 3.6cqw/1 "CG Mono", monospace;
  text-transform: uppercase;
  padding: 1.6cqw 2cqw;
  background: #0b2a8f;
  color: #fff;
  border: 0.4cqw solid #e9edff;
  border-radius: 0;
  outline: none;
  caret-color: #fff;
}
.tune input::placeholder { color: rgba(255,255,255,0.4); }
.tune input:focus { border-color: #ffe14d; }
.tune button, .remote button {
  font: 800 3.1cqw/1 Inter, sans-serif;
  letter-spacing: 0.04em;
  padding: 1.6cqw 3cqw;
  background: linear-gradient(180deg, var(--band-hi), var(--band-lo));
  color: var(--logo);
  border: 0.35cqw solid #fff;
  border-radius: 0;
  cursor: pointer;
}
.tune button:focus-visible, .remote button:focus-visible { outline: 0.4cqw solid #ffe14d; outline-offset: 0.4cqw; }
.tune button:disabled { opacity: 0.6; cursor: wait; }
.suggest {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0.35cqw solid #e9edff;
  border-top: 0;
  background: #0b2a8f;
  max-height: 23cqw;
  overflow-y: auto;
  position: relative;
  z-index: 2;
}
.suggest li {
  font: 600 3cqw/1.2 "CG Mono", monospace;
  color: #fff;
  padding: 1.1cqw 2cqw;
  cursor: pointer;
  text-transform: uppercase;
}
.suggest li[aria-selected="true"], .suggest li:hover { background: #ffe14d; color: #0b2a8f; }
.tune-msg {
  font: 600 3cqw/1.3 "CG Mono", monospace;
  color: #ffe14d;
  margin: 1.6cqw 0 0;
  min-height: 4cqw;
}
.tune-hint {
  font: 600 2.55cqw/1.5 "CG Mono", monospace;
  color: rgba(244, 246, 255, 0.82);
  text-shadow: 0.25cqw 0.25cqw 0 var(--shadow);
  margin: 2.5cqw 0 0;
}

/* ---------- remote (on-screen buttons; fade out when idle) */
.remote {
  position: absolute;
  right: 1.2cqw;
  bottom: 0.9cqw;
  display: flex;
  gap: 1cqw;
  z-index: 5;
  transition: opacity 400ms;
  container-type: normal;
}
.remote button { font-size: clamp(10px, 1.5vw, 14px); padding: 6px 10px; border-width: 2px; }
.tv.idle .remote { opacity: 0; pointer-events: none; }
.tv.idle { cursor: none; }

.credit {
  margin: 6px 16px 0;
  font: 400 11px/1.3 Inter, sans-serif;
  color: #6c7078;
  text-align: center;
}
.credit a { color: #8e939c; }

@media (max-width: 560px) {
  .remote { position: static; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
  .tv.idle .remote { opacity: 1; pointer-events: auto; }
  .tv { width: 100vw; }
  .tune form { width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
  .rows.roll { transition: none; }
  .bug, .ident-spark { animation: none; }
}
