:root {
  --bg: #0b0e14;
  --panel: #131824;
  --panel-2: #1b2233;
  --line: #263048;
  --ink: #eef2f8;
  --muted: #93a0b8;
  --accent: #fbbf24;
  --good: #34d399;
  --bad: #f87171;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 50% -200px, #1a2438 0%, var(--bg) 60%);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus {
  position: static; display: block; padding: 8px 12px; background: var(--accent); color: #000;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .01em; }
.brand svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 2; }
.meta { display: flex; gap: 8px; align-items: center; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 3px 10px; font-size: 12px;
}

main { flex: 1; width: 100%; max-width: 660px; margin: 0 auto; padding: 18px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
}
.card.center { text-align: center; }

.eyebrow {
  margin: 0 0 6px; text-transform: uppercase; letter-spacing: .12em;
  font-size: 11px; color: var(--accent); font-weight: 700;
}

/* The city is the loudest thing on the screen: it is who the round is for. */
.cityName {
  margin: 0 0 4px;
  font-size: clamp(40px, 13.5vw, 78px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
}
/* It stays above the game on every screen, but steps back once a question is
   live so the heading does not crowd the play area on a phone. */
.cityName.live { font-size: clamp(26px, 7.5vw, 44px); }
.cityBar {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 16px 18px 0;
  text-align: center;
}
h1, h2, h3 { margin: 0 0 10px; line-height: 1.15; }
.huge { font-size: clamp(38px, 12vw, 64px); margin: 4px 0 12px; }
.big { font-size: clamp(24px, 6.5vw, 34px); }
.sub { font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 22px; }
.lede { color: var(--ink); margin: 0 0 12px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; line-height: 1.6; }
.fine a, .linkish { color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

button { font: inherit; cursor: pointer; border-radius: 12px; }
button.primary {
  background: var(--accent); color: #1a1200; border: 0;
  padding: 14px 18px; font-weight: 700; width: 100%; margin-bottom: 10px;
}
button.primary:hover { filter: brightness(1.06); }
button.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  padding: 12px 18px; width: 100%; margin-bottom: 10px;
}
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; }
.row button { margin-bottom: 0; }

/* HUD */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.hud-left { display: flex; align-items: center; gap: 12px; }
.step { font-size: 14px; color: var(--muted); }
.lives { display: inline-flex; gap: 5px; }
.lives i { width: 11px; height: 11px; border-radius: 50%; background: var(--good); display: block; }
.lives i.spent { background: #33405c; }
.timer { text-align: right; min-width: 96px; }
.timerNum { font-size: 22px; font-weight: 700; }
.timerBar { height: 4px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.timerBar i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width .25s linear; }

.prompt { font-size: clamp(20px, 5.4vw, 27px); margin-bottom: 18px; }

/* The declaration. It is the only way onto a city board, so it sits on the
   waiting screen where it can still change something. */
.citySetup {
  margin: 18px 0 6px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}
.cityForm { margin: 10px 0 0; }
.cityState {
  margin: 12px 0 4px;
  font-size: 14px;
  color: var(--accent);
}

/* The city question. It is the one that decides the city standing, so it gets
   its own note rather than blending in with the nine. */
.qualifierNote {
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: .01em;
}

.choices { display: grid; gap: 10px; }
.choice {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  padding: 16px; text-align: left; font-size: 17px; width: 100%;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice.picked { border-color: var(--accent); background: #20293c; }
.choice.correct { border-color: var(--good); }
.choice.wrong { border-color: var(--bad); }

.yearForm { display: grid; gap: 10px; }
.yearRow { display: flex; gap: 10px; }
.yearInput {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 14px; font-size: 22px; text-align: center;
}
.yearRow button { width: auto; margin: 0; padding: 14px 20px; }
.locked { text-align: center; margin-top: 14px; font-size: 14px; }

/* Near-miss card */
.nearmiss {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, #182136, #121722);
  padding: 24px 18px; margin: 16px 0;
}
.nm-big { font-size: clamp(40px, 13vw, 66px); font-weight: 700; margin: 0; color: var(--accent); }
.nm-label { margin: 2px 0 14px; color: var(--muted); font-size: 14px; }
.nm-mid { margin: 0 0 6px; font-size: 19px; font-weight: 600; }
.nm-small { margin: 0; color: var(--muted); font-size: 14px; }

.histogram { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.histogram li { display: grid; grid-template-columns: 62px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.histogram .bar { height: 9px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.histogram .bar i { display: block; height: 100%; background: #3f5b93; }
.histogram .bar.mine i { background: var(--accent); }

.leaders { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.leaders li { margin-bottom: 4px; }
.answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.answers li { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; color: var(--muted); }
.answers b { color: var(--ink); display: block; margin-bottom: 2px; font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: center; }
.stat { display: block; font-size: clamp(22px, 6vw, 30px); font-weight: 700; color: var(--accent); }
.statLabel { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.bottom { padding: 16px 18px 26px; text-align: center; border-top: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw;
}

[hidden] { display: none !important; }

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