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

:root {
  color-scheme: light;
  --paper: #FFF7E8;
  --card: #FFFFFF;
  --ink: #1E1B2E;
  --muted: #5A5568;
  --flame: #D63F1B;
  --flame-dark: #B23214;
  --amber: #FFB52E;
  --amber-soft: #FFEBC2;
  --good: #0B7F6F;
  --good-soft: #D9F4EE;
  --bad: #C2301A;
  --bad-soft: #FFE3DB;
  --line: 2.5px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --radius: 14px;
  --display: "Bricolage", "Arial Black", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(30, 27, 46, .09) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
}

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--flame-dark); }
img { display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--flame); outline-offset: 2px; }

/* ---- Top bar ---- */
.topbar { background: var(--ink); }
.topbar__inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font: 800 1.2rem/1 var(--display);
}
.brand img { background: var(--ink); border-radius: 9px; }
.coinchip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.coinchip.is-bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ---- Page column ---- */
.wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  flex: 1 0 auto;
}
.wrap--wide { max-width: 760px; }
.stack > * + * { margin-top: 16px; }

.card {
  background: var(--card);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.lede { color: var(--muted); }
.eyebrow {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--flame-dark);
}

/* ---- Buttons ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: var(--line);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  background: var(--card);
  color: var(--ink);
  font: 700 1rem/1.2 var(--body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.btn:disabled { cursor: default; opacity: .65; box-shadow: none; }
.btn--primary { background: var(--flame); color: #fff; }
.btn--reward { background: var(--amber); }
.btn--plain { background: transparent; border-color: transparent; box-shadow: none; text-decoration: underline; min-height: 44px; }
.btn--plain:active:not(:disabled) { transform: none; }
.btn-row { display: grid; gap: 12px; }

.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: var(--flame-dark);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Questions ---- */
.intro-title { font-size: 1.22rem; }
.q__count { font-weight: 700; color: var(--muted); font-size: .88rem; }
.q__text { margin-top: 4px; font-size: 1.3rem; }
.opts { display: grid; gap: 12px; margin-top: 14px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  background: var(--card);
  border: var(--line);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font: 600 1rem/1.3 var(--body);
  text-align: left;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.opt:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.opt:disabled { cursor: default; box-shadow: none; }
.opt__key {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--amber-soft);
  font-weight: 800;
}
.opt__text { flex: 1; }
.opt__mark { flex: none; font-weight: 800; font-size: 1.15rem; }
.opt.is-correct { background: var(--good); color: #fff; }
.opt.is-wrong { background: var(--bad); color: #fff; }
.opt.is-correct .opt__key, .opt.is-wrong .opt__key { background: rgba(255, 255, 255, .22); }
.opt.is-removed { opacity: .4; border-style: dashed; box-shadow: none; }
.opt.is-removed .opt__text { text-decoration: line-through; }

.fact {
  padding: 12px 14px;
  border-left: 5px solid var(--amber);
  border-radius: 0 10px 10px 0;
  background: var(--amber-soft);
  font-size: .95rem;
}

/* ---- Game screen ---- */
.gamebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gamebar__score { font-weight: 800; font-variant-numeric: tabular-nums; }
.timer { display: flex; align-items: center; gap: 10px; margin: 12px 0 14px; }
.timer__track {
  flex: 1;
  height: 12px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
}
.timer__fill {
  height: 100%;
  background: var(--good);
  transform-origin: left center;
}
.timer.is-low .timer__fill { background: var(--bad); }
.timer__num { width: 2ch; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.lifelines { display: flex; justify-content: center; margin-top: 16px; }
.lifelines .btn { width: auto; min-height: 44px; font-size: .92rem; }
.feedback { margin-top: 16px; display: grid; gap: 12px; }
.feedback__title { font: 800 1.15rem/1.2 var(--display); }
.feedback__title.good { color: var(--good); }
.feedback__title.bad { color: var(--bad); }

.iconbtn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

/* ---- Categories ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stats b { display: block; font: 800 1.35rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stats span { font-size: .78rem; color: var(--muted); }

.cats { display: grid; gap: 12px; margin-top: 12px; }
.cat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
}
.cat:active { transform: translate(3px, 3px); box-shadow: none; }
.cat__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--amber-soft);
  font-size: 1.55rem;
}
.cat__body { flex: 1; min-width: 0; }
.cat__body p { font-size: .88rem; color: var(--muted); }
.cat__meta { font-size: .78rem; font-weight: 700; color: var(--flame-dark); }
.cat__go { flex: none; font-weight: 800; font-size: 1.2rem; }

/* ---- Result ---- */
.score { text-align: center; }
.score__big { margin-top: 6px; font: 800 3.2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.score__big small { font-size: 1.4rem; color: var(--muted); }
.score__coins { margin-top: 8px; font-weight: 700; }
.review { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.review li { padding: 14px; background: var(--card); border: var(--line); border-radius: var(--radius); }
.review .tag { font-size: .8rem; font-weight: 800; }
.review .tag.good { color: var(--good); }
.review .tag.bad { color: var(--bad); }
.review p + p { margin-top: 4px; }
.review .small { font-size: .9rem; color: var(--muted); }

/* ---- Dialogs ---- */
dialog.sheet {
  width: calc(100% - 32px);
  max-width: 400px;
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 7px 7px 0 var(--ink);
  background: var(--card);
  color: var(--ink);
  text-align: center;
}
dialog.sheet::backdrop { background: rgba(30, 27, 46, .62); }
.sheet__title { font-size: 1.6rem; }
.sheet__title.good { color: var(--good); }
.sheet__title.bad { color: var(--bad); }
.sheet__coin { margin: 0 auto 8px; }
.sheet__body { margin-top: 8px; }
.sheet .fact { margin-top: 12px; text-align: left; }
.sheet .btn-row { margin-top: 16px; }
.sheet__note { margin-top: 10px; font-size: .78rem; color: var(--muted); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: .92rem;
  text-align: center;
  transform: translateX(-50%);
}

/* ---- Long-form pages ---- */
.prose h1 { font-size: 2rem; }
.prose__date { margin-top: 6px; color: var(--muted); font-size: .9rem; }
.prose h2 { margin-top: 28px; }
.prose h3 { margin-top: 18px; }
.prose p, .prose ul, .prose ol, .prose table { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose .btn { width: auto; display: inline-flex; margin-top: 12px; }
.tablewrap { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; background: var(--card); font-size: .92rem; }
.prose th, .prose td { padding: 8px 10px; border: 1.5px solid var(--ink); text-align: left; vertical-align: top; }
.prose th { background: var(--amber-soft); }
mark.todo { padding: 0 4px; background: #FFD6CC; color: var(--bad); font-weight: 700; }

.facts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.facts li { padding: 14px; background: var(--card); border: var(--line); border-radius: var(--radius); }
.facts h2 { margin: 0 0 4px; font-size: 1.02rem; }

/* ---- Footer ---- */
.footer { background: var(--ink); color: #E9E6F2; padding: 22px 16px 26px; text-align: center; }
.footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  max-width: 560px;
  margin: 0 auto 12px;
  font-size: .9rem;
}
.footer a, .footer .linklike { color: #fff; }
.footer__note { max-width: 520px; margin: 6px auto 0; font-size: .8rem; color: #C9C5D6; }

.noscript { margin: 0; padding: 12px 16px; background: var(--bad-soft); color: var(--bad); text-align: center; font-weight: 700; }

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