/* Hermaniac — 90s arcade theme. The track is the star; the answer box sits below it. */

:root {
  --bg: #0c0a1f;
  --bg-grid: #17133a;
  --panel: #15123a;
  --panel-2: #221d55;
  --ink: #f4f1ff;
  --muted: #9a93c9;
  --edge: #000000;
  --hi: #ffe14d;
  --accent: #36e2ff;

  /* Rank colours */
  --goat: #ff4fd8;
  --mvp: #ffd43b;
  --starter: #51f075;
  --bench: #5aa9ff;
  --bust: #ff4d4d;

  /* Track geometry */
  --runner-w: clamp(84px, 8vw, 132px);
  --finish-w: 18px;

  --pixel: 'Press Start 2P', monospace;
  --crt: 'VT323', monospace;

  /* Single-look arcade design: always dark */
  color-scheme: dark;
}

body[data-sport="all"] { --accent: #36e2ff; }
body[data-sport="nfl"] { --accent: #51f075; }
body[data-sport="nba"] { --accent: #ff9a3c; }
body[data-sport="mlb"] { --accent: #ff5c8a; }
body[data-sport="soccer"] { --accent: #36e2ff; }
body[data-sport="nhl"] { --accent: #8cf3ff; }
body[data-sport="tennis"] { --accent: #d4ff3c; }
body[data-sport="golf"] { --accent: #7dff9e; }

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--crt);
  font-size: clamp(22px, 0.9vw + 12px, 28px);
  line-height: 1.2;
  background:
    linear-gradient(var(--bg-grid) 2px, transparent 2px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--bg-grid) 2px, transparent 2px) 0 0 / 32px 32px,
    var(--bg);
}

/* CRT scanlines + vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
}

button { font: inherit; color: inherit; cursor: pointer; }
b { color: var(--hi); font-weight: normal; }

/* Chunky pixel frame */
.scene, .box, .modal, .btn, #guess-input, .sport-chip, .toast {
  border: 4px solid var(--edge);
  box-shadow:
    inset -4px -4px 0 rgba(0, 0, 0, 0.35),
    inset 4px 4px 0 rgba(255, 255, 255, 0.12),
    6px 6px 0 var(--edge);
}

/* ---------- Layout ---------- */
.stage {
  max-width: 1200px;
  margin: 0 auto;
  padding-block: 24px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 22px;
}

/* ---------- Stadium scene ---------- */
.scene {
  position: relative;
  overflow: hidden;
  background: linear-gradient(#0b0730 0%, #2a1a6e 55%, #4b2a8c 100%);
}

.scoreboard {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 14px auto 0;
  width: min(92%, 760px);
  padding: 10px 14px;
  background: #000;
  border: 4px solid #3a3a3a;
  box-shadow: 0 0 0 4px #000, 0 0 24px rgba(255, 225, 77, 0.25);
  font-family: var(--pixel);
  font-size: clamp(10px, 0.9vw, 14px);
  color: var(--muted);
}
.sb-logo {
  color: var(--hi);
  text-shadow: 2px 2px 0 #ff4fd8;
  font-size: clamp(12px, 1.2vw, 18px);
}
.sb-dist b { font-size: clamp(14px, 1.3vw, 20px); text-shadow: 0 0 8px var(--hi); }

/* Stadium lights */
.scene::before, .scene::after {
  content: '';
  position: absolute;
  top: 8px;
  width: 44px; height: 14px;
  background: repeating-linear-gradient(90deg, #fff6c4 0 8px, #000 8px 12px);
  border: 3px solid #000;
  box-shadow: 0 0 30px 8px rgba(255, 246, 196, 0.25);
}
.scene::before { left: 14px; }
.scene::after { right: 14px; }

/* Pixel crowd: rows of coloured dots */
.crowd {
  height: clamp(74px, 9vh, 120px);
  margin-top: 14px;
  background:
    radial-gradient(circle at 4px 5px, #ff5c8a 3px, transparent 3.5px) 0 0 / 22px 14px,
    radial-gradient(circle at 15px 9px, #36e2ff 3px, transparent 3.5px) 0 0 / 22px 14px,
    radial-gradient(circle at 10px 3px, #ffe14d 2.5px, transparent 3px) 0 0 / 26px 14px,
    radial-gradient(circle at 20px 11px, #51f075 2.5px, transparent 3px) 0 0 / 30px 14px,
    linear-gradient(#1a1240, #2b1f5e);
}
.scene.roar .crowd { animation: roar 0.3s steps(2) 5; }
@keyframes roar { 50% { background-position: 0 -4px, 0 -3px, 0 -5px, 0 -2px, 0 0; } }

.wall {
  height: 16px;
  background:
    repeating-linear-gradient(90deg, #1f7a45 0 60px, #145c33 60px 120px);
  border-top: 4px solid #000;
  border-bottom: 4px solid #000;
}

/* The track: four lanes, runner in lane 3 */
.lanes {
  position: relative;
  height: clamp(190px, 26vh, 340px);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 calc(25% - 3px),
      rgba(255, 255, 255, 0.85) calc(25% - 3px) 25%
    ),
    repeating-linear-gradient(90deg, #b8442c 0 10px, #a63b25 10px 20px);
}

/* Inset so each tick lines up with the runner's center at that distance */
.ticks {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--runner-w) / 2);
  right: calc(var(--runner-w) / 2 + var(--finish-w));
}
.tick {
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  margin-left: -1px;
  background: repeating-linear-gradient(rgba(255, 255, 255, 0.4) 0 6px, transparent 6px 12px);
}
.tick i {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.55);
  font-style: normal;
  font-family: var(--pixel);
  font-size: 8px;
  color: #fff;
}
.finish {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: var(--finish-w);
  background: conic-gradient(#fff 25%, #000 0 50%, #fff 0 75%, #000 0) 0 0 / 18px 18px;
}
.finish span {
  position: absolute;
  top: 8px;
  right: calc(100% + 6px);
  font-family: var(--pixel);
  font-size: 8px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

/* ---------- Runner ---------- */
.runner {
  position: absolute;
  bottom: 30px;
  width: var(--runner-w);
  left: calc(var(--progress, 0) * (100% - var(--runner-w) - var(--finish-w)));
  color: #fff;
  transition: left var(--run-ms, 600ms) linear;
}
.runner.instant { transition: none; }
.runner svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(3px 3px 0 #000);
}
.runner rect { fill: currentColor; }
.runner path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.runner g { display: none; }
.runner .f-idle { display: inline; }
.runner.running .f-idle, .runner.cheer .f-idle { display: none; }
.runner.running .f-run1 { display: inline; animation: frame-a 0.22s infinite; }
.runner.running .f-run2 { display: inline; animation: frame-b 0.22s infinite; }
.runner.running svg { animation: bob 0.22s steps(2) infinite; }
.runner.cheer:not(.running) .f-cheer { display: inline; }
.runner.cheer:not(.running) svg { animation: hop 0.5s steps(2) infinite; }
.runner.trip svg { animation: shake 0.4s steps(4); }
.runner .shadow {
  width: 60%;
  height: 8px;
  margin: -4px auto 0;
  background: rgba(0, 0, 0, 0.35);
}
@keyframes frame-a { 0%, 49.9% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes frame-b { 0%, 49.9% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes hop { 50% { transform: translateY(-10px); } }

/* Points pop up over the runner's head */
.popup {
  position: absolute;
  bottom: 100%;
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  font-family: var(--pixel);
  font-size: 13px;
  color: var(--tier, #fff);
  text-shadow: 3px 3px 0 #000;
  opacity: 0;
  pointer-events: none;
}
/* Near either end of the track, pin the text to that side so it stays on screen */
.popup.at-start { left: 0; translate: 0 0; }
.popup.at-end { left: auto; right: 0; translate: 0 0; }
.popup.show { animation: float-up 1.8s steps(12) forwards; }
.popup.goat { --tier: var(--goat); font-size: 16px; }
.popup.mvp { --tier: var(--mvp); }
.popup.starter { --tier: var(--starter); }
.popup.bench { --tier: var(--bench); }
.popup.bust { --tier: var(--bust); }
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(-26px); }
  100% { opacity: 0; transform: translateY(-34px); }
}

/* ---------- Answer box ---------- */
.box {
  padding: 18px;
  background: var(--panel);
}

.mode-pill {
  margin: -4px 0 12px;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
}
.mode-pill button {
  border: 0; background: none; padding: 0;
  color: var(--hi); text-decoration: underline;
}

.q-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sport-chip {
  padding: 6px 10px;
  background: var(--accent);
  color: #000;
  font-family: var(--pixel);
  font-size: 10px;
  box-shadow: 3px 3px 0 var(--edge);
  transition: background 0.3s;
}
.q-count { font-family: var(--pixel); font-size: 12px; color: var(--hi); }
/* ---------- Shot clock ---------- */
.timer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.timer-track {
  flex: 1;
  height: 16px;
  background: #000;
  border: 3px solid var(--edge);
  box-shadow: 3px 3px 0 var(--edge);
}
.timer-bar {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(90deg, var(--starter) 0 8px, #3cc95e 8px 10px);
  transition: width 0.1s linear;
}
.timer-num {
  min-width: 42px;
  text-align: right;
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--starter);
  text-shadow: 2px 2px 0 #000;
}
.timer.urgent .timer-bar { background: repeating-linear-gradient(90deg, var(--bust) 0 8px, #c93c3c 8px 10px); }
.timer.urgent .timer-num { color: var(--bust); animation: pulse 0.5s steps(2) infinite; }

.start-view { text-align: center; padding: 8px 0; }
.start-count { font-family: var(--pixel); font-size: 10px; color: var(--muted); }
.start-title {
  margin: 14px 0;
  font-family: var(--pixel);
  font-size: 28px;
  color: var(--hi);
  text-shadow: 3px 3px 0 #ff4fd8, 6px 6px 0 #000;
}
.start-rules { margin: 0 0 18px; }
.prelaunch { text-align: center; padding: 8px 0; }
.launch-clock {
  margin: 4px 0 16px;
  font-family: var(--pixel);
  font-size: clamp(18px, 3vw, 30px);
  color: var(--accent);
  text-shadow: 3px 3px 0 #000;
}

.q-prompt {
  margin: 16px 0 8px;
  font-family: var(--pixel);
  font-size: clamp(16px, 1.3vw, 22px);
  line-height: 1.6;
  font-weight: normal;
}
.q-meta { margin: 0 0 14px; color: var(--muted); }

.combo { position: relative; }
.caret {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--accent);
  animation: pulse 1s steps(2) infinite;
  pointer-events: none;
}
#guess-input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  font-family: var(--crt);
  font-size: clamp(26px, 2vw, 32px);
  color: var(--ink);
  background: #000;
  outline: none;
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.6), 4px 4px 0 var(--edge);
}
#guess-input::placeholder { color: #5b558a; }
#guess-input.nope { animation: shake 0.35s steps(4); border-color: var(--bust); }

/* Names already tried that aren't correct */
.tried {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 12px;
}
.tried span { font-family: var(--pixel); font-size: 8px; color: var(--bust); }
.tried ul { display: contents; list-style: none; }
.tried li {
  padding: 2px 8px;
  font-size: 18px;
  color: var(--muted);
  background: #000;
  border: 2px solid #3a1420;
  text-decoration: line-through;
  text-decoration-color: var(--bust);
}
#guess-input:focus { border-color: var(--accent); }

.did-you-mean {
  margin-top: 14px;
  padding: 12px;
  background: #000;
  border: 4px solid var(--hi);
  animation: drop 0.25s steps(4);
}
.dym-title {
  font-family: var(--pixel);
  font-size: 12px;
  color: var(--hi);
  margin-bottom: 10px;
  animation: pulse 1s steps(2) infinite;
}
.dym-options { display: grid; gap: 8px; }
.dym-btn {
  font-family: var(--crt);
  font-size: 24px;
  letter-spacing: 0;
  text-align: left;
  background: var(--panel-2);
}
.dym-btn::before { content: '▶ '; color: var(--hi); }
.dym-btn:hover, .dym-btn:focus { background: var(--accent); color: #000; outline: none; }
.dym-btn:hover::before, .dym-btn:focus::before { color: #000; }
.dym-none {
  margin-top: 10px;
  padding: 4px 0;
  border: 0;
  background: none;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
  text-decoration: underline;
}
.dym-none:hover { color: var(--ink); }

.actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-top: 16px;
}
.btn {
  padding: 14px 12px;
  font-family: var(--pixel);
  font-size: clamp(12px, 1vw, 15px);
  letter-spacing: 1px;
}
.btn.primary { background: var(--hi); color: #000; }
.btn.primary:hover { background: #fff27a; }
.btn.ghost { background: var(--panel-2); }
.btn.ghost:hover { background: #2f2875; }
.btn:active { transform: translate(6px, 6px); box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.35); }
.btn.wide { width: 100%; }

/* ---------- Reveal ---------- */
.outcome {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #000;
  border: 4px solid var(--tier);
  animation: drop 0.35s steps(5);
}
.outcome .tier-name {
  font-family: var(--pixel);
  font-size: 18px;
  color: var(--tier);
  text-shadow: 3px 3px 0 #000, 0 0 12px var(--tier);
}
.outcome .tier-pts {
  justify-self: end;
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--ink);
}
.outcome .tier-detail { grid-column: 1 / -1; color: var(--muted); }
.outcome.goat { --tier: var(--goat); }
.outcome.goat .tier-name { animation: rainbow 0.6s steps(6) infinite; }
.outcome.mvp { --tier: var(--mvp); }
.outcome.starter { --tier: var(--starter); }
.outcome.bench { --tier: var(--bench); }
.outcome.bust { --tier: var(--bust); }
.outcome.bust .tier-name { animation: shake 0.4s steps(4); }

/* Collapsible extras keep the box small */
.more { margin-bottom: 14px; }
.more summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 0;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--accent);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '▶ '; }
.more[open] summary::before { content: '▼ '; }

.board {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 3px solid var(--edge);
  background: #000;
}
.board li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
}
.board li:nth-child(odd) { background: #0e0b26; }
.board .name { flex: 1; }
.board .pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.board li.mine { background: var(--panel-2); outline: 3px solid var(--hi); outline-offset: -3px; }
.board li.mine .name::before { content: '▶ '; color: var(--hi); }

.badge {
  flex: none;
  width: 62px;
  padding: 4px 0;
  text-align: center;
  font-family: var(--pixel);
  font-size: 8px;
  color: #000;
  border: 2px solid var(--edge);
}
.badge.goat { background: var(--goat); }
.badge.mvp { background: var(--mvp); }
.badge.starter { background: var(--starter); }
.badge.bench { background: var(--bench); }
.badge.bust { background: var(--bust); }

/* ---------- Summary ---------- */
.summary { text-align: center; }
.summary-actions { display: grid; gap: 12px; }
.final-label {
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--hi);
  text-shadow: 3px 3px 0 #ff4fd8;
  animation: pulse 0.8s steps(2) infinite;
}
.final-score {
  margin-top: 14px;
  font-family: var(--pixel);
  font-size: 40px;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--accent), 8px 8px 0 #000;
}
.final-max { margin: 12px 0 18px; color: var(--muted); font-family: var(--pixel); font-size: 10px; }
.summary .more { margin: 14px 0 0; text-align: left; }
.breakdown {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.breakdown li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  background: #000;
  border: 3px solid var(--edge);
}
.bd-text { flex: 1; display: grid; min-width: 0; }
.bd-q { font-size: 17px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-a { font-size: 22px; }
.bd-pts { font-family: var(--pixel); font-size: 12px; color: var(--hi); }
.share-text {
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  font-family: var(--crt);
  font-size: 20px;
  color: var(--ink);
  background: #000;
  border: 3px solid var(--hi);
  resize: none;
}
/* ---------- Today's field (score graph) ---------- */
.field {
  margin-top: 18px;
  padding: 14px;
  text-align: left;
  background: #000;
  border: 3px solid var(--edge);
}
.field-title { font-family: var(--pixel); font-size: 10px; color: var(--muted); }
.field-rank { margin: 10px 0 12px; font-size: 24px; line-height: 1.2; }
.field-rank b { font-family: var(--pixel); font-size: 18px; color: var(--hi); }
.field-note { margin: 10px 0 0; color: var(--muted); }
.hist-wrap { position: relative; padding-top: 22px; }
.hist {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  height: clamp(120px, 18vh, 200px);
  align-items: end;
  border-bottom: 2px solid var(--panel-2);
}
.hist .bar {
  position: relative;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: flex-end;
  cursor: default;
}
.hist .bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hist .fill {
  position: relative;
  display: block;
  width: 100%;
  background: var(--muted);
  border-radius: 4px 4px 0 0;
}
.hist .bar:hover .fill { filter: brightness(1.25); }
.hist .bar.you .fill { background: var(--hi); }
.you-tag {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--hi);
}
.hist-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--muted);
}
.hist-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  padding: 6px 8px;
  white-space: nowrap;
  font-size: 18px;
  color: var(--ink);
  background: var(--panel-2);
  border: 2px solid var(--edge);
  pointer-events: none;
}
.hist-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hist-table th, .hist-table td { padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--panel-2); }
.hist-table th { font-family: var(--pixel); font-size: 8px; color: var(--muted); font-weight: normal; }
.hist-table td:last-child, .hist-table th:last-child { text-align: right; }
.hist-table tr.you td { color: var(--hi); }

.countdown { margin-top: 14px; font-family: var(--pixel); font-size: 10px; line-height: 1.8; color: var(--muted); }
.countdown b { color: var(--accent); }

/* Small text links along the bottom of the box */
.box-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 3px dashed var(--panel-2);
}
.box-menu button {
  padding: 4px 0;
  border: 0;
  background: none;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
}
.box-menu button:hover { color: var(--hi); }

/* ---------- Modals ---------- */
.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  background: var(--panel);
  color: var(--ink);
}
.modal::backdrop { background: rgba(5, 3, 20, 0.8); }
.modal h2 {
  margin: 0 0 16px;
  font-family: var(--pixel);
  font-size: 18px;
  font-weight: normal;
  color: var(--hi);
  text-shadow: 3px 3px 0 #000;
}
.modal p { margin: 0 0 12px; }
.modal .close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--muted);
}
.modal .close:hover { color: var(--hi); }
.muted { color: var(--muted); }
.ranks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.ranks li {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px;
  background: #000;
}
.ranks li span:nth-child(2) { flex: 1; }
.ranks li b { font-family: var(--pixel); font-size: 11px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}
.stat-grid > div { padding: 10px 4px; background: #000; border: 3px solid var(--edge); }
.stat-grid .n { font-family: var(--pixel); font-size: 18px; color: var(--hi); }
.stat-grid .l { margin-top: 8px; font-family: var(--pixel); font-size: 7px; color: var(--muted); }

/* ---------- Suggestions ---------- */
.suggest-form { display: grid; gap: 8px; }
.suggest-form label { font-family: var(--pixel); font-size: 9px; color: var(--muted); margin-top: 4px; }
.suggest-form select, .suggest-form textarea, .suggest-form input {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--crt);
  font-size: 22px;
  color: var(--ink);
  background: #000;
  border: 3px solid var(--edge);
  outline: none;
}
.suggest-form select:focus, .suggest-form textarea:focus, .suggest-form input:focus { border-color: var(--accent); }
.plan-sign-out { margin-top: 14px; }
.suggest-form textarea { resize: vertical; min-height: 96px; }
.suggest-form textarea::placeholder { color: #5b558a; }
.suggest-form :disabled { opacity: 0.5; }
.suggest-count { justify-self: end; font-size: 16px; color: var(--muted); }
.suggest-status { margin: 12px 0 0; color: var(--hi); }
#suggest-mine h3 { margin: 18px 0 8px; font-family: var(--pixel); font-size: 10px; font-weight: normal; color: var(--muted); }
.suggest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 180px; overflow-y: auto; }
.suggest-list li { padding: 6px 8px; background: #000; border: 2px solid var(--edge); font-size: 19px; overflow-wrap: anywhere; }
.suggest-list .kind { margin-right: 8px; font-family: var(--pixel); font-size: 7px; color: var(--accent); }


/* ---------- Planner (owner only) ---------- */
.modal-wide { width: min(760px, calc(100vw - 32px)); }
.plan-date { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.plan-date label, .plan-h3 { font-family: var(--pixel); font-size: 9px; font-weight: normal; color: var(--muted); }
.plan-day { font-family: var(--pixel); font-size: 9px; color: var(--hi); }
.plan-state { color: var(--accent); }
#dlg-plan input, #dlg-plan textarea {
  width: 100%;
  padding: 6px 8px;
  font-family: var(--crt);
  font-size: 20px;
  color: var(--ink);
  background: #000;
  border: 3px solid var(--edge);
  outline: none;
}
#dlg-plan input[type="date"] { width: auto; color-scheme: dark; }
#dlg-plan input[type="radio"] { width: auto; }
#dlg-plan input:focus, #dlg-plan textarea:focus { border-color: var(--accent); }
#dlg-plan textarea { resize: vertical; min-height: 120px; }
#dlg-plan ::placeholder { color: #5b558a; }
.plan-slots { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.plan-slot { display: grid; gap: 6px; padding: 10px; background: var(--panel-2); border: 3px solid var(--edge); }
.slot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-family: var(--pixel); font-size: 9px; }
.slot-head b { color: var(--hi); font-weight: normal; }
.slot-head label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.slot-info, .own-count { font-size: 18px; color: var(--muted); }
.slot-info.bad, .own-count.bad { color: var(--bust); }
.own-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.btn.small { padding: 6px 8px; font-size: 8px; }
.plan-status { min-height: 1.2em; margin: 12px 0 8px; color: var(--hi); }
.plan-status.bad { color: var(--bust); }
.plan-h3 { margin: 18px 0 8px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 180px; overflow-y: auto; }
.plan-list button {
  width: 100%; padding: 6px 8px; text-align: left;
  font-family: var(--crt); font-size: 19px; color: var(--ink);
  background: #000; border: 2px solid var(--edge); cursor: pointer;
}
.plan-list button:hover { border-color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; top: calc(20px + env(safe-area-inset-top, 0px));
  transform: translate(-50%, -8px);
  padding: 10px 14px;
  background: var(--hi);
  color: #000;
  font-family: var(--pixel);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s steps(2), transform 0.15s steps(2);
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Animation ---------- */
.blink-soft { animation: pulse 1.6s steps(2) infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes drop {
  0% { transform: translateY(-16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}
@keyframes rainbow {
  0% { color: #ff4fd8; } 17% { color: #ffd43b; } 33% { color: #51f075; }
  50% { color: #36e2ff; } 67% { color: #5aa9ff; } 83% { color: #b388ff; }
}

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

@media (max-width: 520px) {
  :root { --runner-w: 56px; --finish-w: 12px; }
  .stage { padding-top: 16px; gap: 18px; }
  .scoreboard { flex-wrap: wrap; row-gap: 8px; font-size: 8px; padding: 8px 10px; white-space: nowrap; }
  .sb-logo { flex-basis: 100%; text-align: center; font-size: 11px; }
  .sb-dist b { font-size: 11px; }
  .scene::before, .scene::after { display: none; }
  .crowd { height: 54px; }
  .lanes { height: 150px; }
  .runner { bottom: 26px; }
  .tick i { font-size: 6px; padding: 2px; }
  .finish { background-size: 12px 12px; }
  .finish span { display: none; }
  .q-prompt { font-size: 13px; }
  .final-score { font-size: 32px; }
  .popup { font-size: 10px; }
  .popup.goat { font-size: 12px; }
}

[hidden] { display: none !important; }
