/* Firstdle v3.0 — "the archive card" (inc-035, per PLAN-V3-claude.md).
   Warm paper and ink, flat index cards with a brick top rule, exactly
   three feedback colours (oxidised green / ochre / brick) that never
   carry meaning alone — the verdict text and card labels always say
   it too. No shadows, no gradients, no downloaded fonts. The design
   tokens below are pinned by tests.html so they cannot drift. */
:root {
  --paper: #F5F1E8;
  --surface: #FCFAF4;
  --surface-hover: #EFE9DB;
  --ink: #1C1A17;
  --ink-muted: #57534A;
  --green: #33654A;
  --ochre: #8F5E10;
  --brick: #9E3A2B;
  --green-tint: #E2EBDC;
  --brick-tint: #F2DFD6;
  --btn-bg: #1C1A17;
  --btn-text: #F5F1E8;
  --btn-hover: #35302A;
  --focus: #1C1A17;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130F;
    --surface: #1E1C17;
    --surface-hover: #262319;
    --ink: #EAE3D3;
    --ink-muted: #A8A091;
    --green: #84B596;
    --ochre: #D9A648;
    --brick: #D08068;
    --green-tint: #22301F;
    --brick-tint: #38231C;
    --btn-bg: #EAE3D3;
    --btn-text: #1C1A17;
    --btn-hover: #D8CFBB;
    --focus: #EAE3D3;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--serif); background: var(--paper); color: var(--ink); }
button, textarea { font: inherit; }
.container { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; text-align: center; }
h1 { margin: 8px 0 4px; font-size: 2.2rem; letter-spacing: 0.01em; }
.subtitle { margin: 0 0 24px; color: var(--ink-muted); font-size: 1.1rem; }
.hud { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-bottom: 20px; font-weight: 600; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.choices { display: flex; align-items: stretch; justify-content: center; gap: 12px; }
.choice { flex: 1; min-height: 120px; padding: 20px 12px; font-size: 1.25rem; font-weight: 700; border: 1px solid var(--ink); border-top: 3px solid var(--brick); border-radius: 0; background: var(--surface); color: var(--ink); cursor: pointer; }
.choice:hover:not(:disabled) { background: var(--surface-hover); }
.choice:disabled { cursor: default; opacity: 0.95; }
.choice.correct { border-color: var(--green); background: var(--green-tint); }
.choice.incorrect { border-color: var(--brick); background: var(--brick-tint); }
.vs { align-self: center; font-weight: 700; color: var(--ink-muted); }
.reveal { margin-top: 24px; padding: 16px; background: var(--surface); border: 1px solid var(--ink); border-top: 3px solid var(--brick); border-radius: 0; }
.reveal p { margin: 6px 0; }
#reveal-result { font-weight: 700; }
#reveal-years { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.reveal-facts { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ink-muted); }
.reveal .reveal-note { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.5; }
.reveal .reveal-source { margin: 0; font-size: 0.8rem; line-height: 1.4; color: var(--ink-muted); overflow-wrap: anywhere; }
#next-btn, #play-again-btn { margin-top: 12px; padding: 12px 28px; font-size: 1rem; font-weight: 700; border: 1px solid var(--ink); border-radius: 0; background: var(--btn-bg); color: var(--btn-text); cursor: pointer; }
#next-btn:hover, #play-again-btn:hover { background: var(--btn-hover); }
.mode-choices { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.mode-choices button, #change-mode-btn { padding: 12px 28px; font-size: 1rem; font-weight: 700; border-radius: 0; cursor: pointer; }
#daily-btn { border: 1px solid var(--ink); background: var(--btn-bg); color: var(--btn-text); }
#daily-btn:hover { background: var(--btn-hover); }
#free-play-btn, #practice-btn, #change-mode-btn { border: 1px solid var(--ink); background: var(--surface); color: var(--ink); }
#free-play-btn:hover, #practice-btn:hover, #change-mode-btn:hover { background: var(--surface-hover); }
/* Practice mode's end control (inc-018): the secondary button style at a
   compact size, sitting in the HUD row so it is reachable at all times. */
#end-practice-btn { padding: 4px 12px; font-size: 0.875rem; font-weight: 700; border: 1px solid var(--ink); border-radius: 0; background: var(--surface); color: var(--ink); cursor: pointer; }
#end-practice-btn:hover { background: var(--surface-hover); }
#change-mode-btn { margin-top: 12px; margin-left: 8px; }
.daily-date { color: var(--ink-muted); }
#day-streak, #final-day-streak { color: var(--ochre); font-weight: 700; }
/* Accessibility (inc-012) — adapted from a Claude draft, see report. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.choice:focus-visible { outline-width: 4px; }
@media (forced-colors: active) { button:focus-visible { outline-color: Highlight; } }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
.stats-row { position: relative; }
.stats-card { background: var(--surface); border: 1px solid var(--ink); border-top: 3px solid var(--brick); border-radius: 0; padding: 16px; margin-top: 16px; text-align: left; }
.stats-card h2 { margin: 0 0 12px; font-size: 1rem; text-align: center; letter-spacing: 0.06em; text-transform: uppercase; }
.stats-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; text-align: center; }
.stats-summary dt, .stats-label { margin: 0 0 6px; font-size: 0.8rem; color: var(--ink-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.stats-summary dd { margin: 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-row { display: grid; grid-template-columns: 2.5ch 1fr 3ch; gap: 8px; align-items: center; margin-top: 4px; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.stats-bar { height: 10px; min-width: 4px; border-radius: 0; background: var(--ochre); justify-self: start; }
#share-btn { margin-top: 12px; padding: 12px 28px; font-size: 1rem; font-weight: 700; border: 1px solid var(--ink); border-radius: 0; background: var(--btn-bg); color: var(--btn-text); cursor: pointer; }
/* Free Play difficulty selector (inc-017): native radios styled with the
   two existing button styles — surface/outline unselected, ink filled selected. */
.difficulty { border: 0; padding: 0; margin: 16px 0 0; }
.difficulty legend { font-size: 0.8rem; color: var(--ink-muted); letter-spacing: 0.06em; text-transform: uppercase; padding: 0; margin-bottom: 6px; }
.diff-row { display: flex; gap: 8px; }
.difficulty input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.difficulty label { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--ink); border: 1px solid var(--ink); border-radius: 0; cursor: pointer; font-weight: 700; }
.difficulty input:checked + label { background: var(--btn-bg); color: var(--btn-text); }
.difficulty input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Theme selector (inc-019): same radio/label styling as difficulty, laid
   out as a 2-column grid with "All themes" spanning the first row. */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-grid > label { text-align: center; line-height: 1.2; padding: 6px 4px; }
.theme-grid > label.theme-all-label { grid-column: 1 / -1; }
@media (max-width: 359px) { .theme-grid { grid-template-columns: 1fr; } }
#share-btn:hover { background: var(--btn-hover); }
#share-text { margin-top: 8px; max-width: 100%; font: inherit; padding: 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--ink); border-radius: 0; }
@media (max-width: 480px) {
  .choices { flex-direction: column; }
  .choice { min-height: 80px; width: 100%; }
}
