:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --ink: #13201d;
  --ink-2: #4a5753;
  --line: #dfe3dc;
  --brand: #0f2a26;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --good: #15803d;
  --good-bg: #e7f5ec;
  --fair: #b45309;
  --fair-bg: #fdf1e2;
  --limited: #b91c1c;
  --limited-bg: #fdeaea;
  --skipped: #6b7280;
  --skipped-bg: #eef0f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(19, 32, 29, 0.06), 0 8px 24px rgba(19, 32, 29, 0.06);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; line-height: 1.5; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 750; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }

/* ---------- buttons ---------- */
button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, transform 0.05s; }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.45); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-ink); padding: 0.7em 1.4em; font-weight: 650; }
.primary:hover { background: #0b5f58; }
.primary.large { font-size: 1.1rem; padding: 0.85em 1.8em; }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); padding: 0.6em 1.2em; font-weight: 550; }
.ghost:hover { border-color: var(--ink-2); }
.small { font-size: 0.85rem; padding: 0.4em 0.9em; }
.on-dark { color: #fff; border-color: rgba(255, 255, 255, 0.35); background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(6px); }
.on-dark:hover { border-color: #fff; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }

/* ---------- layout ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem clamp(1rem, 4vw, 2.5rem); }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 750; color: var(--brand); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: conic-gradient(from 200deg, var(--accent) 0 70%, #99d5cd 70% 100%); }
main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem; }
.screen > section { margin-top: 2.5rem; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; padding-top: clamp(1rem, 4vw, 3rem); }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 36em; margin-bottom: 1.6em; }
.setup h2 { font-size: 1.05rem; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.checklist li { padding-left: 1.6rem; position: relative; color: var(--ink-2); }
.checklist li::before { content: ''; position: absolute; left: 0; top: 0.45em; width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px solid var(--accent); }
.checklist strong { color: var(--ink); font-weight: 600; }

.hero-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pick-summary { margin: 0; font-weight: 600; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.section-head.wide { max-width: none; }
.seg { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.seg [aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }

.test-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.6rem; }
.pick { display: flex; gap: 0.7rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1rem; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.pick:hover { border-color: var(--ink-2); }
.pick:has(input:checked) { border-color: var(--accent); background: #f1f8f7; }
.pick input { margin: 0.2rem 0 0; width: 1.05rem; height: 1.05rem; accent-color: var(--accent); flex: none; }
.pick-body { display: flex; flex-direction: column; gap: 0.1rem; }
.pick-name { font-weight: 650; }
.pick small { color: var(--ink-2); font-size: 0.82rem; }

.brain-intro { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brain-intro h2 { margin-bottom: 0.3rem; }
.brain-intro p { margin: 0; max-width: 40em; }

/* progress chart */
.select-label select { font: inherit; font-size: 0.9rem; padding: 0.4em 2em 0.4em 0.9em; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); }
.chart-card { padding: 1.1rem 1.2rem 0.9rem; }
.chart-caption { margin: 0 0 0.6rem; font-size: 0.9rem; }
.chart-caption strong { color: var(--ink); font-weight: 650; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.45); outline-offset: 4px; border-radius: 6px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-tick { fill: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent); opacity: 0.08; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-hot { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; pointer-events: none; }
.chart-cross { stroke: var(--ink-2); stroke-width: 1; opacity: 0.5; pointer-events: none; }
.chart-end { fill: var(--ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tip { position: absolute; transform: translate(-50%, calc(-100% - 14px)); background: var(--ink); color: #fff; border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.82rem; line-height: 1.35; pointer-events: none; white-space: nowrap; display: flex; flex-direction: column; box-shadow: var(--shadow); z-index: 2; }
.chart-tip-date { opacity: 0.75; }
.chart-tip-row { display: flex; align-items: center; gap: 0.4rem; }
.chart-tip-row i { width: 12px; height: 2px; background: #5eead4; border-radius: 1px; }
.chart-tip b { font-size: 1rem; }
.chart-tip .up { color: #86efac; }
.chart-tip .down { color: #fca5a5; }
.chart-tip-hint { opacity: 0.6; font-size: 0.75rem; }
.chart-table { margin-top: 0.5rem; font-size: 0.88rem; }
.chart-table summary { cursor: pointer; color: var(--ink-2); }
.chart-table table { border-collapse: collapse; margin-top: 0.5rem; min-width: 16rem; }
.chart-table th, .chart-table td { text-align: left; padding: 0.3rem 1.2rem 0.3rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.chart-table th { font-weight: 600; color: var(--ink-2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.history-list { display: grid; gap: 0.6rem; }
.history-item { display: grid; grid-template-columns: 11rem 1fr auto; gap: 1rem; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; color: var(--ink); }
.history-item:hover { border-color: var(--accent); }
.h-date { font-weight: 600; font-size: 0.92rem; display: flex; flex-direction: column; }
.h-date small { font-weight: 500; color: var(--ink-2); font-size: 0.78rem; }
.h-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { font-size: 0.75rem; padding: 0.15em 0.6em; border-radius: 999px; background: var(--skipped-bg); color: var(--ink-2); }
.chip b { font-weight: 700; }
.h-score { font-size: 1.5rem; font-weight: 750; display: flex; align-items: baseline; gap: 0.35rem; }
.h-score small { font-size: 0.78rem; font-weight: 650; }
.up { color: var(--good); }
.down { color: var(--limited); }

[data-status='good'].chip { background: var(--good-bg); color: var(--good); }
[data-status='fair'].chip { background: var(--fair-bg); color: var(--fair); }
[data-status='limited'].chip { background: var(--limited-bg); color: var(--limited); }

.device { margin-top: 1rem; font-size: 0.9rem; }
.device summary { cursor: pointer; color: var(--ink-2); }
.device p { margin: 0.6rem 0; }
.device-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.6rem 0; }
.device code { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.3em 0.6em; font-size: 0.8rem; word-break: break-all; }
.device input { flex: 1; min-width: 14rem; font: inherit; font-size: 0.85rem; padding: 0.45em 0.8em; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }

.disclaimer { margin-top: 3rem; font-size: 0.82rem; color: var(--ink-2); max-width: 46em; }

/* ---------- session (full-screen camera stage) ---------- */
body[data-screen='session'] { background: #050807; overflow: hidden; }
body[data-screen='session'] .topbar { display: none; }
body[data-screen='session'] main { max-width: none; padding: 0; }
.stage { position: fixed; inset: 0; background: #050807; color: #fff; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }

.stage-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: max(1rem, env(safe-area-inset-top)) clamp(1rem, 3vw, 2rem) 2.5rem; background: linear-gradient(rgba(0, 0, 0, 0.6), transparent); }
.progress { flex: 1; max-width: 30rem; }
.progress p { margin: 0 0 0.5rem; font-weight: 600; font-size: 0.95rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.progress-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: #2dd4bf; transition: width 0.4s ease; }
.stage-actions { display: flex; gap: 0.4rem; }

.pill { position: absolute; left: 50%; bottom: max(2rem, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 2rem); padding: 0.8em 1.4em; border-radius: 999px; font-weight: 650; font-size: clamp(1rem, 2.6vw, 1.35rem); text-align: center; backdrop-filter: blur(8px); }
.pill.warn { background: rgba(251, 191, 36, 0.92); color: #1c1403; }
.pill.ok { background: rgba(45, 212, 191, 0.92); color: #03201c; }

.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(7rem, 26vw, 16rem); font-weight: 800; color: #fff; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5); pointer-events: none; font-variant-numeric: tabular-nums; }

.hud { position: absolute; left: 50%; bottom: max(2rem, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 0.7em 1.4em; border-radius: 16px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); font-size: clamp(1rem, 2.6vw, 1.5rem); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.cue { position: absolute; left: 50%; bottom: calc(max(2rem, env(safe-area-inset-bottom)) + 5.5rem); transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); padding: 0.55em 1.2em; border-radius: 16px; background: rgba(45, 212, 191, 0.94); color: #03201c; font-size: clamp(1.4rem, 4.2vw, 2.6rem); font-weight: 800; line-height: 1.2; text-align: center; letter-spacing: -0.01em; }
.instruction { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(34rem, calc(100% - 2rem)); max-height: calc(100% - 7rem); overflow-y: auto; color: var(--ink); margin-top: 1.5rem; }
.instruction h2 { font-size: 1.6rem; margin-bottom: 0.3rem; }
.view-tag { display: inline-block; font-size: 0.8rem; font-weight: 650; padding: 0.2em 0.7em; border-radius: 999px; background: #e6f4f2; color: var(--accent); margin-bottom: 0.9rem; }
.steps { padding-left: 1.3rem; margin: 0 0 1.3rem; display: grid; gap: 0.5rem; }
.ins-actions { display: flex; gap: 0.6rem; align-items: center; }
.auto-note { margin: 0.8rem 0 0; font-size: 0.88rem; color: var(--ink-2); min-height: 1.3em; }

.loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1rem; text-align: center; padding: 2rem; background: #050807; }
.loading p { max-width: 28rem; margin: 0; }
.loading.error .spinner { display: none; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.2); border-top-color: #2dd4bf; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- brain check ---------- */
#screen-brain { max-width: 40rem; margin: 0 auto; padding-top: 1.5rem; }
.brain-top { margin-bottom: 1rem; }
.brain-label { font-weight: 650; margin-bottom: 0.5rem; }
.progress-track.light { background: var(--line); }
.progress-track.light .progress-bar { background: var(--accent); }
.brain-card h2 { font-size: 1.5rem; }
.brain-area:empty { display: none; }
.brain-area { margin: 0.5rem 0 1.2rem; }
.brain-progress { text-align: center; margin: 0.7rem 0 0; font-size: 0.9rem; }

.rt-pad { display: grid; place-items: center; width: 100%; min-height: 15rem; border-radius: var(--radius); font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 800; color: #fff; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: none; }
.rt-pad[data-state='wait'] { background: #7f1d1d; }
.rt-pad[data-state='go'] { background: #15803d; }
.rt-pad[data-state='early'] { background: #b45309; }
.rt-pad[data-state='done'] { background: var(--brand); }
.rt-pad:active { transform: none; }

.span-digit { display: grid; place-items: center; min-height: 12rem; margin: 0; font-size: clamp(4.5rem, 18vw, 8rem); font-weight: 800; font-variant-numeric: tabular-nums; background: var(--brand); color: #fff; border-radius: var(--radius); }
.span-form { display: grid; gap: 0.7rem; }
.span-form label { font-weight: 650; }
.span-form input { font: inherit; font-size: 2rem; letter-spacing: 0.25em; text-align: center; padding: 0.4em; border: 2px solid var(--line); border-radius: 12px; font-variant-numeric: tabular-nums; }
.span-form input:focus { border-color: var(--accent); outline: none; }
.span-feedback { display: grid; place-items: center; min-height: 12rem; margin: 0; text-align: center; font-size: 1.3rem; background: var(--skipped-bg); border-radius: var(--radius); padding: 1rem; }
.span-feedback.ok { background: var(--good-bg); color: var(--good); font-weight: 750; font-size: 1.8rem; }

.stroop-word { display: grid; place-items: center; min-height: 11rem; margin: 0 0 0.9rem; background: #0b1513; border-radius: var(--radius); font-size: clamp(2.6rem, 11vw, 4.2rem); font-weight: 850; letter-spacing: 0.04em; color: #fff; }
.stroop-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.stroop-keys button { padding: 0.9em 0.4em; font-weight: 700; border-radius: 12px; touch-action: manipulation; }

/* ---------- results ---------- */
.results-head { display: flex; gap: clamp(1.2rem, 4vw, 2.5rem); align-items: center; padding-top: 1.5rem; }
.results-head h1 { margin-bottom: 0.2rem; }
.res-date { font-weight: 600; color: var(--ink-2); margin-bottom: 0.4rem; }
.ring { --c: var(--accent); flex: none; width: 150px; height: 150px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(closest-side, var(--bg) 79%, transparent 80% 100%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring span { font-size: 2.8rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ring small { color: var(--ink-2); font-size: 0.8rem; }
.ring[data-status='good'] { --c: var(--good); }
.ring[data-status='fair'] { --c: var(--fair); }
.ring[data-status='limited'] { --c: var(--limited); }
.ring[data-status='skipped'] { --c: var(--skipped); }
.save-status { font-size: 0.88rem; color: var(--good); margin: 0; }
.res-tools { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.8rem; }
.share-status { font-size: 0.85rem; color: var(--ink-2); }
.shared-banner { margin: 1rem 0 0; padding: 0.7rem 1rem; border-radius: 10px; background: #e6f4f2; color: var(--brand); font-weight: 550; }
.shared-banner a { color: var(--accent); font-weight: 700; }
.replay-btn { margin-top: 1rem; }

.replay { width: min(46rem, calc(100% - 2rem)); border: none; border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.replay::backdrop { background: rgba(5, 8, 7, 0.65); }
.replay-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.6rem; }
.replay-head h2 { margin: 0; }
.replay #replay-sides { margin-bottom: 0.6rem; }
.replay-canvas { display: block; width: 100%; height: auto; border-radius: 10px; background: #0b1513; }
.replay-controls { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.7rem; }
.replay-controls input { flex: 1; accent-color: var(--accent); }
.replay-time { font-variant-numeric: tabular-nums; font-size: 0.88rem; color: var(--ink-2); min-width: 3.5rem; text-align: right; }
.replay-note { font-size: 0.8rem; margin: 0.6rem 0 0; }
.save-status.error { color: var(--limited); }

.test-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.test-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.test-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }
.badge { display: flex; flex-direction: column; align-items: flex-end; font-size: 1.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.badge small { font-size: 0.72rem; font-weight: 600; color: var(--ink-2); margin-top: 0.3rem; }
.test-card[data-status='good'] .badge { color: var(--good); }
.test-card[data-status='fair'] .badge { color: var(--fair); }
.test-card[data-status='limited'] .badge { color: var(--limited); }
.test-card dl { margin: 0; display: grid; gap: 0.7rem; }
.metric dt { font-size: 0.82rem; color: var(--ink-2); }
.metric dd { margin: 0; display: flex; flex-direction: column; }
.metric dd strong { font-size: 1.1rem; }
.metric dd span { font-size: 0.8rem; color: var(--ink-2); }
.notes { margin: 0.9rem 0 0; padding: 0.7rem 0.9rem 0.7rem 1.8rem; background: var(--fair-bg); border-radius: 10px; font-size: 0.84rem; color: #6b3a06; }

.drills { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.drill { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.drill .detail { font-weight: 600; margin-bottom: 0.4rem; }
.drill .muted { font-size: 0.9rem; }
.drill ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.drill li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.92rem; padding-top: 0.45rem; border-top: 1px solid var(--line); }
.dose { color: var(--accent); font-weight: 650; white-space: nowrap; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; max-width: 46rem; margin-bottom: 0.75rem; }
.section-head h2 { margin: 0; }
.ai-report { max-width: 46rem; }
.report-error { color: var(--limited); font-size: 0.9rem; margin: 0.8rem 0 0; }
.ai-report h2, .ai-report h3 { margin-top: 1.2em; }
.ai-report > :first-child { margin-top: 0; }
.ai-report ul, .ai-report ol { padding-left: 1.3rem; }
.ai-report li { margin-bottom: 0.35rem; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

.results-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2.5rem; }

/* ---------- responsive ---------- */
/* ---------- accounts ---------- */
.topnav { display: flex; align-items: center; gap: 0.5rem; }
.github-btn { display: inline-flex; align-items: center; gap: 0.45rem; background: var(--brand); color: #fff; border-color: var(--brand); }
.github-btn:hover { background: #18403a; border-color: #18403a; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden; background: #d7ece9; color: var(--brand); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 44px; height: 44px; font-size: 0.95rem; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; padding: 0.2rem 0.7rem 0.2rem 0.2rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.88rem; font-weight: 600; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { border-color: var(--ink-2); }
.account-menu .avatar { width: 28px; height: 28px; }
.account-pop { position: absolute; right: 0; top: calc(100% + 0.5rem); min-width: 15rem; padding: 1rem; z-index: 20; }
.account-pop p { margin: 0 0 0.6rem; }
.account-who { display: flex; flex-direction: column; line-height: 1.3; }
.account-who .muted { font-size: 0.85rem; }
.account-coach { font-size: 0.88rem; }
.role-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.15em 0.6em; border-radius: 999px; background: var(--skipped-bg); color: var(--ink-2); vertical-align: 0.1em; }
.role-tag[data-role='admin'] { background: #ece7fb; color: #5b3fb5; }
.role-tag[data-role='coach'] { background: #e6f4f2; color: var(--accent); }
p.role-tag { display: inline-block; }

.notice { display: flex; align-items: center; gap: 0.5rem 0.8rem; flex-wrap: wrap; margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 12px; background: #e6f4f2; color: var(--brand); }
.notice p { margin: 0; flex: 1 1 18rem; }
.notice[data-tone='warn'] { background: var(--fair-bg); color: #7c3a06; }
.notice[data-tone='good'] { background: var(--good-bg); color: var(--good); }
.viewing-banner { display: flex; align-items: center; gap: 0.6rem 0.8rem; flex-wrap: wrap; margin-top: 1rem; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--brand); color: #fff; }
.viewing-banner p { margin: 0; flex: 1 1 16rem; }
.viewing-banner span:not(.avatar) { opacity: 0.8; }
.viewing-banner .ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.viewing-banner .ghost:hover { border-color: #fff; }
.res-person { margin: 0 0 0.3rem; font-size: 0.85rem; font-weight: 650; color: var(--accent); text-transform: none; }

.people-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; padding-top: clamp(1rem, 3vw, 2rem); margin-bottom: 1.2rem; }
.people-head h1 { margin-bottom: 0.3rem; }
.people-head p { margin: 0; max-width: 40em; }
#people-filter { margin-bottom: 1rem; }
.people-list { display: grid; gap: 0.6rem; }
.person { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; }
.person h3 { margin: 0 0 0.1rem; }
.person h3 small { font-weight: 500; font-size: 0.82rem; }
.person p { margin: 0; }
.person-login { font-size: 0.85rem; color: var(--ink-2); display: flex; align-items: center; gap: 0.5rem; }
.person-facts { font-size: 0.85rem; color: var(--ink-2); margin-top: 0.2rem !important; }
.person-facts .warn { color: var(--fair); font-weight: 600; }
.person-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
body[data-screen='people'] #btn-people { background: var(--brand); border-color: var(--brand); color: #fff; }
.danger { color: var(--limited); }
.danger:hover { border-color: var(--limited); }
.people-foot { font-size: 0.85rem; margin-top: 1.2rem; }
.empty { padding: 1rem 0; }

.modal { width: min(30rem, calc(100% - 2rem)); border: none; border-radius: var(--radius); padding: 1.4rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.modal::backdrop { background: rgba(5, 8, 7, 0.55); }
.user-form { display: grid; gap: 1rem; }
.user-form h2 { margin: 0; }
.field { display: grid; gap: 0.3rem; }
.field > span:first-child { font-size: 0.88rem; font-weight: 650; }
.field small { font-size: 0.8rem; }
.field input, .field select { font: inherit; font-size: 0.95rem; width: 100%; padding: 0.55em 0.8em; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.field input:disabled { background: var(--bg); color: var(--ink-2); }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.45); outline-offset: 1px; }
.prefixed { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: 0.8em; }
.prefixed > span { color: var(--ink-2); }
.prefixed input { border: none; padding-left: 0.2em; }
.form-error { margin: 0; color: var(--limited); font-size: 0.9rem; font-weight: 550; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 1fr auto; }
  .h-chips { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 560px) {
  .person { grid-template-columns: auto 1fr; }
  .person-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .account-name { display: none; }
  .account-menu summary { padding-right: 0.2rem; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .stage-top { flex-direction: column; }
  .instruction h2 { font-size: 1.3rem; }
}
@media (max-width: 420px) {
  .brand { font-size: 0; gap: 0; }
  .topnav { gap: 0.35rem; }
  .stroop-keys { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- print / Save as PDF ---------- */
@media print {
  :root { background: #fff; }
  body { background: #fff; }
  .topbar, .notice, .viewing-banner, .res-tools, .results-actions, #btn-report, .replay-btn, .shared-banner, dialog { display: none !important; }
  main { max-width: none; padding: 0; }
  .screen > section { margin-top: 1.4rem; }
  .ring { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: radial-gradient(closest-side, #fff 79%, transparent 80% 100%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
  .test-card, .drill, .ai-report, .notes { break-inside: avoid; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .test-cards, .drills { grid-template-columns: repeat(2, 1fr); }
  .ai-report:has(> p.muted:only-child) { display: none; }
  .ai-section:has(.ai-report > p.muted:only-child) { display: none; }
  .disclaimer { margin-top: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
