:root {
  --covid: #0f766e;
  --covid-soft: #ccfbf1;
  --trump: #c8102e;
  --trump-soft: #fde2e4;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;

  --bg: #fdf8f0;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5b5b5b;
  --border: #e6e0d6;
  --shadow: 0 6px 24px rgb(0 0 0 / 0.08);
  --primary: #1a1a1a;
  --primary-text: #ffffff;

  --font-display: "Archivo Black", "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --covid: #2dd4bf;
    --covid-soft: #10302d;
    --trump: #f87171;
    --trump-soft: #3a1518;
    --ok: #4ade80;
    --ok-soft: #12301d;
    --bad: #f87171;
    --bad-soft: #3a1518;

    --bg: #121212;
    --surface: #1e1e1e;
    --text: #f2f2f2;
    --muted: #a8a8a8;
    --border: #333;
    --shadow: 0 6px 24px rgb(0 0 0 / 0.4);
    --primary: #f2f2f2;
    --primary-text: #121212;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.screen { display: flex; flex-direction: column; flex: 1; gap: 16px; }
.screen[hidden] { display: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

h1, h2 { margin: 0; }
h1:focus, h2:focus { outline: none; }
[tabindex="-1"]:focus-visible { outline: none; }

/* ---------- Start ---------- */
.hero { text-align: center; padding-top: 12px; }
.hero-emoji { font-size: 2rem; margin: 0 0 4px; letter-spacing: 0.15em; }
.title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 11vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.pitch { margin: 8px 0 0; color: var(--muted); font-size: 1.05rem; }

.eras { display: grid; gap: 12px; }
.era {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 6px solid;
  box-shadow: var(--shadow);
}
.era h2 { font-size: 1.05rem; }
.era p { margin: 4px 0 0; font-size: 0.95rem; color: var(--muted); }
.era-covid { border-color: var(--covid); }
.era-covid h2 { color: var(--covid); }
.era-trump { border-color: var(--trump); }
.era-trump h2 { color: var(--trump); }

.disclaimer {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

.error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bad-soft);
  color: var(--bad);
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.actions {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.btn {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border-radius: 16px;
  font: 700 1.15rem/1.2 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--text); }

.btn-answer { min-height: 64px; font-size: 1.3rem; color: #fff; }
.btn-covid { background: var(--covid); }
.btn-trump { background: var(--trump); }
@media (prefers-color-scheme: dark) {
  .btn-answer { color: #121212; }
}

/* On tall or wide screens, keep the buttons with the content and center the
   whole screen instead of pinning the buttons to the bottom edge. */
@media (min-width: 700px), (min-height: 860px) {
  .app { justify-content: center; }
  .screen { flex: none; }
  .actions { margin-top: 8px; }
}

/* ---------- Question ---------- */
.progress { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--muted); }
.progress span { min-width: 3.5em; font-variant-numeric: tabular-nums; }
.progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 10%; background: var(--text); border-radius: 99px; transition: width 0.3s ease; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.prompt {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 7vw, 1.9rem);
  line-height: 1.2;
  font-weight: 400;
}

.hint { margin: 0; text-align: center; color: var(--muted); font-weight: 600; }

/* ---------- Reveal ---------- */
.reveal { border-top: 8px solid var(--border); display: grid; gap: 10px; }
.reveal[data-era="covid"] { border-top-color: var(--covid); }
.reveal[data-era="trump"] { border-top-color: var(--trump); }

.verdict { font-family: var(--font-display); font-size: 2rem; font-weight: 400; }
.is-correct .verdict { color: var(--ok); }
.is-wrong .verdict { color: var(--bad); }

.era-tag {
  margin: 0;
  justify-self: start;
  padding: 6px 12px;
  border-radius: 99px;
  font-weight: 700;
}
.reveal[data-era="covid"] .era-tag { background: var(--covid-soft); color: var(--covid); }
.reveal[data-era="trump"] .era-tag { background: var(--trump-soft); color: var(--trump); }

.reveal-prompt { margin: 0; font-weight: 600; }
.figure { margin: 0; font-size: 1.35rem; }
.figure strong { font-family: var(--font-display); font-weight: 400; }
.date { color: var(--muted); font-size: 1rem; }
.context { margin: 0; color: var(--muted); }
.source { margin: 0; font-size: 0.9rem; color: var(--muted); }
.source a { color: var(--text); font-weight: 600; }

/* ---------- Results ---------- */
.score { font-family: var(--font-display); font-size: 4rem; line-height: 1; font-weight: 400; }
.rank { margin: 8px 0 0; font-size: 1.3rem; font-weight: 700; }

.recap { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recap li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.mark {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-weight: 700;
}
.recap .ok .mark { background: var(--ok-soft); color: var(--ok); }
.recap .bad .mark { background: var(--bad-soft); color: var(--bad); }
.recap-body { display: grid; gap: 2px; }
.recap-era { font-size: 0.8rem; font-weight: 700; }
.recap-era.era-covid { color: var(--covid); }
.recap-era.era-trump { color: var(--trump); }

.share-status { margin: 0; min-height: 1.5em; text-align: center; font-weight: 600; color: var(--muted); }

/* ---------- Motion ---------- */
.screen[data-active] { animation: fade-in 0.25s ease both; }
#screen-reveal[data-active] .reveal { animation: slide-up 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.flash-correct { animation: flash 0.45s ease; }
.shake-wrong { animation: shake 0.45s ease; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  40% { box-shadow: 0 0 0 6px var(--ok); background: var(--ok); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
  50% { box-shadow: 0 0 0 6px var(--bad); }
}

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

/* ---------- Challenge & share ---------- */
.challenge {
  margin: 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--text);
  text-align: center;
  font-weight: 700;
}

.grid-line { margin: 10px 0 0; font-size: 1.4rem; letter-spacing: 0.05em; }
.challenge-result { margin: 8px 0 0; font-weight: 700; font-size: 1.1rem; }

.share-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.share-pitch { margin: 0; text-align: center; font-weight: 600; }
.btn-share {
  color: #fff;
  background: linear-gradient(90deg, var(--covid), var(--trump));
}
@media (prefers-color-scheme: dark) {
  .btn-share { color: #121212; }
}

.recap-title { margin: 8px 0 0; font-size: 1rem; color: var(--muted); }
.share-box .share-status:empty { display: none; }
