:root {
  --night: #16142d;
  --deck: #201e3e;
  --deck-2: #2b2852;
  --line: #3b3769;
  --ink: #f4f1e8;
  --dim: #b9b5d6;
  --faint: #9692bd;
  --live: #ff4d5e;
  --focus: #f2d21b;
  --ok: #6fd391;
  --warn: #f2c14b;
  --bar-1: #cfcfcf;
  --bar-2: #f2d21b;
  --bar-3: #22c3d6;
  --bar-4: #3dbb5c;
  --bar-5: #d34fae;
  --bar-6: #ec4b4f;
  --bar-7: #4f72ec;

  --font-display: "DIN Condensed", "DIN Alternate", "Bahnschrift Condensed", "Bahnschrift", "D-DIN Condensed", "Barlow Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-num: "DIN Alternate", "Bahnschrift", "D-DIN", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --page: 1180px;
  --band-h: clamp(30px, 2.6vw + 14px, 42px);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.005em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

a:hover {
  text-decoration-color: currentColor;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 40;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--focus);
  color: #111;
}

.skip:focus {
  top: 8px;
}

/* Brand */

.wordmark,
.bug {
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.01em;
}

.wordmark-dash {
  display: inline-block;
  margin: 0 0.04em;
}

.bars {
  display: flex;
  height: 4px;
}

.bars i {
  flex: 1;
}

.bars i:nth-child(1) { background: var(--bar-1); }
.bars i:nth-child(2) { background: var(--bar-2); }
.bars i:nth-child(3) { background: var(--bar-3); }
.bars i:nth-child(4) { background: var(--bar-4); }
.bars i:nth-child(5) { background: var(--bar-5); }
.bars i:nth-child(6) { background: var(--bar-6); }
.bars i:nth-child(7) { background: var(--bar-7); }

/* Top bar */

.topbar {
  max-width: var(--page);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 44px);
}

.brand {
  display: inline-grid;
  gap: 3px;
  text-decoration: none;
}

.brand .wordmark {
  font-size: 2rem;
  line-height: 0.9;
}

.nav {
  display: flex;
  gap: clamp(12px, 2.5vw, 28px);
  font-size: 0.9375rem;
}

.nav a {
  color: var(--dim);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--focus);
}

.credit {
  margin-left: auto;
  color: var(--faint);
  font-size: 0.8125rem;
  text-decoration: none;
  text-align: right;
}

.credit:hover {
  color: var(--ink);
}

/* The set: screen and console */

.tv {
  position: relative;
  max-width: var(--page);
  margin: 6px auto 0;
  padding: 0 var(--gutter);
}

body.theater .tv {
  max-width: 1640px;
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}

.screen:focus {
  outline: none;
}

.screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.bug {
  position: absolute;
  z-index: 2;
  top: clamp(10px, 1.6vw, 18px);
  right: clamp(12px, 2vw, 24px);
  font-size: clamp(1.125rem, 0.8rem + 1.3vw, 2rem);
  line-height: 1;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.bug::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 3px;
  background: linear-gradient(90deg,
    var(--bar-1) 0 14.28%, var(--bar-2) 0 28.57%, var(--bar-3) 0 42.85%,
    var(--bar-4) 0 57.14%, var(--bar-5) 0 71.42%, var(--bar-6) 0 85.71%, var(--bar-7) 0);
  opacity: 0.85;
}

.tally {
  position: absolute;
  top: 12px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: rgba(14, 12, 30, 0.72);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: #e8e5f5;
  pointer-events: none;
}

.tally-lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5c587e;
}

.screen[data-state="live"] .tally-lamp {
  background: var(--live);
  box-shadow: 0 0 10px 2px rgba(255, 60, 80, 0.6);
}

.screen[data-state="connecting"] .tally-lamp,
.screen[data-state="reconnecting"] .tally-lamp {
  background: var(--warn);
  animation: standby 1.6s ease-in-out infinite;
}

.screen[data-state="behind"] .tally-lamp,
.screen[data-state="paused"] .tally-lamp {
  background: #9b3a46;
}

@keyframes standby {
  50% {
    opacity: 0.3;
  }
}

/* On-screen banner: what is on, how far in, what is next */

.osd {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--band-h);
  padding: 48px clamp(16px, 3vw, 28px) clamp(14px, 2.4vw, 22px);
  background: linear-gradient(to top, rgba(12, 10, 28, 0.92) 0%, rgba(12, 10, 28, 0.72) 55%, rgba(12, 10, 28, 0) 100%);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.osd.visible {
  opacity: 1;
  transform: none;
}

.osd-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.osd-swatch {
  flex: none;
  width: 8px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--bar-2);
}

.osd-title {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1rem + 1.8vw, 2.25rem);
  line-height: 1;
}

.osd-meta {
  margin-top: 4px;
  color: #cfcbe6;
  font-size: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
}

.osd-progress {
  margin-top: 12px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.osd-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--focus);
}

.osd-next {
  margin-top: 8px;
  color: #cfcbe6;
  font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
}

.overlay-stats {
  position: absolute;
  right: 14px;
  top: clamp(44px, 4vw + 20px, 70px);
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(12, 10, 28, 0.78);
  color: #ece9f7;
  font-size: 0.75rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.overlay-stats div {
  display: grid;
  grid-template-columns: 82px auto;
  gap: 10px;
}

.ov-k {
  color: #aaa6c8;
}

.big-play,
.unmute {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  color: #fff;
  background: rgba(14, 12, 30, 0.82);
  backdrop-filter: blur(6px);
}

.big-play {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 26px 16px 20px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.375rem;
}

.big-play svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.unmute {
  left: 14px;
  top: 52px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  font-size: 0.9375rem;
}

.unmute svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.big-play:hover,
.unmute:hover {
  background: rgba(14, 12, 30, 0.95);
}

.big-play[hidden],
.unmute[hidden],
.screen-msg[hidden],
.overlay-stats[hidden],
.popover[hidden],
.signal[hidden],
#pip[hidden] {
  display: none;
}

.screen-msg {
  position: absolute;
  inset: 0 0 var(--band-h);
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: rgba(12, 10, 28, 0.86);
}

.screen-msg-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
}

.screen-msg-body {
  max-width: 46ch;
  color: var(--dim);
  font-size: 0.9375rem;
}

.console {
  position: relative;
  background: var(--deck);
  border-radius: 0 0 14px 14px;
  padding: 10px 12px 6px;
}

/* News band: channel label, rotating headlines, Paris and Beirut clock */

.band {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--band-h);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  background: rgba(14, 12, 30, 0.94);
  font-size: clamp(0.75rem, 0.55rem + 0.7vw, 1.0625rem);
  line-height: 1;
}

.band-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 0.9em;
  background: var(--live);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15em;
}

.band-logo {
  font-weight: 800;
  font-style: italic;
}

.band-tag {
  padding-left: 0.5em;
  border-left: 1px solid rgba(255, 255, 255, 0.55);
}

.ticker {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding-left: 24px;
  animation: ticker var(--ticker-duration, 60s) linear infinite;
  will-change: transform;
}

.band:hover .ticker-track,
.band.paused .ticker-track {
  animation-play-state: paused;
}

.band.rotate .ticker-track {
  animation: none;
  padding-left: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.tick {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6em;
  padding-right: 2.4em;
  color: #f4f1e8;
}

.tick::after {
  content: "";
  align-self: center;
  width: 0.45em;
  height: 0.45em;
  margin-left: 1.8em;
  border-radius: 1px;
  background: var(--faint);
}

.tick-source {
  font-family: var(--font-display);
  font-size: 1.1em;
  color: var(--focus);
}

.band-clock {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 0.9em;
  background: var(--ink);
  color: var(--night);
  font-family: var(--font-display);
  font-size: 1.15em;
}

.band-clock span {
  transition: opacity 0.22s ease;
}

.band-clock.swap span {
  opacity: 0;
}

.band-time {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  min-width: 2.9em;
}

/* When the playout server draws the logo, clock and band into the picture */

.graphics-in-video .bug,
.graphics-in-video .band {
  display: none;
}

.graphics-in-video .osd {
  bottom: 7.5%;
}

.graphics-in-video .screen-msg {
  inset: 0;
}

.graphics-in-video .tally {
  top: 2.8%;
}

/* Rewind ruler: one tick per segment */

.ruler {
  position: relative;
}

.ruler-track {
  position: relative;
  height: 20px;
  border-radius: 3px;
  background: var(--deck-2);
  overflow: hidden;
}

.ruler-ticks {
  position: absolute;
  inset: 0;
  --tick: 6.66%;
  background-image: linear-gradient(to right, transparent calc(100% - 1px), rgba(244, 241, 232, 0.3) calc(100% - 1px));
  background-size: var(--tick) 45%;
  background-position: right top;
  background-repeat: repeat-x;
}

.ruler-buffer,
.ruler-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
}

.ruler-buffer {
  background: rgba(244, 241, 232, 0.12);
}

.ruler-played {
  background: rgba(244, 241, 232, 0.26);
}

.ruler-head {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 100%;
  width: 3px;
  margin-left: -3px;
  border-radius: 2px;
  background: var(--ink);
}

.screen[data-state="live"] ~ .console .ruler-head,
.tv:has(.screen[data-state="live"]) .ruler-head {
  background: var(--live);
}

.ruler input[type="range"] {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ruler:has(input:focus-visible) .ruler-track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ruler-scale {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

#ruler-end {
  text-align: right;
}

/* Controls */

.controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0 2px;
}

.spacer {
  flex: 1;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
}

.icon-btn:hover {
  background: var(--deck-2);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

svg .stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#play .i-pause,
#play.is-playing .i-play,
#mute .i-muted,
#mute.is-muted .i-sound,
#fullscreen .i-exit,
#fullscreen.is-full .i-enter {
  display: none;
}

#play.is-playing .i-pause,
#mute.is-muted .i-muted,
#fullscreen.is-full .i-exit {
  display: block;
}

#theater[aria-pressed="true"],
#settings[aria-expanded="true"],
#signal-btn[aria-expanded="true"] {
  background: var(--deck-2);
  color: var(--focus);
}

.volume {
  width: 88px;
  margin: 0 6px 0 0;
  accent-color: var(--ink);
}

.live-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin-left: 4px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.live-btn:hover {
  border-color: var(--ink);
}

.live-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.live-btn.at-edge {
  border-color: transparent;
  cursor: default;
}

.live-btn.at-edge .live-dot {
  background: var(--live);
}

.pill-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  height: 32px;
  margin-right: 4px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  font-size: 0.875rem;
  white-space: nowrap;
  line-height: 30px;
}

.pill-btn-label {
  color: var(--faint);
}

#quality-label {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.pill-btn:hover,
.pill-btn[aria-expanded="true"] {
  border-color: var(--ink);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  margin-right: 4px;
  border-radius: 999px;
  background: var(--deck-2);
}

.segmented button {
  min-width: 52px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--dim);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
}

.segmented button[aria-checked="true"] {
  background: var(--ink);
  color: var(--night);
}

.segmented button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Popovers */

.popover {
  position: absolute;
  right: 12px;
  bottom: 58px;
  z-index: 5;
  width: min(340px, calc(100% - 24px));
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--deck-2);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(4, 3, 14, 0.55);
  font-size: 0.9375rem;
}

.popover fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.popover legend {
  padding: 0;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 1.125rem;
}

.popover label {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.popover label small {
  grid-column: 2;
  color: var(--dim);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.popover label:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.popover input {
  margin: 4px 0 0;
  accent-color: var(--focus);
}

.popover .check {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.popover-note {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* Below the set: programme and guide */

.below {
  max-width: var(--page);
  margin: clamp(24px, 4vw, 40px) auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.6fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

body.theater .below {
  max-width: 1640px;
}

.prog-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-size: 0.875rem;
}

.prog-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--bar-2);
}

.prog-title {
  margin-top: 10px;
  font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  line-height: 0.95;
}

.prog-meta {
  margin-top: 10px;
  color: var(--dim);
}

.prog-synopsis {
  margin-top: 14px;
  max-width: 42ch;
  font-size: 1.0625rem;
  line-height: 1.55;
}

.prog-progress {
  margin-top: 18px;
  height: 4px;
  border-radius: 2px;
  background: var(--deck-2);
  overflow: hidden;
}

.prog-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--focus);
}

.prog-next {
  margin-top: 10px;
  color: var(--dim);
  font-size: 0.9375rem;
}

.guide-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 14px;
}

.guide-head h2 {
  font-size: 1.75rem;
}

.guide-tz {
  color: var(--faint);
  font-size: 0.8125rem;
}

.epg {
  list-style: none;
  margin: 0;
  padding: 0 0 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--line) transparent;
}

.epg:focus-visible {
  outline-offset: 4px;
}

.epg-item {
  --minutes: 10;
  --swatch: var(--bar-2);
  position: relative;
  flex: none;
  width: clamp(124px, calc(var(--minutes) * 17px), 420px);
  min-height: 104px;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--deck);
  border-top: 4px solid var(--swatch);
  border-radius: 4px;
  scroll-snap-align: start;
  overflow: hidden;
}

.epg-item.is-now {
  background: var(--deck-2);
}

.epg-time {
  font-family: var(--font-num);
  font-size: 0.875rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.is-now .epg-time {
  color: var(--ink);
}

.epg-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.epg-len {
  margin-top: auto;
  color: var(--faint);
  font-size: 0.8125rem;
}

.epg-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--focus);
}

/* Headlines list */

.headlines {
  grid-column: 1 / -1;
}

.headlines .guide-head .text-btn {
  margin-left: auto;
}

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  column-gap: 28px;
}

.news-item,
.news-empty {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--line);
}

.news-empty {
  grid-column: 1 / -1;
  color: var(--dim);
}

.news-meta {
  color: var(--faint);
  font-size: 0.8125rem;
}

.news-title {
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
}

a.news-title:hover {
  text-decoration: underline;
}

/* Signal drawer */

.signal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(380px, 100vw);
  padding: 18px 20px 28px;
  overflow-y: auto;
  background: var(--deck);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(4, 3, 14, 0.5);
}

.signal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.signal-head h2 {
  font-size: 1.75rem;
}

.readouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 0;
}

.readouts div {
  min-width: 0;
}

.readout-wide {
  grid-column: 1 / -1;
}

.readouts dt {
  font-size: 0.8125rem;
  color: var(--dim);
}

.readouts dd {
  margin: 2px 0 0;
  font-family: var(--font-num);
  font-size: 1.3125rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

#r-source[data-level="ok"] {
  color: var(--ok);
}

#r-source[data-level="warn"] {
  color: var(--warn);
}

#r-source[data-level="bad"] {
  color: var(--live);
}

#r-engine {
  font-family: var(--font-body);
  font-size: 0.9375rem;
}

.signal-note {
  margin-top: 14px;
  color: var(--dim);
  font-size: 0.875rem;
}

.signal-sub {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 1.25rem;
}

.signal-sub + .signal-note {
  margin-top: 6px;
}

.links {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.links li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "kind copy"
    "url url";
  align-items: center;
  gap: 4px 8px;
  padding: 8px 8px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--night);
}

.link-kind {
  grid-area: kind;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.link-url {
  grid-area: url;
  font-family: var(--font-code);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.copy-btn {
  grid-area: copy;
  min-width: 64px;
  height: 30px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--night);
  font-size: 0.8125rem;
}

.copy-btn.done {
  background: var(--ok);
}

.text-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.875rem;
}

.text-btn:hover {
  border-color: var(--ink);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

/* Footer */

.foot {
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(var(--page) - 2 * var(--gutter));
  margin: clamp(48px, 7vw, 88px) auto 0;
  padding: 20px 0 36px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  color: var(--faint);
  font-size: 0.875rem;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.foot-links a,
.foot-links .link-btn {
  color: var(--dim);
}

/* Shortcuts dialog */

.shortcuts {
  width: min(460px, calc(100vw - 32px));
  padding: 22px 24px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--deck);
  color: var(--ink);
}

.shortcuts::backdrop {
  background: rgba(6, 5, 18, 0.66);
}

.shortcuts h2 {
  font-size: 1.625rem;
  margin-bottom: 14px;
}

.shortcuts dl {
  margin: 0 0 18px;
  display: grid;
  gap: 7px;
}

.shortcuts dl div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: baseline;
}

.shortcuts dd {
  margin: 0;
  color: var(--dim);
}

kbd {
  display: inline-block;
  min-width: 24px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--night);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  text-align: center;
}

/* Full screen: the whole set fills the display */

.tv:fullscreen {
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
  background: #000;
}

.tv:fullscreen .screen {
  flex: 1;
  aspect-ratio: auto;
  border-radius: 0;
}

.tv:fullscreen .console {
  border-radius: 0;
}

/* How it works */

.doc {
  max-width: var(--page);
  margin: clamp(16px, 4vw, 40px) auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}

.toc {
  position: sticky;
  top: 24px;
  font-size: 0.9375rem;
}

.toc p {
  color: var(--faint);
  font-size: 0.8125rem;
  margin-bottom: 8px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.toc a {
  color: var(--dim);
  text-decoration: none;
}

.toc a:hover {
  color: var(--ink);
}

.article {
  max-width: 70ch;
}

.article h1 {
  font-size: clamp(2.5rem, 1.8rem + 3vw, 4rem);
  line-height: 0.95;
}

.article .lede {
  margin-top: 16px;
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--dim);
}

.article section {
  margin-top: clamp(40px, 6vw, 64px);
  scroll-margin-top: 24px;
}

.article h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
  margin-bottom: 14px;
}

.article h3 {
  font-size: 1.375rem;
  margin: 26px 0 8px;
}

.article p,
.article li {
  font-size: 1.0625rem;
  line-height: 1.65;
}

.article p + p {
  margin-top: 12px;
}

.article code {
  font-family: var(--font-code);
  font-size: 0.875em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--deck);
}

.path-steps {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 4px;
}

.path-steps li {
  position: relative;
  counter-increment: step;
  padding: 0 0 22px 52px;
}

.path-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--deck-2);
  font-family: var(--font-num);
  font-size: 1rem;
}

.path-steps li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}

.path-steps li:last-child::after {
  display: none;
}

.path-steps li:last-child::before {
  background: var(--live);
}

.path-steps h3 {
  margin: 4px 0 6px;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--dim);
  font-weight: 600;
  font-size: 0.8125rem;
}

td.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.gloss {
  margin: 16px 0 0;
  display: grid;
  gap: 14px;
}

.gloss dt {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.gloss dd {
  margin: 2px 0 0;
  color: var(--dim);
  line-height: 1.6;
}

.credit-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 2px;
  vertical-align: baseline;
}

.swatch-1 { background: var(--bar-2); }
.swatch-2 { background: var(--bar-3); }
.swatch-3 { background: var(--bar-4); }
.swatch-4 { background: var(--bar-5); }
.swatch-5 { background: var(--bar-6); }
.swatch-6 { background: var(--bar-7); }
.swatch-7 { background: var(--bar-1); }

/* Narrow screens */

@media (max-width: 920px) {
  .below,
  body.theater .below {
    grid-template-columns: minmax(0, 1fr);
  }

  .doc {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
  }

  .toc ol {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 6px;
  }

  .wide-only {
    display: none;
  }
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .nav {
    order: 3;
    width: 100%;
  }

  .tv {
    padding: 0;
  }

  .screen {
    border-radius: 0;
  }

  .console {
    border-radius: 0;
    padding: 8px 8px 4px;
  }

  .volume,
  #ruler-legend,
  .pill-btn-label {
    display: none;
  }

  .ruler-scale {
    grid-template-columns: 1fr 1fr;
  }

  .osd {
    padding-top: 36px;
  }

  .osd-next {
    display: none;
  }

  .credit,
  .band-logo {
    display: none;
  }

  .band-tag {
    padding-left: 0;
    border-left: 0;
  }

  .tally {
    top: 8px;
    left: 10px;
    font-size: 0.875rem;
  }
}

@media (max-width: 460px) {
  .controls {
    flex-wrap: wrap;
  }

  .spacer {
    flex-basis: 100%;
    height: 0;
  }

  .icon-btn {
    width: 38px;
  }

  #pip {
    display: none;
  }
}

@media (pointer: coarse) {
  .icon-btn {
    height: 44px;
  }
}

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

@media (forced-colors: active) {
  .tally-lamp,
  .osd-swatch,
  .prog-swatch {
    forced-color-adjust: none;
    border: 1px solid CanvasText;
  }

  .ruler-head {
    background: Highlight;
  }
}
