/* ---------- Questions ---------- */
.t-intro { max-width: 640px; }
.t-intro h1 { font-size: clamp(30px, 5vw, 42px); margin-bottom: 28px; }
.t-form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; border: 0; }
.field label, .field legend { font-weight: 600; }
.field legend { margin-bottom: 4px; }
select {
  font: inherit; color: var(--ink); background-color: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%; max-width: 360px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235B6573' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 12px 8px; background-position: right 16px center;
  padding-inline-end: 40px;
}
html[dir="rtl"] select { background-position: left 16px center; }
.choice-row { display: flex; gap: 12px; margin-top: 4px; }
.choice { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px; cursor: pointer; font-weight: 500; }
.choice:has(input:checked) { border-color: var(--ink); }
.choice input { accent-color: var(--ink); width: 18px; height: 18px; }
.consent { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; }
.consent a { color: var(--signal); }
.form-error { color: #9B2C2C; font-weight: 600; font-size: 15px; }
.t-form .btn { justify-self: start; }

/* ---------- Running test: full screen, no header/footer ---------- */
body.testing .site-header, body.testing .site-footer { display: none; }
body.testing main { padding: 0; }
.t-area { min-height: 100vh; min-height: 100dvh; }
.t-area .jspsych-content-wrapper, .t-area .jspsych-content { width: 100%; min-height: inherit; }
.t-screen { max-width: 640px; margin-inline: auto; padding: 48px 16px; }
.t-screen h1 { font-size: clamp(28px, 5vw, 40px); margin-bottom: 20px; }
.t-screen p { margin-bottom: 12px; font-size: 17px; }
.t-screen .btn { margin-top: 16px; }
.t-visual { margin: 8px 0 24px; }
.t-arena {
  position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
}
.t-top { padding: 18px 16px; font-size: 14px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.t-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 0 16px 60px; }
.t-msg { font-size: 18px; color: var(--muted); min-height: 1.6em; text-align: center; }
.t-feedback { font-size: clamp(24px, 5vw, 34px); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.t-feedback.t-bad { color: var(--muted); font-size: clamp(18px, 3.5vw, 24px); }

/* Demo visuals on instruction screens */
.demo { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.demo figure { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.demo figcaption { font-size: 14px; font-weight: 600; color: var(--muted); }
.demo-arrow { font-size: 28px; color: var(--muted); }
html[dir="rtl"] .demo-arrow { transform: scaleX(-1); }

/* Reaction time */
.t-arena .rt-box { width: min(200px, 55vw); height: min(200px, 55vw); cursor: pointer; }
.rt-box { border: 3px solid var(--ink); border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px; background: transparent; }
.rt-box.on { background: var(--signal); border-color: var(--signal); }
.rt-box.on .rt-box-label { visibility: hidden; }
.rt-box-label { font-size: 15px; color: var(--muted); line-height: 1.4; }
.demo-box { width: 72px; height: 72px; border-width: 2px; }

/* Go / No-Go */
.gng-slot { position: relative; width: 160px; height: 160px; display: flex; align-items: center; justify-content: center; }
.gng-fix { position: absolute; font-size: 32px; color: var(--muted); }
.gng-shape { position: relative; width: 140px; height: 140px; visibility: hidden; }
.gng-shape.on { visibility: visible; }
.gng-go { background: var(--signal); border-radius: 4px; }
.gng-nogo { background: var(--ink); border-radius: 50%; }
.gng-shape.on ~ .gng-fix, .gng-slot:has(.gng-shape.on) .gng-fix { visibility: hidden; }
.demo .gng-shape { width: 64px; height: 64px; }

/* Digit span */
.ds-cue { font-size: 16px; color: var(--muted); }
.ds-digit { font-size: clamp(72px, 18vw, 120px); font-weight: 600; min-height: 1.2em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ds-entry { font-size: clamp(32px, 8vw, 44px); font-weight: 600; letter-spacing: 0.12em; min-height: 1.4em; border-bottom: 2px solid var(--line); min-width: 220px; text-align: center; font-variant-numeric: tabular-nums; }
.ds-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.ds-pad button { height: 60px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 24px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.ds-pad button:active { background: var(--line); }
.ds-pad .ds-ok { background: var(--ink); color: var(--bg); border-color: var(--ink); font-size: 16px; }
.ds-pad .ds-del { font-size: 20px; }
.ds-demo span { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 26px; font-weight: 600; }

/* Mental rotation */
.mr-q { font-size: 18px; font-weight: 600; text-align: center; }
.mr-pair { display: flex; gap: clamp(16px, 6vw, 56px); }
.mr-cell { width: min(160px, 40vw); height: min(160px, 40vw); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.mr-shape { width: 100%; height: 100%; fill: var(--ink); }
.mr-buttons { display: flex; gap: 12px; }
.mr-btn { min-width: 130px; font-size: 18px; padding: 16px 24px; }
.mr-demo figure { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.mr-demo .mr-shape { width: 56px; height: 56px; }
.mr-demo figcaption { width: 100%; text-align: center; }

/* ---------- Results ---------- */
.t-results { max-width: 760px; }
.score-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 640px) { .score-grid { grid-template-columns: 1fr 1fr; } }
.score-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.score-label { font-weight: 600; margin-bottom: 8px; }
.score-value { font-size: 20px; color: var(--muted); margin-bottom: 8px; }
.score-value strong { font-size: clamp(48px, 9vw, 64px); color: var(--ink); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score-word { font-size: clamp(28px, 5vw, 36px); color: var(--ink); font-weight: 600; line-height: 1.3; }
#res-too-few h1 { font-size: clamp(28px, 5vw, 40px); }
.again { margin-top: 32px; font-size: 17px; }
.t-results .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
#res-verify { margin-top: 28px; }
#res-turnstile { margin-top: 12px; }
.save-status { margin-top: 20px; }
.save-status.good { color: var(--signal); font-weight: 600; }
#res-history { margin-top: 48px; }
#res-history h2 { font-size: 20px; }
.history { width: 100%; max-width: 560px; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.history th, .history td { text-align: start; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
html[dir="rtl"] .history th, html[dir="rtl"] .history td { padding: 10px 0 10px 12px; }
.history th { font-size: 13px; color: var(--muted); font-weight: 600; }
.disclaimer { margin-top: 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.share-msg { margin-top: 12px; word-break: break-all; }

/* Vigilance: running millisecond counter inside the box */
.rt-box { position: relative; }
.pvt-counter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(36px, 10vw, 52px); font-weight: 600; color: var(--bg); font-variant-numeric: tabular-nums; pointer-events: none; }
.demo-counter { font-size: 18px; }

/* Corsi: fixed board, identical in every language (always LTR, never mirrored) */
.corsi-board { position: relative; width: min(360px, 84vw); aspect-ratio: 1 / 1; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; touch-action: manipulation; }
.corsi-block { position: absolute; width: 16%; height: 16%; border: 0; border-radius: 6px; background: var(--ink); cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
.corsi-block.lit { background: var(--signal); }
.corsi-board.showing .corsi-block { cursor: default; }
.corsi-cue { font-size: 17px; font-weight: 600; text-align: center; min-height: 1.6em; }
.corsi-demo .corsi-board { width: 180px; pointer-events: none; }

/* Optional extra tests on the results page */
#res-more { margin-top: 36px; }
#res-more h2 { font-size: 20px; margin-bottom: 6px; }
#res-more-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* Session progress bar: sits above the running test */
.t-bar { position: fixed; top: 0; inset-inline: 0; z-index: 10; background: var(--bg); padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
.t-bar-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; text-align: center; }
.t-bar-track { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; max-width: 560px; margin-inline: auto; }
.t-bar-fill { height: 100%; width: 0; background: var(--signal); border-radius: 999px; transition: width 300ms ease; }
html[dir="rtl"] .t-bar-track { direction: rtl; }
body.testing .t-arena { top: 62px; }
body.testing .t-screen { padding-top: 90px; }

/* Go / No-Go: teal circle lure, level banners */
.gng-lure { background: var(--signal); border-radius: 50%; }
.t-banner { text-align: center; gap: 12px; }
.t-banner h2 { font-size: clamp(28px, 6vw, 40px); margin: 0; }
.t-banner p { font-size: 17px; max-width: 32ch; }
.t-banner .demo { justify-content: center; margin-top: 8px; }
.t-banner .demo .gng-shape { width: 56px; height: 56px; }

/* Go / No-Go v4 shapes: only the teal square is a "go" */
.gng-dark-circle { background: var(--ink); border-radius: 50%; }
.gng-teal-circle { background: var(--signal); border-radius: 50%; }
.gng-dark-square { background: var(--ink); border-radius: 4px; }

/* Clear "Practice" badge during practice tries */
#t-area[data-phase="practice"]::after {
  content: attr(data-badge); position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 11;
  background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  padding: 5px 14px; border-radius: 999px;
}
#t-area[data-phase="practice"] .t-top { padding-top: 48px; }
