@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --ground: #121A3A;
  --raised: #1E2A5C;
  --text: #F5F3EA;
  --muted: #BCC2DD;
  --accent: #FFD23F;   /* the one main action, the rung */
  --ink: #121A3A;      /* text on the accent */
  --right: #5BE59A;
  --wrong: #FF8A8A;
  --edge: #3A4785;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 18px/1.5 "Lexend", system-ui, sans-serif;
  padding: env(safe-area-inset-top, 0) 16px env(safe-area-inset-bottom, 0);
}
a { color: var(--accent); }
main { max-width: 640px; margin: 0 auto; padding-block: 16px 20px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

h1, h2, h3 { margin: 0; line-height: 0.95; letter-spacing: -0.03em; }
h1 { font-weight: 800; font-size: clamp(44px, 14.5vw, 120px); color: var(--accent); }  /* "Countries" still fits a 375px phone */
h2 { font-weight: 800; font-size: clamp(44px, 13vw, 76px); }
h3 { font-weight: 600; font-size: 22px; margin-top: 32px; }
b { font-weight: 600; }

.kicker a { color: inherit; }
.kicker, .label { font-size: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { font-size: 20px; max-width: 30em; margin: 18px 0 0; }
.note { color: var(--muted); font-size: 15px; }
.home-head { margin-bottom: 28px; }
.home-head .kicker { margin-bottom: 10px; }

/* Buttons: one filled main action per view, the rest outlined */
.btn {
  font: inherit; font-weight: 600; font-size: 17px;
  color: var(--text); background: transparent;
  border: 2px solid var(--text); border-radius: 12px;
  padding: 10px 16px; min-height: 48px; cursor: pointer;
}
.btn.big { font-size: 20px; font-weight: 800; padding: 12px 24px; min-height: 54px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn.text { border: 0; padding: 8px 10px; font-size: 22px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) { .btn:not(:disabled):hover { background: var(--raised); } .btn.primary:not(:disabled):hover { background: #FFE07A; } }

.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.home-actions .btn { flex: 1 1 160px; }

.bests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 32px 0 0; border-top: 2px solid var(--edge); border-bottom: 2px solid var(--edge); }
.bests div { padding: 14px 0; }
.bests dt { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.bests dd { margin: 2px 0 0; font-size: 34px; font-weight: 800; }

.how { margin-top: 24px; }
.how summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.how ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.how li { margin: 6px 0; }

/* Play */
.bar { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 2px solid var(--edge); }
.bar .stat { margin: 0; display: flex; flex-direction: column; }
.bar .stat .label { font-size: 12px; }
.bar .num { font-size: 24px; font-weight: 800; line-height: 1.1; }
#pos { color: var(--accent); }
.lives { font-size: 18px; letter-spacing: 3px; line-height: 1.4; }
.bar #mute { margin-left: auto; }
.bar #mute[aria-pressed="true"] { text-decoration: line-through; color: var(--muted); }

/* Verdict */
.verdict { margin-top: 14px; padding: 16px; border-radius: 16px; background: var(--raised); }
.verdict-head { font-size: 30px; font-weight: 800; margin: 0 0 10px; line-height: 1; }
.verdict.right .verdict-head { color: var(--right); }
.verdict.wrong .verdict-head { color: var(--wrong); }
.verdict .btn { margin-top: 14px; width: 100%; }
.verdict p { margin: 10px 0 0; }

/* Done */
.done-head { margin-top: 10px; color: var(--accent); }
.share-text { font: inherit; font-size: 18px; background: var(--raised); border-radius: 12px; padding: 14px; white-space: pre-wrap; margin: 20px 0 12px; }
.missed { list-style: none; padding: 0; margin: 10px 0 24px; }
.missed li { padding: 12px 0; border-bottom: 1px solid var(--edge); }
.missed b { font-size: 22px; font-weight: 800; }
.missed span { display: block; color: var(--muted); font-size: 16px; }

.foot { max-width: 640px; margin: 0 auto; padding: 8px 0 28px; color: var(--muted); font-size: 14px; }

.pop { animation: pop 160ms ease-out; }
@keyframes pop { from { transform: scale(0.96); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

/* The games home */
.games { list-style: none; padding: 0; margin: 8px 0 0; border-top: 2px solid var(--edge); }
.games li { border-bottom: 2px solid var(--edge); }
.games a { display: block; padding: 20px 0; color: var(--text); text-decoration: none; }
.games .game-name { display: block; font-size: clamp(32px, 9vw, 48px); font-weight: 800; line-height: 1; color: var(--accent); letter-spacing: -0.02em; }
.games .game-line { display: block; margin-top: 8px; color: var(--muted); }
.games .game-today { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--muted); }
.games .game-today.done { color: var(--right); }
.today { margin: 0 0 28px; }
.today .bests { grid-template-columns: repeat(2, 1fr); margin-top: 8px; }
@media (hover: hover) { .games a:hover .game-name { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; } }
.games a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

/* Shared by the multiple-choice games and the clocked games: topics, the timer switch, the question, the clock, answers */
.topics { border: 0; padding: 0; margin: 0 0 18px; }
.topics legend { padding: 0; margin-bottom: 10px; }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-list label {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  border: 2px solid var(--edge); border-radius: 12px; font-weight: 600; font-size: 16px; cursor: pointer;
}
.topic-list label:has(input:checked) { border-color: var(--accent); background: var(--raised); }
.topic-list input, .switch input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 18px; font-weight: 600; cursor: pointer; }
.clue { padding: 14px 0 4px; }
.question { font-size: clamp(20px, 5.6vw, 30px); font-weight: 600; line-height: 1.25; margin: 6px 0 0; }
.clock { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.clock-track { flex: 1; height: 10px; border-radius: 5px; background: var(--raised); overflow: hidden; }
.clock-fill { height: 100%; width: 100%; background: var(--accent); }
.clock.low .clock-fill { background: var(--wrong); }
.clock-n { font-weight: 800; font-size: 20px; min-width: 2ch; text-align: right; }
.answers { display: grid; gap: 8px; margin-top: 12px; }
.answers .btn { text-align: left; font-size: 18px; padding: 10px 14px; min-height: 52px; display: flex; gap: 12px; align-items: center; }
.answers .key { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--raised); color: var(--muted); font-size: 15px; }
.answers .btn.right { border-color: var(--right); color: var(--right); }
.answers .btn.wrong { border-color: var(--wrong); color: var(--wrong); }
.answers .btn.gone { visibility: hidden; }
.answers .btn:disabled { opacity: 1; }
.answers .btn:disabled:not(.right):not(.wrong) { opacity: 0.45; }
#fifty { margin-top: 12px; }
.verdict .answer-was { font-size: 22px; font-weight: 800; }
.verdict .why { color: var(--muted); }
.pic.shape { border: 0; background: none; object-fit: contain; }
.pic { display: block; height: min(240px, 26vh); height: min(240px, 26dvh); width: auto; max-width: 100%; aspect-ratio: 4 / 3; margin: 12px 0 0; border: 2px solid var(--edge); border-radius: 6px; background: var(--raised); }

#regions:empty { min-height: 112px; }  /* the continents arrive with the data: keep their room so nothing jumps */

/* short screens (an iPhone SE once Safari's bars are counted): a little tighter, so a game's whole question and its
   answers fit without scrolling. Every button stays at least 44px tall. */
@media (max-height: 600px) {
  .btn.big { min-height: 48px; padding: 9px 20px; font-size: 18px; }
  .btn { min-height: 44px; padding: 8px 14px; }
  .answers .btn { min-height: 46px; padding: 8px 12px; }
  .answers { gap: 6px; }
  .pic { height: 21vh; height: 21dvh; }
  .clue { padding-top: 10px; }
}

/* Who Am I?: each clue on its own line, the newest last */
.question.clues .clue-line { display: block; font-size: 18px; margin-top: 6px; }
.question.clues .clue-line:last-child { color: var(--accent); }
#more { margin-top: 10px; }

/* Today's Five on the games home */
.five { margin: 4px 0 30px; padding: 18px 16px 6px; border-radius: 16px; background: var(--raised); }
.five-title { font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--text); }
.five-day { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; margin-left: 6px; }
.five-list { list-style: none; counter-reset: five; padding: 0; margin: 12px 0 14px; display: grid; gap: 6px; }
.five-list li { counter-increment: five; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; }
.five-list li::before { content: counter(five); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--ground); color: var(--muted); font-size: 15px; font-weight: 800; }
.five-list li.done::before { content: "✓"; background: var(--right); color: var(--ink); }
.five-mark { margin-left: auto; color: var(--right); }
.five-go { display: block; text-align: center; text-decoration: none; }
.five-score { font-size: 64px; font-weight: 800; line-height: 1; margin: 6px 0 4px; color: var(--accent); }
.five-of { font-size: 28px; color: var(--muted); }
.five-stats { grid-template-columns: repeat(2, 1fr); border: 0; margin-top: 14px; }
.games-head { margin: 0 0 8px; }
