/* ==========================================================================
   SPEEDLAB — arcade.css
   The arcade-cabinet system: frame, CRT screen, seven-segment readout,
   physical buttons, rank meter, result panel, and consequence-only motion.
   ========================================================================== */

/* ---- Cabinet frame ------------------------------------------------------ */
.cabinet {
  position: relative;
  background: var(--c-panel);
  border: var(--bd-2) solid var(--c-line);
  border-radius: 10px;
  box-shadow: var(--shadow-hard-lg);
  padding: var(--sp-3);
  margin-top: var(--sp-3);
}
/* corner "bolts" */
.cabinet::before, .cabinet::after {
  content: ""; position: absolute; width: 10px; height: 10px;
  background: var(--c-panel-2); border: 2px solid var(--c-line); border-radius: 50%;
  top: 8px;
}
.cabinet::before { left: 8px; }
.cabinet::after  { right: 8px; }
@media (min-width: 640px) { .cabinet { padding: var(--sp-4); } }

/* Marquee title strip above the screen */
.marquee {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--c-p1); color: var(--c-line);
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  padding: 0.4rem 0.75rem; margin-bottom: var(--sp-3); text-align: center;
}

/* ---- CRT screen --------------------------------------------------------- */
.screen {
  position: relative; overflow: hidden;
  background: var(--c-screen);
  border: var(--bd-2) solid var(--c-line);
  border-radius: 8px;
  /* recessed bezel: hard inset shadow, no blur */
  box-shadow: inset 0 0 0 3px #05030d, inset 0 0 0 6px #1c1636;
  padding: var(--sp-4) var(--sp-3);
  min-height: 340px;                 /* reserve height → no layout shift */
  display: flex; flex-direction: column; gap: var(--sp-3);
}
@media (min-width: 640px) { .screen { min-height: 380px; padding: var(--sp-5) var(--sp-4); } }

/* scanline pattern (a 1px repeating pattern, not a decorative colour wash) */
.screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.25) 3px
  );
}

/* ---- Seven-segment readout --------------------------------------------- */
.readout-row {
  display: flex; align-items: flex-end; justify-content: center;
  gap: var(--sp-5); flex-wrap: wrap; position: relative; z-index: 2;
}
.readout { text-align: center; }
.readout-label {
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.7rem; color: var(--c-ink-dim); margin-top: 0.35rem;
}
.seg-wrap { position: relative; display: inline-block; }
.seg-value, .seg-ghost {
  font-family: var(--font-seg);
  font-weight: 700; line-height: 1;
  font-size: clamp(3.5rem, 18vw, 7rem);
}
.readout.small .seg-value, .readout.small .seg-ghost { font-size: clamp(1.8rem, 8vw, 3rem); }
/* faint "off" segments sitting behind the live value — classic LCD look */
.seg-ghost { position: absolute; inset: 0; color: var(--c-amber); opacity: 0.08; }
.seg-value { position: relative; color: var(--c-amber); }
.seg-value.go { color: var(--c-go); }
/* static glow — no animation, safe for reduced-motion */
.readout .seg-value { text-shadow: 0 0 12px rgba(255,197,49,0.45); }
.readout .seg-value.go { text-shadow: 0 0 12px rgba(43,232,107,0.45); }

/* ---- Click pad (the primary play surface) ------------------------------ */
.play { flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.play-area { position: relative; z-index: 2; flex: 1; display: flex; }
.click-pad {
  flex: 1; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  color: var(--c-line); background: var(--c-p1);
  border: var(--bd-2) solid var(--c-line); border-radius: 8px;
  box-shadow: var(--shadow-hard-lg);
  font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  transition: transform .05s steps(2), box-shadow .05s steps(2), background-color .05s;
}
.click-pad .hint { font-size: 0.8rem; font-weight: 800; color: rgba(0,0,0,0.6); text-transform: none; letter-spacing: 0; }
.click-pad:active,
.click-pad.is-pressed { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--c-line); background: #ff5c93; }
.click-pad.is-armed { background: var(--c-go); }
.click-pad:disabled { cursor: default; }

/* ---- Physical round arcade button (start / restart) -------------------- */
.arcade-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 3.5rem; height: 3.5rem; padding: 0 1.25rem;
  font-weight: 900; text-transform: uppercase; font-size: 1.1rem;
  color: var(--c-line); background: var(--c-p2);
  border: var(--bd-2) solid var(--c-line); border-radius: 999px;
  box-shadow: var(--shadow-hard-lg); cursor: pointer;
  transition: transform .06s steps(2), box-shadow .06s steps(2);
}
.arcade-btn.p1 { background: var(--c-p1); }
.arcade-btn:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--c-line); }

/* ---- Duration / mode selector ------------------------------------------ */
.seg-select { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin: var(--sp-3) 0 0; }
.seg-select .opt {
  font-weight: 800; font-size: 0.9rem; cursor: pointer;
  color: var(--c-ink); background: var(--c-panel-2);
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  padding: 0.5rem 0.75rem; box-shadow: 3px 3px 0 var(--c-line);
  transition: transform .06s steps(2), box-shadow .06s steps(2);
}
.seg-select .opt[aria-pressed="true"] { background: var(--c-amber); color: var(--c-line); }
.seg-select .opt:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--c-line); }

/* ---- Rank badge + segmented power meter -------------------------------- */
.rank-badge {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--c-panel-2); border: var(--bd) solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow-hard);
  padding: 0.5rem 0.75rem;
}
.rank-badge .r-name {
  font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em; font-size: 1.1rem;
}
.meter { display: inline-flex; gap: 3px; }
.meter .cell {
  width: 8px; height: 20px; background: #2a1f47;
  border: 2px solid var(--c-line); border-radius: 2px;
}
.meter .cell.on { background: var(--tier, var(--c-amber)); }

/* ---- Result panel ------------------------------------------------------- */
.result { display: none; text-align: center; position: relative; z-index: 2; }
.result.show { display: block; }
.result .result-rank { display: flex; justify-content: center; margin-bottom: var(--sp-3); }
.result .pct { font-weight: 800; color: var(--c-ink); margin: var(--sp-2) 0; }
.result .pct b { color: var(--c-go); }
.stat-line {
  display: flex; justify-content: center; gap: var(--sp-4); flex-wrap: wrap;
  color: var(--c-ink-dim); font-weight: 800; font-size: 0.9rem; margin: var(--sp-2) 0 var(--sp-3);
}
.stat-line .v { color: var(--c-amber); }
.stat-line .v.new { color: var(--c-go); }
.result-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: var(--sp-3); }
.result-actions .btn { box-shadow: var(--shadow-hard); }

/* personal-best banner shown under the screen at all times */
.pb-strip {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3);
  background: var(--c-panel-2); border: var(--bd) solid var(--c-line);
  border-radius: var(--radius); font-weight: 800; font-size: 0.9rem;
}
.pb-strip .pb-val { color: var(--c-amber); font-family: var(--font-seg); font-size: 1.1rem; }
.pb-strip button { color: var(--c-ink-dim); background: none; border: none; cursor: pointer; font-weight: 700; text-decoration: underline; font-size: 0.8rem; }

/* ---- Consequence-only motion ------------------------------------------- */
/* screen shake on a new personal best */
@keyframes screen-shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}
.shake { animation: screen-shake .35s steps(3) 1; }

/* hard-edged pixel confetti (square, no blur, no rotation) */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti-bit { position: absolute; width: 10px; height: 10px; top: -12px; }
@keyframes confetti-fall {
  to { transform: translateY(110vh); }
}
.confetti-bit { animation: confetti-fall linear forwards; }

/* value "tick" feedback when the count increments */
@keyframes seg-tick { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
.seg-value.tick { animation: seg-tick .08s steps(2) 1; }

/* ---- Homepage ----------------------------------------------------------- */
.hero { text-align: center; margin: var(--sp-5) 0 var(--sp-4); }
.hero h1 { font-size: clamp(2.2rem, 8vw, 4rem); }
.hero .lead { max-width: 46ch; margin-left: auto; margin-right: auto; }

/* Daily challenge card — the streak/daily surface */
.daily {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4);
  justify-content: space-between;
  background: var(--c-panel); border: var(--bd-2) solid var(--c-line);
  border-radius: 10px; box-shadow: var(--shadow-hard-lg);
  padding: var(--sp-3) var(--sp-4); margin: var(--sp-4) 0;
}
.daily .d-main { display: flex; flex-direction: column; gap: 0.15rem; }
.daily .d-eyebrow { font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; color: var(--c-amber); font-size: 0.85rem; }
.daily .d-name { font-weight: 900; font-size: clamp(1.3rem, 4vw, 1.8rem); text-transform: uppercase; letter-spacing: -0.01em; }
.daily .d-right { display: flex; align-items: center; gap: var(--sp-4); }
.streak-badge {
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  background: var(--c-panel-2); border: var(--bd) solid var(--c-line);
  border-radius: var(--radius); padding: 0.5rem 0.8rem; min-width: 4.5rem; text-align: center;
}
.streak-badge .num { font-family: var(--font-seg); font-size: 1.8rem; color: var(--c-go); }
.streak-badge .lbl { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; color: var(--c-ink-dim); margin-top: 0.25rem; }

/* Category section heading with a hard rule */
.cat-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  border-bottom: var(--bd) solid var(--c-line); padding-bottom: 0.4rem; margin: var(--sp-5) 0 var(--sp-3);
}
.cat-head h2 { margin: 0; }
.cat-head .count { font-weight: 800; color: var(--c-ink-dim); font-size: 0.85rem; }

/* "Soon" tile variant for not-yet-built tests (non-links, no 404s) */
.tile.soon { opacity: 0.62; box-shadow: none; cursor: default; }
.tile.soon:hover { transform: none; box-shadow: none; }
.tile .t-soon {
  display: inline-block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
  background: var(--c-amber); color: var(--c-line); border: 2px solid var(--c-line);
  padding: 0 0.3rem; border-radius: 3px; margin-bottom: 0.35rem;
}

/* ---- Scroll Speed ------------------------------------------------------- */
.scroll-box {
  position: relative; z-index: 2; flex: 0 0 auto; height: 280px;
  overflow-y: scroll; overflow-x: hidden;
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel-2); box-shadow: inset 0 0 0 3px #05030d;
  -webkit-overflow-scrolling: touch;
}
.scroll-inner { height: 4000px; position: relative; }
.scroll-stripes {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom, var(--c-p2) 0, var(--c-p2) 26px,
    var(--c-panel-2) 26px, var(--c-panel-2) 52px);
  opacity: 0.25;
}
.scroll-hint {
  position: sticky; top: 40%; text-align: center; z-index: 2;
  font-weight: 900; text-transform: uppercase; color: var(--c-ink);
  pointer-events: none; font-size: 1.1rem;
}

/* ---- Swipe Speed -------------------------------------------------------- */
.swipe-pad {
  position: relative; z-index: 2; flex: 1; min-height: 240px; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  border: var(--bd-2) solid var(--c-line); border-radius: 8px;
  background: var(--c-p2); box-shadow: var(--shadow-hard-lg);
  color: var(--c-line); font-weight: 900; text-transform: uppercase;
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  font-size: clamp(1.3rem, 5vw, 2rem);
}
.swipe-pad:active { cursor: grabbing; }
.swipe-pad.flash { background: var(--c-go); }
.swipe-pad .hint { font-size: 0.8rem; font-weight: 800; color: rgba(0,0,0,0.6); text-transform: none; }

/* ---- Emoji Hunt --------------------------------------------------------- */
.emoji-grid { display: grid; gap: var(--sp-1); margin: 0 auto; width: 100%; max-width: 460px; }
.emoji-cell {
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel); cursor: pointer; padding: 0;
  line-height: 1; touch-action: manipulation; user-select: none;
}
.emoji-cell:active { transform: translate(2px,2px); }
.emoji-cell.bad { background: var(--c-p1); }

/* ---- AI or Human ------------------------------------------------------- */
.aih-area {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-4); text-align: center; padding: var(--sp-4) var(--sp-3);
}
.aih-progress { font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; color: var(--c-amber); min-height: 1em; }
.aih-prompt {
  font-size: clamp(1.15rem, 3.4vw, 1.55rem); font-weight: 600; line-height: 1.55;
  width: 100%; max-width: 42ch; color: var(--c-ink);
  background: var(--c-panel-2); border: var(--bd) solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow-hard);
  padding: var(--sp-4); min-height: 5em;
  display: flex; align-items: center; justify-content: center;
}
.aih-btns { display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: center; }
.aih-btns .btn { min-width: 9rem; font-size: 1.15rem; padding: 0.8rem 1.4rem; }
.aih-start { margin-top: var(--sp-1); }
.aih-prompt.flash-good { animation: flash-good-k .18s steps(2) 1; }
.aih-prompt.flash-bad  { animation: flash-bad-k .18s steps(2) 1; }

/* ---- Word Guess (Wordle-style) ----------------------------------------- */
.wg-stage { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.wg-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 100%; max-width: 300px; }
.wg-tile {
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-screen); color: var(--c-ink);
  font-weight: 900; font-size: clamp(1.2rem, 6vw, 2rem); text-transform: uppercase;
}
.wg-tile.filled { border-color: var(--c-p2); }
.wg-tile.correct { background: var(--c-go); color: var(--c-line); border-color: var(--c-line); }
.wg-tile.present { background: var(--c-amber); color: var(--c-line); border-color: var(--c-line); }
.wg-tile.absent  { background: #2a1f47; color: var(--c-ink-dim); border-color: var(--c-line); }
.wg-msg { min-height: 1.2em; font-weight: 800; color: var(--c-amber); }

.wg-kbd { display: flex; flex-direction: column; gap: 5px; width: 100%; max-width: 460px; }
.wg-kbd-row { display: flex; gap: 4px; justify-content: center; }
.wg-key {
  flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 2px;
  border: 2px solid var(--c-line); border-radius: 5px; cursor: pointer;
  background: var(--c-panel); color: var(--c-ink);
  font-weight: 800; font-size: 0.85rem; text-transform: uppercase;
  touch-action: manipulation; box-shadow: 2px 2px 0 var(--c-line);
}
.wg-key:active { transform: translate(2px,2px); box-shadow: none; }
.wg-key.wide { flex: 1.5 1 auto; font-size: 0.7rem; }
.wg-key.correct { background: var(--c-go); color: var(--c-line); }
.wg-key.present { background: var(--c-amber); color: var(--c-line); }
.wg-key.absent  { background: #2a1f47; color: var(--c-ink-dim); }
@keyframes wg-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.wg-row-shake { animation: wg-shake .2s steps(3) 1; }

/* ---- Memory tests (shared) --------------------------------------------- */
.mem-stage { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; }
.mem-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); text-align: center; }
.mem-hint { color: var(--c-ink-dim); font-size: 0.9rem; max-width: 32ch; margin: 0; }
.mem-feedback { font-weight: 800; min-height: 1.2em; margin: 0; }
.mem-feedback.good { color: var(--c-go); }
.mem-feedback.bad { color: var(--c-p1); }
.mem-lives { display: flex; gap: 0.35rem; justify-content: center; }
.mem-lives .life { width: 14px; height: 14px; border: 2px solid var(--c-line); border-radius: 50%; background: var(--c-p1); }
.mem-lives .life.gone { background: #2a1f47; }

/* Number Memory */
.mem-number {
  font-family: var(--font-seg); color: var(--c-amber);
  font-size: clamp(2.6rem, 12vw, 5rem); line-height: 1;
  text-shadow: 0 0 12px rgba(255,197,49,0.45); letter-spacing: 0.05em;
  word-break: break-all;
}
.mem-bar { width: min(320px, 80%); height: 12px; background: #2a1f47; border: var(--bd) solid var(--c-line); border-radius: 999px; overflow: hidden; }
.mem-bar-fill { height: 100%; width: 100%; background: var(--c-amber); }
.mem-input {
  font-family: var(--font-seg); font-size: 2rem; text-align: center; width: min(320px, 90%);
  color: var(--c-amber); background: var(--c-screen);
  border: var(--bd) solid var(--c-line); border-radius: var(--radius); padding: 0.4rem 0.6rem;
}

/* Grids (Sequence / Visual / Chimp) */
.mem-grid { display: grid; gap: var(--sp-2); margin: 0 auto; width: 100%; max-width: 420px; }
.mem-cell {
  aspect-ratio: 1 / 1; border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel); box-shadow: inset 0 0 0 3px #05030d;
  cursor: pointer; padding: 0; touch-action: manipulation;
  font-family: var(--font-seg); font-size: clamp(1.1rem, 5vw, 1.8rem); color: var(--c-ink);
  display: flex; align-items: center; justify-content: center;
  transition: background-color .08s steps(2);
}
.mem-cell.lit { background: var(--c-p2); }
.mem-cell.good { background: var(--c-go); }
.mem-cell.bad { background: var(--c-p1); }
.mem-cell.hidden-num { color: transparent; background: var(--c-p1); }
.mem-cell.blank { background: var(--c-panel-2); cursor: default; box-shadow: none; border-color: transparent; }
.mem-cell.numbered { background: var(--c-panel-2); }

/* ---- Color Match (Stroop) ---------------------------------------------- */
.stroop-area {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-4); text-align: center;
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel-2); padding: var(--sp-4);
}
.stroop-prompt { font-weight: 800; color: var(--c-ink-dim); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.85rem; }
.stroop-word { font-weight: 900; font-size: clamp(2.6rem, 12vw, 5rem); line-height: 1; letter-spacing: 0.02em; }
.stroop-btns { display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: center; }
.stroop-btns .btn { min-width: 8rem; font-size: 1.1rem; padding: 0.7rem 1.2rem; }
.btn-go { background: var(--c-go); }
.stroop-start { margin-top: var(--sp-2); }
@keyframes flash-good-k { 0% { box-shadow: inset 0 0 0 4px var(--c-go); } 100% { box-shadow: inset 0 0 0 4px transparent; } }
@keyframes flash-bad-k  { 0% { box-shadow: inset 0 0 0 4px var(--c-p1); } 100% { box-shadow: inset 0 0 0 4px transparent; } }
.stroop-area.flash-good { animation: flash-good-k .18s steps(2) 1; }
.stroop-area.flash-bad  { animation: flash-bad-k .18s steps(2) 1; }

/* ---- Aim Trainer -------------------------------------------------------- */
.aim-arena {
  position: relative; z-index: 2; flex: 1; min-height: 260px;
  border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: manipulation;
}
.aim-target {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--c-p1); border: var(--bd) solid var(--c-line);
  box-shadow: var(--shadow-hard); cursor: pointer; padding: 0;
  font-weight: 900; color: var(--c-line); text-transform: uppercase;
}
.aim-target:not(.aim-start) { position: absolute; }
/* concentric bullseye ring */
.aim-target:not(.aim-start)::after {
  content: ""; position: absolute; inset: 14px; border-radius: 50%;
  border: 3px solid var(--c-line);
}
.aim-start { position: static; width: auto; height: auto; border-radius: 999px; padding: 0.7rem 1.4rem; font-size: 1.1rem; box-shadow: var(--shadow-hard-lg); }
.aim-target:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--c-line); }

/* ---- Whack-a-Mole ------------------------------------------------------- */
.mole-wrap { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; }
.mole-grid {
  flex: 1; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2); min-height: 260px;
}
.mole-hole {
  position: relative; border: var(--bd) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel-2); cursor: pointer; overflow: hidden;
  box-shadow: inset 0 0 0 3px #05030d; touch-action: manipulation; padding: 0;
}
.mole-hole::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: 62%; height: 62%; transform: translate(-50%, 0) scale(0.2);
  background: var(--c-go); border: var(--bd) solid var(--c-line); border-radius: 50% 50% 45% 45%;
  transition: transform .08s steps(2), top .08s steps(2); opacity: 0;
}
.mole-hole.up::after { top: 20%; transform: translate(-50%, 0) scale(1); opacity: 1; }
/* two eyes on the mole */
.mole-hole.up::before {
  content: ""; position: absolute; z-index: 2; left: 50%; top: 34%;
  width: 8px; height: 8px; border-radius: 50%;
  transform: translateX(-50%);
  background: var(--c-line);
  box-shadow: -9px 0 0 var(--c-line), 9px 0 0 var(--c-line);
}
.mole-start { display: flex; align-items: center; justify-content: center; }

/* ---- Click Counter ------------------------------------------------------ */
.counter-controls { display: flex; gap: 0.6rem; justify-content: center; margin-top: var(--sp-3); }
.counter-note { text-align: center; color: var(--c-ink-dim); font-size: 0.85rem; margin-top: var(--sp-2); }

/* ---- Typing Speed Test -------------------------------------------------- */
.type-stage { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.type-passage {
  flex: 0 0 auto; position: relative;
  background: var(--c-panel-2); border: var(--bd) solid var(--c-line);
  border-radius: var(--radius); padding: var(--sp-3);
  font-size: clamp(1.05rem, 3.2vw, 1.4rem); line-height: 1.9;
  font-weight: 600; letter-spacing: 0.01em;
  color: var(--c-ink-dim); cursor: text; overflow: hidden; height: 7.6em;
  -webkit-user-select: none; user-select: none;
}
/* words wrap as whole units; letters stay inline inside each word */
.type-lines { display: flex; flex-wrap: wrap; align-content: flex-start; will-change: transform; }
.type-passage .word { display: inline-block; white-space: nowrap; }
.type-passage .ch { color: var(--c-ink-dim); }
.type-passage .ch.sp { display: inline-block; width: 0.4em; }   /* the space, its own wrap point */
.type-passage .ch.good { color: var(--c-go); }
.type-passage .ch.bad { color: var(--c-p1); background: rgba(255,61,127,0.18); border-radius: 2px; }
.type-passage .ch.cur {
  background: var(--c-amber); color: var(--c-line); border-radius: 2px;
}
.type-passage.blurred::after {
  content: "Tap to start typing"; position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,7,22,0.82); color: var(--c-amber);
  font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em;
  font-size: 1.1rem;
}
/* the capture input is off-screen but focusable (raises the mobile keyboard) */
.type-input {
  position: absolute; opacity: 0; width: 2px; height: 2px;
  left: -10px; top: 0; border: 0; padding: 0; z-index: -1;
}

/* ---- Reaction Time Test ------------------------------------------------- */
.react-stage {
  position: relative; z-index: 2; flex: 1; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  color: var(--c-line); background: var(--c-p2);
  border: var(--bd-2) solid var(--c-line); border-radius: 8px;
  box-shadow: var(--shadow-hard-lg);
  font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em;
  min-height: 240px;
}
.react-stage.is-wait  { background: #E5484D; }              /* red — hold */
.react-stage.is-go    { background: var(--c-go); }          /* green — click! */
.react-stage.is-early { background: #FF8A00; }              /* too soon */
.react-big { font-size: clamp(1.6rem, 6vw, 2.6rem); text-align: center; padding: 0 1rem; }
.react-sub { font-size: 0.85rem; font-weight: 800; color: rgba(0,0,0,0.55); text-transform: none; letter-spacing: 0; text-align: center; padding: 0 1rem; }
.react-ms { font-family: var(--font-seg); font-size: clamp(2.4rem, 10vw, 4rem); color: var(--c-line); }

/* per-attempt result slots below the screen */
.react-slots { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; margin-top: var(--sp-3); }
.react-slot {
  min-width: 3.4rem; padding: 0.35rem 0.5rem; text-align: center;
  background: var(--c-panel-2); border: var(--bd) solid var(--c-line);
  border-radius: var(--radius); font-weight: 800; font-size: 0.8rem; color: var(--c-ink-dim);
}
.react-slot .n { display: block; font-family: var(--font-seg); font-size: 1rem; color: var(--c-ink-dim); }
.react-slot.filled { border-color: var(--c-amber); }
.react-slot.filled .n { color: var(--c-amber); }
