:root {
  --bg: #fff4e6; --card: #ffffff; --ink: #1f1b2d; --muted: #6b6478; --line: #1f1b2d;
  --coral: #ff5a5f; --sun: #ffc83d; --mint: #2fbf9b; --sky: #5aa9ff;
  --shadow: 4px 4px 0 var(--ink);
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17141f; --card: #231f31; --ink: #f6efe6; --muted: #aaa3b8; --line: #f6efe6; --shadow: 4px 4px 0 #000; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Bricolage Grotesque", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.02em; }
h1 { font-size: clamp(2.2rem, 8vw, 3.8rem); }
h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; max-width: 880px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 1.4rem; letter-spacing: -.03em; }
.coin { width: 34px; height: 34px; }
.top nav { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.top nav a { text-decoration: none; }

main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 8px 16px 40px; }
.foot { text-align: center; padding: 24px 16px 36px; color: var(--muted); font-size: .9rem; }
.foot .fine { font-size: .8rem; }

.btn, .pill {
  display: inline-block; border: 3px solid var(--line); background: var(--coral); color: #fff;
  font: inherit; font-weight: 800; padding: 14px 24px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow); text-decoration: none; text-align: center; transition: transform .08s, box-shadow .08s;
}
.btn:hover, .pill:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active, .pill:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.big { font-size: 1.2rem; padding: 16px 34px; }
.btn.ghost, .btn.alt { background: var(--card); color: var(--ink); }
.btn.sun { background: var(--sun); color: #1f1b2d; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.pill { padding: 8px 16px; font-size: .95rem; }
.btn.small { padding: 8px 16px; font-size: .9rem; }

.card { background: var(--card); border: 3px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }

/* hero */
.hero { text-align: center; padding: 28px 0 16px; }
.hero .coin-lg { width: 120px; height: 120px; animation: flip 5s ease-in-out infinite; transform-origin: center; }
@keyframes flip { 0%, 80%, 100% { transform: rotateY(0) } 90% { transform: rotateY(180deg) } }
@media (prefers-reduced-motion: reduce) { .hero .coin-lg { animation: none; } * { transition: none !important; } }
.hero p.lead { font-size: 1.2rem; max-width: 30ch; margin: 0 auto 1.4em; color: var(--muted); }
.stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 28px 0 8px; }
.stat { background: var(--card); border: 3px solid var(--line); border-radius: var(--r); padding: 10px 18px; min-width: 130px; text-align: center; }
.stat b { display: block; font-size: 1.8rem; font-weight: 800; }
.stat span { font-size: .85rem; color: var(--muted); }

.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 12px 0 28px; }
.step { background: var(--card); border: 3px solid var(--line); border-radius: var(--r); padding: 18px; }
.step .n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sun); color: #1f1b2d; font-weight: 800; border: 3px solid var(--line); margin-bottom: 8px; }
.example { text-align: center; font-weight: 800; font-size: 1.1rem; }
.example .big { font-size: 2.4rem; color: var(--coral); display: block; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 0; padding: 0; list-style: none; }
.chips li { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 700; }

/* forms */
label { display: block; font-weight: 800; margin-bottom: 6px; }
input[type=text] { width: 100%; font: inherit; font-weight: 700; padding: 14px 16px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); }
input[type=text]:focus { outline: 3px solid var(--sky); outline-offset: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { font: inherit; font-weight: 800; padding: 10px 16px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--sun); color: #1f1b2d; box-shadow: 3px 3px 0 var(--ink); }
.field { margin-bottom: 22px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.toggle { display: flex; align-items: flex-start; gap: 10px; font-weight: 700; }
.toggle input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--coral); }
.error { color: var(--coral); font-weight: 800; min-height: 1.4em; }

/* question screen */
.progress { height: 14px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); overflow: hidden; margin: 8px 0 6px; }
.progress i { display: block; height: 100%; background: var(--mint); transition: width .25s; }
.qmeta { display: flex; justify-content: space-between; font-weight: 700; color: var(--muted); font-size: .9rem; }
.qtitle { text-align: center; margin: 22px 0 18px; font-size: 1.3rem; }
.duel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opt { font: inherit; font-weight: 800; font-size: clamp(1.1rem, 4.5vw, 1.6rem); min-height: 170px; padding: 16px; border: 3px solid var(--line); border-radius: var(--r); color: #1f1b2d; cursor: pointer; box-shadow: var(--shadow); word-break: break-word; transition: transform .08s, box-shadow .08s; }
.opt:nth-child(1) { background: #ffd1d2; } .opt:nth-child(2) { background: #fff0b8; }
.opt:hover { transform: translate(-1px, -1px); }
.opt:active, .opt.picked { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.vs { text-align: center; color: var(--muted); font-weight: 800; margin: 12px 0 0; }
.back { background: none; border: 0; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 8px 0; }

/* results */
.score { text-align: center; }
.score .pct { font-size: clamp(3.4rem, 18vw, 6rem); font-weight: 800; line-height: 1; color: var(--coral); }
.score .sub { font-weight: 800; font-size: 1.2rem; }
.rank { display: inline-block; margin-top: 10px; background: var(--sun); color: #1f1b2d; border: 3px solid var(--line); border-radius: 999px; padding: 4px 16px; font-weight: 800; }
.board { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.board li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 2px dashed color-mix(in srgb, var(--ink) 25%, transparent); counter-increment: r; }
.board li:last-child { border: 0; }
.board li::before { content: counter(r); width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--sun); color: #1f1b2d; font-size: .85rem; font-weight: 800; border: 2px solid var(--line); }
.board li:nth-child(1)::before { background: var(--coral); color: #fff; }
.board .nm { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .sc { font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 16px 0; }

.review { list-style: none; margin: 0; padding: 0; }
.review li { padding: 10px 0; border-bottom: 2px dashed color-mix(in srgb, var(--ink) 25%, transparent); display: flex; gap: 10px; align-items: center; }
.review li:last-child { border: 0; }
.review .mark { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; border: 2px solid var(--line); }
.review .ok .mark { background: var(--mint); } .review .no .mark { background: var(--coral); }
.review .t { flex: 1; font-weight: 700; }
.review .t small { display: block; font-weight: 500; color: var(--muted); }
.bar { height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--coral); }
.bar.a i { background: var(--coral); } .bar.b i { background: var(--sun); }
.pctlabel { flex: none; font-weight: 800; min-width: 3.2em; text-align: right; }

.share { display: flex; flex-wrap: wrap; gap: 8px; }
.linkbox { display: flex; gap: 8px; margin-bottom: 12px; }
.linkbox input { flex: 1; min-width: 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 800; z-index: 10; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.mine { display: flex; flex-direction: column; gap: 8px; }
.mine a { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; text-decoration: none; font-weight: 800; display: flex; justify-content: space-between; }
@media (max-width: 420px) { .opt { min-height: 140px; } }
