:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1b1f24; --muted: #5b6573; --line: #dde1e6;
  --accent: #2f5bea; --accent-ink: #fff; --ok: #1a7f4b; --ok-bg: #e6f4ec; --bad: #b42318; --bad-bg: #fdecea;
  --flag: #b25e00; --glass: rgb(255 255 255 / .72);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #181c22; --ink: #e8ebef; --muted: #9aa4b1; --line: #2a3038;
    --accent: #6b8cff; --accent-ink: #0f1216; --ok: #5bd394; --ok-bg: #12291d; --bad: #ff8a80; --bad-bg: #2e1614;
    --flag: #ffb454; --glass: rgb(24 28 34 / .72);
  }
}
/* Solid bars and firmer edges for people who ask for less transparency or more contrast. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) { :root { --glass: var(--card); } }
@media (prefers-contrast: more) { :root { --line: #767f8c; } }
* { box-sizing: border-box; }
/* 100% keeps the reader's own text size setting; sizes below are in rem so they scale with it. */
body { margin: 0; background: var(--bg); color: var(--ink); font: 100%/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Translucent bar: content scrolls under it instead of being cut off by an opaque strip. */
header { display: flex; align-items: center; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); position: sticky; top: 0; z-index: 2; }
header a { color: var(--ink); text-decoration: none; font-weight: 700; }
.brand { margin-right: 8px; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
header nav { display: flex; gap: 4px; }
header nav a { padding: 6px 12px; border-radius: 980px; color: var(--muted); font-weight: 600; font-size: .9375rem; transition: color .15s, background-color .15s; }
header nav a:hover { color: var(--ink); }
header nav a[aria-current="page"] { color: var(--ink); background: var(--line); }
body.session header nav, body.session header .gh { display: none; }
#timer { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; }
#end { padding: 6px 14px; }
header a.gh { font-size: .875rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 980px; padding: 6px 12px; transition: color .15s, border-color .15s; }
header a.gh:hover { color: var(--ink); border-color: var(--accent); }
#timer.low { color: var(--bad); }
main { max-width: 820px; margin: 0 auto; padding: 28px 16px 48px; }
footer { text-align: center; color: var(--muted); font-size: .8125rem; line-height: 1.8; padding: 0 16px 32px; }
main a, footer a { color: var(--accent); }
/* Tracking is size-specific: large type tightens, small caps loosen, body stays at 0. */
h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -.022em; margin: 0 0 8px; }
h2 { font-size: 1.25rem; line-height: 1.4; letter-spacing: -.012em; margin: 16px 0; }
.muted { color: var(--muted); }
h2.sub { font-size: 1.0625rem; letter-spacing: -.01em; margin: 32px 0 10px; }
.small { font-size: .875rem; }
.strip { font-size: .875rem; color: var(--muted); margin: 0; }
/* Grouped list with inset separators and a disclosure chevron, like iOS Settings. */
.domains { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.drow { position: relative; display: grid; grid-template-columns: 1fr auto auto; gap: 6px 12px; align-items: center; min-height: 52px; padding: 12px 16px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color .15s; }
.drow + .drow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line); }
.drow::after { content: "›"; grid-area: 1 / 3; color: var(--muted); font-size: 1.375rem; line-height: 1; }
.drow:hover { background: var(--bg); }
.drow:active { background: var(--line); transition: none; }
.drow .muted { font-size: .875rem; }
.drow .meter { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.drow .meter i { display: block; height: 100%; background: var(--accent); }
main a.teaser { display: block; margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); text-decoration: none; font-size: .9375rem; transition: transform .1s ease-out, border-color .15s; }
.teaser span { color: var(--accent); font-weight: 600; white-space: nowrap; }
.teaser:hover { border-color: var(--accent); }
.teaser:active { transform: scale(.99); }
.rules { padding-left: 20px; }
.rules li { margin: 4px 0; }
.keys { display: none; font-size: .875rem; }
@media (hover: hover) and (pointer: fine) { .keys { display: block; } }
.tag { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.actions, .nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
/* Press feedback lands on pointer-down (:active), not on release. */
.btn { padding: 10px 20px; border-radius: 980px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: transform .1s ease-out, border-color .15s, background-color .15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--flag); font: inherit; font-weight: 600; cursor: pointer; margin: -10px -4px -10px auto; padding: 10px 4px; }
.bar .qid { font-size: .75rem; }
.bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .875rem; }
.bar strong { font-variant-numeric: tabular-nums; }
.progress { height: 4px; background: var(--line); border-radius: 2px; margin: 10px 0 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }
.scenario { margin: 18px 0 0; font-size: 1.0625rem; }
.scenario + h2 { margin-top: 12px; }
.why { display: block; margin-top: 6px; font-size: .875rem; line-height: 1.5; color: var(--muted); }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; transition: transform .1s ease-out, border-color .15s, background-color .15s; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:active:not(:disabled) { transform: scale(.99); background: var(--bg); }
.opt:disabled { cursor: default; }
.opt .key { flex: none; width: 2em; height: 2em; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: .8125rem; font-weight: 700; }
/* Multiple response gets square keys, the checkbox shape, so it reads differently from pick-one. */
.opts.multi .key { border-radius: 7px; }
.opt.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.opt.picked .key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .key { background: var(--ok); border-color: var(--ok); color: var(--card); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .key { background: var(--bad); border-color: var(--bad); color: var(--card); }
.explain { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid; }
.explain.ok { border-color: var(--ok); background: var(--ok-bg); }
.explain.bad { border-color: var(--bad); background: var(--bad-bg); }
.explain strong { display: block; margin-bottom: 4px; }
.explain.ok strong { color: var(--ok); }
.explain.bad strong { color: var(--bad); }
.explain p { margin: 6px 0 0; }
/* Feedback rises in right after Check, so it's clear the press caused it. */
.explain, .opt .why { animation: rise .28s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.palette button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: .8125rem; font-variant-numeric: tabular-nums; cursor: pointer; }
@media (pointer: coarse) { .palette button { width: 44px; height: 44px; } }
.palette .ans { background: var(--line); }
.palette .flag { border-color: var(--flag); color: var(--flag); font-weight: 700; }
.palette .cur { outline: 2px solid var(--accent); }
.score { font-size: 3.5rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.rows { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.row { display: grid; grid-template-columns: 1fr 64px; gap: 4px 12px; align-items: center; font-size: .875rem; }
.row strong { font-variant-numeric: tabular-nums; }
.row .meter { grid-column: 1 / -1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.row .meter i { display: block; height: 100%; background: var(--accent); }
details { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px 14px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
summary .yes { color: var(--ok); }
summary .no { color: var(--bad); }
details ul { padding-left: 20px; }
details li.right { color: var(--ok); font-weight: 600; }
details li.wrong { color: var(--bad); }
details li { margin: 8px 0; }
details li .why { font-weight: 400; color: var(--muted); }
.facts { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 0; padding: 12px 16px 12px 34px; font-size: .9375rem; }
.facts li { margin: 4px 0; }
kbd { font: .75rem ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
@media (max-width: 520px) {
  h1 { font-size: 1.625rem; } h2 { font-size: 1.125rem; } .score { font-size: 2.75rem; }
  header { flex-wrap: wrap; padding: 10px 12px; }
  body:not(.session) header { position: static; }
  header nav { order: 3; width: 100%; }
  header nav a { flex: 1; min-height: 44px; display: grid; place-items: center; padding: 0; }
  .gh span { display: none; }
  body.session .nav { position: sticky; bottom: 0; z-index: 1; margin: 16px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
  body.session .nav .btn { flex: 1; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  header, body.session .nav { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* Reduced motion keeps the feedback but drops the movement: fades only, no scaling or sliding. */
@media (prefers-reduced-motion: reduce) {
  :active { transform: none !important; }
  @keyframes rise { from { opacity: 0; } }
}
