/* Quotient design system — first-party only, system fonts, light & dark. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #cde2fb;
  --accent-soft-2: #9ec5f4;
  --series-2: #eb6834;
  --good: #006300;
  --good-bg: #e6f4e6;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --critical: #d03b3b;
  --critical-bg: #fbe3e3;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px -12px rgba(11, 11, 11, 0.18);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322; --ink: #ffffff; --ink-2: #c3c2b7;
    --muted: #898781; --hairline: #2c2c2a; --baseline: #383835; --border: rgba(255,255,255,0.10);
    --accent: #3987e5; --accent-soft: #184f95; --accent-soft-2: #1c5cab; --series-2: #d95926;
    --good: #0ca30c; --good-bg: #0f2a0f; --warn: #fab219; --warn-bg: #2e2410; --critical: #e66767; --critical-bg: #331616;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.6);
  }
}
:root[data-theme="dark"] { color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322; --ink: #ffffff; --ink-2: #c3c2b7;
  --muted: #898781; --hairline: #2c2c2a; --baseline: #383835; --border: rgba(255,255,255,0.10);
  --accent: #3987e5; --accent-soft: #184f95; --accent-soft-2: #1c5cab; --series-2: #d95926;
  --good: #0ca30c; --good-bg: #0f2a0f; --warn: #fab219; --warn-bg: #2e2410; --critical: #e66767; --critical-bg: #331616;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-family: var(--font); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; font-weight: 650; }
h1 { font-size: clamp(1.7rem, 2.6vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
code, kbd { font-family: var(--mono); font-size: .92em; }
kbd { background: var(--surface-2); border: 1px solid var(--hairline); border-bottom-width: 2px; border-radius: 6px; padding: 0 .4em; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 1.5rem 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; }
ul.clean { list-style: none; padding: 0; margin: 0; }

/* ---- layout ---- */
.container { width: min(1100px, 100% - 2rem); margin: 0 auto; }
.narrow { width: min(720px, 100% - 2rem); margin: 0 auto; }
main { flex: 1; padding: 2rem 0 3rem; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 20; }
.topbar .container { display: flex; align-items: center; gap: 1.25rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); font-size: 1.12rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.nav { display: flex; gap: .15rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.linklike { color: var(--ink-2); padding: .4rem .7rem; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { color: var(--ink); background: var(--surface-2); }
.footer { border-top: 1px solid var(--hairline); color: var(--muted); font-size: .85rem; padding: 1.25rem 0; }
.footer .container { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; }
.footer a { color: var(--ink-2); }
.spacer { flex: 1; }

/* ---- components ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.35rem 1.5rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card.tight { padding: 1rem 1.15rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .35rem; }
.lead { font-size: 1.12rem; color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .06s ease, background .15s ease, box-shadow .15s ease; line-height: 1.2; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--critical); border-color: var(--critical); background: transparent; }
.btn.danger:hover { background: var(--critical-bg); }
.btn.large { padding: .85rem 1.6rem; font-size: 1.05rem; border-radius: 12px; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--hairline); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--ink); border-color: transparent; }
.badge.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.critical { background: var(--critical-bg); color: var(--critical); border-color: transparent; }

.alert { border-radius: var(--radius-sm); padding: .8rem 1rem; border: 1px solid var(--hairline); background: var(--surface-2); display: flex; gap: .6rem; align-items: flex-start; }
.alert.success { background: var(--good-bg); color: var(--good); border-color: transparent; }
.alert.error, .alert.critical { background: var(--critical-bg); color: var(--critical); border-color: transparent; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.alert.info { background: var(--accent-soft); color: var(--ink); border-color: transparent; }
.messages { margin-bottom: 1.25rem; display: grid; gap: .5rem; }

/* forms */
form .field { margin-bottom: 1rem; }
label { font-weight: 600; font-size: .95rem; display: block; margin-bottom: .3rem; }
.help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
  font: inherit; width: 100%; padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--baseline); background: var(--surface); color: var(--ink); }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.check { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; font-weight: 400; margin-bottom: .75rem; }
.check input { margin-top: .25rem; }
.errorlist { color: var(--critical); margin: .25rem 0 0; padding-left: 1.1rem; font-size: .9rem; }
.form-actions { margin-top: 1.25rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

/* stat tile / hero number */
.hero { display: grid; gap: .25rem; }
.hero .value { font-size: clamp(2.8rem, 6vw, 4.2rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.hero .range { color: var(--ink-2); }
.hero .band { font-weight: 600; }

/* domain list */
.domain-row { display: grid; grid-template-columns: 1.2fr 3fr auto; gap: 1rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--hairline); }
.domain-row:last-child { border-bottom: 0; }
.domain-row .name { font-weight: 600; }
.domain-row .name small { display: block; font-weight: 400; color: var(--muted); }
.domain-row .score { text-align: right; font-variant-numeric: tabular-nums; }
.domain-row .score b { font-size: 1.15rem; }
@media (max-width: 640px) { .domain-row { grid-template-columns: 1fr; gap: .3rem; } .domain-row .score { text-align: left; } }

/* charts */
.viz { width: 100%; height: auto; display: block; }
.viz text { font-family: var(--font); fill: var(--ink-2); font-size: 12px; }
.viz .grid line { stroke: var(--hairline); }
.viz .baseline { stroke: var(--baseline); }
.viz .ref { stroke: var(--muted); stroke-dasharray: 4 4; }
.viz .bar { fill: var(--accent); }
.viz .bar2 { fill: var(--series-2); }
.viz .ci { stroke: var(--ink-2); stroke-width: 2; }
.viz .label { fill: var(--ink); font-weight: 600; }
.viz .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.viz .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.viz .band { fill: var(--accent-soft); opacity: .6; }
.legend { display: flex; gap: 1rem; font-size: .85rem; color: var(--ink-2); margin-top: .5rem; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: middle; }
.viz-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--page); padding: .35rem .6rem; border-radius: 8px; font-size: .8rem; transform: translate(-50%, -120%); white-space: nowrap; opacity: 0; transition: opacity .1s; }
.viz-wrap { position: relative; }

/* ---- test runner ---- */
.runner { position: fixed; inset: 0; background: var(--page); z-index: 50; display: flex; flex-direction: column; overflow: auto; }
.runner-top { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--hairline); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.runner-top .title { font-weight: 650; }
.runner-top .progress { flex: 1; height: 6px; background: var(--hairline); border-radius: 999px; overflow: hidden; max-width: 380px; }
.runner-top .progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s ease; }
.runner-top .counter { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.timer { display: inline-flex; align-items: center; gap: .4rem; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .95rem; min-width: 5rem; justify-content: flex-end; }
.timer.low { color: var(--critical); font-weight: 600; }
.timer .ring { width: 22px; height: 22px; }
.runner-notice { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); padding: .5rem .9rem; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 60; box-shadow: var(--shadow); }
.runner-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 1.25rem 1rem 2rem; width: 100%; }
.stage { width: min(900px, 100%); display: grid; gap: 1.25rem; }
.stage.center { text-align: center; justify-items: center; }
.stimulus { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); display: flex; justify-content: center; }
.stimulus svg { max-width: 100%; height: auto; }
.matrix-svg { width: min(420px, 100%); }
.options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.options.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.options.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.options.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.options.list { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; width: 100%; }
@media (max-width: 640px) { .options, .options.cols-5, .options.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .options.cols-3 { grid-template-columns: repeat(3, 1fr);} }
.option { position: relative; background: var(--surface); border: 2px solid var(--hairline); border-radius: 12px; padding: .6rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .4rem; transition: border-color .12s, transform .06s; min-height: 64px; justify-content: center; font-size: 1.05rem; }
.option:hover { border-color: var(--accent-soft-2); }
.option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.option .key { position: absolute; top: 6px; left: 8px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.option svg { width: 100%; max-width: 110px; height: auto; }
.option.text { padding: .8rem 1rem .8rem 2.2rem; align-items: flex-start; text-align: left; }
.actions { display: flex; gap: .75rem; justify-content: center; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .88rem; text-align: center; }
.series-display { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; display: flex; gap: .5em; flex-wrap: wrap; justify-content: center; }
.series-display .q { color: var(--accent); }
.answer-input { font: inherit; font-size: 1.6rem; text-align: center; padding: .5rem .8rem; border-radius: 12px; border: 2px solid var(--baseline); width: min(280px, 100%); background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
.answer-input:focus { border-color: var(--accent); outline: none; }
.stem { font-size: 1.35rem; font-weight: 500; text-align: center; max-width: 700px; }
.intro { width: min(680px, 100%); }
.intro .steps { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.intro .steps span { padding: .25rem .6rem; border-radius: 999px; background: var(--surface-2); font-size: .8rem; color: var(--ink-2); border: 1px solid var(--hairline); }
.intro .steps span.done { background: var(--good-bg); color: var(--good); border-color: transparent; }
.intro .steps span.now { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.example { display: grid; gap: .75rem; }
.example .stimulus { padding: .75rem; }
.example .options { gap: .5rem; }
.example .option { min-height: 44px; padding: .4rem; cursor: default; }
.example .option.correct { border-color: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.big-digit { font-size: clamp(5rem, 18vw, 9rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; min-height: 1em; }
.digit-echo { font-size: 1.4rem; letter-spacing: .3em; min-height: 1.6em; font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: .5rem; justify-content: center; }
.keypad button { font: inherit; font-size: 1.4rem; font-weight: 600; height: 60px; border-radius: 12px; border: 1px solid var(--baseline); background: var(--surface); color: var(--ink); cursor: pointer; }
.keypad button:active { background: var(--surface-2); }
.keypad button.wide { grid-column: span 3; font-size: 1rem; height: 48px; }
.corsi { position: relative; width: min(440px, 92vw); aspect-ratio: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.corsi .block { position: absolute; width: 13%; aspect-ratio: 1; background: var(--surface-2); border: 2px solid var(--baseline); border-radius: 8px; transform: translate(-50%, -50%); cursor: pointer; transition: background .08s, border-color .08s; }
.corsi .block.lit { background: var(--accent); border-color: var(--accent); }
.corsi .block.picked { border-color: var(--accent); background: var(--accent-soft); }
.corsi.locked .block { cursor: default; }
.coding-key { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }
.coding-key .pair { display: grid; justify-items: center; gap: .15rem; padding: .35rem .5rem; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); min-width: 54px; }
.coding-key .pair svg { width: 34px; height: 34px; }
.coding-key .pair b { font-size: 1rem; }
.coding-stim svg { width: 120px; height: 120px; }
.search-row { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center; }
.search-row .targets, .search-row .items { display: flex; gap: .5rem; }
.search-row .targets { padding-right: 1.25rem; border-right: 2px solid var(--baseline); }
.search-row svg { width: 56px; height: 56px; }
@media (max-width: 640px) { .search-row svg { width: 40px; height: 40px; } }
.yesno { display: flex; gap: 1rem; justify-content: center; }
.yesno button { font: inherit; font-size: 1.3rem; font-weight: 600; width: 120px; height: 64px; border-radius: 14px; border: 2px solid var(--baseline); background: var(--surface); color: var(--ink); cursor: pointer; }
.yesno button:active { background: var(--surface-2); }
.feedback { min-height: 1.5rem; font-weight: 600; text-align: center; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--critical); }
.countdown { font-size: 3rem; font-weight: 700; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }
.done-check { width: 64px; height: 64px; color: var(--good); }

/* training content */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.4rem; }
.prose blockquote { border-left: 4px solid var(--accent); background: var(--surface-2); padding: .75rem 1rem; margin: 1.25rem 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .3rem; }
.toc { position: sticky; top: 76px; font-size: .9rem; }
.toc a { display: block; padding: .3rem 0; color: var(--ink-2); }
.toc a.active { color: var(--accent); font-weight: 600; }
.layout-side { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; }
@media (max-width: 860px) { .layout-side { grid-template-columns: 1fr; } .toc { position: static; } }

/* landing */
.hero-landing { padding: 3rem 0 2rem; display: grid; gap: 1.25rem; max-width: 760px; }
.hero-landing h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.feature { display: grid; gap: .35rem; }
.feature .icon { width: 36px; height: 36px; color: var(--accent); }
.print-only { display: none; }
@media print { .topbar, .footer, .no-print { display: none !important; } .card { box-shadow: none; } .print-only { display: block; } }

/* ---- header tools: language switch (segmented control) + theme toggle ---- */
.tools { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.lang-switch { display: inline-flex; margin: 0; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; }
.lang-switch button { font: inherit; font-size: .8rem; font-weight: 600; padding: .3rem .55rem; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; line-height: 1.2; }
.lang-switch button + button { border-left: 1px solid var(--hairline); }
.lang-switch button:hover { color: var(--ink); background: var(--surface-2); }
.lang-switch button.on { background: var(--accent-soft); color: var(--ink); }

/* compact navigation on narrow screens: brand + tools on the first row, links as a scroll row below.
   The scroll row has no visible scrollbar, so JS (app.js) marks hidden edges via data-fade and the mask
   below fades them — the "there is more" affordance a hidden scrollbar takes away. */
@media (max-width: 700px) {
  .topbar .container { flex-wrap: wrap; gap: .15rem .5rem; padding: .35rem 0 0; min-height: 0; }
  .brand { order: 1; }
  .tools { order: 2; margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 0 .35rem; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav button { white-space: nowrap; }
  .nav a { padding: .35rem .6rem; }
  .nav[data-fade="right"] { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); }
  .nav[data-fade="left"] { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent); }
  .nav[data-fade="both"] { -webkit-mask-image: linear-gradient(to right, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent); }
  main { padding-top: 1.25rem; }
  th, td { padding: .45rem .4rem; font-size: .92rem; }
}

/* phones: denser cards, runner top bar that never wraps, task widgets sized for ~360-430 px */
@media (max-width: 480px) {
  .card { padding: 1.1rem 1rem; }
  .card.tight { padding: .85rem .9rem; }
  .hero-landing { padding: 1.5rem 0 1rem; }
  .runner-top { gap: .6rem; padding: .55rem .75rem; }
  .runner-top .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  .runner-top .progress { min-width: 36px; }
  .runner-top .counter { font-size: .82rem; white-space: nowrap; }
  .timer { min-width: 4rem; font-size: .9rem; }
  .runner-body { padding: .9rem .6rem 1.5rem; }
  .stage { gap: 1rem; }
  .stimulus { padding: .85rem; }
  .options { gap: .5rem; }
  .option { padding: .5rem; min-height: 56px; }
  .option.text { padding: .7rem .8rem .7rem 1.9rem; }
  .stem { font-size: 1.2rem; }
  /* symbol search: 2 targets + 5 items must fit ONE row (the task is a row scan) — 7 × 32 px + gaps < 340 px */
  .search-row { gap: .75rem; }
  .search-row .targets, .search-row .items { gap: .3rem; }
  .search-row .targets { padding-right: .75rem; }
  .search-row svg { width: 32px; height: 32px; }
  .coding-key { gap: .3rem; }
  .coding-key .pair { min-width: 44px; padding: .3rem .35rem; }
  .coding-key .pair svg { width: 28px; height: 28px; }
  .coding-stim svg { width: 96px; height: 96px; }
  .keypad { grid-template-columns: repeat(3, minmax(64px, 1fr)); width: min(280px, 100%); }
  .yesno button { width: 44%; max-width: 140px; }
  .series-display { letter-spacing: .05em; }
  .intro .steps span { font-size: .74rem; }
}

/* touch devices (any width): tap targets ≥ 44 px where the desktop sizing is tighter */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.small { min-height: 36px; }
  .nav a { padding: .5rem .7rem; }
  .lang-switch button { padding: .45rem .65rem; }
  .option { min-height: 64px; }
}
