/* Shared look for every page: colors, fonts, buttons, the home page list and the quiz board. */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --ink: #18213a;
  --muted: #5d6680;
  --line: #d3d9e6;
  --accent: #2f4fd8;
  --accent-ink: #ffffff;
  --hit: #ffd84a;
  --hit-ink: #1f1a00;
  --miss: #c8344a;
  --miss-bg: #fbe6ea;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10152a; --surface: #182040; --ink: #e9edf8; --muted: #9aa4c4; --line: #2b355e;
    --accent: #7d95ff; --accent-ink: #0d1330; --hit: #f2c933; --hit-ink: #1f1a00;
    --miss: #ff7d92; --miss-bg: #3a1a26; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10152a; --surface: #182040; --ink: #e9edf8; --muted: #9aa4c4; --line: #2b355e;
  --accent: #7d95ff; --accent-ink: #0d1330; --hit: #f2c933; --hit-ink: #1f1a00;
  --miss: #ff7d92; --miss-bg: #3a1a26; color-scheme: dark;
}

[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 980px; margin: 0 auto; padding-inline: 16px; padding-block: 24px 48px; display: grid; gap: 20px; }

.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1; margin: 4px 0 0; text-wrap: balance; letter-spacing: -.02em; }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }

.back { font-family: var(--font-mono); font-size: 13px; color: var(--muted); text-decoration: none; justify-self: start; }
.back:hover { color: var(--accent); }
.back:focus-visible { outline: 3px solid var(--hit); outline-offset: 2px; border-radius: 4px; }

/* Home page: one card per quiz */
.quiz-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card {
  display: grid; gap: 6px; height: 100%; box-sizing: border-box;
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 16px 20px;
  color: var(--ink); text-decoration: none; transition: border-color .15s ease, transform .15s ease;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
a.card:focus-visible { outline: 3px solid var(--hit); outline-offset: 2px; }
.card .meta { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; line-height: 1.15; margin: 0; }
.card.broken { border-style: dashed; color: var(--miss); }
.card.broken .meta { color: var(--miss); }

/* Quiz page: header strip with score + clock, answer field, then the answer grid */
.board { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: stretch; }
@media (max-width: 640px) { .board { grid-template-columns: 1fr 1fr; } .entry { grid-column: 1 / -1; } }

.entry { display: grid; gap: 6px; min-width: 0; }
.entry label { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.entry-row { display: flex; gap: 8px; }
#answer {
  flex: 1; min-width: 0; font: 600 1.25rem var(--font-body); color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
#answer:focus { outline: none; border-color: var(--accent); }
#answer:disabled { opacity: .55; }
#answer.flash-hit { border-color: var(--hit); }
#answer.flash-dupe { border-color: var(--miss); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; display: grid; align-content: center; min-width: 120px; }
.stat .k { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--font-mono); font-weight: 700; font-size: 1.75rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .v small { font-size: .55em; color: var(--muted); font-weight: 500; }
#clock.low { color: var(--miss); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
button {
  font: 700 .95rem var(--font-body); border-radius: 999px; padding: 10px 20px; cursor: pointer;
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button:focus-visible { outline: 3px solid var(--hit); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: not-allowed; }
.status { font-size: .95rem; color: var(--muted); min-height: 1.5em; margin: 0; }
.status strong { color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cell {
  font-family: var(--font-body); font-weight: 700; font-size: .95rem;
  min-height: 40px; border-radius: 8px; padding: 8px 10px; display: flex; align-items: center;
  background: var(--surface); border: 1px dashed var(--line); color: transparent;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}
.cell.hit { background: var(--hit); color: var(--hit-ink); border: 1px solid var(--hit); transform: scale(1.02); }
.cell.hit.settled { transform: none; }
.cell.miss { background: var(--miss-bg); color: var(--miss); border: 1px solid var(--miss); }

/* Squares with a label (like "2019 Masters") show it above the answer, even while empty */
.cell.labeled { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 56px; }
.cell-label { font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: .04em; color: var(--muted); }
.cell.hit .cell-label { color: var(--hit-ink); opacity: .7; }
.cell.miss .cell-label { color: var(--miss); opacity: .8; }

.result { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; display: grid; gap: 4px; }
.result h2 { font-family: var(--font-display); font-weight: 800; margin: 0; font-size: 1.6rem; }
.result p { margin: 0; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .cell, .card { transition: none; } .cell.hit, a.card:hover { transform: none; } }
