/* Layout: one narrow column like a trade ticket. Color is reserved for rarity: each tier has its own hue, and the rarer the answer, the louder the reveal. */
:root {
  --bg: #EDF0F2;
  --panel: #FFFFFF;
  --ink: #14202C;
  --muted: #5A6875;
  --line: #CDD5DC;
  --accent: #A86200;
  --good: #1D7148;
  --bad: #B0281E;
  --bar: #C9D2DA;
  /* rarity tiers */
  --t0: #5F6B77;
  --t1: #08693F;
  --t2: #1D4ED8;
  --t3: #7E22CE;
  --gold: #9A6A00;
  --night: #0A1017;
  --night-ink: #F4F1E8;
  --gold-bright: #F2BC48; /* gold on the always-dark Black Swan panels, both themes */
  --c: var(--ink);
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D151D; --panel: #15212D; --ink: #E4EAF0; --muted: #91A0AE; --line: #2A3A4A;
    --accent: #F0A43A; --good: #5CC98F; --bad: #F07A6E; --bar: #2E4153;
    --t0: #93A3B3; --t1: #3DD68C; --t2: #6AA8FF; --t3: #C78BFF; --gold: #F2BC48;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D151D; --panel: #15212D; --ink: #E4EAF0; --muted: #91A0AE; --line: #2A3A4A;
  --accent: #F0A43A; --good: #5CC98F; --bad: #F07A6E; --bar: #2E4153;
  --t0: #93A3B3; --t1: #3DD68C; --t2: #6AA8FF; --t3: #C78BFF; --gold: #F2BC48;
  color-scheme: dark;
}
.tier-t0 { --c: var(--t0); }
.tier-t1 { --c: var(--t1); }
.tier-t2 { --c: var(--t2); }
.tier-t3 { --c: var(--t3); }
.tier-swan { --c: var(--gold); }
.tier-miss { --c: var(--bad); }
.tier-all { --c: var(--ink); }

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 48px;
}
body.modal-open { overflow: hidden; }
.wrap { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
a { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Masthead */
.mast { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.brand { display: flex; align-items: flex-end; gap: 10px; text-decoration: none; }
.brand svg { width: 64px; height: 34px; flex: none; }
.brand h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-stretch: 72%; font-size: 2.6rem; line-height: .9; letter-spacing: -.01em; text-transform: uppercase; }
.issue { text-align: right; font-family: var(--font-mono); font-size: .78rem; color: var(--muted); line-height: 1.4; }
.issue b { color: var(--ink); font-weight: 600; }
.lede { margin: 0; color: var(--muted); font-size: .95rem; max-width: 60ch; }
.lede strong { color: var(--ink); font-weight: 600; }
.foot { margin: 0; color: var(--muted); font-size: .82rem; }

/* Nav */
.nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); align-items: flex-end; flex-wrap: wrap; }
.nav a { text-decoration: none; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 8px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.nav-help { margin-left: auto; margin-bottom: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 12px; font-family: var(--font-mono); font-size: .76rem; }
.nav-help:hover { color: var(--ink); border-color: var(--ink); }

#view { display: flex; flex-direction: column; gap: 16px; }

/* Prompt pips */
.pips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pip { height: 6px; border-radius: 3px; background: var(--line); }
.pip.on { background: var(--ink); }
.pip[class*="tier-"] { background: var(--c); }
.pip.tier-miss { opacity: .55; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; }
.eyebrow { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.q { margin: 0; font-family: var(--font-display); font-weight: 700; font-stretch: 88%; font-size: clamp(1.5rem, 4.6vw, 2rem); line-height: 1.12; text-wrap: balance; }
.hint { margin: -6px 0 0; color: var(--muted); font-size: .9rem; }
form.answer { display: flex; gap: 8px; }
form.answer input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
form.answer input:focus { border-color: var(--ink); outline: none; }
.btn { border: 0; border-radius: 8px; padding: 12px 18px; background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; display: inline-block; }
.btn:hover:not(:disabled) { opacity: .88; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 12px; font-size: .88rem; font-weight: 500; }
.btn.ghost:hover { color: var(--ink); border-color: var(--ink); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.feedback { min-height: 1.5em; margin: 0; font-size: .95rem; }
.feedback.bad { color: var(--bad); }
.feedback.info { color: var(--muted); }
.suggest { border: 0; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 1px 8px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { font-family: var(--font-mono); font-size: .8rem; padding: 3px 8px; border-radius: 4px; background: var(--bg); color: var(--muted); text-decoration: line-through; }

/* Timer */
.timer { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: -6px; }
.timer-fill { height: 100%; width: 100%; background: var(--ink); transition: width .1s linear; }
.timer-fill.low { background: var(--bad); }
.clock { font-family: var(--font-mono); font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.clock.low { color: var(--bad); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
form.answer input.shake { animation: shake .3s ease-in-out; border-color: var(--bad); }

/* ---------- Instant grade: louder the rarer ---------- */
.reveal .grade-wrap { min-height: 2.8rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grade-emoji { font-size: 2.2rem; line-height: 1; display: inline-block; }
.reveal.tier-t2 .grade-emoji { font-size: 2.6rem; }
.reveal.tier-t3 .grade-emoji { font-size: 3rem; }
.reveal.tier-swan .grade-emoji { font-size: 3.4rem; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--gold) 70%, transparent)); }
.lad-emoji { margin-right: 6px; }
.grade { display: inline-block; font-family: var(--font-display); font-weight: 800; font-stretch: 72%; line-height: 1; text-transform: uppercase; letter-spacing: .01em; color: var(--c); font-size: 2.1rem; }
.reveal.tier-t1 .grade { font-size: 2.4rem; }
.reveal.tier-t2 .grade { font-size: 2.8rem; }
.reveal.tier-t3 .grade { font-size: 3.2rem; }
.reveal.tier-swan .grade { font-size: 3.6rem; }
.reveal.tier-t1 { border-color: var(--c); }
.reveal.tier-t2 { border: 2px solid var(--c); background: radial-gradient(120% 70% at 0% 0%, color-mix(in srgb, var(--c) 16%, var(--panel)), var(--panel) 70%); }
.reveal.tier-t3 { border: 2px solid var(--c); background: radial-gradient(130% 80% at 0% 0%, color-mix(in srgb, var(--c) 26%, var(--panel)), var(--panel) 75%); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent), 0 14px 40px color-mix(in srgb, var(--c) 28%, transparent); }
.reveal.tier-swan { border: 2px solid var(--gold); color: var(--night-ink); background: radial-gradient(120% 90% at 10% 0%, color-mix(in srgb, var(--gold) 34%, var(--night)), var(--night) 72%); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent), 0 18px 50px color-mix(in srgb, var(--gold) 30%, transparent); }
.reveal.tier-swan .eyebrow, .reveal.tier-swan .reveal-sub, .reveal.tier-swan .spark-cap, .reveal.tier-swan .could { color: color-mix(in srgb, var(--night-ink) 70%, var(--night)); }
.reveal.tier-swan .grade { background: linear-gradient(100deg, var(--gold-bright) 20%, #FFF4C9 45%, var(--gold-bright) 70%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; }
.reveal.tier-swan .btn { background: var(--gold-bright); color: var(--night); }
.reveal.tier-swan .reveal-pts { color: var(--gold-bright); }
.reveal.tier-swan .spark { border-color: color-mix(in srgb, var(--night-ink) 25%, var(--night)); }
.reveal.tier-swan .could { border-color: var(--gold); }
.reveal.tier-miss .reveal-pts { color: var(--muted); }
.reveal-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.reveal-text { min-width: 0; }
.reveal-answer { font-family: var(--font-display); font-weight: 700; font-stretch: 88%; font-size: 1.5rem; line-height: 1.15; text-wrap: balance; }
.reveal-sub { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.reveal-pts { font-family: var(--font-display); font-weight: 800; font-stretch: 70%; font-size: 3.6rem; line-height: .85; font-variant-numeric: tabular-nums; flex: none; color: var(--c); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 72px; border-bottom: 1px solid var(--line); }
.spark i { flex: 1 1 0; min-width: 2px; height: var(--h); background: color-mix(in srgb, var(--c) 45%, transparent); border-radius: 2px 2px 0 0; transform-origin: bottom; }
.spark i.me { background: var(--c); outline: 2px solid var(--ink); outline-offset: 0; }
.reveal.tier-swan .spark i.me { outline-color: var(--night-ink); }
.spark-cap { margin: -8px 0 0; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }
.could { margin: 0; font-size: .9rem; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--c); }
.burst { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@keyframes pop { 0% { opacity: 0; transform: translateY(12px) scale(.85); } 60% { opacity: 1; transform: translateY(0) scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 55%, transparent); } 100% { box-shadow: 0 0 0 26px transparent; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: no-preference) {
  .reveal .grade, .reveal .grade-emoji { opacity: 0; }
  .reveal.go .grade { animation: pop .5s cubic-bezier(.2, 1.3, .4, 1) both; }
  .reveal.go .grade-emoji { animation: emojiPop .6s cubic-bezier(.2, 1.5, .4, 1) .08s both; }
  .reveal.tier-t3.go .grade-emoji, .reveal.tier-swan.go .grade-emoji { animation: emojiPop .7s cubic-bezier(.2, 1.5, .4, 1) .08s both, emojiBob 1.8s ease-in-out .8s infinite; }
  @keyframes emojiPop { 0% { opacity: 0; transform: scale(.2) rotate(-25deg); } 60% { opacity: 1; transform: scale(1.3) rotate(10deg); } 100% { opacity: 1; transform: none; } }
  @keyframes emojiBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
  .reveal.tier-t0.go .grade { animation-duration: .35s; }
  .reveal.tier-t3.go, .reveal.tier-swan.go { animation: ring 1s ease-out .35s 1; }
  .reveal.tier-swan.go .grade { animation: pop .6s cubic-bezier(.2, 1.3, .4, 1) both, shimmer 2.4s linear .6s infinite; }
  .reveal .spark i { transform: scaleY(0); transition: transform .5s ease-out; transition-delay: var(--d); }
  .reveal.go .spark i { transform: scaleY(1); }
}

/* ---------- Results ---------- */
.score-head { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: end; }
.big { font-family: var(--font-display); font-weight: 800; font-stretch: 70%; font-size: 4.4rem; line-height: .85; font-variant-numeric: tabular-nums; }
.big small { font-size: 1.4rem; color: var(--muted); font-weight: 600; }
.tier { font-family: var(--font-display); font-weight: 700; font-stretch: 85%; font-size: 1.3rem; }
.tier-sub { color: var(--muted); font-size: .9rem; margin: 0; }
.sharebox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sharebox pre { margin: 0; font-family: var(--font-mono); font-size: .85rem; background: var(--bg); padding: 8px 12px; border-radius: 6px; user-select: all; white-space: pre-wrap; }
.basis { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--font-mono); font-size: .74rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); display: inline-block; }

.res { border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.res h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-stretch: 90%; font-size: 1.15rem; line-height: 1.2; text-wrap: balance; }
.yours { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.yours .who { font-weight: 600; }
.yours .who.miss { color: var(--bad); font-weight: 500; }
.badge { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); white-space: nowrap; }
.badge.tier-swan { background: var(--night); color: var(--gold-bright); border-color: var(--gold-bright); }

.swan-banner { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--gold) 28%, var(--night)), var(--night) 70%); color: var(--night-ink); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); }
.swan-banner.got { border: 2px solid var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 20%, transparent); }
.swan-eyebrow { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-bright); }
.swan-name { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: 1.45rem; line-height: 1.1; }
.swan-fact { font-size: .86rem; color: color-mix(in srgb, var(--night-ink) 72%, var(--night)); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 4px 11px; font-size: .8rem; font-family: var(--font-mono); display: inline-flex; gap: 6px; align-items: center; }
.tab::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tab.tier-all::before { display: none; }
.tab span { opacity: .7; }
.tab:hover { border-color: var(--c); color: var(--ink); }
.tab[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 16%, var(--panel)); border-color: var(--c); color: var(--ink); font-weight: 600; }
.answers { display: flex; flex-direction: column; gap: 3px; max-height: 330px; overflow-y: auto; padding-right: 2px; }
.answers[data-sel="t0"] .bar:not([data-tier="t0"]),
.answers[data-sel="t1"] .bar:not([data-tier="t1"]),
.answers[data-sel="t2"] .bar:not([data-tier="t2"]),
.answers[data-sel="t3"] .bar:not([data-tier="t3"]) { display: none; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 10px; align-items: center; font-size: .86rem; }
.bar .lab { position: relative; padding: 3px 8px; border-radius: 4px; min-width: 0; overflow: hidden; }
.bar .lab span { position: relative; z-index: 1; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--c) 32%, var(--panel)); border-radius: 4px; }
.bar.me .lab { outline: 2px solid var(--ink); outline-offset: -2px; }
.bar.me .lab span { font-weight: 700; }
.bar .pct { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.notes { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.notes li { font-size: .88rem; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--line); }
.notes li b { color: var(--ink); font-weight: 600; }
details summary { cursor: pointer; font-size: .86rem; color: var(--muted); }
details[open] summary { margin-bottom: 8px; }

/* Rating widget */
.rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.rate-label { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chipbtn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: .84rem; }
.chipbtn:hover { border-color: var(--ink); }
.chipbtn.keep[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: var(--panel); }
.chipbtn.cut[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: var(--panel); }
.chipbtn[data-filter][aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.rate-note { flex: 1 1 180px; min-width: 0; font: inherit; font-size: .86rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }

/* All games */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.game { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.game:hover { border-color: var(--ink); }
.game-top { display: flex; justify-content: space-between; align-items: center; }
.game-no { font-family: var(--font-display); font-weight: 700; font-stretch: 85%; font-size: 1.15rem; }
.today { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; background: var(--accent); color: var(--panel); padding: 1px 6px; border-radius: 3px; }
.game ul { margin: 0; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
.game .status { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); margin-top: auto; }
.game .score { font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: 1.6rem; line-height: 1; margin-top: auto; font-variant-numeric: tabular-nums; }
.game .score small { font-size: .8rem; color: var(--muted); }
.dots { display: flex; gap: 4px; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--c); }

/* Lab */
.lab-intro { margin: 0; color: var(--muted); font-size: .92rem; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.lab-group { display: flex; flex-direction: column; gap: 8px; }
.lab-group h3 { margin: 6px 0 0; font-family: var(--font-display); font-weight: 700; font-stretch: 85%; font-size: 1.1rem; }
.lab-group h3 a { text-decoration: none; }
.lab-group h3 a:hover { text-decoration: underline; }
.lab-row { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.lab-q { margin: 0; font-weight: 600; text-wrap: balance; }
.lab-answers { margin: 0; font-size: .84rem; color: var(--muted); }
.empty { color: var(--muted); }

/* Score bell curve */
.curve { display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 8px; border-radius: 10px; background: var(--bg); }
.curve-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.curve-big { font-family: var(--font-display); font-weight: 700; font-stretch: 85%; font-size: 1.25rem; }
.curve-big b { color: var(--accent); font-weight: 800; }
.curve-svg { width: 100%; height: auto; display: block; }
.curve-svg .c-area { fill: color-mix(in srgb, var(--muted) 22%, transparent); }
.curve-svg .c-you { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.curve-svg .c-line { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.curve-svg .c-axis { stroke: var(--line); stroke-width: 1; }
.curve-svg .c-mark { stroke: var(--accent); stroke-width: 2.5; }
.curve-svg .c-label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; fill: var(--ink); }
.curve-svg .c-tick { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); }

/* Answer check review (Prompt lab) */
.learned { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.learned-h { margin: 0; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lchips { display: flex; flex-wrap: wrap; gap: 6px; }
.lchip { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; padding: 3px 4px 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.lchip.ok { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.lchip.no { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--muted); }
.lchip.off { opacity: .55; text-decoration: line-through; }
.lchip i { color: var(--muted); font-style: normal; font-size: .78rem; }
.lchip button { border: 0; background: var(--bg); color: var(--ink); border-radius: 999px; padding: 2px 9px; font-size: .76rem; }
.lchip button:hover { background: var(--line); }
.learned-al { margin: 0; font-size: .78rem; color: var(--muted); font-family: var(--font-mono); }

/* ---------- How to play ---------- */
.help { position: fixed; inset: 0; z-index: 50; display: grid; justify-items: center; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--night) 62%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.help[hidden] { display: none; }
.help-panel { position: relative; margin-block: auto; width: 100%; max-width: 520px; background: var(--panel); color: var(--ink); border-radius: 16px; border: 1px solid var(--line); padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.help-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.help-x:hover { color: var(--ink); border-color: var(--ink); }
.help-kicker { margin: 0; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.help-panel h2 { margin: -8px 0 0; font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: 2rem; line-height: 1.02; text-wrap: balance; padding-right: 30px; }
.help-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.help-steps li { counter-increment: s; position: relative; padding-left: 34px; font-size: .93rem; color: var(--muted); }
.help-steps li b { color: var(--ink); }
.help-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--panel); font-family: var(--font-mono); font-size: .78rem; font-weight: 600; display: grid; place-items: center; }
.tail-svg { width: 100%; height: auto; display: block; }
.tail-svg .z { fill: color-mix(in srgb, var(--c) 55%, transparent); }
.tail-svg .curve { stroke: var(--ink); stroke-width: 2; }
.tail-svg .axis { stroke: var(--line); stroke-width: 1; }
.tail-svg .swan-d { fill: var(--gold); }
.tail-svg .lbl { font-family: var(--font-mono); font-size: 9px; fill: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ladder { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.ladder li { display: grid; grid-template-columns: 1fr auto 70px; gap: 10px; align-items: center; padding: 7px 12px; border-radius: 8px; background: color-mix(in srgb, var(--c) 12%, var(--panel)); border-left: 4px solid var(--c); font-size: .88rem; }
.ladder li.tier-swan { background: radial-gradient(140% 160% at 0% 0%, color-mix(in srgb, var(--gold) 30%, var(--night)), var(--night) 70%); color: var(--night-ink); --c: var(--gold-bright); }
.lad-name { font-family: var(--font-display); font-weight: 700; font-stretch: 88%; font-size: 1rem; color: var(--c); }
.lad-range { color: var(--muted); font-size: .8rem; text-align: right; }
.ladder li.tier-swan .lad-range { color: color-mix(in srgb, var(--night-ink) 70%, var(--night)); }
.lad-pts { font-family: var(--font-mono); font-weight: 600; font-size: .82rem; text-align: right; font-variant-numeric: tabular-nums; }
.help-foot { margin: 0; font-size: .82rem; color: var(--muted); }
.help-go { align-self: stretch; padding: 14px; font-size: 1rem; }
@media (prefers-reduced-motion: no-preference) {
  .help:not([hidden]) .help-panel { animation: pop .45s cubic-bezier(.2, 1.2, .4, 1) both; }
}

@media (max-width: 460px) {
  .card { padding: 16px; }
  .brand h1 { font-size: 2.1rem; }
  .brand svg { width: 48px; }
  form.answer { flex-direction: column; }
  .big { font-size: 3.6rem; }
  .reveal.tier-t3 .grade { font-size: 2.6rem; }
  .reveal.tier-swan .grade { font-size: 2.9rem; }
  .reveal-pts { font-size: 3rem; }
  .help-panel { padding: 22px 18px 18px; }
  .help-panel h2 { font-size: 1.7rem; }
  .ladder li { grid-template-columns: 1fr 64px; }
  .lad-range { grid-column: 1 / -1; grid-row: 2; text-align: left; margin-top: -6px; }
  .lad-pts { grid-column: 2; grid-row: 1; }
}

/* Owner-only warnings (question pipeline, answer checks). Players never see these. */
.owner-note { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--bad); border-left-width: 4px; border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 14px; line-height: 1.45; }
.owner-note b { color: var(--bad); }
.owner-note p { margin: 0; }
.owner-note p + p { margin-top: 6px; }
.pipe-warn { color: var(--bad); }

/* Stats page (owner only) */
.stats-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat b { display: block; font-family: "Archivo", sans-serif; font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }
.stats-game { margin-top: 16px; }
.stats-nums { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 12px; font-size: 14px; color: var(--muted); }
.stats-nums b { color: var(--ink); font-size: 18px; margin-right: 2px; }
.stats-spread { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; height: 90px; align-items: end; margin-bottom: 18px; }
.stats-spread .sb { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.stats-spread i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; }
.stats-spread span { position: absolute; bottom: -16px; font-size: 10px; color: var(--muted); }
.stats-spread em { font-style: normal; font-size: 10px; color: var(--muted); line-height: 1; margin-bottom: 3px; }
.stats-prompts { list-style: none; padding: 0; margin: 8px 0 0; }
.stats-prompts li { padding: 10px 0; border-top: 1px solid var(--line); }
.stats-q { margin: 0 0 4px; font-weight: 600; color: var(--ink); }
.stats-prompts .basis { margin: 2px 0 0; }
@media (max-width: 520px) { .stat b { font-size: 22px; } .stats-top { gap: 8px; } }
.schips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.schip { font-size: 13px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--c, var(--line)); color: var(--ink); }
.schip b { color: var(--c, var(--muted)); margin-left: 2px; }
.schip.tier-swan { --c: var(--gold); }
/* Streak, rank and Black Swan badges on the results page */
.perks { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.perk { font-size: 14px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.perk.streak { border-color: var(--accent); color: var(--accent); }
.perk.swan { background: #14202C; color: var(--gold-bright); border-color: #14202C; }

/* Home-screen counter (shown from 50 players a day) */
.today-count { margin: -4px 0 14px; font-size: 15px; color: var(--muted); }
.today-count b { color: var(--ink); }

/* Share-image sheet */
.card-panel { max-width: 440px; text-align: center; }
.card-img { display: block; width: 100%; height: auto; border-radius: 14px; margin: 8px 0 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.card-panel .row { justify-content: center; gap: 10px; }
