/* Derm Drill · Quiet Pop */
:root {
  --bg: #FAFAF7; --surface: #FFFFFF; --sunk: #F0F0EB; --line: #E6E6E1; --line-strong: #CFCFC8;
  --ink: #121214; --on-ink: #FFFFFF; --muted: #5F5F66; --faint: #8A8A90;
  --accent: #3B5BFF; --on-accent: #FFFFFF; --accent-soft: #EEF1FF; --accent-text: #2A43CC;
  --hero: #3B5BFF; --on-hero: #FFFFFF; --hero-muted: #F2F4FF; --hero-chip: rgba(255, 255, 255, .18);
  --good: #3B5BFF; --good-soft: #EEF1FF; --good-text: #2A43CC;
  --bad: #D93B3B; --bad-soft: #FDECEC; --bad-text: #B42323;
  --warm: #FFF1E8; --warm-text: #B4480F; --flame: #F76B15;
  --shadow: none;
  --radius: 20px; --radius-sm: 14px;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --mono: var(--sans);
  --nav-h: 64px;
  --ease-out: cubic-bezier(.2, .8, .2, 1); --ease-spring: cubic-bezier(.3, 1.5, .5, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111113; --surface: #19191C; --sunk: #232327; --line: #2C2C31; --line-strong: #3E3E45;
  --ink: #F2F2EF; --on-ink: #111113; --muted: #A5A5AD; --faint: #6E6E76;
  --accent: #7B8CFF; --on-accent: #0B0D24; --accent-soft: #1E2240; --accent-text: #A9B4FF;
  --hero: #3B5BFF; --on-hero: #FFFFFF; --hero-muted: #F2F4FF; --hero-chip: rgba(255, 255, 255, .18);
  --good: #7B8CFF; --good-soft: #1E2240; --good-text: #A9B4FF;
  --bad: #FF6B6B; --bad-soft: #3A1A1C; --bad-text: #FFB3B3;
  --warm: #33200F; --warm-text: #FFB27A; --flame: #FF8A3D;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --surface: #19191C; --sunk: #232327; --line: #2C2C31; --line-strong: #3E3E45;
    --ink: #F2F2EF; --on-ink: #111113; --muted: #A5A5AD; --faint: #6E6E76;
    --accent: #7B8CFF; --on-accent: #0B0D24; --accent-soft: #1E2240; --accent-text: #A9B4FF;
    --hero: #3B5BFF; --on-hero: #FFFFFF; --hero-muted: #F2F4FF; --hero-chip: rgba(255, 255, 255, .18);
    --good: #7B8CFF; --good-soft: #1E2240; --good-text: #A9B4FF;
    --bad: #FF6B6B; --bad-soft: #3A1A1C; --bad-text: #FFB3B3;
    --warm: #33200F; --warm-text: #FFB27A; --flame: #FF8A3D;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility; -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary, label { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-text); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ic.fill { fill: currentColor; stroke-width: 1.5; }
.mono { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
.eyebrow.accent { color: var(--accent-text); }
.display { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; line-height: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* page frame */
.wrap {
  max-width: 640px; margin: 0 auto;
  padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px));
  padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(var(--nav-h) + 32px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 20px;
}
.wrap.wide { max-width: 1080px; }
.wrap.bare { padding-block-end: calc(32px + env(safe-area-inset-bottom, 0px)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 34px; font-weight: 600; letter-spacing: -.025em; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.section-head a, .section-head .link { font-size: 15px; font-weight: 500; color: var(--accent-text); text-decoration: none; background: none; border: 0; padding: 10px 0; }

/* bottom navigation */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav a {
  height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none; transition: color .15s;
}
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"] .ic { color: var(--accent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink);
  font-size: 16px; font-weight: 600; text-decoration: none; transition: transform .12s var(--ease-out), background .15s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { background: var(--sunk); border-color: var(--sunk); color: var(--faint); }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 0; background: transparent; color: var(--ink); transition: background .15s, transform .12s;
}
.icon-btn:active { transform: scale(.94); background: var(--sunk); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--sunk); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip.warm { background: var(--warm); color: var(--warm-text); }
.chip.warm .ic { color: var(--flame); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.good { background: var(--good-soft); color: var(--good-text); }
.chip.bad { background: var(--bad-soft); color: var(--bad-text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
a.card { display: block; color: inherit; text-decoration: none; transition: transform .12s var(--ease-out); }
a.card:active { transform: scale(.985); }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s var(--ease-out); }
.bar.thin { height: 4px; }

/* home */
.card.level { display: flex; flex-direction: column; gap: 14px; }
.lvl-icon { width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.lvl-name { font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: -.015em; }
.hero { background: var(--hero); color: var(--on-hero); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.hero .eyebrow { color: var(--hero-muted); }
.hero-title { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.hero .chip { background: var(--hero-chip); color: var(--on-hero); font-weight: 500; }
.hero .muted { color: var(--hero-muted); }
.hero .btn.primary { background: #FFFFFF; border-color: #FFFFFF; color: #1F33A6; }
.hero .icon-btn { width: 52px; height: 52px; border-radius: var(--radius-sm); background: var(--hero-chip); color: var(--on-hero); }
.install { display: flex; flex-direction: column; gap: 12px; }
.install ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.install .share { display: inline-flex; vertical-align: -4px; color: var(--accent-text); }

/* map */
.map { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px; }
.map::before { content: ""; position: absolute; left: 29px; top: 34px; bottom: 34px; width: 1px; background: var(--line-strong); }
.stop { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-sm); }
.stop-btn { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 4px; background: none; border: 0; text-align: left; width: 100%; border-radius: var(--radius-sm); transition: background .15s; }
.stop-btn:hover { background: var(--sunk); }
.node { width: 38px; height: 38px; border-radius: 999px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); position: relative; z-index: 1; }
.node.cleared { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.node.current { background: var(--ink); border-color: var(--ink); color: var(--on-ink); box-shadow: 0 0 0 5px var(--accent-soft); animation: breathe 2.4s ease-in-out infinite; }
.node.boss { border-radius: 12px; background: var(--surface); border: 1.5px solid var(--ink); color: var(--ink); }
.node.boss.cleared { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.node.boss.current { background: var(--ink); color: var(--on-ink); }
.node .dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.stop-title { font-size: 16px; font-weight: 600; }
.stop.locked .stop-title { color: var(--muted); font-weight: 500; }
.stop-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-status { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.stop-status.good, .stop-status.accent { color: var(--accent-text); }
.stop-panel { margin: 4px 0 10px 52px; padding: 14px; border-radius: var(--radius-sm); background: var(--sunk); display: flex; flex-direction: column; gap: 10px; }

/* session frame */
.session-top { display: flex; align-items: center; gap: 10px; margin-inline-start: -10px; }
.session-top .bar { flex: 1 1 auto; height: 4px; }
.session-top .bar > span { background: var(--ink); }
.count { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.xp-now { position: relative; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xp-now .hop { position: absolute; right: 0; top: -16px; font-size: 13px; color: var(--accent-text); opacity: 0; }
.lives { display: inline-flex; gap: 2px; color: var(--bad); }
.lives .off { color: var(--line-strong); }
.q-kicker { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.q-title { font-size: 28px; font-weight: 600; line-height: 1.12; letter-spacing: -.02em; }
.confirm { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius-sm); background: var(--warm); color: var(--warm-text); }
.confirm .row { flex-wrap: wrap; }

/* photos */
.photo { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.frame { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--sunk); aspect-ratio: 4 / 3; max-width: 100%; }
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .45s ease; }
.credit { font-size: 12px; color: var(--muted); }
.credit a { color: var(--muted); }

/* choices: quiet rows, the right one fills */
.choices { display: flex; flex-direction: column; gap: 0; }
.choice {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: 14px; min-height: 56px; width: 100%; padding: 12px 12px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink);
  text-align: left; font-size: 17px; font-weight: 400; line-height: 1.3;
  transition: background .15s, color .2s, opacity .25s, border-radius .2s, transform .12s var(--ease-out);
}
.choice:first-child { border-top: 1px solid var(--line); }
.choice:hover:not(:disabled) { background: var(--sunk); }
.choice:active:not(:disabled) { transform: scale(.985); }
.choice .key { width: 18px; flex-shrink: 0; font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; }
.choice .txt { flex: 1 1 auto; }
.choice.selected { background: var(--accent-soft); color: var(--accent-text); border-radius: var(--radius-sm); border-color: transparent; font-weight: 500; }
.choice.selected .key { color: var(--accent-text); }
.choice.right, .choice.wrong { border-radius: var(--radius-sm); border-color: transparent; font-weight: 600; }
.choice.right { color: var(--on-accent); }
.choice.right::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); transform-origin: left center; }
.choice.right .key { color: var(--on-accent); opacity: .8; }
.choice.wrong { background: var(--bad-soft); color: var(--bad-text); }
.choice.wrong .key { color: var(--bad-text); }
.choice.wrong .txt { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.choice.dim { opacity: .35; }
.choice:disabled { cursor: default; }

/* enlarge photos */
.zoom-btn { border: 0; background: transparent; color: #fff; padding: 0; }
.zoom-btn.cover { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: flex-end; padding: 10px; cursor: zoom-in; }
.zoom-hint { width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: rgba(18, 18, 20, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: transform .12s var(--ease-out); }
.zoom-btn:active .zoom-hint { transform: scale(.9); }
.side-wrap { position: relative; display: flex; }
.side-wrap > .side { flex: 1 1 auto; width: 100%; }
.zoom-btn.corner { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(8, 8, 10, .95); animation: lbIn .2s ease-out; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; cursor: zoom-in; }
.lb-stage.zoomed { cursor: grab; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transform-origin: center center; will-change: transform; animation: lbImg .28s var(--ease-out); }
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: 44px; height: 44px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .16); color: #fff; display: flex; align-items: center; justify-content: center; }
.lb-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; color: rgba(255, 255, 255, .75); font-size: 13px; pointer-events: none; }
body.lb-open { overflow: hidden; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbImg { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* duel */
.duel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.side {
  display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left;
  transition: transform .12s var(--ease-out), background .2s, border-color .2s, opacity .25s;
}
.side:active:not(:disabled) { transform: scale(.98); }
.side .frame { border-radius: var(--radius-sm); }
.side .badge { position: absolute; top: 8px; left: 8px; width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 700; }
.side .cap { font-size: 14px; line-height: 1.35; }
.side.right { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.side.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-text); }
.side.right .badge { background: #FFFFFF; color: #1F33A6; }
.side.wrong .badge { background: var(--bad); color: #fff; }
.tells { width: 100%; border-collapse: collapse; font-size: 14px; }
.tells th, .tells td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.tells th { font-size: 12px; font-weight: 600; color: var(--muted); border-top: 0; background: var(--sunk); }
.tells td:first-child { color: var(--muted); }
.tells td:not(:first-child) { font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

/* vignette */
.stem { font-size: 17px; line-height: 1.65; max-width: 68ch; }
.ask { font-size: 17px; line-height: 1.55; font-weight: 600; max-width: 68ch; }
.v-grid { display: grid; gap: 20px; }
@media (min-width: 1024px) {
  .v-grid.revealed { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .v-grid.revealed .feedback { position: sticky; top: 20px; }
}

/* flashcards */
.flash {
  width: 100%; min-height: 340px; display: flex; flex-direction: column; gap: 14px; padding: 24px;
  border-radius: 24px; border: 1px solid var(--line); background: var(--surface);
  text-align: left; color: var(--ink); transition: transform .12s var(--ease-out);
}
.flash:active:not(:disabled) { transform: scale(.985); }
.flash .front { font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }
.flash .back { font-size: 19px; line-height: 1.5; }
.flash .hint { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.flash.flipped { animation: flip .42s var(--ease-out); }
.rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rate button { min-height: 64px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 600; transition: transform .12s var(--ease-out); }
.rate button:active { transform: scale(.95); }
.rate small { font-weight: 500; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rate .again { color: var(--bad-text); }
.rate .hard { color: var(--warm-text); }
.rate .good { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rate .good small { color: var(--on-accent); opacity: .85; }
.rate .easy { color: var(--accent-text); }

/* feedback */
.feedback { display: flex; flex-direction: column; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.feedback:focus { outline: none; }
.fb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fb-head .display { font-size: 46px; }
.feedback.bad .fb-head .display { color: var(--bad-text); }
.fb-sub { font-size: 15px; line-height: 1.6; color: var(--muted); }
.fb-sub > span { white-space: nowrap; }
.fb-sub .sep { padding-inline-end: 6px; }
.fb-sub b { color: var(--ink); font-weight: 600; }
.combo-dots { display: inline-flex; gap: 5px; margin-inline-end: 8px; vertical-align: 1px; }
.combo-dots i { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); }
.feedback ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.feedback details { border-top: 1px solid var(--line); padding-top: 12px; }
.feedback summary { cursor: pointer; font-weight: 600; font-size: 15px; color: var(--accent-text); min-height: 32px; }
.feedback details[open] summary { margin-bottom: 8px; }
.why li { color: var(--muted); font-size: 15px; }
.ref { font-size: 12px; color: var(--muted); }

/* setup */
.opt-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.opt:first-child { border-top: 0; }
.opt input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.opt .t { font-size: 16px; font-weight: 600; }
.opt .d { font-size: 13px; color: var(--muted); }
.topic-chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, transform .12s; }
.topic-chip:active { transform: scale(.96); }
.topic-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--radius-sm); background: var(--sunk); }
.seg button { min-height: 58px; border-radius: 11px; border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.seg b { font-size: 15px; }
.seg.compact button { min-height: 44px; font-size: 15px; font-weight: 500; }
.seg.compact button[aria-pressed="true"] { font-weight: 600; }
.seg small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.switch { width: 56px; height: 44px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.switch .track { width: 50px; height: 30px; padding: 3px; border-radius: 999px; background: var(--line-strong); display: flex; transition: background .2s; }
.switch .knob { width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease-spring); }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }
.sticky-foot {
  position: sticky; bottom: 0; margin-inline: -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
}

/* stats */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.tile b { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.mastery { display: flex; flex-direction: column; gap: 16px; }
.m-row { display: flex; flex-direction: column; gap: 7px; }
.m-row .top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 15px; }
.m-row .name { font-weight: 600; }
.m-bar { position: relative; height: 6px; border-radius: 999px; background: var(--line); }
.m-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.m-bar > span.cleared { background: var(--accent); }
.m-bar .mark { position: absolute; left: 80%; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; background: var(--ink); opacity: .3; }
.body-map { display: flex; align-items: center; gap: 16px; }
.body-map svg { width: 120px; height: 240px; flex-shrink: 0; }
.body-map .silhouette { fill: var(--sunk); }
.body-map .hot { fill: var(--bad); stroke: var(--ink); }
.regions { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.region-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; }
.region-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.empty { padding: 22px; border-radius: var(--radius-sm); border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; font-size: 14px; }

/* results */
.result-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-block: 12px 4px; }
.result-hero .badge { width: 64px; height: 64px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); }
.result-hero .badge.bad { background: var(--bad-soft); color: var(--bad-text); }
.result-hero h1 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 52px; letter-spacing: 0; line-height: 1; }
.xp-rows { display: flex; flex-direction: column; gap: 8px; }
.xp-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.xp-row span:first-child { color: var(--muted); }
.xp-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px solid var(--line); }
.xp-total b { font-size: 30px; font-weight: 600; letter-spacing: -.02em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.review-item { border-top: 1px solid var(--line); padding-block: 12px; }
.review-item summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.review-item .body { padding: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }

/* more / scoring */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list > * { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; font-size: 16px; }
.list > *:first-child { border-top: 0; }
.list .ic:first-child { color: var(--accent-text); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field input[type=text] { min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table td { padding: 12px 16px; border-top: 1px solid var(--line); }
.rules-table tr:first-child td { border-top: 0; }
.rules-table td:last-child { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.layers { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; }
.layer { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 16px; color: #121214; }
.layer .n { width: 22px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.layer .name { flex: 1 1 auto; font-size: 15px; }
.layer .xp { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.layer.here .name { font-weight: 700; }
.here-tag { padding: 3px 9px; border-radius: 999px; background: #121214; color: #fff; font-size: 12px; font-weight: 600; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 40px); padding: 12px 18px; border-radius: var(--radius-sm); background: var(--ink); color: var(--on-ink);
  font-size: 15px; font-weight: 600; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); transition: opacity .2s, transform .3s var(--ease-spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* loading */
.loading { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 24px; text-align: center; }

/* motion: plays once, right after an answer (.fresh) */
.fresh .choice.right::before { animation: sweep .38s var(--ease-out) both; }
.fresh .choice.right .ic path { stroke-dasharray: 24; animation: draw .3s .22s ease-out both; }
.fresh .choice.right, .fresh .side.right { animation: pop .42s var(--ease-spring); }
.fresh .choice.wrong, .fresh .side.wrong { animation: shake .42s ease-in-out; }
.fresh .feedback { animation: rise .42s var(--ease-out) both; }
.fresh .fb-head .display { animation: settle .5s var(--ease-spring) .06s both; }
.fresh .combo-dots i { animation: dotpop .36s var(--ease-spring) both; }
.fresh .xp-now .hop { animation: hop 1.1s var(--ease-out) both; }
.fresh .xp-now .val { display: inline-block; animation: pulse .5s var(--ease-spring) .5s; }
.lvl-up { animation: settle .7s var(--ease-spring) both; }
.count-up { font-variant-numeric: tabular-nums; }
@keyframes sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(.97); } 45% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: translateY(6px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes dotpop { 0% { transform: scale(0); } 70% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes hop { 0% { opacity: 0; transform: translateY(8px); } 25% { opacity: 1; transform: translateY(-2px); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.16); color: var(--accent-text); } }
@keyframes flip { 0% { transform: perspective(900px) rotateX(12deg) scale(.98); opacity: .6; } 100% { transform: none; opacity: 1; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 5px var(--accent-soft); } 50% { box-shadow: 0 0 0 9px var(--accent-soft); } }

/* confetti */
.confetti { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -16px; width: 8px; height: 12px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { 0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; } 85% { opacity: 1; } 100% { transform: translate3d(var(--dx, 0px), 105vh, 0) rotate(var(--rot, 540deg)); opacity: 0; } }

@media (max-width: 380px) {
  .q-title { font-size: 25px; }
  .fb-head .display { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .confetti { display: none; }
}
