:root {
  --night: #07090b;
  --panel: #0f1418;
  --panel-2: #151c21;
  --line: #243038;
  --ink: #e9efe6;
  --ink-dim: #8b9a93;
  --turf: #16361f;
  --turf-2: #1a3d24;
  --chalk: #d9e6d6;
  --team-a: #b8ff3c;   /* Swatters: acid */
  --team-b: #ff4fc8;   /* Maggots: toxic */
  --ball: #c9803a;
  --boom: #ffb238;
  --mono: "Silkscreen", ui-monospace, monospace;
  --sans: "Chakra Petch", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--night);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; background: rgba(7, 9, 11, .92);
  backdrop-filter: blur(6px);
}
.brand { font: 700 18px/1 var(--mono); letter-spacing: .06em; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 14px; height: 14px; background: var(--team-a);
  box-shadow: 4px 4px 0 var(--team-b);
}
select {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  font: 500 13px var(--sans); padding: 8px 10px; border-radius: 0; max-width: 60vw;
}

.stage {
  max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px;
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "board board"
    "pitch brain"
    "controls brain"
    "feed facts"
    "rosters facts";
}
.board { grid-area: board; }
.pitch-wrap { grid-area: pitch; }
.controls { grid-area: controls; }
.brain { grid-area: brain; }
.feed { grid-area: feed; }
.rosters { grid-area: rosters; }
.facts { grid-area: facts; }

/* scoreboard: the supplied art, with live text laid into its windows */
.board { position: relative; container-type: inline-size; line-height: 0; }
.board-art { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.sb { position: absolute; display: flex; align-items: center; justify-content: center; line-height: 1; font-family: var(--mono); font-weight: 700; }
.sb-score { color: #ffe600; font-size: 5.6cqw; text-shadow: .25cqw .25cqw 0 #7a4a00, -.12cqw -.12cqw 0 #000; font-variant-numeric: tabular-nums; }
.sb-clock { flex-direction: column; gap: .5cqw; }
.sb-clock small { color: #f4f4f4; font-size: 2.3cqw; text-shadow: .15cqw .15cqw 0 #000; }
.sb-clock b { color: #ff2a2a; font-size: 3.4cqw; text-shadow: .2cqw .2cqw 0 #5a0000; font-variant-numeric: tabular-nums; }
.sb-name { font-size: 2.6cqw; letter-spacing: .06em; white-space: nowrap; overflow: hidden; justify-content: center; }
.sb-name-a { color: var(--team-a); }
.sb-name-b { color: var(--team-b); }

.pitch-wrap { grid-area: pitch; }
.controls { grid-area: controls; }
.brain { grid-area: brain; }
.feed { grid-area: feed; }
.rosters { grid-area: rosters; }
.facts { grid-area: facts; }

.pitch-wrap { position: relative; border: 2px solid #1c252b; background: #0b1a10; line-height: 0; }
#pitch { width: 100%; height: auto; display: block; cursor: crosshair; image-rendering: pixelated; }
.callout {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  font: 700 clamp(22px, 5vw, 56px)/1 var(--mono); letter-spacing: .04em;
  color: #ffe066; text-shadow: 4px 4px 0 #000, 0 0 30px rgba(255, 178, 56, .5);
  pointer-events: none; white-space: nowrap;
  animation: slam .9s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes slam { from { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn, .chip {
  font: 700 13px/1 var(--mono); letter-spacing: .06em; color: var(--night);
  background: var(--team-a); border: 0; padding: 11px 18px; cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}
.btn:active, .chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.chip { background: var(--panel-2); color: var(--ink-dim); padding: 9px 11px; box-shadow: none; border: 1px solid var(--line); }
.chip.on { color: var(--night); background: #ffe066; border-color: #ffe066; }
.speeds { display: flex; gap: 6px; }
#scrub { flex: 1; min-width: 160px; accent-color: var(--team-a); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid #ffe066; outline-offset: 2px; }

.brain { background: var(--panel); border: 1px solid var(--line); padding: 16px; align-self: start; }
.brain-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.kicker { font: 400 10px/1 var(--mono); color: var(--ink-dim); letter-spacing: .14em; }
.who { font: 700 16px/1.25 var(--mono); margin-top: 6px; max-width: 16ch; }
.fired { text-align: right; }
.fired span { font: 700 22px/1 var(--mono); color: #ffe066; font-variant-numeric: tabular-nums; }
.fired small { display: block; font-size: 11px; color: var(--ink-dim); max-width: 16ch; margin-left: auto; line-height: 1.3; margin-top: 4px; }
.retina-wrap { margin: 14px 0 12px; background: #000; border: 1px solid var(--line); line-height: 0; }
#retina { width: 100%; height: auto; display: block; }
.retina-cap { font: 400 10px/1 var(--mono); color: var(--ink-dim); letter-spacing: .1em; padding: 8px 10px; line-height: 1; }
.motor { margin: 0; display: grid; gap: 10px; }
.motor div { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; }
.motor dt { font: 700 12px/1.2 var(--mono); }
.motor dt small { display: block; font: 400 10px/1.3 var(--sans); color: var(--ink-dim); letter-spacing: 0; }
.motor dd { margin: 0; }
.meter { height: 12px; background: #06080a; border: 1px solid var(--line); position: relative; overflow: hidden; }
.meter i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--team-a); transition: width .12s linear, left .12s linear; }
.meter.center::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--ink-dim); }
.hint { font-size: 12px; color: var(--ink-dim); margin: 14px 0 0; }

.feed, .facts { background: var(--panel); border: 1px solid var(--line); padding: 16px 18px; }
h2 { font: 700 13px/1 var(--mono); letter-spacing: .1em; margin: 0 0 12px; color: var(--ink-dim); }
.facts h2 + ul { margin-bottom: 18px; }
#feed { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; font-size: 14px; }
#feed li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #1d272d; }
#feed li time { font: 400 12px/1.6 var(--mono); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
#feed li.big { color: #ffe066; font-weight: 700; }
.facts ul { margin: 0; padding-left: 18px; color: #c7d3cc; font-size: 14px; }
.facts li { margin-bottom: 8px; }
.facts b { color: var(--ink); }

.credit { max-width: 1320px; margin: 0 auto; padding: 0 24px 40px; color: var(--ink-dim); font-size: 12px; }
.credit a { color: var(--ink); }

@media (max-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "pitch" "controls" "brain" "feed" "rosters" "facts";
    padding: 12px 16px 32px;
  }
  .bar { padding: 12px 16px; }
  .credit { padding: 0 16px 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .callout { animation: none; }
  .meter i { transition: none; }
}

/* the referee's popup card: slides in over the corner of the field */
.refcard {
  position: absolute; right: 2%; bottom: 3%; width: min(34%, 240px); margin: 0;
  background: #000; border: 3px solid #1c252b; box-shadow: 6px 6px 0 #000;
  animation: refin .35s cubic-bezier(.2, 1.4, .4, 1) both; line-height: 1.2;
}
.refcard img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.refcard figcaption {
  font: 700 clamp(10px, 1.3vw, 14px)/1.3 var(--mono); color: #ffe600; background: #0b0f12;
  padding: 8px 10px; letter-spacing: .03em; text-transform: uppercase;
}
@keyframes refin { from { transform: translateX(120%) rotate(8deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .refcard { animation: none; } }

.rosters { background: var(--panel); border: 1px solid var(--line); padding: 16px 18px; }
.rosters h2 small { font: 400 11px var(--sans); letter-spacing: 0; color: var(--ink-dim); margin-left: 8px; }
.roster-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.roster-cols h3 { font: 700 13px/1 var(--mono); margin: 0 0 10px; letter-spacing: .06em; }
.roster-cols ol { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.roster-cols li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #1d272d; align-items: baseline; }
.roster-cols li b { font: 700 12px var(--mono); color: var(--ink-dim); }
.roster-cols li span.stat { font: 400 11px var(--mono); color: var(--ink-dim); white-space: nowrap; }
.roster-cols li.out { color: #7d8b84; text-decoration: line-through; text-decoration-color: #6fe01f; }
.roster-cols li .star { color: #ffe600; }
@media (max-width: 600px) { .roster-cols { grid-template-columns: 1fr; } }

.stadium { font: 700 12px/1 var(--mono); color: var(--ink-dim); letter-spacing: .1em; order: 9; margin-left: auto; }
.stadium:empty { display: none; }
