/* ═══════════════════════════════════════════════
   IQ LAB — Master Stylesheet
   Dark cognitive-training theme
═══════════════════════════════════════════════ */

:root {
  --bg:          #080c18;
  --bg2:         #0d1124;
  --card:        #111827;
  --card-hover:  #16213a;
  --border:      #1e2d4e;
  --border2:     #2a3f6a;

  --txt:         #e2e8f0;
  --txt2:        #94a3b8;
  --txt3:        #64748b;

  --purple:      #8b5cf6;
  --blue:        #3b82f6;
  --cyan:        #06b6d4;
  --green:       #10b981;
  --yellow:      #f59e0b;
  --red:         #ef4444;
  --pink:        #ec4899;
  --orange:      #f97316;

  --memory:      #8b5cf6;
  --reasoning:   #14b8a6;
  --logic:       #3b82f6;
  --speed:       #f59e0b;
  --attention:   #10b981;
  --reading:     #ec4899;

  --radius:      12px;
  --radius-lg:   18px;
  --shadow:      0 4px 24px rgba(0,0,0,.45);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.3);
}

:root[data-theme="light"] {
  --bg:          #f6f8fc;
  --bg2:         #e9eef8;
  --card:        #ffffff;
  --card-hover:  #eef4ff;
  --border:      #cad7ee;
  --border2:     #9fb3d9;
  --txt:         #142033;
  --txt2:        #42546f;
  --txt3:        #667892;
  --shadow:      0 8px 28px rgba(41,56,88,.14);
  --shadow-sm:   0 3px 12px rgba(41,56,88,.10);
}

:root[data-contrast="high"] {
  --border:      #5272ad;
  --border2:     #8bb7ff;
  --txt:         #ffffff;
  --txt2:        #d8e6ff;
  --txt3:        #a9c5ff;
}

:root[data-theme="light"][data-contrast="high"] {
  --txt:         #06111f;
  --txt2:        #172b49;
  --txt3:        #29466f;
  --border:      #5f7fb5;
  --border2:     #244d91;
}

:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  animation: none !important;
  scroll-behavior: auto !important;
  transition-duration: .01ms !important;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
}
body.in-game {
  height: 100dvh;
  overflow: hidden;
}
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: not-allowed; opacity: .48; }
input, select  { font: inherit; }
svg    { display: block; }
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ══════════════════════════
   HEADER
══════════════════════════ */
.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 60px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 1.3rem; font-weight: 700;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.header-stats {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
}
.stat-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 50px;
  font-size: .82rem; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
}
.stat-chip.flame { border-color: rgba(249,115,22,.4); color: var(--orange); }
.stat-chip.iq    { border-color: rgba(139,92,246,.4); color: var(--purple); }
.stat-chip.level { border-color: rgba(6,182,212,.4);  color: var(--cyan); }
.header-actions  { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  font-size: 1rem; background: var(--card);
  border: 1px solid var(--border);
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--card-hover); border-color: var(--border2); }
.install-btn {
  display: none;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(16,185,129,.45);
  background: linear-gradient(90deg, var(--green), var(--cyan));
  color: #041018;
  font-size: .82rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(16,185,129,.22);
}
.install-btn.show { display: inline-flex; }

/* ══════════════════════════
   SCREENS
══════════════════════════ */
.screen { display: none; min-height: calc(100vh - 60px); }
.screen.active { display: block; }
#screen-game.active {
  height: calc(100dvh - 60px);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════
   DASHBOARD — HERO
══════════════════════════ */
.hero {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 24px;
  padding: 36px 32px 28px;
  background: linear-gradient(135deg, #0d1124 0%, #111827 60%, #120d24 100%);
  border-bottom: 1px solid var(--border);
}
.hero-text h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  background: linear-gradient(90deg, #c4b5fd, var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-text p { color: var(--txt2); margin-top: 6px; font-size: .95rem; }

.daily-iq-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  min-width: 280px;
  box-shadow: var(--shadow);
}
.daily-iq-card h3 { font-size: .82rem; text-transform: uppercase; letter-spacing:.08em; color: var(--txt3); margin-bottom: 10px; }
.iq-line { display: flex; align-items: center; gap: 12px; }
.iq-value { font-size: 3rem; font-weight: 800; color: var(--purple); line-height: 1; }
.iq-meta  { font-size: .8rem; color: var(--txt2); margin-top: 6px; }
.iq-bars  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.iq-bar-row { font-size: .75rem; }
.iq-bar-row span { display: block; color: var(--txt3); margin-bottom: 3px; }
.iq-bar-track { height: 4px; background: var(--border); border-radius: 2px; }
.iq-bar-fill  { height: 4px; border-radius: 2px; transition: width .6s ease; }
.trend-pill {
  font-size: .72rem; font-weight: 800;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--txt2);
  white-space: nowrap;
}
.trend-pill.up { color: var(--green); border-color: rgba(16,185,129,.35); }
.trend-pill.down { color: var(--yellow); border-color: rgba(245,158,11,.35); }

.dashboard-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.quick-actions, .dashboard-controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.daily-goal {
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.daily-goal-top {
  display: flex; justify-content: space-between;
  font-size: .78rem; font-weight: 700;
  color: var(--txt2); margin-bottom: 7px;
}
.goal-track {
  height: 6px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.goal-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg,var(--green),var(--cyan));
  border-radius: inherit;
  transition: width .5s ease;
}
.game-search, .game-sort {
  height: 38px;
  color: var(--txt);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.game-search { min-width: 240px; padding: 0 12px; }
.game-sort { padding: 0 10px; }
.game-search::placeholder { color: var(--txt3); }

.recommended-section {
  padding: 20px 32px 8px;
  background: var(--bg);
}
.section-heading {
  display: flex; align-items: end; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.section-kicker {
  display: block;
  color: var(--txt3);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.section-heading h2 { font-size: 1rem; }
.recommended-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.recommended-item {
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: transform .15s, border-color .15s;
}
.recommended-item:hover { transform: translateY(-2px); border-color: var(--border2); }
.rec-icon { font-size: 1.8rem; }
.recommended-item b { display: block; font-size: .88rem; }
.recommended-item small { display: block; color: var(--txt3); margin-top: 2px; }
.small-btn { padding: 7px 12px; font-size: .78rem; border-radius: 8px; }

.level-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 32px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.level-tab {
  min-height: 70px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: border-color .15s, transform .15s, background .15s;
}
.level-tab:hover { border-color: var(--border2); transform: translateY(-1px); }
.level-tab.active {
  border-color: var(--purple);
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(6,182,212,.10));
}
.level-tab span {
  display: block;
  font-size: .98rem;
  font-weight: 900;
  color: var(--txt);
}
.level-tab small {
  display: block;
  margin-top: 4px;
  font-size: .76rem;
  color: var(--txt3);
}

/* ══════════════════════════
   CATEGORY BAR
══════════════════════════ */
.category-bar {
  position: sticky; top: 60px; z-index: 80;
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.cat-btn {
  padding: 7px 16px; border-radius: 50px;
  font-size: .83rem; font-weight: 600;
  color: var(--txt2);
  border: 1px solid var(--border);
  background: transparent;
  transition: all .15s;
}
.cat-btn:hover  { border-color: var(--border2); color: var(--txt); }
.cat-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ══════════════════════════
   GAMES GRID
══════════════════════════ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}
.game-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  color: var(--txt);
  text-align: left;
  animation: cardEnter .32s ease both;
  animation-delay: var(--delay, 0ms);
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--border2);
  box-shadow: var(--shadow);
}
.game-card-top {
  height: 90px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  position: relative;
}
.game-card-icon { font-size: 2.4rem; }
.game-card-body { padding: 14px 16px; }
.game-card-name  { font-size: .92rem; font-weight: 700; margin-bottom: 4px; }
.game-card-desc  { font-size: .78rem; color: var(--txt2); line-height: 1.4; margin-bottom: 10px; }
.game-card-foot  { display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; }
.card-preview {
  display: flex; justify-content: space-between; gap: 8px;
  color: var(--txt3);
  border-top: 1px solid var(--border);
  padding-top: 9px;
  margin-bottom: 10px;
  font-size: .72rem;
}
.cat-tag {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 4px;
}
.status-badge, .difficulty-badge {
  font-size: .68rem; font-weight: 800;
  border-radius: 999px;
  padding: 3px 7px;
  border: 1px solid var(--border);
}
.status-badge.new { color: var(--cyan); }
.status-badge.tried { color: var(--yellow); }
.status-badge.mastered { color: var(--green); }
.difficulty-badge {
  position: absolute; top: 8px; right: 10px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
}
.difficulty-badge.easy { color: var(--green); }
.difficulty-badge.medium { color: var(--yellow); }
.difficulty-badge.hard { color: var(--pink); }
.best-score { font-size: .75rem; color: var(--txt3); }
.best-score b { color: var(--txt2); }

.cat-tag.memory    { background: rgba(139,92,246,.15);  color: var(--memory); }
.cat-tag.reasoning { background: rgba(20,184,166,.15);  color: var(--reasoning); }
.cat-tag.logic     { background: rgba(59,130,246,.15);  color: var(--logic); }
.cat-tag.speed     { background: rgba(245,158,11,.15);  color: var(--speed); }
.cat-tag.attention { background: rgba(16,185,129,.15);  color: var(--attention); }
.cat-tag.reading   { background: rgba(236,72,153,.15);  color: var(--reading); }

.game-card-top.memory    { background: linear-gradient(135deg,rgba(139,92,246,.2),rgba(139,92,246,.05)); }
.game-card-top.reasoning { background: linear-gradient(135deg,rgba(20,184,166,.2),rgba(20,184,166,.05)); }
.game-card-top.logic     { background: linear-gradient(135deg,rgba(59,130,246,.2),rgba(59,130,246,.05)); }
.game-card-top.speed     { background: linear-gradient(135deg,rgba(245,158,11,.2),rgba(245,158,11,.05)); }
.game-card-top.attention { background: linear-gradient(135deg,rgba(16,185,129,.2),rgba(16,185,129,.05)); }
.game-card-top.reading   { background: linear-gradient(135deg,rgba(236,72,153,.2),rgba(236,72,153,.05)); }

.card-number {
  position: absolute; top: 8px; left: 10px;
  font-size: .7rem; font-weight: 700; color: var(--txt3);
}
.score-ring-mini {
  position: absolute; right: 10px; bottom: 8px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--card) 58%, transparent 59%),
    conic-gradient(var(--cyan) var(--score), rgba(255,255,255,.12) 0);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.score-ring-mini span { font-size: .7rem; font-weight: 900; color: var(--txt2); }
.play-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
  border-radius: var(--radius-lg);
}
.play-overlay span { font-size: 2rem; }
.game-card:hover .play-overlay { opacity: 1; }

.skeleton-card { pointer-events: none; padding: 0; min-height: 194px; }
.skeleton-block, .skeleton-lines span {
  display: block;
  background: linear-gradient(90deg, var(--border), var(--card-hover), var(--border));
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}
.skeleton-top { height: 90px; }
.skeleton-lines { padding: 16px; }
.skeleton-lines span { height: 10px; border-radius: 999px; margin-bottom: 10px; }
.skeleton-lines span:nth-child(1) { width: 75%; }
.skeleton-lines span:nth-child(2) { width: 100%; }
.skeleton-lines span:nth-child(3) { width: 45%; }
.empty-state {
  grid-column: 1 / -1;
  min-height: 260px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 10px;
  color: var(--txt2);
  border: 1px dashed var(--border2);
  border-radius: 8px;
}
.empty-state div { font-size: 2.4rem; color: var(--cyan); }
.empty-state h3 { color: var(--txt); }
.empty-state p { color: var(--txt3); }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  to { background-position: -220% 0; }
}

/* ══════════════════════════
   GAME SCREEN
══════════════════════════ */
.game-header {
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 58px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 90;
  flex: 0 0 58px;
}
.back-btn {
  padding: 7px 14px; border-radius: 8px;
  font-size: .85rem; font-weight: 600; color: var(--txt2);
  border: 1px solid var(--border); background: var(--card);
  transition: all .15s; white-space: nowrap;
}
.back-btn:hover { color: var(--txt); border-color: var(--border2); }
.game-title-row { display: flex; align-items: center; gap: 10px; flex: 1; }
.game-icon-lg   { font-size: 1.4rem; }
.game-title-text { font-size: 1rem; font-weight: 700; }
.game-hdr-meta  { display: flex; gap: 16px; align-items: center; margin-left: auto; }
.timer-display  { font-size: .9rem; font-weight: 700; color: var(--cyan); font-variant-numeric: tabular-nums; }
.score-display  { font-size: .9rem; font-weight: 700; color: var(--yellow); }

.game-content {
  --play-h: calc(100dvh - 118px);
  height: var(--play-h);
  min-height: 0;
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(8px, 2.2vh, 20px);
  overflow: hidden;
  contain: layout paint;
}
.game-content > * {
  max-width: 100%;
  max-height: 100%;
}

/* ══════════════════════════
   RESULTS
══════════════════════════ */
.results-wrapper {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.results-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  text-align: center;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow);
}
.res-emoji { font-size: 3.5rem; margin-bottom: 8px; }
.results-card h2 { font-size: 1.3rem; margin-bottom: 20px; color: var(--txt); }
.score-ring { position: relative; width: 120px; height: 120px; margin: 0 auto 20px; }
.score-ring span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 800; color: var(--purple);
}
.res-details {
  background: var(--bg2); border-radius: var(--radius);
  padding: 14px; margin-bottom: 16px;
  font-size: .85rem; line-height: 1.8;
  text-align: left;
}
.res-details .detail-row { display: flex; justify-content: space-between; }
.res-details .detail-row b { color: var(--cyan); }
.result-breakdown {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.breakdown-row {
  display: grid;
  grid-template-columns: 90px 1fr 34px;
  align-items: center;
  gap: 8px;
  color: var(--txt2);
}
.breakdown-row div {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.breakdown-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg,var(--purple),var(--cyan));
  border-radius: inherit;
}
.xp-badge {
  display: inline-block;
  background: linear-gradient(90deg,var(--purple),var(--blue));
  border-radius: 50px;
  padding: 6px 18px;
  font-size: .85rem; font-weight: 700;
  margin-bottom: 20px; color: #fff;
}
.res-actions { display: flex; gap: 12px; justify-content: center; }

/* ══════════════════════════
   BUTTONS
══════════════════════════ */
.btn-primary {
  padding: 10px 24px; border-radius: 50px;
  font-size: .9rem; font-weight: 700;
  background: linear-gradient(90deg,var(--purple),var(--blue));
  color: #fff; transition: opacity .15s, transform .1s;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-secondary {
  padding: 10px 24px; border-radius: 50px;
  font-size: .9rem; font-weight: 700;
  background: var(--bg2); color: var(--txt2);
  border: 1px solid var(--border); transition: all .15s;
}
.btn-secondary:hover { border-color: var(--border2); color: var(--txt); }
.btn-ghost {
  padding: 10px 24px; border-radius: 50px;
  font-size: .9rem; font-weight: 700;
  background: transparent; color: var(--txt2);
  border: 1px solid var(--border); transition: all .15s;
}
.btn-ghost:hover { border-color: var(--border2); color: var(--txt); }

/* ══════════════════════════
   ANALYTICS & PROFILE
══════════════════════════ */
.screen-inner { max-width: 800px; margin: 0 auto; padding: 24px; }
.screen-hdr {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px;
}
.screen-hdr h2 { font-size: 1.4rem; }

.analytics-section { margin-bottom: 28px; }
.analytics-section h3 {
  font-size: .8rem; text-transform: uppercase; letter-spacing:.08em;
  color: var(--txt3); margin-bottom: 14px;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; }
.stat-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  text-align: center;
}
.stat-box .val { font-size: 1.8rem; font-weight: 800; color: var(--purple); }
.stat-box .lbl { font-size: .75rem; color: var(--txt3); margin-top: 4px; }
.wide-stat { max-width: 320px; }
.small-val { font-size: 1.15rem !important; }
.empty-copy { color: var(--txt3); text-align: center; padding: 20px; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .85rem;
}
.history-item .hi-name { font-weight: 600; }
.history-item .hi-score { color: var(--purple); font-weight: 700; }
.history-item .hi-date  { color: var(--txt3); font-size: .78rem; }

.cat-progress { display: flex; flex-direction: column; gap: 10px; }
.cat-prog-row { display: flex; justify-content: space-between; }
.cat-prog-row span { font-size: .82rem; color: var(--txt2); }
.cat-prog-bar { height: 8px; background: var(--border); border-radius: 4px; margin-top: 4px; }
.cat-prog-fill { height: 8px; border-radius: 4px; transition: width .8s ease; }
.category-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.category-legend span {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--txt2);
  font-size: .8rem;
}
.category-legend i { width: 9px; height: 9px; border-radius: 50%; }

.profile-level {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  text-align: center; margin-bottom: 20px;
}
.level-name { font-size: 1.6rem; font-weight: 800; color: var(--purple); margin: 8px 0; }
.level-icon { font-size: 3rem; }
.xp-bar-wrap { margin: 12px 0; }
.xp-bar-track { height: 8px; background: var(--border); border-radius: 4px; }
.xp-bar-fill  { height: 8px; border-radius: 4px; background: linear-gradient(90deg,var(--purple),var(--blue)); transition: width .8s; }
.xp-label { font-size: .8rem; color: var(--txt3); margin-top: 4px; display:flex; justify-content:space-between; }
.profile-prefs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 14px 0 10px;
}
.profile-streak { font-size: .82rem; color: var(--txt3); }
.reset-row { text-align: center; margin-top: 20px; }

.achievements { display: grid; grid-template-columns: repeat(auto-fill,minmax(130px,1fr)); gap: 12px; }
.achievement {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
}
.achievement.unlocked { border-color: var(--purple); }
.achievement .ach-icon { font-size: 1.8rem; margin-bottom: 6px; }
.achievement .ach-name { font-size: .75rem; font-weight: 600; }
.achievement .ach-desc { font-size: .68rem; color: var(--txt3); margin-top: 2px; }
.achievement.locked { opacity: .4; filter: grayscale(1); }
.achievement.unlocked {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--purple) 25%, transparent), var(--shadow-sm);
}

/* ══════════════════════════
   GAME SHARED STYLES
══════════════════════════ */
.game-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 640px;
}
.game-instructions {
  text-align: center; max-width: 500px;
}
.game-instructions h2 { font-size: 1.5rem; margin-bottom: 10px; }
.game-instructions p  { color: var(--txt2); line-height: 1.6; margin-bottom: 20px; }
.game-instructions ul { text-align: left; color: var(--txt2); font-size: .9rem; line-height: 1.9; margin-bottom: 20px; padding-left: 20px; }

.level-indicator {
  font-size: .78rem; color: var(--txt3); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 8px;
}
.game-timer-bar {
  height: 4px; background: var(--border); border-radius: 2px;
  margin-bottom: 20px; overflow: hidden;
}
.game-timer-fill { height: 4px; border-radius: 2px; background: var(--cyan); transition: width .1s linear; }

/* ── fast reading ── */
.rsvp-wrap { text-align: center; width: 100%; }
.rsvp-speed-ctrl { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 20px; font-size: .85rem; color: var(--txt2); }
.rsvp-speed-ctrl input[type=range] { width: 160px; accent-color: var(--purple); }
.rsvp-screen {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 160px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.rsvp-word {
  font-size: 2.4rem; font-weight: 800;
  color: var(--txt);
  animation: wordFlash .1s ease;
}
@keyframes wordFlash { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.rsvp-focus-bar {
  position: absolute; top: 0; width: 2px; height: 100%;
  background: rgba(139,92,246,.3);
}
.rsvp-progress { height: 3px; background: var(--border); border-radius: 2px; margin-bottom: 20px; }
.rsvp-progress-fill { height: 3px; border-radius: 2px; background: var(--purple); transition: width .2s; }

.q-set h3 { font-size: 1rem; margin-bottom: 16px; color: var(--cyan); }
.question-block { margin-bottom: 16px; }
.question-block p { font-size: .9rem; margin-bottom: 8px; color: var(--txt2); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-btn {
  padding: 10px 12px; border-radius: 8px; font-size: .85rem;
  background: var(--bg2); border: 1px solid var(--border); color: var(--txt2);
  text-align: left; transition: all .12s;
}
.opt-btn:hover  { border-color: var(--purple); color: var(--txt); }
.opt-btn.selected { background: rgba(139,92,246,.2); border-color: var(--purple); color: var(--txt); }
.opt-btn.correct  { background: rgba(16,185,129,.2); border-color: var(--green); color: var(--green); }
.opt-btn.wrong    { background: rgba(239,68,68,.15);  border-color: var(--red);   color: var(--red); }

/* ── number memory ── */
.num-display {
  font-size: 4rem; font-weight: 800; letter-spacing: .15em;
  color: var(--purple); text-align: center;
  background: var(--bg2); border-radius: var(--radius-lg);
  padding: 36px 40px; margin: 20px 0;
  font-variant-numeric: tabular-nums;
  min-width: 300px;
}
.num-input-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.digit-inp {
  width: 48px; height: 56px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--txt);
  font-size: 1.4rem; font-weight: 700; text-align: center;
  transition: border-color .12s;
}
.digit-inp:focus { outline: none; border-color: var(--purple); }

/* ── pattern memory ── */
.pattern-grid {
  display: inline-grid; gap: 6px;
  margin: 20px auto; border-radius: var(--radius);
}
.pat-cell {
  width: 52px; height: 52px; border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg2);
  transition: all .15s; cursor: pointer;
}
.pat-cell.lit      { background: var(--purple); border-color: var(--purple); box-shadow: 0 0 14px rgba(139,92,246,.5); }
.pat-cell.selected { background: rgba(139,92,246,.35); border-color: var(--purple); }
.pat-cell.correct  { background: var(--green); border-color: var(--green); }
.pat-cell.wrong    { background: var(--red);   border-color: var(--red); }

/* ── stroop ── */
.stroop-word { font-size: 3.5rem; font-weight: 900; text-align: center; margin: 24px 0; letter-spacing: .02em; }
.color-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.color-btn {
  width: 110px; height: 52px; border-radius: 10px;
  font-size: .85rem; font-weight: 700; color: #fff;
  border: 2px solid transparent; transition: transform .1s, opacity .1s;
}
.color-btn:hover { transform: scale(1.05); }
.color-btn:active { transform: scale(.96); }
.stroop-feedback { font-size: 1.4rem; text-align: center; min-height: 36px; margin-top: 4px; }
.stroop-score-strip { display: flex; gap: 24px; justify-content: center; font-size: .85rem; margin-bottom: 12px; }
.stroop-score-strip span b { color: var(--cyan); }

/* ── dual n-back ── */
.nback-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 8px; width: 240px; margin: 20px auto;
}
.nback-cell {
  height: 72px; border-radius: var(--radius);
  background: var(--bg2); border: 2px solid var(--border);
  transition: all .15s;
}
.nback-cell.active { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 20px rgba(59,130,246,.5); }
.nback-btns { display: flex; gap: 16px; justify-content: center; margin-top: 20px; }
.nback-btn {
  padding: 12px 28px; border-radius: 50px; font-size: .9rem; font-weight: 700;
  border: 2px solid var(--border); color: var(--txt2); background: var(--bg2);
  transition: all .12s;
}
.nback-btn:hover { border-color: var(--blue); color: var(--blue); }
.nback-btn.pressed { background: var(--blue); border-color: var(--blue); color: #fff; }
.nback-info { text-align: center; font-size: .82rem; color: var(--txt3); margin-top: 10px; }

/* ── mental math ── */
.math-problem { font-size: 3rem; font-weight: 800; text-align: center; color: var(--txt); margin: 24px 0; }
.math-input-row { display: flex; gap: 12px; justify-content: center; align-items: center; }
.math-input {
  width: 140px; height: 52px; border-radius: 10px; text-align: center;
  font-size: 1.4rem; font-weight: 700;
  background: var(--bg2); border: 2px solid var(--border); color: var(--txt);
  transition: border-color .12s;
}
.math-input:focus { outline: none; border-color: var(--purple); }
.math-streak { text-align: center; font-size: .82rem; color: var(--txt3); margin-top: 8px; }

/* ── matrix/missing shape ── */
.matrix-wrap { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; }
.matrix-grid {
  display: inline-grid; grid-template-columns: repeat(3,80px);
  gap: 6px;
}
.matrix-cell {
  width: 80px; height: 80px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.matrix-cell.empty { border-style: dashed; border-color: var(--txt3); }
.answer-choices { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.answer-choice {
  width: 80px; height: 80px;
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .12s;
}
.answer-choice:hover  { border-color: var(--purple); }
.answer-choice.selected { border-color: var(--purple); background: rgba(139,92,246,.15); }
.answer-choice.correct  { border-color: var(--green);  background: rgba(16,185,129,.15); }
.answer-choice.wrong    { border-color: var(--red);    background: rgba(239,68,68,.1); }

/* ── memory cards ── */
.cards-grid {
  display: inline-grid; gap: 8px; margin: 0 auto;
}
.mem-card {
  width: 72px; height: 90px; border-radius: var(--radius);
  cursor: pointer; position: relative; perspective: 600px;
  transform-style: preserve-3d; transition: transform .35s;
}
.mem-card.flipped, .mem-card.matched { transform: rotateY(180deg); }
.mem-card-face {
  position: absolute; inset: 0; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden;
}
.mem-card-back {
  background: linear-gradient(135deg,var(--purple),var(--blue));
  font-size: 1.4rem;
}
.mem-card-front {
  background: var(--card); border: 2px solid var(--border);
  font-size: 1.8rem; transform: rotateY(180deg);
}
.mem-card.matched .mem-card-front { border-color: var(--green); background: rgba(16,185,129,.1); }
.card-stats { display: flex; gap: 24px; justify-content: center; font-size: .85rem; margin-bottom: 16px; }
.card-stats span b { color: var(--cyan); }

/* ── flash calculation ── */
.flash-number {
  font-size: 5rem; font-weight: 900; color: var(--cyan);
  text-align: center; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  animation: flashIn .12s ease;
}
@keyframes flashIn { from { opacity: 0; transform: scale(1.3); } to { opacity: 1; transform: scale(1); } }
.flash-input {
  width: 180px; height: 56px; border-radius: 10px; text-align: center;
  font-size: 1.6rem; font-weight: 700;
  background: var(--bg2); border: 2px solid var(--border); color: var(--txt);
}
.flash-input:focus { outline: none; border-color: var(--cyan); }

/* ── visual search ── */
.search-grid {
  display: grid; gap: 2px; margin: 12px auto;
  font-size: .85rem; font-weight: 700; user-select: none;
  font-family: monospace;
}
.search-cell {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; cursor: pointer;
  color: var(--txt2); transition: all .1s;
}
.search-cell:hover  { background: rgba(255,255,255,.08); color: var(--txt); }
.search-cell.target { color: var(--yellow); }
.search-cell.found  { background: rgba(16,185,129,.25); color: var(--green); border-radius: 4px; }

/* ── simon ── */
.simon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 280px; margin: 0 auto; }
.simon-btn {
  height: 120px; border-radius: var(--radius);
  opacity: .55; transition: opacity .12s, transform .08s;
  cursor: pointer;
}
.simon-btn:active, .simon-btn.lit { opacity: 1; transform: scale(.96); }
.simon-btn[data-color=red]    { background: var(--red); }
.simon-btn[data-color=green]  { background: var(--green); }
.simon-btn[data-color=blue]   { background: var(--blue); }
.simon-btn[data-color=yellow] { background: var(--yellow); }
.simon-level { text-align: center; font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; color: var(--txt2); }

/* ── reaction time ── */
.reaction-screen {
  width: 100%; max-width: 500px; height: 280px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; cursor: pointer;
  transition: background .1s;
  border: 2px solid var(--border); user-select: none;
}
.reaction-screen.wait   { background: var(--bg2); color: var(--txt3); }
.reaction-screen.ready  { background: #3b1f1f; color: var(--red); }
.reaction-screen.go     { background: #1b3a2b; color: var(--green); }
.reaction-screen.done   { background: var(--bg2); color: var(--cyan); }
.reaction-results { text-align: center; margin-top: 16px; font-size: 1.5rem; font-weight: 800; color: var(--yellow); }
.reaction-list { text-align: center; font-size: .82rem; color: var(--txt3); }

/* ── odd one out ── */
.odd-grid { display: grid; gap: 8px; margin: 0 auto; }
.odd-cell {
  width: 60px; height: 60px; border-radius: var(--radius); font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border: 2px solid var(--border);
  cursor: pointer; transition: all .1s;
}
.odd-cell:hover  { border-color: var(--border2); transform: scale(1.05); }
.odd-cell.correct { border-color: var(--green); background: rgba(16,185,129,.15); }
.odd-cell.wrong   { border-color: var(--red);   background: rgba(239,68,68,.1); animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ── sequence prediction ── */
.seq-display { font-size: 2rem; font-weight: 800; text-align: center; margin: 20px 0; letter-spacing: .04em; }
.seq-choices { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.seq-choice {
  padding: 14px 24px; border-radius: var(--radius);
  background: var(--bg2); border: 2px solid var(--border);
  font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all .12s;
}
.seq-choice:hover   { border-color: var(--blue); color: var(--blue); }
.seq-choice.correct { border-color: var(--green); background: rgba(16,185,129,.15); color: var(--green); }
.seq-choice.wrong   { border-color: var(--red);   background: rgba(239,68,68,.1);   color: var(--red); }

/* ── story recall ── */
.story-text {
  background: var(--bg2); border-radius: var(--radius);
  padding: 20px; line-height: 1.8; font-size: .92rem; color: var(--txt);
  margin-bottom: 16px; max-width: 560px;
}
.story-countdown { text-align: center; font-size: 2rem; font-weight: 800; color: var(--yellow); margin: 12px 0; }

/* ── symbol digit coding ── */
.symbol-key {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  background: var(--bg2); border-radius: var(--radius);
  padding: 14px; margin-bottom: 16px;
}
.sym-pair {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 48px;
}
.sym-pair .sym { font-size: 1.4rem; }
.sym-pair .dig { font-size: .82rem; font-weight: 700; color: var(--cyan); }
.sym-pair .divider { width: 36px; height: 1px; background: var(--border); }

.coding-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: flex-end; margin-bottom: 12px; }
.coding-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.coding-item .sym { font-size: 1.3rem; }
.coding-item input {
  width: 40px; height: 40px; text-align: center;
  font-size: 1.1rem; font-weight: 700;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; color: var(--txt);
}
.coding-item input:focus { outline: none; border-color: var(--purple); }
.coding-item input.ok  { border-color: var(--green); color: var(--green); }
.coding-item input.err { border-color: var(--red);   color: var(--red); }

/* ── direction memory ── */
.dir-display { font-size: 3rem; text-align: center; min-height: 80px; margin: 16px 0; }
.dir-buttons { display: grid; grid-template-columns: repeat(3,72px); grid-template-rows: repeat(3,72px); gap: 6px; margin: 0 auto; width: fit-content; }
.dir-btn {
  width: 72px; height: 72px; border-radius: var(--radius);
  font-size: 1.6rem;
  background: var(--bg2); border: 2px solid var(--border);
  transition: all .1s;
}
.dir-btn:hover { border-color: var(--purple); }
.dir-btn:active { transform: scale(.92); }
.dir-sequence { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 40px; margin-top: 12px; }
.dir-sequence span { font-size: 1.4rem; }

/* ── rapid categorization ── */
.rapid-word { font-size: 2.6rem; font-weight: 900; text-align: center; margin: 20px 0; color: var(--txt); }
.rapid-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 400px; margin: 0 auto; }
.rapid-cat-btn {
  padding: 18px; border-radius: var(--radius); font-size: .9rem; font-weight: 700;
  border: 2px solid var(--border); background: var(--bg2); color: var(--txt2);
  transition: all .12s;
}
.rapid-cat-btn:hover { transform: scale(1.03); }
.rapid-cat-btn.correct { background: rgba(16,185,129,.2); border-color: var(--green); color: var(--green); }
.rapid-cat-btn.wrong   { background: rgba(239,68,68,.1);  border-color: var(--red);   color: var(--red); }

/* ── word association ── */
.assoc-word { font-size: 2.4rem; font-weight: 800; text-align: center; margin: 20px 0; color: var(--cyan); }
.assoc-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 380px; margin: 0 auto; }
.assoc-btn {
  padding: 16px 12px; border-radius: var(--radius); font-size: .9rem; font-weight: 700;
  border: 2px solid var(--border); background: var(--bg2); color: var(--txt2);
  transition: all .12s; text-align: center;
}
.assoc-btn:hover   { border-color: var(--cyan); color: var(--cyan); }
.assoc-btn.correct { background: rgba(16,185,129,.2); border-color: var(--green); color: var(--green); }
.assoc-btn.wrong   { background: rgba(239,68,68,.1);  border-color: var(--red);   color: var(--red); }

/* ── hidden object ── */
.hidden-grid { display: grid; gap: 3px; margin: 0 auto; font-size: .95rem; }
.hid-cell {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; cursor: pointer; font-size: 1.1rem;
  transition: background .1s;
}
.hid-cell:hover { background: rgba(255,255,255,.06); }
.hid-cell.found { background: rgba(16,185,129,.25); border-radius: 4px; animation: pulseGreen .4s; }
@keyframes pulseGreen { 0%{transform:scale(1)} 50%{transform:scale(1.3)} 100%{transform:scale(1)} }
.hidden-target { text-align: center; font-size: 1.1rem; margin-bottom: 12px; }
.hidden-target span { font-size: 1.8rem; }

/* ── sudoku ── */
.sudoku-board { display: inline-grid; margin: 0 auto; border: 2px solid var(--border2); }
.sudoku-cell {
  width: 44px; height: 44px; text-align: center;
  font-size: 1.1rem; font-weight: 700;
  background: var(--bg2); border: 1px solid var(--border); color: var(--txt);
}
.sudoku-cell:focus { outline: none; background: rgba(139,92,246,.1); border-color: var(--purple); }
.sudoku-cell.given { color: var(--cyan); background: rgba(6,182,212,.06); }
.sudoku-cell.error { background: rgba(239,68,68,.1); border-color: var(--red); color: var(--red); }
.sudoku-cell.correct { background: rgba(16,185,129,.1); color: var(--green); }

/* ── tower of hanoi ── */
.hanoi-wrap { user-select: none; }
.hanoi-pegs { display: flex; gap: 20px; align-items: flex-end; justify-content: center; margin: 0 auto; }
.hanoi-peg { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.peg-label { font-size: .78rem; color: var(--txt3); margin-bottom: 6px; }
.peg-discs { display: flex; flex-direction: column-reverse; align-items: center; min-height: 160px; justify-content: flex-start; gap: 3px; padding-bottom: 0; }
.peg-rod {
  width: 6px; height: 170px; background: var(--border2);
  border-radius: 3px; position: absolute; bottom: 0;
}
.peg-base { width: 140px; height: 8px; background: var(--border2); border-radius: 4px; }
.hanoi-disc {
  height: 22px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
  transition: all .2s; cursor: grab;
}
.hanoi-disc.selected { box-shadow: 0 0 0 3px #fff, 0 0 16px rgba(139,92,246,.6); transform: translateY(-8px); }
.hanoi-peg-area {
  position: relative; width: 140px; height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  border-radius: var(--radius);
  transition: background .15s; padding-bottom: 8px;
}
.hanoi-peg-area:hover  { background: rgba(139,92,246,.08); }
.hanoi-peg-area.active { background: rgba(139,92,246,.18); }
.hanoi-stats { display: flex; gap: 20px; justify-content: center; font-size: .85rem; margin-bottom: 16px; }
.hanoi-stats span b { color: var(--yellow); }

/* ── trail making ── */
.trail-canvas { border-radius: var(--radius-lg); touch-action: none; cursor: pointer; display: block; }
.trail-info { text-align: center; font-size: .85rem; color: var(--txt2); margin-top: 10px; }

/* ── face memory ── */
.face-grid { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.face-card {
  width: 100px; padding: 12px; border-radius: var(--radius);
  background: var(--bg2); border: 2px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: all .12s;
  font-size: .75rem; color: var(--txt3); text-align: center;
}
.face-card:hover  { border-color: var(--purple); }
.face-card.selected { border-color: var(--purple); background: rgba(139,92,246,.1); }
.face-card.correct  { border-color: var(--green);  background: rgba(16,185,129,.1); }
.face-card.wrong    { border-color: var(--red);     background: rgba(239,68,68,.08); }

/* ── focus timer ── */
.focus-canvas { border-radius: var(--radius-lg); cursor: crosshair; display: block; }
.focus-stats { display: flex; gap: 20px; justify-content: center; font-size: .9rem; margin-top: 12px; }
.focus-stats span b { color: var(--cyan); }

/* ── peripheral vision ── */
.periph-canvas { border-radius: var(--radius-lg); cursor: crosshair; display: block; }
.periph-score { text-align: center; font-size: .85rem; color: var(--txt3); margin-top: 10px; }

/* ── rotation puzzle ── */
.rotation-wrap { display: flex; gap: 32px; align-items: center; justify-content: center; flex-wrap: wrap; }
.rotation-original { text-align: center; }
.rotation-original p { font-size: .78rem; color: var(--txt3); margin-bottom: 8px; }
.rotation-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rot-choice {
  width: 100px; height: 100px; border-radius: var(--radius);
  background: var(--bg2); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .12s;
}
.rot-choice:hover   { border-color: var(--purple); }
.rot-choice.correct { border-color: var(--green); background: rgba(16,185,129,.1); }
.rot-choice.wrong   { border-color: var(--red);   background: rgba(239,68,68,.08); }

/* ── speed comparison ── */
.comp-numbers { display: flex; gap: 32px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 20px 0; }
.comp-num {
  min-width: 160px; height: 100px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 900;
  background: var(--bg2); border: 2px solid var(--border);
  cursor: pointer; transition: all .12s; font-variant-numeric: tabular-nums;
}
.comp-num:hover  { border-color: var(--yellow); transform: scale(1.03); }
.comp-num.correct { border-color: var(--green); background: rgba(16,185,129,.1); }
.comp-num.wrong   { border-color: var(--red);   background: rgba(239,68,68,.08); }
.comp-vs { font-size: 1.2rem; color: var(--txt3); font-weight: 700; }

/* ── multi-task ── */
.multi-task-wrap { display: flex; gap: 16px; width: 100%; max-width: 680px; }
.mt-panel { flex: 1; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.mt-panel h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--txt3); margin-bottom: 12px; }
.mt-word { font-size: 1.4rem; font-weight: 800; min-height: 40px; color: var(--txt); }
.mt-shape { font-size: 2rem; min-height: 50px; text-align: center; }
.mt-shape-count { font-size: .85rem; color: var(--txt2); margin-top: 8px; }

/* ══════════════════════════
   PROGRESS / MISC
══════════════════════════ */
.progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; margin: 12px 0;
}
.progress-fill {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg,var(--purple),var(--blue));
  transition: width .4s ease;
}
.round-counter { text-align: center; font-size: .82rem; color: var(--txt3); }
.phase-label { text-align: center; font-size: .9rem; color: var(--yellow); font-weight: 700; margin: 8px 0; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 24px;
  font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow); z-index: 999;
  transition: transform .3s ease, opacity .3s;
  opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ══════════════════════════
   RESPONSIVE
══════════════════════════ */
@media (max-width: 640px) {
  .app-header { padding: 0 12px; gap: 8px; }
  .logo { font-size: 1.05rem; }
  .header-stats { display: none; }
  .header-actions { display: none; }
  .install-btn.show {
    position: fixed;
    top: 12px;
    left: 104px;
    right: auto;
    z-index: 250;
    min-height: 34px;
    padding: 0 13px;
  }
  .icon-btn { width: 32px; height: 32px; font-size: .88rem; }
  .stat-chip.iq, .stat-chip.level { display: none; }
  .hero { padding: 20px 16px; }
  .daily-iq-card { min-width: 100%; }
  .iq-bars { grid-template-columns: 1fr; }
  .dashboard-tools, .recommended-section { padding-left: 16px; padding-right: 16px; }
  .level-selector {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  .level-tab {
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
  }
  .level-tab small { margin-top: 0; text-align: left; }
  .dashboard-tools { align-items: stretch; }
  .quick-actions, .dashboard-controls { width: 100%; }
  .quick-actions > *, .dashboard-controls > * { flex: 1 1 100%; }
  .game-search { min-width: 0; width: 100%; }
  .recommended-strip { grid-template-columns: 1fr; }
  .section-heading { align-items: start; }
  .category-bar {
    padding: 12px 16px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .category-bar::-webkit-scrollbar { display: none; }
  .cat-btn { flex: 0 0 auto; }
  .games-grid { padding: 16px; grid-template-columns: 1fr; }
  .game-card-top { height: 78px; }
  .game-card-desc { min-height: 0; }
  .score-ring-mini { width: 36px; height: 36px; }
  .results-card { padding: 28px 22px; }
  .breakdown-row { grid-template-columns: 78px 1fr 30px; }
  .game-header { padding: 0 12px; gap: 8px; }
  .game-title-row { min-width: 0; }
  .game-title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .88rem;
  }
  .game-hdr-meta { gap: 8px; }
  .score-display { display: none; }
  .timer-display { font-size: .78rem; }
  .game-content {
    padding: 14px;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    contain: none;
  }
  .module-level-grid {
    grid-template-columns: 1fr;
  }
  .module-level-btn {
    min-height: 54px;
  }
  .module-seek,
  .v2i-sub,
  .v2-start-btn {
    max-width: calc(100vw - 32px);
  }
  .game-content > * {
    max-height: none;
  }
  body.in-game .v2-intro,
  body.in-game .module-controls,
  body.in-game .v2-comp-wrap,
  body.in-game .v2-nm-wrap,
  body.in-game .v2-pm-wrap,
  body.in-game .v2-stroop-wrap,
  body.in-game .v2-nback-wrap,
  body.in-game .v2-mm-wrap,
  body.in-game .v2-ms-wrap,
  body.in-game .v2-rot-wrap,
  body.in-game .v2-oot-wrap,
  body.in-game .v2-seq-wrap,
  body.in-game .v2-mc-wrap,
  body.in-game .v2-fc-wrap,
  body.in-game .v2-pv-wrap,
  body.in-game .v2-vs-wrap,
  body.in-game .v2-simon-wrap,
  body.in-game .v2-rt-wrap,
  body.in-game .v2-mt-wrap,
  body.in-game .v2-wa-wrap,
  body.in-game .v2-sr-wrap,
  body.in-game .v2-sr-q-wrap,
  body.in-game .v2-sdc-wrap,
  body.in-game .v2-ho-wrap,
  body.in-game .v2-dm-wrap,
  body.in-game .v2-rc-wrap,
  body.in-game .v2-su-wrap,
  body.in-game .matrix-wrap,
  body.in-game .q-set,
  body.in-game .game-panel {
    max-height: none;
    overflow: visible;
  }
  .matrix-grid { grid-template-columns: repeat(3,64px); }
  .matrix-cell { width: 64px; height: 64px; }
  .answer-choice { width: 64px; height: 64px; }
  .comp-num { min-width: 120px; font-size: 1.6rem; }
  .hanoi-pegs { gap: 8px; }
  .hanoi-peg-area { width: 100px; }
  .multi-task-wrap { flex-direction: column; }
}
@media (max-width: 380px) {
  .header-stats { display: none; }
  .games-grid { grid-template-columns: 1fr; gap: 12px; }
  .header-actions .icon-btn:nth-child(2),
  .header-actions .icon-btn:nth-child(3) { display: none; }
  .game-card-body { padding: 12px; }
  .game-card-name { font-size: .82rem; }
  .game-card-desc, .card-preview, .best-score { font-size: .7rem; }
}

/* ══════════════════════════════════════════════════
   V2 GAME STYLES — Improved Games 1-5
   Mobile-first · Touch-optimised
══════════════════════════════════════════════════ */

/* ── Core animation ── */
@keyframes v2FadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes v2Pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes v2Shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-5px); }
  75%     { transform: translateX(5px); }
}
@keyframes litPop {
  0%   { transform: scale(.7); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── V2 Intro screen ── */
.v2-intro {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; width: 100%; max-width: 480px;
  box-sizing: border-box;
  padding: 8px 4px;
}
.v2i-icon {
  font-size: 4rem; margin-bottom: 10px;
  filter: drop-shadow(0 0 24px rgba(139,92,246,.5));
  animation: v2Pop 1.2s ease infinite alternate;
}
.v2i-title { font-size: clamp(1.5rem,5vw,2rem); font-weight: 800; margin-bottom: 6px; }
.v2i-sub {
  font-size: clamp(.88rem,2.5vw,.95rem); color: var(--txt2); line-height: 1.55;
  margin-bottom: 18px; max-width: 380px;
}
.v2i-rules {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 18px; width: 100%; margin-bottom: 18px;
  display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.v2i-rule {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: clamp(.82rem,2.2vw,.88rem); color: var(--txt2); line-height: 1.5;
}
.v2i-rule > span:first-child { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.v2i-pick-label { font-size: .78rem; color: var(--txt3); text-transform: uppercase; letter-spacing:.06em; margin-bottom: 8px; }
.v2-best-chip {
  display: inline-block; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3);
  border-radius: 50px; padding: 5px 16px; font-size: .8rem; font-weight: 700;
  color: var(--yellow); margin-bottom: 16px;
}
.v2-start-btn {
  padding: 15px 0; border-radius: 50px; font-size: 1.05rem; font-weight: 800;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  color: #fff; width: 100%; max-width: 300px; letter-spacing: .02em;
  transition: transform .1s, opacity .1s; touch-action: manipulation;
  box-shadow: 0 6px 24px rgba(139,92,246,.35);
}
.v2-start-btn:hover  { opacity: .92; transform: translateY(-2px); }
.v2-start-btn:active { transform: scale(.95); opacity: .85; }

/* -- module setup controls -- */
.module-controls { gap: 0; }
.game-scoreboard {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 14px;
  padding: 12px;
  background: color-mix(in srgb, var(--bg2) 82%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}
.scoreboard-main {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.scoreboard-main div,
.scoreboard-level {
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 8px;
}
.scoreboard-main span,
.scoreboard-level span,
.scoreboard-recent > span {
  display: block;
  font-size: .66rem;
  color: var(--txt3);
  font-weight: 800;
  text-transform: uppercase;
}
.scoreboard-main strong {
  display: block;
  margin-top: 3px;
  font-size: 1.2rem;
  color: var(--txt);
}
.scoreboard-levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.scoreboard-level {
  text-align: center;
  padding: 6px 4px;
}
.scoreboard-level strong {
  display: block;
  margin-top: 2px;
  font-size: .95rem;
  color: var(--txt2);
}
.scoreboard-level.active {
  border-color: var(--purple);
  background: rgba(139,92,246,.14);
}
.scoreboard-level.active strong { color: var(--purple); }
.scoreboard-recent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.scoreboard-recent div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.scoreboard-recent span:not(:first-child),
.scoreboard-recent div span {
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: var(--txt2);
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
}
.scoreboard-recent em {
  color: var(--txt3);
  font-size: .75rem;
  font-style: normal;
}
.module-level-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  width: 100%; margin-bottom: 14px;
}
.module-level-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 72px; padding: 12px 8px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--bg2); color: var(--txt2);
  cursor: pointer; touch-action: manipulation; transition: all .12s;
}
.module-level-btn span {
  font-size: .68rem; font-weight: 800; color: var(--txt3); text-transform: uppercase;
}
.module-level-btn strong { font-size: .95rem; color: var(--txt2); }
.module-level-btn small { font-size: .68rem; color: var(--txt3); line-height: 1.15; }
.module-level-btn.active { border-color: var(--purple); background: rgba(139,92,246,.12); }
.module-level-btn.active span,
.module-level-btn.active strong,
.module-level-btn.active small { color: var(--purple); }
.module-seek {
  width: 100%; margin: 0 0 12px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg2);
}
.module-readout,
.module-range {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.module-readout { margin-bottom: 8px; color: var(--txt2); font-size: .78rem; }
.module-readout strong { color: var(--purple); font-size: .98rem; }
.module-seek input[type=range] { width: 100%; accent-color: var(--purple); cursor: pointer; }
.module-range { margin-top: 4px; color: var(--txt3); font-size: .7rem; }

/* ── Speed selector (Fast Reading) ── */
.v2-speed-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  width: 100%; margin-bottom: 16px;
}
.v2-speed-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--bg2);
  cursor: pointer; transition: all .12s; touch-action: manipulation;
}
.v2-speed-btn:active { transform: scale(.95); }
.v2-speed-btn.active { border-color: var(--purple); background: rgba(139,92,246,.12); }
.v2sb-val { font-size: 1.5rem; font-weight: 900; color: var(--txt3); line-height: 1; }
.v2sb-lvl { font-size: .68rem; font-weight: 800; color: var(--txt3); text-transform: uppercase; }
.v2sb-lbl { font-size: .72rem; color: var(--txt3); }
.v2-speed-btn.active .v2sb-val { color: var(--purple); }
.v2-speed-btn.active .v2sb-lvl { color: var(--purple); }
.v2-speed-btn.active .v2sb-lbl { color: var(--purple); }
.v2-speed-seek {
  width: 100%; margin: 0 0 16px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg2);
}
.v2-speed-readout,
.v2-speed-range {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.v2-speed-readout { margin-bottom: 8px; color: var(--txt2); font-size: .78rem; }
.v2-speed-readout strong { color: var(--purple); font-size: .98rem; }
.v2-speed-seek input[type=range] {
  width: 100%; accent-color: var(--purple); cursor: pointer;
}
.v2-speed-range {
  margin-top: 4px; color: var(--txt3); font-size: .7rem;
}

/* ── RSVP stage (Fast Reading) ── */
.v2-rsvp-stage {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 520px;
}
.v2-rsvp-topbar {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; margin-bottom: 10px; font-size: .8rem; flex-wrap: wrap; gap: 6px;
}
.v2-topic-tag {
  background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.25);
  border-radius: 50px; padding: 4px 12px; font-size: .78rem; font-weight: 600; color: var(--purple);
}
.v2-wc { color: var(--txt3); font-size: .78rem; }
.v2-rsvp-arena {
  width: 100%; height: clamp(140px,30vw,200px);
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; margin-bottom: 10px;
}
.v2-rsvp-mark {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 2px; height: 100%;
  background: linear-gradient(to bottom, transparent 10%, rgba(139,92,246,.35) 50%, transparent 90%);
  pointer-events: none;
}
.v2-rsvp-word {
  font-size: clamp(1.8rem,6vw,3rem); font-weight: 900; color: var(--txt);
  z-index: 1; letter-spacing: .01em; text-align: center; padding: 0 16px;
  animation: rsvpWordIn .1s ease;
}
@keyframes rsvpWordIn { from{opacity:0;transform:scale(.82)} to{opacity:1;transform:scale(1)} }
.v2-rsvp-word.v2-countdown { font-size: 3.5rem; color: var(--purple); }
.v2-prog-track { width: 100%; height: 5px; background: var(--border); border-radius: 3px; margin-bottom: 8px; }
.v2-prog-fill  { height: 5px; border-radius: 3px; background: linear-gradient(90deg,var(--purple),var(--cyan)); transition: width .15s; }
.v2-rsvp-hint  { font-size: .78rem; color: var(--txt3); }

/* ── Comprehension questions (Fast Reading) ── */
.v2-comp-wrap { width: 100%; max-width: 500px; }
.v2-comp-hdr  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.v2-comp-badge {
  background: rgba(139,92,246,.15); border: 1px solid rgba(139,92,246,.3);
  border-radius: 50px; padding: 5px 14px; font-size: .82rem; font-weight: 700; color: var(--purple);
}
.v2-comp-topic { font-size: .78rem; color: var(--txt3); }
.v2-comp-card  {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px;
}
.v2-comp-q { font-size: clamp(.9rem,2.5vw,1rem); font-weight: 700; margin-bottom: 14px; line-height: 1.45; color: var(--txt); }
.v2-comp-opts  { display: flex; flex-direction: column; gap: 9px; }
.v2-comp-opt {
  width: 100%; padding: 14px 16px; border-radius: 10px; text-align: left;
  font-size: clamp(.85rem,2.2vw,.92rem); font-weight: 500;
  background: var(--card); border: 1.5px solid var(--border); color: var(--txt2);
  transition: all .12s; touch-action: manipulation; cursor: pointer;
}
.v2-comp-opt:hover   { border-color: var(--purple); color: var(--txt); transform: translateX(3px); }
.v2-comp-opt:active  { transform: scale(.97); }
.v2-comp-opt.correct { background: rgba(16,185,129,.1);  border-color: var(--green);  color: var(--green); }
.v2-comp-opt.wrong   { background: rgba(239,68,68,.08);  border-color: var(--red);    color: var(--red); animation: v2Shake .3s; }

/* ── Countdown overlay ── */
.v2-cd-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.v2-cd-num  {
  font-size: 6rem; font-weight: 900; color: var(--purple);
  animation: v2Pop .7s ease;
}

/* ── Number Memory v2 ── */
.v2-nm-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 380px; }
.v2-nm-label {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--txt3); margin-bottom: 10px; font-weight: 700;
}
.v2-nm-number {
  font-size: clamp(2.2rem,8vw,3.8rem); font-weight: 900; letter-spacing: .22em;
  color: var(--purple); font-variant-numeric: tabular-nums;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 20px; width: 100%; text-align: center; margin-bottom: 10px;
}
.v2-nm-countdown { font-size: .82rem; color: var(--yellow); font-weight: 700; min-height: 20px; }
.v2-nm-display {
  font-size: clamp(1.6rem,5vw,2.4rem); font-weight: 900; letter-spacing: .22em;
  color: var(--txt); font-variant-numeric: tabular-nums;
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; width: 100%; text-align: center; margin-bottom: 14px;
  min-height: 60px; display: flex; align-items: center; justify-content: center;
  transition: color .2s;
}
.v2-pad {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; width: 100%;
}
.v2-pad-key {
  height: clamp(52px,12vw,62px); border-radius: 12px;
  font-size: clamp(1.1rem,3vw,1.3rem); font-weight: 700;
  background: var(--card); border: 1.5px solid var(--border); color: var(--txt);
  transition: all .1s; touch-action: manipulation; user-select: none;
}
.v2-pad-key:hover  { background: var(--card-hover); }
.v2-pad-key:active { transform: scale(.9); background: rgba(139,92,246,.2); border-color: var(--purple); }
.v2-pad-key.del    { color: var(--red); font-size: 1.4rem; }
.v2-pad-key.ok     { background: linear-gradient(90deg,var(--green),var(--cyan)); color: #fff; border: none; font-size: 1.3rem; }
.v2-pad-key.ok:active { opacity: .85; }

/* ── Pattern Memory v2 ── */
.v2-pm-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.v2-pm-top  {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; margin-bottom: 8px; font-size: .82rem;
}
.v2-pm-rounds { color: var(--txt2); }
.v2-pm-rounds b { color: var(--purple); }
.v2-pm-info   { color: var(--cyan); font-weight: 700; font-size: .85rem; text-align: center; }
.v2-pm-score  { color: var(--txt3); }
.v2-pm-score b { color: var(--yellow); }
.v2-pm-grid   { display: inline-grid; touch-action: manipulation; margin: 12px 0; }
.v2-pm-cell {
  border-radius: 10px; background: var(--bg2); border: 2px solid var(--border);
  cursor: pointer; transition: background .12s, border-color .12s, box-shadow .15s, transform .08s;
  touch-action: manipulation; user-select: none;
}
.v2-pm-cell:active { transform: scale(.9); }
.v2-pm-cell.lit  { background: var(--purple); border-color: rgba(139,92,246,.6); box-shadow: 0 0 20px rgba(139,92,246,.65); }
.v2-pm-cell.lit-pop { animation: litPop .22s ease forwards; }
.v2-pm-cell.sel  { background: rgba(59,130,246,.35); border-color: var(--blue); }
.v2-pm-cell.ok   { background: rgba(16,185,129,.4);  border-color: var(--green); box-shadow: 0 0 14px rgba(16,185,129,.4); }
.v2-pm-cell.err  { background: rgba(239,68,68,.35);  border-color: var(--red); animation: v2Shake .3s; }
.v2-pm-cell.missed { border-color: var(--purple); border-style: dashed; }
.v2-pm-hint { font-size: .78rem; color: var(--txt3); margin-top: 4px; }
.v2-pm-sel-count { font-size: .82rem; color: var(--txt2); }
.v2-pm-sel-count b { color: var(--purple); }
.v2-check-btn {
  padding: 10px 20px; border-radius: 50px; font-size: .88rem; font-weight: 700;
  background: linear-gradient(90deg,var(--purple),var(--blue)); color: #fff;
  transition: transform .1s, opacity .1s; touch-action: manipulation;
}
.v2-check-btn:active { transform: scale(.94); opacity: .85; }

/* ── Stroop v2 ── */
.v2-stroop-demo {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 16px; width: 100%;
}
.v2-demo-word { font-size: 2.4rem; font-weight: 900; text-align: center; margin-bottom: 6px; }
.v2-demo-hint { font-size: .78rem; color: var(--txt3); text-align: center; }

.v2-stroop-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 460px; }
.v2-stroop-hud  { display: flex; justify-content: space-around; align-items: center; width: 100%; margin-bottom: 12px; }
.v2-sh-block    { text-align: center; }
.v2-sh-val      { display: block; font-size: 2rem; font-weight: 900; line-height: 1; }
.v2-sh-val.green { color: var(--green); }
.v2-sh-val.red   { color: var(--red); }
.v2-sh-lbl      { font-size: .7rem; color: var(--txt3); text-transform: uppercase; letter-spacing:.05em; }
.v2-sh-timer    { position: relative; width: 64px; height: 64px; }
.v2-sh-timer svg { position: absolute; top:0; left:0; }
.v2-sh-timer-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 800; color: var(--cyan);
}
.v2-stroop-arena {
  width: 100%; height: clamp(130px,28vw,180px);
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; margin-bottom: 8px;
}
.v2-sa-flash {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity .15s; border-radius: inherit; pointer-events: none;
}
.v2-sa-word { font-size: clamp(2.2rem,7vw,3.6rem); font-weight: 900; z-index: 1; letter-spacing: .02em; }
.v2-stroop-prompt { font-size: .8rem; color: var(--txt3); margin-bottom: 12px; }
.v2-stroop-btns {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; width: 100%;
}
.v2-stroop-btn {
  height: clamp(52px,12vw,62px); border-radius: 12px;
  font-size: clamp(.78rem,2.2vw,.9rem); font-weight: 800;
  color: #fff; border: 2px solid transparent;
  transition: transform .08s, opacity .1s, box-shadow .1s;
  touch-action: manipulation; user-select: none;
}
.v2-stroop-btn:active { transform: scale(.88); opacity: .85; }

/* ── N-Back v2 ── */
.v2-nback-demo {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: 14px; width: 100%;
}
.v2-nbd-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.v2-nbd-pos {
  width: 44px; height: 44px; border-radius: 8px; border: 2px solid var(--border);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: var(--txt3);
}
.v2-nbd-pos.nbd-was { background: rgba(59,130,246,.2); border-color: var(--blue); color: var(--blue); }
.v2-nbd-pos.nbd-now { background: rgba(245,158,11,.2); border-color: var(--yellow); color: var(--yellow); }
.v2-nbd-hint { font-size: .78rem; color: var(--txt3); text-align: center; }

.v2-nback-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 380px; }
.v2-nb-topbar  { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 8px; }
.v2-nb-badge   {
  background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3);
  border-radius: 50px; padding: 5px 14px; font-size: .82rem; font-weight: 700; color: var(--blue);
}
.v2-nb-trial   { font-size: .8rem; color: var(--txt3); font-variant-numeric: tabular-nums; }
.v2-nb-stats   { font-size: .8rem; color: var(--txt3); }
.v2-nb-stats b { color: var(--txt2); }
.v2-nb-progress { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 14px; }
.v2-nb-prog-fill { height: 4px; border-radius: 2px; background: var(--blue); transition: width .3s; }
.v2-nb-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 8px; width: min(280px,78vw); aspect-ratio: 1; margin-bottom: 18px;
}
.v2-nb-sq {
  border-radius: 12px; background: var(--bg2); border: 2px solid var(--border);
  transition: background .12s, border-color .12s, box-shadow .15s;
  aspect-ratio: 1;
}
.v2-nb-sq.lit {
  background: var(--blue); border-color: rgba(59,130,246,.6);
  box-shadow: 0 0 24px rgba(59,130,246,.6);
  animation: v2Pop .2s ease;
}
.v2-nb-btn {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  background: var(--card); border: 2px solid var(--border); color: var(--txt2);
  transition: all .12s; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.v2-nb-btn:hover   { border-color: var(--blue); color: var(--blue); background: rgba(59,130,246,.08); }
.v2-nb-btn:active  { transform: scale(.95); }
.v2-nb-btn.pressed { background: rgba(59,130,246,.2); border-color: var(--blue); color: var(--blue); transform: scale(.95); }
.v2-nb-btn-inner   { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 800; }
.v2-nb-btn-icon    { font-size: 1.3rem; }
.v2-nb-btn-sub     { font-size: .72rem; color: var(--txt3); }
.v2-nb-feedback    { min-height: 22px; font-size: .88rem; font-weight: 700; margin-top: 8px; text-align: center; }

/* ─ Responsive for v2 ─ */
@media (max-width: 480px) {
  .v2-speed-grid { grid-template-columns: 1fr 1fr; }
  .v2-stroop-btns { grid-template-columns: repeat(3,1fr); gap: 6px; }
  .v2-stroop-btn { height: 50px; font-size: .76rem; }
  .v2i-rules { padding: 12px 14px; }
  .v2-nm-number { padding: 20px 14px; }
  .v2-comp-card { padding: 14px; }
  .v2-comp-opt { padding: 12px 14px; }
}
@media (max-width: 360px) {
  .v2-nb-grid { width: 88vw; }
  .v2-stroop-btns { grid-template-columns: 1fr 1fr; }
  .v2-stroop-btn:last-child { grid-column: span 2; }
}

/* ═══════════════════════════════════════════
   GAME 6 — Mental Math Sprint v2
═══════════════════════════════════════════ */
.v2-mm-wrap { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; padding: 0 4px; box-sizing:border-box; }
.v2-mm-timerbar-wrap { width:100%; max-width:380px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-mm-timerbar { height:100%; width:100%; background:var(--green); border-radius:3px; transition:width 1s linear, background .4s; }
.v2-mm-hud { display:flex; width:100%; max-width:380px; justify-content:space-between; align-items:flex-end; padding:0 4px; }
.v2-mm-hud-item { display:flex; flex-direction:column; align-items:center; gap:2px; }
.v2-mm-hud-item.main { flex:1; }
.v2-mm-hud-val { font-size:1.6rem; font-weight:900; color:var(--txt); line-height:1; }
.v2-mm-hud-val.cyan   { color:var(--cyan); }
.v2-mm-hud-val.yellow { color:var(--yellow); }
.v2-mm-hud-lbl { font-size:.65rem; color:var(--txt3); text-transform:uppercase; letter-spacing:.05em; }
.v2-mm-problem { font-size:clamp(2rem, 8vw, 3rem); font-weight:900; color:var(--txt); letter-spacing:2px; text-align:center; }
.v2-mm-op { color:var(--cyan); }
.v2-mm-eq { color:var(--txt3); }
.v2-mm-q  { color:var(--purple); }
.v2-mm-display { font-size:clamp(2.2rem, 9vw, 3.4rem); font-weight:900; color:var(--txt); min-height:60px; background:rgba(255,255,255,.05); border:2px solid rgba(255,255,255,.12); border-radius:14px; padding:10px 28px; text-align:center; width:100%; max-width:300px; box-sizing:border-box; }
.v2-mm-fb { font-size:.82rem; color:var(--txt3); min-height:20px; text-align:center; }

/* Shared countdown */
.v2-cd-wrap { display:flex; flex-direction:column; align-items:center; justify-content:center; height:220px; gap:12px; }
.v2-cd-num { font-size:5rem; font-weight:900; color:var(--purple); animation:v2Pop .3s ease; }

/* ═══════════════════════════════════════════
   GAME 7 & 8 — Missing Shape / Matrix Reasoning v2
═══════════════════════════════════════════ */
.v2-ms-wrap { display:flex; flex-direction:column; align-items:center; gap:16px; width:100%; padding:4px; box-sizing:border-box; }
.v2-ms-topbar { display:flex; width:100%; max-width:380px; justify-content:space-between; font-size:.84rem; font-weight:600; }
.v2-ms-matrix { display:grid; justify-content:center; }
.v2-ms-cell { display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.10); border-radius:10px; transition:border-color .2s; }
.v2-ms-cell.missing { border:2px dashed var(--purple); background:rgba(139,92,246,.08); animation:v2Pulse 1.4s ease-in-out infinite; }
.v2-ms-qmark { font-size:1.8rem; font-weight:900; color:var(--purple); opacity:.7; }
.v2-ms-prompt { font-size:.84rem; color:var(--txt3); margin:0; }
.v2-ms-choices { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; }
.v2-ms-choice { cursor:pointer; padding:10px; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.12); border-radius:12px; display:flex; align-items:center; justify-content:center; touch-action:manipulation; transition:border-color .15s, transform .1s; }
.v2-ms-choice:hover { border-color:var(--purple); transform:scale(1.04); }
.v2-ms-choice:active { transform:scale(.96); }
.v2-ms-choice.ok  { border-color:var(--green); background:rgba(16,185,129,.15); }
.v2-ms-choice.err { border-color:var(--red);   background:rgba(239,68,68,.12); animation:v2Shake .35s ease; }
@keyframes v2Pulse { 0%,100%{opacity:.55} 50%{opacity:1} }

/* ═══════════════════════════════════════════
   GAME 9 — Rotation Puzzle v2
═══════════════════════════════════════════ */
.v2-rot-wrap { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; padding:4px; box-sizing:border-box; }
.v2-rot-topbar { display:flex; width:100%; max-width:380px; justify-content:space-between; font-size:.84rem; font-weight:600; }
.v2-rot-demo { display:flex; align-items:center; justify-content:center; gap:14px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.10); border-radius:16px; padding:16px 20px; margin:8px 0; flex-wrap:wrap; }
.v2-rot-demo-arrow { font-size:.78rem; color:var(--txt3); font-style:italic; text-align:center; }
.v2-rot-original { display:flex; flex-direction:column; align-items:center; gap:6px; }
.v2-rot-original p { margin:0; font-size:.76rem; color:var(--txt3); text-transform:uppercase; letter-spacing:.06em; }
.v2-rot-orig-box { background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.12); border-radius:14px; padding:12px; }
.v2-rot-target-label { font-size:.9rem; color:var(--txt2); text-align:center; }
.v2-rot-choices { display:grid; grid-template-columns:1fr 1fr; gap:12px; width:100%; max-width:380px; }
.v2-rot-choice { cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:6px; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.12); border-radius:14px; padding:12px 8px; touch-action:manipulation; transition:border-color .15s, transform .1s; }
.v2-rot-choice:hover { border-color:var(--purple); transform:scale(1.03); }
.v2-rot-choice:active { transform:scale(.96); }
.v2-rot-choice.ok  { border-color:var(--green); background:rgba(16,185,129,.14); }
.v2-rot-choice.err { border-color:var(--red);   background:rgba(239,68,68,.12); animation:v2Shake .35s ease; }
.v2-rot-deg { font-size:.72rem; font-weight:700; color:var(--txt3); text-transform:uppercase; }

/* ═══════════════════════════════════════════
   GAME 10 — Odd One Out v2
═══════════════════════════════════════════ */
.v2-oot-wrap { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; padding:4px; box-sizing:border-box; }
.v2-oot-timerbar-wrap { width:100%; max-width:420px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-oot-timerbar { height:100%; width:100%; background:var(--cyan); border-radius:3px; }
.v2-oot-top { display:flex; width:100%; max-width:420px; justify-content:space-between; align-items:center; font-size:.84rem; font-weight:600; }
.v2-oot-clock { font-size:1.1rem; font-weight:900; color:var(--yellow); }
.v2-oot-grid { display:grid; gap:6px; justify-content:center; width:100%; }
.v2-oot-cell { display:flex; align-items:center; justify-content:center; font-size:clamp(1.5rem,6vw,2rem); cursor:pointer; background:rgba(255,255,255,.05); border:2px solid rgba(255,255,255,.09); border-radius:12px; aspect-ratio:1; touch-action:manipulation; transition:border-color .15s, transform .08s; user-select:none; }
.v2-oot-cell:hover { border-color:rgba(255,255,255,.3); transform:scale(1.06); }
.v2-oot-cell:active { transform:scale(.92); }
.v2-oot-cell.correct { border-color:var(--green); background:rgba(16,185,129,.18); animation:v2Pop .3s ease; }
.v2-oot-cell.wrong   { border-color:var(--red);   background:rgba(239,68,68,.14);  animation:v2Shake .3s ease; }
/* demo row in intro */
.v2-oot-demo { background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08); border-radius:12px; padding:12px 14px; text-align:center; margin:4px 0; }
.v2-oot-demo-row { display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.v2-oot-demo-cell { font-size:1.5rem; padding:4px; border-radius:8px; border:2px solid transparent; }
.v2-oot-demo-cell.odd { border-color:var(--yellow); background:rgba(245,158,11,.14); }
.v2-oot-demo-hint { margin:6px 0 0; font-size:.76rem; color:var(--txt3); }

/* ─ Extra responsive for games 6-10 ─ */
@media (max-width: 480px) {
  .v2-mm-hud-val { font-size:1.3rem; }
  .v2-mm-problem { letter-spacing:0; }
  .v2-rot-choices { gap:8px; }
  .v2-rot-choice { padding:10px 6px; }
}

/* ═══════════════════════════════════════════
   GAME 11 — Sequence Prediction v2
═══════════════════════════════════════════ */
.v2-seq-wrap { display:flex; flex-direction:column; align-items:center; gap:16px; width:100%; padding:4px; box-sizing:border-box; }
.v2-seq-chain { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:6px; background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.09); border-radius:16px; padding:16px 12px; width:100%; max-width:380px; box-sizing:border-box; }
.v2-seq-item { min-width:52px; height:52px; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.08); border:2px solid rgba(255,255,255,.14); border-radius:12px; font-size:1.15rem; font-weight:800; color:var(--txt); }
.v2-seq-item.missing { border-color:var(--purple); color:var(--purple); background:rgba(139,92,246,.12); animation:v2Pulse 1.4s ease-in-out infinite; }
.v2-seq-arrow { color:var(--txt3); font-size:.95rem; }
.v2-seq-choices { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; max-width:340px; }
.v2-seq-choice { cursor:pointer; padding:16px 10px; text-align:center; font-size:1.2rem; font-weight:800; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.12); border-radius:14px; touch-action:manipulation; transition:border-color .15s, transform .1s; }
.v2-seq-choice:hover { border-color:var(--purple); transform:scale(1.04); }
.v2-seq-choice:active { transform:scale(.94); }
.v2-seq-choice.ok  { border-color:var(--green); background:rgba(16,185,129,.14); }
.v2-seq-choice.err { border-color:var(--red);   background:rgba(239,68,68,.12); animation:v2Shake .35s ease; }

/* ═══════════════════════════════════════════
   GAME 12 — Memory Cards v2
═══════════════════════════════════════════ */
.v2-mc-wrap { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; padding:4px; box-sizing:border-box; }
.v2-mc-hud { display:flex; width:100%; max-width:420px; justify-content:space-around; }
.v2-mc-hud-item { display:flex; flex-direction:column; align-items:center; gap:2px; }
.v2-mc-val { font-size:1.4rem; font-weight:900; color:var(--txt); }
.v2-mc-val.purple { color:var(--purple); }
.v2-mc-val.cyan   { color:var(--cyan); }
.v2-mc-val.green  { color:var(--green); }
.v2-mc-lbl { font-size:.65rem; color:var(--txt3); text-transform:uppercase; }
.v2-mc-grid { display:grid; gap:6px; width:100%; max-width:420px; justify-items:stretch; }
.v2-mc-card { width:100%; min-width:0; aspect-ratio:1; cursor:pointer; perspective:600px; touch-action:manipulation; }
.v2-mc-inner { width:100%; height:100%; position:relative; transform-style:preserve-3d; transition:transform .35s ease; border-radius:10px; }
.v2-mc-card.flipped .v2-mc-inner { transform:rotateY(180deg); }
.v2-mc-card.matched .v2-mc-inner { transform:rotateY(180deg); }
.v2-mc-back, .v2-mc-front { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:clamp(1.2rem,4vw,1.6rem); border-radius:10px; backface-visibility:hidden; }
.v2-mc-back  { background:rgba(139,92,246,.18); border:2px solid rgba(139,92,246,.35); }
.v2-mc-front { background:rgba(255,255,255,.08); border:2px solid rgba(255,255,255,.16); transform:rotateY(180deg); }
.v2-mc-card.matched .v2-mc-front { background:rgba(16,185,129,.18); border-color:var(--green); }

/* ═══════════════════════════════════════════
   GAME 13 — Flash Calculation v2
═══════════════════════════════════════════ */
.v2-fc-wrap { display:flex; flex-direction:column; align-items:center; gap:16px; width:100%; padding:4px; box-sizing:border-box; }
.v2-fc-stage { display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; }
.v2-fc-label { font-size:.84rem; color:var(--txt3); margin:0; }
.v2-fc-number { font-size:clamp(4rem, 18vw, 6rem); font-weight:900; color:var(--cyan); min-height:90px; display:flex; align-items:center; justify-content:center; }
.v2-fc-count { font-size:.78rem; color:var(--txt3); }
.v2-fc-input-area { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; }
.v2-fc-display { font-size:2.4rem; font-weight:900; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.12); border-radius:14px; padding:10px 28px; min-width:160px; text-align:center; }

/* ═══════════════════════════════════════════
   GAME 14 — Peripheral Vision v2
═══════════════════════════════════════════ */
.v2-pv-wrap { display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; padding:4px; box-sizing:border-box; }
.v2-pv-hud { display:flex; gap:24px; font-size:.88rem; font-weight:700; }
.v2-pv-hint { font-size:.75rem; color:var(--txt3); margin:0; text-align:center; }
.v2-pv-canvas { border-radius:14px; border:2px solid rgba(255,255,255,.09); display:block; max-width:100%; touch-action:manipulation; cursor:crosshair; }

/* ═══════════════════════════════════════════
   GAME 15 — Visual Search v2
═══════════════════════════════════════════ */
.v2-vs-wrap { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; padding:4px; box-sizing:border-box; }
.v2-vs-target-bar { font-size:1rem; font-weight:700; color:var(--txt2); background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.12); border-radius:12px; padding:10px 24px; text-align:center; }
.v2-vs-target-char { font-size:1.8rem; font-weight:900; color:var(--yellow); margin-left:10px; }
.v2-vs-grid { display:grid; gap:2px; width:100%; max-width:480px; }
.v2-vs-cell { display:flex; align-items:center; justify-content:center; font-size:clamp(.75rem, 2.5vw, .95rem); font-family:monospace; font-weight:700; aspect-ratio:1; background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.07); border-radius:5px; cursor:pointer; color:var(--txt3); touch-action:manipulation; transition:background .1s; }
.v2-vs-cell:hover { background:rgba(255,255,255,.10); color:var(--txt); }
.v2-vs-cell:active { transform:scale(.88); }
.v2-vs-cell.found { background:rgba(16,185,129,.28); border-color:var(--green); color:var(--green); animation:v2Pop .3s ease; }
.v2-vs-cell.wrong { background:rgba(239,68,68,.22); border-color:var(--red); color:var(--red); }

/* ─ Extra responsive for games 11-15 ─ */
@media (max-width: 480px) {
  .v2-seq-chain { padding:12px 8px; }
  .v2-seq-item  { min-width:44px; height:44px; font-size:1rem; }
  .v2-mc-val { font-size:1.2rem; }
  .v2-fc-number { min-height:70px; }
}

/* ═══════════════════════════════════════════
   GAME 16 — Simon Game v2
═══════════════════════════════════════════ */
.v2-simon-preview { display:flex; gap:10px; justify-content:center; margin:10px 0; }
.v2-sp-pad { width:48px; height:48px; border-radius:12px; transition:opacity .2s; }
.v2-simon-wrap { display:flex; flex-direction:column; align-items:center; gap:18px; width:100%; padding:4px; box-sizing:border-box; }
.v2-simon-lvl  { font-size:1.1rem; font-weight:800; color:var(--txt); }
.v2-simon-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; width:min(280px,80vw); }
.v2-simon-pad  { width:100%; aspect-ratio:1; border-radius:18px; cursor:pointer; touch-action:manipulation;
  background:rgba(0,0,0,.25); border:3px solid var(--pc,#888);
  transition:transform .08s, box-shadow .08s, background .08s; }
.v2-simon-pad:active { transform:scale(.93); }
.v2-simon-pad.lit { background:var(--pc); box-shadow:0 0 28px var(--pc), 0 0 56px color-mix(in srgb,var(--pc) 45%,transparent); transform:scale(1.06); }
.v2-simon-msg  { font-size:1rem; font-weight:700; color:var(--txt2); min-height:24px; }

/* ═══════════════════════════════════════════
   GAME 17 — Reaction Time v2
═══════════════════════════════════════════ */
.v2-rt-wrap   { display:flex; flex-direction:column; align-items:center; gap:16px; width:100%; }
.v2-rt-dots   { display:flex; gap:10px; }
.v2-rt-dot    { width:14px; height:14px; border-radius:50%; background:rgba(255,255,255,.12); border:2px solid rgba(255,255,255,.2); }
.v2-rt-dot.done   { background:var(--green); border-color:var(--green); }
.v2-rt-dot.active { background:var(--yellow); border-color:var(--yellow); animation:v2Pulse 1s ease-in-out infinite; }
.v2-rt-screen { width:100%; max-width:440px; height:200px; border-radius:20px; display:flex; align-items:center; justify-content:center; cursor:pointer; touch-action:manipulation; transition:background .2s; border:3px solid rgba(255,255,255,.1); }
.v2-rt-screen.wait { background:#1e2a4a; }
.v2-rt-screen.ready{ background:#7c2d2d; animation:v2Pulse 1.2s ease-in-out infinite; }
.v2-rt-screen.go   { background:var(--green); border-color:var(--green); box-shadow:0 0 40px rgba(16,185,129,.5); }
.v2-rt-label  { font-size:1.2rem; font-weight:800; color:#fff; text-align:center; pointer-events:none; }
.v2-rt-list   { width:100%; max-width:380px; display:flex; flex-direction:column; gap:4px; }
.v2-rt-item   { display:flex; justify-content:space-between; padding:7px 12px; background:rgba(255,255,255,.05); border-radius:8px; font-size:.84rem; }

/* ═══════════════════════════════════════════
   GAME 18 — Multi-Task v2
═══════════════════════════════════════════ */
.v2-mt-wrap   { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; box-sizing:border-box; }
.v2-mt-timerbar-wrap { width:100%; max-width:420px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-mt-timerbar { height:100%; width:100%; background:var(--cyan); border-radius:3px; transition:width 1s linear; }
.v2-mt-hud    { display:flex; justify-content:space-between; width:100%; max-width:420px; font-size:.84rem; font-weight:600; }
.v2-mt-panels { display:flex; width:100%; max-width:420px; gap:0; border:2px solid rgba(255,255,255,.1); border-radius:16px; overflow:hidden; }
.v2-mt-panel  { flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; padding:18px 10px; }
.v2-mt-panel-lbl { font-size:.7rem; font-weight:700; color:var(--txt3); text-transform:uppercase; letter-spacing:.07em; }
.v2-mt-word   { font-size:clamp(1.6rem,7vw,2.4rem); font-weight:900; color:var(--cyan); min-height:50px; display:flex; align-items:center; }
.v2-mt-shape  { font-size:clamp(2rem,8vw,2.8rem); min-height:50px; display:flex; align-items:center; }
.v2-mt-sc     { font-size:.72rem; color:var(--txt3); }
.v2-mt-divider{ width:2px; background:rgba(255,255,255,.1); align-self:stretch; }
.v2-mt-q-wrap { display:flex; flex-direction:column; align-items:center; gap:8px; width:100%; max-width:380px; box-sizing:border-box; }
.v2-mt-q-block{ width:100%; display:flex; flex-direction:column; align-items:center; gap:8px; }
.v2-mt-q-lbl  { font-size:.86rem; color:var(--txt2); font-weight:600; margin:0; align-self:flex-start; }
.v2-mt-word-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; width:100%; }
.v2-seq-choice.sel2 { border-color:var(--blue); background:rgba(59,130,246,.15); }

/* ═══════════════════════════════════════════
   GAME 19 — Word Association v2
═══════════════════════════════════════════ */
.v2-wa-wrap { display:flex; flex-direction:column; align-items:center; gap:16px; width:100%; padding:4px; box-sizing:border-box; }
.v2-wa-word { font-size:clamp(2.2rem,9vw,3.2rem); font-weight:900; color:var(--txt); text-align:center; padding:18px; background:rgba(255,255,255,.05); border:2px solid rgba(255,255,255,.1); border-radius:16px; width:100%; max-width:380px; box-sizing:border-box; }
.v2-wa-opts { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; max-width:380px; }
.v2-wa-btn  { cursor:pointer; padding:16px 10px; text-align:center; font-size:1rem; font-weight:700; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.12); border-radius:14px; touch-action:manipulation; transition:border-color .12s, transform .08s; }
.v2-wa-btn:hover { border-color:var(--purple); transform:scale(1.03); }
.v2-wa-btn:active { transform:scale(.94); }
.v2-wa-btn.ok  { border-color:var(--green); background:rgba(16,185,129,.14); }
.v2-wa-btn.err { border-color:var(--red);   background:rgba(239,68,68,.12); animation:v2Shake .3s ease; }

/* ═══════════════════════════════════════════
   GAME 20 — Story Recall v2
═══════════════════════════════════════════ */
.v2-sr-wrap   { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; padding:4px; box-sizing:border-box; }
.v2-sr-barwrap{ width:100%; max-width:520px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-sr-bar    { height:100%; width:100%; background:var(--blue); border-radius:3px; transition:width 1s linear; }
.v2-sr-lbl    { font-size:.82rem; color:var(--txt2); font-weight:600; }
.v2-sr-text   { background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); border-radius:14px; padding:18px 20px; font-size:1rem; line-height:1.65; color:var(--txt); max-width:520px; width:100%; box-sizing:border-box; }
.v2-sr-q-wrap { display:flex; flex-direction:column; gap:14px; width:100%; max-width:500px; padding:4px; box-sizing:border-box; }
.v2-sr-q-hdr  { font-size:.9rem; font-weight:700; color:var(--txt2); margin:0; }
.v2-sr-q-block{ background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.09); border-radius:14px; padding:14px; }
.v2-sr-q-text { font-size:.88rem; font-weight:600; color:var(--txt); margin:0 0 10px; }
.v2-sr-opts   { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.v2-sr-opt    { cursor:pointer; padding:10px 8px; text-align:center; font-size:.82rem; font-weight:600; background:rgba(255,255,255,.06); border:2px solid rgba(255,255,255,.1); border-radius:10px; touch-action:manipulation; transition:border-color .12s; }
.v2-sr-opt:hover { border-color:var(--purple); }
.v2-sr-opt.sel { border-color:var(--blue); background:rgba(59,130,246,.14); }
.v2-sr-opt.ok  { border-color:var(--green); background:rgba(16,185,129,.18); }
.v2-sr-opt.err { border-color:var(--red);   background:rgba(239,68,68,.14); }

/* ═══════════════════════════════════════════
   GAME 21 — Symbol Digit Coding v2
═══════════════════════════════════════════ */
.v2-sdci-key  { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); border-radius:14px; padding:12px 10px; width:100%; max-width:400px; box-sizing:border-box; }
.v2-sdci-pair { display:flex; flex-direction:column; align-items:center; gap:2px; min-width:38px; }
.v2-sdci-sym  { font-size:1.15rem; }
.v2-sdci-dig  { font-size:.78rem; font-weight:800; color:var(--cyan); background:rgba(6,182,212,.15); border-radius:4px; padding:1px 6px; }
.v2-sdc-wrap  { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; padding:4px; box-sizing:border-box; }
.v2-sdc-barwrap{ width:100%; max-width:400px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-sdc-bar   { height:100%; width:100%; background:var(--green); border-radius:3px; transition:width 1s linear; }
.v2-sdc-hud   { display:flex; justify-content:space-between; width:100%; max-width:400px; font-size:.84rem; font-weight:600; }
.v2-sdc-task  { display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; }
.v2-sdc-sym   { font-size:5rem; line-height:1; color:var(--yellow); min-height:80px; display:flex; align-items:center; }
.v2-sdc-progwrap{ width:100%; max-width:300px; height:4px; background:rgba(255,255,255,.08); border-radius:2px; overflow:hidden; }
.v2-sdc-prog  { height:100%; background:var(--purple); border-radius:2px; transition:width .15s; }
.v2-sdc-numpad{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; width:100%; max-width:300px; }
.v2-sdc-key   { height:54px; font-size:1.4rem; font-weight:900; background:rgba(255,255,255,.08); border:2px solid rgba(255,255,255,.15); border-radius:12px; color:var(--txt); cursor:pointer; touch-action:manipulation; transition:background .1s, transform .08s; }
.v2-sdc-key:hover  { background:rgba(255,255,255,.14); border-color:var(--purple); }
.v2-sdc-key:active { transform:scale(.92); }
.v2-sdc-fb    { min-height:22px; font-size:.9rem; font-weight:700; text-align:center; }

/* ═══════════════════════════════════════════
   GAME 22 — Hidden Object v2
═══════════════════════════════════════════ */
.v2-ho-wrap   { display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; padding:4px; box-sizing:border-box; }
.v2-ho-barwrap{ width:100%; max-width:440px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-ho-bar    { height:100%; width:100%; background:var(--cyan); border-radius:3px; }
.v2-ho-top    { display:flex; width:100%; max-width:440px; justify-content:space-between; align-items:center; font-size:.84rem; font-weight:600; }
.v2-ho-target { font-size:.84rem; font-weight:700; }
.v2-ho-tsym   { font-size:1.4rem; margin-right:4px; }
.v2-ho-grid   { display:grid; gap:3px; width:100%; max-width:440px; }
.v2-ho-cell   { display:flex; align-items:center; justify-content:center; font-size:clamp(1.2rem,4.5vw,1.6rem); aspect-ratio:1; cursor:pointer; touch-action:manipulation; border-radius:6px; border:1px solid transparent; transition:border-color .1s, transform .07s; user-select:none; }
.v2-ho-cell:hover  { border-color:rgba(255,255,255,.25); transform:scale(1.08); }
.v2-ho-cell:active { transform:scale(.88); }
.v2-ho-cell.found { background:rgba(16,185,129,.25); border-color:var(--green); animation:v2Pop .3s ease; }
.v2-ho-cell.wrong { background:rgba(239,68,68,.18); border-color:var(--red); animation:v2Shake .3s ease; }

/* ═══════════════════════════════════════════
   GAME 23 — Direction Memory v2
═══════════════════════════════════════════ */
.v2-dm-wrap   { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; padding:4px; box-sizing:border-box; }
.v2-dm-level  { font-size:.9rem; font-weight:700; color:var(--txt2); }
.v2-dm-demo   { display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); border-radius:12px; padding:12px 18px; margin:4px 0; }
.v2-dm-demo-arrow{ font-size:1.8rem; font-weight:900; color:var(--cyan); }
.v2-dm-disp   { font-size:4.5rem; font-weight:900; color:var(--yellow); min-height:80px; display:flex; align-items:center; justify-content:center; }
.v2-dm-trail  { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; min-height:32px; }
.v2-dm-entered{ font-size:1.4rem; font-weight:900; color:var(--purple); background:rgba(139,92,246,.15); border-radius:8px; padding:2px 8px; }
.v2-dm-dpad   { display:grid; grid-template-columns:1fr 56px 1fr; grid-template-rows:56px 56px 56px; gap:6px; align-items:center; justify-items:center; }
.v2-dm-btn    { width:56px; height:56px; font-size:1.8rem; font-weight:900; background:rgba(255,255,255,.08); border:2px solid rgba(255,255,255,.15); border-radius:14px; color:var(--txt); cursor:pointer; touch-action:manipulation; transition:background .1s, transform .08s; }
.v2-dm-btn:hover  { background:rgba(139,92,246,.2); border-color:var(--purple); }
.v2-dm-btn:active { transform:scale(.88); }
.v2-dm-center { font-size:1.4rem; }
.v2-dm-hint   { font-size:.88rem; font-weight:700; color:var(--txt2); text-align:center; min-height:20px; }

/* ═══════════════════════════════════════════
   GAME 24 — Rapid Categorization v2
═══════════════════════════════════════════ */
.v2-rc-preview  { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin:8px 0; }
.v2-rc-prev-tag { padding:6px 14px; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.12); border-radius:20px; font-size:.78rem; font-weight:700; color:var(--txt2); }
.v2-rc-wrap   { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; padding:4px; box-sizing:border-box; }
.v2-rc-barwrap{ width:100%; max-width:420px; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.v2-rc-bar    { height:100%; width:100%; background:var(--cyan); border-radius:3px; transition:width 1s linear; }
.v2-rc-hud    { display:flex; justify-content:space-around; width:100%; max-width:420px; font-size:.88rem; font-weight:700; }
.v2-rc-word   { font-size:clamp(2rem,9vw,3rem); font-weight:900; color:var(--txt); text-align:center; min-height:70px; display:flex; align-items:center; justify-content:center; width:100%; max-width:380px; background:rgba(255,255,255,.05); border:2px solid rgba(255,255,255,.1); border-radius:16px; }
.v2-rc-cats   { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; max-width:380px; }
.v2-rc-btn    { height:54px; font-size:1rem; font-weight:800; background:rgba(255,255,255,.07); border:2px solid rgba(255,255,255,.12); border-radius:14px; color:var(--txt); cursor:pointer; touch-action:manipulation; transition:background .1s, transform .08s; }
.v2-rc-btn:hover { border-color:var(--purple); background:rgba(139,92,246,.12); }
.v2-rc-btn:active { transform:scale(.93); }
.v2-rc-btn.ok  { background:rgba(16,185,129,.2);  border-color:var(--green); }
.v2-rc-btn.err { background:rgba(239,68,68,.18);  border-color:var(--red); }
.v2-rc-fb     { min-height:22px; font-size:.88rem; font-weight:700; text-align:center; }

/* ═══════════════════════════════════════════
   GAME 25 — Sudoku Mini v2
═══════════════════════════════════════════ */
.v2-su-demo   { display:flex; flex-direction:column; gap:3px; margin:10px 0; }
.v2-su-demo-row { display:flex; gap:3px; justify-content:center; }
.v2-su-demo-cell{ width:38px; height:38px; display:flex; align-items:center; justify-content:center; font-size:1rem; font-weight:800; border-radius:8px; }
.v2-su-demo-cell.given{ background:rgba(255,255,255,.1); color:var(--txt); }
.v2-su-demo-cell.empty{ background:rgba(139,92,246,.12); border:2px dashed var(--purple); color:var(--purple); }
.v2-su-wrap   { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; padding:4px; box-sizing:border-box; }
.v2-su-hud    { display:flex; justify-content:space-between; width:100%; max-width:300px; font-size:.84rem; font-weight:600; }
.v2-su-grid   { display:grid; grid-template-columns:repeat(4,1fr); gap:4px; width:min(280px,80vw); }
.v2-su-cell   { aspect-ratio:1; display:flex; align-items:center; justify-content:center; font-size:1.3rem; font-weight:900; border-radius:10px; border:2px solid rgba(255,255,255,.1); background:rgba(255,255,255,.06); cursor:pointer; touch-action:manipulation; transition:border-color .12s, background .12s; user-select:none; }
.v2-su-cell:nth-child(4n+3), .v2-su-cell:nth-child(4n+4) { }
.v2-su-cell:nth-child(n+9):nth-child(-n+12) { border-top:3px solid rgba(255,255,255,.3); }
.v2-su-cell.given { background:rgba(255,255,255,.12); cursor:default; color:var(--txt); border-color:rgba(255,255,255,.18); }
.v2-su-cell.sel   { border-color:var(--purple); background:rgba(139,92,246,.2); }
.v2-su-cell.hl    { background:rgba(139,92,246,.07); border-color:rgba(139,92,246,.25); }
.v2-su-cell.ok    { border-color:var(--green); background:rgba(16,185,129,.18); }
.v2-su-cell.err   { border-color:var(--red);   background:rgba(239,68,68,.15); animation:v2Shake .3s ease; }
.v2-su-numpad { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; width:min(280px,80vw); }
.v2-su-key    { height:52px; font-size:1.3rem; font-weight:900; background:rgba(255,255,255,.08); border:2px solid rgba(255,255,255,.14); border-radius:12px; color:var(--txt); cursor:pointer; touch-action:manipulation; transition:background .1s, transform .08s; }
.v2-su-key:hover  { background:rgba(255,255,255,.14); border-color:var(--purple); }
.v2-su-key:active { transform:scale(.9); }
.v2-su-key.del { font-size:1rem; color:var(--txt3); }

/* ─ Extra responsive for games 16-25 ─ */
@media (max-width: 480px) {
  .v2-simon-grid { width:min(240px,88vw); gap:10px; }
  .v2-rt-screen  { height:160px; }
  .v2-mt-panels  { flex-direction:column; }
  .v2-mt-divider { width:100%; height:2px; }
  .v2-dm-dpad    { grid-template-columns:1fr 50px 1fr; grid-template-rows:50px 50px 50px; }
  .v2-dm-btn     { width:50px; height:50px; font-size:1.5rem; }
}

/* Game fit mode: keep every module inside the visible play area. */
body.in-game .v2-intro,
body.in-game .module-controls,
body.in-game .v2-comp-wrap,
body.in-game .v2-nm-wrap,
body.in-game .v2-pm-wrap,
body.in-game .v2-stroop-wrap,
body.in-game .v2-nback-wrap,
body.in-game .v2-mm-wrap,
body.in-game .v2-ms-wrap,
body.in-game .v2-rot-wrap,
body.in-game .v2-oot-wrap,
body.in-game .v2-seq-wrap,
body.in-game .v2-mc-wrap,
body.in-game .v2-fc-wrap,
body.in-game .v2-pv-wrap,
body.in-game .v2-vs-wrap,
body.in-game .v2-simon-wrap,
body.in-game .v2-rt-wrap,
body.in-game .v2-mt-wrap,
body.in-game .v2-wa-wrap,
body.in-game .v2-sr-wrap,
body.in-game .v2-sr-q-wrap,
body.in-game .v2-sdc-wrap,
body.in-game .v2-ho-wrap,
body.in-game .v2-dm-wrap,
body.in-game .v2-rc-wrap,
body.in-game .v2-su-wrap,
body.in-game .matrix-wrap,
body.in-game .q-set,
body.in-game .game-panel {
  max-height: 100%;
  overflow: hidden;
}
body.in-game .v2-intro {
  justify-content: center;
}
body.in-game .v2i-icon {
  font-size: clamp(2.5rem, 8vw, 3.4rem);
  margin-bottom: 6px;
}
body.in-game .v2i-title {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  margin-bottom: 4px;
}
body.in-game .v2i-sub {
  margin-bottom: 12px;
  line-height: 1.4;
}
body.in-game .v2i-rules {
  padding: 10px 14px;
  gap: 7px;
  margin-bottom: 12px;
}
body.in-game .v2i-rule {
  line-height: 1.35;
}
body.in-game .module-level-grid,
body.in-game .v2-speed-grid {
  margin-bottom: 10px;
}
body.in-game .module-level-btn {
  min-height: 58px;
  padding: 8px 6px;
}
body.in-game .module-seek,
body.in-game .v2-speed-seek {
  padding: 9px 10px;
  margin-bottom: 9px;
}
body.in-game .v2-speed-btn {
  padding: 9px 6px;
}
body.in-game .v2-start-btn {
  padding: 12px 0;
}
body.in-game .v2-comp-card,
body.in-game .v2-sr-q-block {
  padding: 12px;
}
body.in-game .v2-comp-q,
body.in-game .v2-sr-q-text,
body.in-game .question-block {
  margin-bottom: 8px;
}
body.in-game .v2-comp-opt,
body.in-game .v2-sr-opt,
body.in-game .opt-btn {
  padding: 9px 10px;
}
body.in-game .v2-rsvp-arena,
body.in-game .v2-stroop-arena {
  height: min(170px, calc(var(--play-h) * .34));
}
body.in-game .v2-nb-grid {
  width: min(250px, 64vw, calc(var(--play-h) * .42));
}
body.in-game .v2-simon-grid {
  width: min(250px, 72vw, calc(var(--play-h) * .48));
}
body.in-game .v2-rt-screen {
  height: min(190px, calc(var(--play-h) * .36));
}
body.in-game .v2-sr-text {
  padding: 12px 14px;
  line-height: 1.45;
}
body.in-game .v2-sdc-sym,
body.in-game .v2-dm-disp {
  min-height: 58px;
}
body.in-game .v2-fc-number {
  min-height: 64px;
}
body.in-game .v2-pv-canvas,
body.in-game .trail-canvas,
body.in-game .focus-canvas,
body.in-game .periph-canvas {
  max-width: 100%;
  max-height: calc(var(--play-h) - 86px);
}
body.in-game .v2-vs-grid,
body.in-game .v2-ho-grid {
  max-height: calc(var(--play-h) - 112px);
}
body.in-game .face-grid,
body.in-game .hidden-grid,
body.in-game .coding-row {
  max-height: calc(var(--play-h) - 110px);
  overflow: hidden;
}

@media (max-height: 720px) {
  .app-header {
    height: 52px;
    padding: 0 16px;
  }
  #screen-game.active {
    height: calc(100dvh - 52px);
  }
  .game-header {
    height: 48px;
    flex-basis: 48px;
    padding: 0 14px;
    gap: 10px;
  }
  .back-btn {
    padding: 6px 10px;
    font-size: .78rem;
  }
  .game-title-text,
  .timer-display,
  .score-display {
    font-size: .82rem;
  }
  .game-hdr-meta {
    gap: 8px;
  }
  .game-content {
    --play-h: calc(100dvh - 100px);
    height: var(--play-h);
    padding: 8px;
  }
  body.in-game .v2i-rules {
    display: none;
  }
  body.in-game .v2i-sub {
    max-width: 420px;
  }
  body.in-game .v2-stroop-hud,
  body.in-game .v2-mm-hud,
  body.in-game .v2-mc-hud,
  body.in-game .v2-rc-hud {
    margin-bottom: 4px;
  }
  body.in-game .v2-sh-timer {
    width: 54px;
    height: 54px;
  }
  body.in-game .v2-sdc-key,
  body.in-game .v2-su-key,
  body.in-game .v2-rc-btn,
  body.in-game .v2-dm-btn {
    height: 46px;
  }
}

@media (max-width: 640px) {
  .header-actions .icon-btn:nth-child(n+2) {
    display: none;
  }
  .game-content {
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    contain: none;
  }
  .game-content > * {
    max-height: none;
  }
  body.in-game .v2-intro,
  body.in-game .module-controls,
  body.in-game .v2-comp-wrap,
  body.in-game .v2-nm-wrap,
  body.in-game .v2-pm-wrap,
  body.in-game .v2-stroop-wrap,
  body.in-game .v2-nback-wrap,
  body.in-game .v2-mm-wrap,
  body.in-game .v2-ms-wrap,
  body.in-game .v2-rot-wrap,
  body.in-game .v2-oot-wrap,
  body.in-game .v2-seq-wrap,
  body.in-game .v2-mc-wrap,
  body.in-game .v2-fc-wrap,
  body.in-game .v2-pv-wrap,
  body.in-game .v2-vs-wrap,
  body.in-game .v2-simon-wrap,
  body.in-game .v2-rt-wrap,
  body.in-game .v2-mt-wrap,
  body.in-game .v2-wa-wrap,
  body.in-game .v2-sr-wrap,
  body.in-game .v2-sr-q-wrap,
  body.in-game .v2-sdc-wrap,
  body.in-game .v2-ho-wrap,
  body.in-game .v2-dm-wrap,
  body.in-game .v2-rc-wrap,
  body.in-game .v2-su-wrap,
  body.in-game .matrix-wrap,
  body.in-game .q-set,
  body.in-game .game-panel {
    max-height: none;
    overflow: visible;
  }
  body.in-game .module-level-grid {
    grid-template-columns: 1fr;
  }
  body.in-game .v2-intro {
    width: calc(100vw - 64px);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }
  body.in-game .game-scoreboard {
    max-width: 100%;
  }
  body.in-game .scoreboard-levels {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.in-game .scoreboard-recent {
    align-items: flex-start;
    flex-direction: column;
  }
  body.in-game .scoreboard-recent div {
    justify-content: flex-start;
  }
  body.in-game .module-level-btn {
    min-height: 54px;
  }
  body.in-game .module-seek,
  body.in-game .v2i-sub,
  body.in-game .v2-start-btn {
    max-width: calc(100vw - 32px);
  }
  body.in-game .v2i-sub {
    width: min(100%, 300px);
    overflow-wrap: anywhere;
  }
}

/* Complex games 31-35 */
.complex-wrap {
  width: min(100%, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.complex-clues {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
}
.complex-clues div,
.complex-feedback,
.maze-meta {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--txt2);
  font-size: .86rem;
}
.logic-assign-grid {
  display: grid;
  gap: 10px;
  width: 100%;
}
.logic-assign-grid label {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  text-align: left;
}
.logic-assign-grid span { font-weight: 800; color: var(--txt); }
.logic-assign-grid select {
  min-height: 40px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--card);
  color: var(--txt);
  padding: 0 10px;
}
.maze-grid {
  display: grid;
  gap: 4px;
  width: min(92vw, 420px);
}
.maze-cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--txt2);
  font-weight: 900;
}
.maze-cell.wall { background: #182033; opacity: .6; }
.maze-cell.key { color: var(--yellow); border-color: rgba(245,158,11,.5); }
.maze-cell.goal { color: var(--green); border-color: rgba(16,185,129,.55); }
.maze-cell.player { background: rgba(139,92,246,.22); color: var(--purple); border-color: var(--purple); }
.op-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  color: var(--txt2);
  font-size: .86rem;
}
.op-rule {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(20,184,166,.16);
  color: var(--reasoning);
  font-weight: 900;
  letter-spacing: .08em;
}
.op-numbers,
.spatial-start {
  font-size: clamp(2.4rem, 12vw, 4.5rem);
  font-weight: 900;
  color: var(--txt);
}
.op-choices,
.spatial-options,
.analogy-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
.op-choice,
.spatial-option,
.analogy-option {
  min-height: 56px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-weight: 900;
}
.op-choice.correct,
.spatial-option.correct,
.analogy-option.correct { border-color: var(--green); background: rgba(16,185,129,.18); }
.op-choice.wrong,
.spatial-option.wrong,
.analogy-option.wrong { border-color: var(--red); background: rgba(239,68,68,.16); }
.spatial-seq {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.spatial-seq span {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--txt2);
  font-weight: 800;
}
.spatial-prompt { color: var(--txt2); font-weight: 700; }
.analogy-line {
  width: 100%;
  padding: 16px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: clamp(1.25rem, 6vw, 2rem);
  font-weight: 900;
}
.analogy-line.muted { color: var(--cyan); }

@media (max-width: 640px) {
  body.in-game .complex-wrap {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }
  .logic-assign-grid label {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .op-choices,
  .spatial-options,
  .analogy-options {
    grid-template-columns: 1fr;
  }
  .maze-grid {
    width: min(86vw, 340px);
    gap: 3px;
  }
  .maze-cell {
    border-radius: 4px;
    font-size: .76rem;
  }
}
