/* Fonts are self-hosted (OFL, from Google Fonts): no third-party request on any page. */
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 600 800; font-display: swap; src: url(/fonts/bricolage-grotesque-latin.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-latin.woff2) format('woff2'); }
:root {
  --paper: #fbfaf7;
  --card: #ffffff;
  --ink: #16130f;
  --ink-2: #4a453e;
  --ink-3: #8a847b;
  --line: #e7e3dc;
  --a: #f0532d;        /* option A: vermillion */
  --a-soft: #fde9e3;
  --b: #2d4bf0;        /* option B: cobalt */
  --b-soft: #e5e9fd;
  --ok: #157a4a;
  --ok-soft: #e2f3ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --radius: 14px;
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1040px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font: 700 20px/1 var(--display); letter-spacing: -0.02em; text-decoration: none; }
.logo .mark { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(90deg, var(--a) 50%, var(--b) 50%); box-shadow: inset 0 0 0 2px var(--paper); outline: 1.5px solid var(--ink); }
.top nav a { font-size: 14px; color: var(--ink-2); text-decoration: none; margin-left: 16px; }
.top nav a:hover { color: var(--ink); text-decoration: underline; }

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.025em; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(34px, 8vw, 54px); font-weight: 750; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.lede { font-size: 18px; color: var(--ink-2); margin: 14px 0 0; max-width: 34em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hl-a { color: var(--a); } .hl-b { color: var(--b); }

/* surfaces */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack > * + * { margin-top: 14px; }
section { margin: 28px 0; }

/* form */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 17px; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--ink); }
.opt-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.opt { position: relative; }
.opt .tag { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font: 700 13px/1 var(--display); color: #fff; }
.opt.a .tag { background: var(--a); } .opt.b .tag { background: var(--b); }
.opt .input { padding-left: 46px; }
.vs { text-align: center; font: 700 12px/1 var(--display); color: var(--ink-3); letter-spacing: .12em; }
.count { font-size: 12px; color: var(--ink-3); text-align: right; margin-top: 4px; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.imgpick { display: none; gap: 10px; grid-template-columns: 1fr 1fr; }
.imgpick.on { display: grid; }
.imgpick label { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; text-align: center; font-size: 13px; color: var(--ink-2); cursor: pointer; min-height: 90px; display: grid; place-items: center; overflow: hidden; }
.imgpick img { max-width: 100%; max-height: 120px; border-radius: 6px; }
.imgpick input { display: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 14px 20px; font-weight: 650; font-size: 16px; cursor: pointer; text-decoration: none; transition: transform .06s, background .15s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.full { width: 100%; }
.btn.sm { padding: 9px 13px; font-size: 14px; border-radius: 10px; }
.btn.wa { background: #1f9d55; color: #fff; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 600; }

/* vote */
.q { font-size: clamp(26px, 6.4vw, 38px); font-weight: 720; margin: 18px 0 20px; }
.choices { display: grid; gap: 12px; }
.choice { width: 100%; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 20px 18px; font: 650 20px/1.25 var(--body); cursor: pointer; display: flex; align-items: center; gap: 14px; transition: border-color .12s, background .12s, transform .06s; min-height: 76px; }
.choice:active { transform: scale(.985); }
.choice .tag { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 700 15px/1 var(--display); }
.choice.a .tag { background: var(--a); } .choice.b .tag { background: var(--b); }
.choice.a:hover { border-color: var(--a); background: var(--a-soft); }
.choice.b:hover { border-color: var(--b); background: var(--b-soft); }
.choice img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex: none; }
.choices.img .choice { flex-direction: column; align-items: stretch; text-align: center; }
.choices.img .choice img { width: 100%; height: auto; aspect-ratio: 4/3; }
.choices.img { grid-template-columns: 1fr 1fr; }
.choices.img .choice .tag { align-self: center; }

/* results */
.res { display: grid; gap: 10px; }
.bar { position: relative; border-radius: 12px; overflow: hidden; background: #f2efe9; height: 52px; display: flex; align-items: center; }
.bar .fill { position: absolute; inset: 0 auto 0 0; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.bar.a .fill { background: var(--a-soft); border-right: 3px solid var(--a); }
.bar.b .fill { background: var(--b-soft); border-right: 3px solid var(--b); }
.bar .lbl { position: relative; padding: 0 14px; font-weight: 600; display: flex; justify-content: space-between; width: 100%; gap: 10px; }
.bar .lbl > span { display: flex; align-items: center; min-width: 0; }
.bar .lbl .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .lbl b { font-family: var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.bar .lbl .me { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--ink); color: #fff; border-radius: 6px; padding: 3px 6px; margin-right: 8px; }

/* verdict */
.verdict-head { display: flex; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px; border-radius: 99px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.mute { background: #efece6; color: var(--ink-2); }
.big { font: 750 clamp(56px, 16vw, 88px)/0.95 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 40px; margin: 22px 0 6px; }
.track .rail { position: absolute; left: 0; right: 0; top: 18px; height: 4px; background: #ece8e1; border-radius: 4px; }
.track .band { position: absolute; top: 12px; height: 16px; border-radius: 8px; opacity: .28; }
.track .dot { position: absolute; top: 11px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; transform: translateX(-50%); box-shadow: 0 0 0 1.5px var(--ink); }
.track .mid { position: absolute; left: 50%; top: 4px; bottom: 4px; width: 0; border-left: 1.5px dashed var(--ink-3); }
.track .mid::after { content: '50%'; position: absolute; top: -14px; left: -12px; font-size: 11px; color: var(--ink-3); }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.nudge { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-soft); border-radius: 12px; padding: 14px; }
.nudge.ok { background: var(--ok-soft); }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; }

/* post-vote CTA */
.cta-link { display: inline-block; margin-top: 6px; font-weight: 650; text-underline-offset: 4px; }
.yourturn { border: 2px solid var(--ink); border-radius: 18px; padding: 18px; background: #fff; box-shadow: 6px 6px 0 var(--ink); }
.yourturn .preview { margin: 12px 0; padding: 12px; border-radius: 10px; background: var(--paper); font-size: 15px; }
.yourturn .preview b { display: block; font-family: var(--display); font-size: 18px; margin-bottom: 6px; }
.yourturn .edit { display: none; margin: 12px 0; }
.yourturn.editing .edit { display: block; }
.yourturn.editing .preview { display: none; }

/* lab */
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 14px 0; }
.grid2 > section { margin: 0; }
.kpi { font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tbl td.n { font-variant-numeric: tabular-nums; text-align: right; }
.tbl th.n { text-align: right; }
.banner { border-radius: 14px; padding: 16px 18px; border: 1.5px solid; }
.banner.mute { border-color: var(--line); background: #f5f2ec; }
.banner.warn { border-color: #f0d49b; background: var(--warn-soft); }
.banner.ok { border-color: #a8dbbf; background: var(--ok-soft); }
.banner.bad { border-color: #f1b3ad; background: var(--bad-soft); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.flagrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.flagrow:last-child { border-bottom: 0; }
code, .mono { font-family: var(--mono); font-size: 13px; }
code { background: #f1eee8; padding: 1px 5px; border-radius: 5px; }
.audit { font-size: 13px; max-height: 260px; overflow: auto; }
.audit div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
details summary { cursor: pointer; font-weight: 600; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: #f5f2ec; padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }
.ci { position: relative; height: 26px; margin-top: 6px; }
.ci .rail { position: absolute; left: 0; right: 0; top: 12px; height: 2px; background: var(--line); }
.ci .zero { position: absolute; top: 2px; bottom: 2px; border-left: 1.5px dashed var(--ink-3); }
.ci .band { position: absolute; top: 7px; height: 12px; border-radius: 6px; background: var(--ink); opacity: .75; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font: 700 13px/1 var(--display); }
footer { margin: 44px 0 30px; font-size: 13px; color: var(--ink-3); }
footer a { color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
.toast.on { opacity: 1; }
.hidden { display: none !important; }
.skeleton { color: transparent; background: linear-gradient(90deg, #eee9e2, #f6f3ee, #eee9e2); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 720px) {
  .opt-row { grid-template-columns: 1fr auto 1fr; align-items: center; }
  .choices:not(.img) { grid-template-columns: 1fr 1fr; }
  .choice { min-height: 120px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
