/* ============================================================
   WIREDESK — team dispatch console
   Direction: Terminal Utilitarian (recipe 4) + 2 overrides
     · structural: two-pane console (feed + readout rail)
     · display voice: condensed Oswald against Plex Mono data
   ============================================================ */

@font-face {
  font-family: 'Plex Mono';
  src: url('assets/ibm-plex-mono.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  src: url('assets/oswald.ttf') format('truetype');
  font-weight: 200 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a0d0a;
  --bg-2: #0d120d;
  --surface: #111811;
  --surface-2: #162016;
  --ink: #e9f1e5;
  --body-ink: #d3dfcf;
  --muted: #93a790;
  --muted-2: #7d907b;
  --line: #273527;
  --line-2: #1b251b;
  --accent: #ffb000;
  --accent-2: #ffd173;
  --accent-ink: #140d00;
  --todo: #a7bba4;
  --prog: #ffb000;
  --blocked: #ff6157;
  --done: #5fd08a;

  --fs-1: 10.5px;
  --fs-2: 11px;
  --fs-3: 12px;
  --fs-4: 13px;
  --fs-5: 15px;
  --fs-6: 17px;

  --sans: 'Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --display: 'Oswald', 'Arial Narrow', system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 2px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--body-ink);
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(180deg, rgba(255, 176, 0, 0.028) 0 1px, transparent 1px 3px),
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 100% 3px, 48px 48px, 48px 48px;
  background-attachment: fixed;
  animation: scan 9s linear infinite;
  -webkit-font-smoothing: antialiased;
}
@keyframes scan {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 0 6px, 0 0, 0 0; }
}


h1, h2, h3 { margin: 0; }

dl, dd { margin: 0; }

p { margin: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

[hidden] { display: none !important; }

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

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 18px; font-family: var(--sans); font-size: var(--fs-4);
  font-weight: 600; text-decoration: none; transition: top 0.15s var(--ease);
}
.skip:focus { top: 12px; }

.wrap {
  max-width: 1460px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 56px);
}

/* ---------------- masthead ---------------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 10, 0.94);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-block: 12px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}
.brand b { color: var(--accent); font-weight: 700; }
.brand-cursor {
  display: inline-block;
  width: 0.5em; height: 0.86em;
  background: var(--accent);
  transform: translateY(0.06em);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.brand-sub {
  font-family: var(--sans);
  font-size: var(--fs-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
}
.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  font-size: var(--fs-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.topnav a:active { transform: scale(0.97); }

.station {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: var(--fs-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.station-item { display: inline-flex; align-items: center; gap: 6px; }
.station-k { color: var(--muted-2); }
.station-v { color: var(--ink); font-variant-numeric: tabular-nums; }
.lamp {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--done);
  box-shadow: 0 0 8px rgba(95, 208, 138, 0.9);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------- hero / station header ---------------- */
.station-header {
  border-bottom: 1px solid var(--line);
  padding-block: clamp(48px, 7vw, 104px) clamp(36px, 5vw, 76px);
  position: relative;
  overflow: clip;
}

/* terminal print-in on load (CSS only, respects reduced motion) */
@keyframes bootIn {
  from { opacity: 0; clip-path: inset(0 100% 0 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}
.hero-copy > * { animation: bootIn 0.42s steps(10) both; }
.hero-copy > *:nth-child(1) { animation-delay: 0.02s; }
.hero-copy > *:nth-child(2) { animation-delay: 0.08s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.14s; }
.hero-copy > *:nth-child(4) { animation-delay: 0.2s; }
.wirelog { animation: bootIn 0.55s steps(12) 0.16s both; }
.tally { animation: bootIn 0.45s steps(10) 0.28s both; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.hero-side {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 24px);
}
.eyebrow {
  font-size: var(--fs-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
h1 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(42px, 7vw, 104px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-sub {
  margin-top: 16px;
  max-width: 46ch;
  color: var(--muted);
  font-size: var(--fs-5);
  line-height: 1.7;
}
.count-row {
  display: flex;
  align-items: flex-end;
  gap: clamp(14px, 2vw, 26px);
  margin-top: clamp(24px, 3vw, 40px);
}
.count {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(76px, 9.5vw, 168px);
  line-height: 0.78;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 64px rgba(255, 176, 0, 0.28);
}
.count-label {
  font-size: var(--fs-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
  padding-bottom: 8px;
}
.tally {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  border-block: 1px solid var(--line);
}
.tally-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 18px;
  border-inline-end: 1px solid var(--line-2);
}
.tally-item:first-child { padding-inline-start: 0; }
.tally-item:last-child { border-inline-end: 0; }
.tally-n {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--fs-6);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tally-k {
  font-size: var(--fs-1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.tally-item[data-status='todo'] .tally-n { color: var(--todo); }
.tally-item[data-status='in-progress'] .tally-n { color: var(--prog); }
.tally-item[data-status='blocked'] .tally-n { color: var(--blocked); }
.tally-item[data-status='done'] .tally-n { color: var(--done); }

/* wire log */
.wirelog {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: inset 0 0 0 1px rgba(255, 176, 0, 0.04), 0 18px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  display: flex;
  flex-direction: column;
  scroll-margin-top: 100px;
}
.wirelog::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 176, 0, 0.05) 0 1px, transparent 1px 4px);
  opacity: 0.5;
}
.wirelog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
}
.wirelog-head .live-tag { margin-inline-start: auto; color: var(--accent); }
.log-lines {
  list-style: none;
  margin: 0;
  padding: 14px;
  flex: 1 1 auto;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  font-size: var(--fs-3);
  line-height: 1.85;
  position: relative;
}
.wirelog-scope {
  position: relative;
  padding: 12px 14px;
  border-bottom: 1px dashed var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: var(--fs-2);
}
.scope-row { display: flex; align-items: center; gap: 12px; }
.scope-k {
  flex: 0 0 62px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.scope-v { color: var(--body-ink); letter-spacing: 0.03em; min-width: 0; overflow-wrap: anywhere; }
.prio-meter { display: flex; flex: 1 1 auto; gap: 3px; height: 8px; }
.pm { height: 8px; }
.pm-high { background: var(--prog); }
.pm-med { background: var(--muted); }
.pm-low { background: var(--line); }
.g4 { flex: 4 1 0; }
.log-lines li { display: flex; gap: 8px; align-items: baseline; }
.log-time { color: var(--muted-2); white-space: nowrap; }
.log-arrow { color: var(--accent); }
.log-msg { color: var(--body-ink); word-break: break-word; }
.log-lines li:last-child .log-msg::after {
  content: '';
  display: inline-block;
  width: 7px; height: 1em;
  background: var(--accent);
  transform: translateY(2px);
  margin-inline-start: 2px;
  animation: blink 1.05s steps(1) infinite;
}

/* ---------------- console ---------------- */
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: clamp(20px, 3vw, 44px);
  align-items: stretch;
  padding-block: clamp(28px, 4vw, 56px) clamp(48px, 6vw, 88px);
}
.feed { min-width: 0; }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.field { display: flex; flex-direction: column; gap: 7px; flex: 1 1 220px; }
.field-status { flex: 0 1 200px; }
.field > label {
  font-size: var(--fs-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding-inline: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.prompt:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.prompt-sigil { color: var(--accent); font-size: var(--fs-5); }
.prompt input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  outline: none;
}
.prompt input::placeholder { color: var(--muted-2); }
.prompt input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.5; }

select {
  height: 48px;
  padding-inline: 14px 38px;
  border: 1px solid var(--line);
  border-radius: 0;
  background-color: var(--bg-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-5);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23FFB000' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
select:focus,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.result-count { color: var(--accent); }

/* feed rows */
.wire-list { list-style: none; margin: 0; padding: 0; }
.row { border-bottom: 1px solid var(--line-2); }
.row-btn {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 14px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}
.row-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-btn:active { transform: scale(0.992); }
.row-index {
  font-size: var(--fs-2);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  transition: color 0.15s var(--ease);
}
.row-title {
  display: block;
  font-size: clamp(15px, 1.15vw, 17px);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  transition: color 0.15s var(--ease);
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 7px;
  font-size: var(--fs-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta-k { color: var(--muted-2); margin-inline-end: 5px; }
.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}
.signal { display: flex; align-items: flex-end; gap: 2px; height: 13px; }
.signal i { width: 4px; background: var(--line); }
.signal i:nth-child(1) { height: 5px; }
.signal i:nth-child(2) { height: 9px; }
.signal i:nth-child(3) { height: 13px; }
.signal i.on { background: var(--prog); }
.signal[data-priority='low'] i.on { background: var(--muted); }
.chip {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid currentColor;
  font-size: var(--fs-1);
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--todo);
}
.chip[data-status='in-progress'] { color: var(--prog); }
.chip[data-status='blocked'] { color: var(--blocked); }
.chip[data-status='done'] { color: var(--done); }

/* empty state */
.empty {
  margin-top: 18px;
  padding: 32px clamp(20px, 4vw, 40px);
  border: 1px solid var(--accent);
  background:
    repeating-linear-gradient(135deg, rgba(255, 176, 0, 0.05) 0 10px, transparent 10px 20px),
    var(--surface);
}
.empty-code {
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0.01em;
  color: var(--accent);
  line-height: 1;
}
.empty p + p { margin-top: 12px; }
.empty-body { max-width: 52ch; color: var(--muted); font-size: var(--fs-5); }
.empty strong { color: var(--ink); }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: var(--fs-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.12s var(--ease);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-solid { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.empty .btn { margin-top: 20px; }

/* ---------------- readout ---------------- */
.readout { min-width: 0; }
.readout-frame {
  border: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.placeholder {
  padding: 56px 28px;
  text-align: center;
  color: var(--muted-2);
  font-size: var(--fs-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.9;
}
.placeholder-mark {
  display: block;
  color: var(--line);
  font-size: 26px;
  letter-spacing: 0.3em;
  margin-bottom: 18px;
}
.placeholder-hint { color: var(--muted-2); text-transform: none; letter-spacing: 0.02em; }

.detail { padding: 22px; scroll-margin-top: 90px; }
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.detail-label {
  font-size: var(--fs-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.close-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease);
}
.close-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.close-btn:active { transform: scale(0.94); }
.detail h2 {
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: clamp(22px, 2.3vw, 30px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-block: 18px 4px;
}
.detail-id {
  font-size: var(--fs-1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px 18px;
  margin: 18px 0 0;
  padding-block: 16px;
  border-block: 1px solid var(--line-2);
  font-size: var(--fs-4);
}
.kv dt {
  font-size: var(--fs-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding-top: 2px;
}
.kv dd { margin: 0; color: var(--ink); }
.body-full {
  margin-block: 20px 4px;
  max-width: 62ch;
  font-size: var(--fs-5);
  line-height: 1.75;
  color: var(--body-ink);
  white-space: pre-line;
}
.detail-status {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}
.detail-status > label {
  display: block;
  font-size: var(--fs-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.detail-status select { width: 100%; }
.feedback {
  margin-top: 12px;
  min-height: 1.5em;
  font-size: var(--fs-3);
  letter-spacing: 0.04em;
  color: var(--done);
}
.feedback.flash { animation: flash 0.7s var(--ease); }
@keyframes flash { 0% { background: rgba(95, 208, 138, 0.18); } 100% { background: transparent; } }

/* ---------------- legend / footer ---------------- */
.legend {
  border-top: 1px solid var(--line);
  padding-block: clamp(40px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
}
.legend h2 {
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: clamp(20px, 2.4vw, 30px);
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: 12px;
}
.legend p { color: var(--muted); max-width: 58ch; font-size: var(--fs-5); line-height: 1.7; }
.legend-keys { display: flex; flex-direction: column; gap: 10px; }
.legend-key {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-block: 10px;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-3);
}
.legend-key span:last-child { color: var(--muted); }
.footer {
  border-top: 1px solid var(--line);
  padding-block: 24px 40px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--fs-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------------- hover (fine pointers only) ---------------- */
@keyframes signalPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (hover: hover) and (pointer: fine) {
  .topnav a:hover { color: var(--accent); border-color: var(--line); background: var(--surface); }
  .row-btn:hover { background: var(--surface-2); transform: translateX(4px); }
  .row-btn:hover .row-index { color: var(--accent); }
  .row-btn:hover .row-title { color: var(--accent-2); }
  .row-btn:hover .signal i.on { animation: signalPulse 0.6s steps(3) infinite; }
  .btn:hover { background: var(--accent); color: var(--accent-ink); }
  .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
  .close-btn:hover { background: var(--accent); color: var(--accent-ink); }
  a:hover { color: var(--accent-2); }
}
.row-btn:focus-visible .signal i.on { animation: signalPulse 0.6s steps(3) infinite; }

/* ---------------- responsive ---------------- */
@media (max-width: 1039px) {
  .hero-grid { grid-template-columns: 1fr; }
  .console { grid-template-columns: 1fr; }
  .readout { display: none; }
  body.detail-open { overflow: hidden; }
  body.detail-open .readout {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--bg);
    overflow: auto;
    padding: 20px clamp(20px, 4vw, 40px) 40px;
  }
  .readout-frame {
    position: static;
    max-height: none;
    border: 0;
    background: transparent;
  }
  .detail { padding: 0; max-width: 640px; margin-inline: auto; }
  .legend { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .masthead-inner { gap: 10px 16px; }
  .station { gap: 12px; }
  .brand-sub, .station-edition { display: none; }
  .field-status { flex: 1 1 100%; }
  .station-header { padding-block: 36px 32px; }
  .log-lines { min-height: 120px; }
  .topnav {
    order: 3;
    width: 100%;
    margin-inline-start: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-inline-end: 24px;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--line-2);
    padding-top: 4px;
  }
  .topnav a { flex: 0 0 auto; }
  .count-label { padding-bottom: 0; }
  .tally-item { padding: 10px 12px; }
  .tally-item:first-child { padding-inline-start: 0; }
  .row-btn { grid-template-columns: 30px minmax(0, 1fr); }
  .row-side {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
  }
  .result-line { letter-spacing: 0.08em; }
}

@media (min-width: 1040px) {
  .masthead { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(6px); }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  body { animation: none; }
  .log-msg::after { animation: none; }
}
