/* Arcade Pass — visual system: arcade-at-night palette, display + numeric faces. */
:root {
  --c-ground: #0a0d14;
  --c-surface: #131826;
  --c-surface-2: #1a2032;
  --c-border: rgba(255, 255, 255, 0.08);
  --c-text: #eef1f7;
  --c-text-muted: #8a92a8;
  --c-warm: #ff9a3c;
  --c-warm-strong: #ff7a1a;
  --c-cool: #38e1c6;
  --c-urgent: #ff5c5c;
  --c-gold: #f4c14d;
  --c-silver: #c7ccd6;
  --c-bronze: #d68a4c;
  --c-magenta: #e15bf0;
  --c-green: #4ce38a;

  --c-cat-reflex: var(--c-cool);
  --c-cat-puzzle: var(--c-magenta);
  --c-cat-classic: var(--c-gold);
  --c-cat-daily: var(--c-green);

  --glow-gold: 0 0 16px rgba(244, 193, 77, 0.45);
  --glow-cool: 0 0 16px rgba(56, 225, 198, 0.45);
  --glow-magenta: 0 0 16px rgba(225, 91, 240, 0.45);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.35);
  --shadow-warm: 0 8px 20px rgba(255, 122, 26, 0.28);

  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 250ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--c-ground);
  color: var(--c-text);
  font-family: var(--font-body);
}

body {
  display: flex;
  flex-direction: column;
  padding-left: calc(var(--sp-4) + var(--safe-left));
  padding-right: calc(var(--sp-4) + var(--safe-right));
  padding-bottom: calc(64px + var(--sp-4) + var(--safe-bottom));
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

button { font-family: inherit; color: inherit; }

#app-header {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--sp-4) + var(--safe-top)) 0 var(--sp-3);
  background: linear-gradient(var(--c-ground) 60%, transparent);
}

.wordmark { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display); font-weight: 600; font-size: 16px; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn:active { transform: scale(0.94); background: var(--c-surface-2); }

.pill-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 40px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.pill-btn:active { transform: scale(0.96); background: var(--c-surface-2); }

/* Wallet sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-end;
  background: rgba(4, 6, 10, 0.6);
  backdrop-filter: blur(2px);
  transition: opacity var(--dur) var(--ease);
}
.sheet-backdrop.hidden { display: none; }
.sheet-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: calc(var(--sp-5) + var(--safe-bottom));
  animation: sheet-in var(--dur-slow) var(--ease);
}
@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.wallet-body { display: flex; flex-direction: column; gap: var(--sp-4); }
.wallet-address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-body);
}
.wallet-balances { display: flex; gap: var(--sp-3); }
.wallet-balance {
  flex: 1;
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.wallet-balance .wallet-balance-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; display: block; }
.wallet-balance .wallet-balance-label { color: var(--c-text-muted); font-size: 12px; }
.wallet-input {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text);
  padding: 0 var(--sp-4);
  font-size: 15px;
  font-family: inherit;
}
.wallet-input:focus { outline: 2px solid var(--c-cool); outline-offset: -1px; }
.wallet-error { color: var(--c-urgent); font-size: 13px; }
.wallet-divider { border-top: 1px solid var(--c-border); margin: 0; }
.wallet-divider-label { text-align: center; }
.wallet-section-label { font-weight: 600; margin: 0; }
.wallet-body a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
#wallet-telegram-widget { display: flex; justify-content: center; min-height: 40px; }

#app-main { flex: 1; display: flex; flex-direction: column; max-width: 430px; width: 100%; margin: 0 auto; position: relative; }

@media (min-width: 760px) {
  body { padding-top: var(--sp-6); }
}

.screen {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.screen.hidden { display: none; }
.screen.entering { opacity: 0; transform: translateY(8px); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: var(--sp-5);
}

.section-title { font-size: 15px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: var(--sp-2); }

.muted { color: var(--c-text-muted); }
.small { font-size: 13px; }

.link-btn {
  background: none;
  border: 0;
  padding: var(--sp-2) 0;
  color: var(--c-cool);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: 48px;
}

/* Buttons */
.btn {
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  padding: 0 var(--sp-5);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--c-warm); color: #16110a; box-shadow: var(--shadow-warm); }
.btn-secondary { background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-lg { width: 100%; font-size: 18px; min-height: 56px; }
.btn:disabled { opacity: 0.5; transform: none; cursor: default; }

/* Home: teaser + game list */
.teaser-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.teaser-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.teaser-head h2 { font-size: 16px; }

.mini-rows, .board-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
}
.row.row--me { border: 1px solid var(--c-cool); background: rgba(56, 225, 198, 0.08); }
.row .rank { font-family: var(--font-display); font-weight: 700; width: 24px; flex-shrink: 0; color: var(--c-text-muted); }
.row .rank.gold { color: var(--c-gold); }
.row .rank.silver { color: var(--c-silver); }
.row .rank.bronze { color: var(--c-bronze); }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .score { font-family: var(--font-body); font-weight: 700; color: var(--c-cool); }
.row-sep { text-align: center; color: var(--c-text-muted); letter-spacing: 0.3em; font-size: 12px; padding: var(--sp-1) 0; }

.prize-card, .hero-pool { display: flex; flex-direction: column; gap: var(--sp-3); }
.hero-pool {
  position: relative;
  overflow: hidden;
  border-color: rgba(244, 193, 77, 0.25);
}
.hero-pool::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(244, 193, 77, 0.16) 48%, transparent 66%);
  background-size: 220% 100%;
  animation: pool-shimmer 4.5s linear infinite;
  pointer-events: none;
}
.prize-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.prize-amount { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--c-gold); text-shadow: var(--glow-gold); }
.prize-split { color: var(--c-text-muted); font-size: 13px; }
.prize-countdown { font-variant-numeric: tabular-nums; }
.prize-winners-label { margin: 0; font-size: 13px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Countdown: each digit "flips" in place when it changes value */
.countdown-flip {
  display: inline-flex;
  gap: 2px;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}
.countdown-flip .cf-digit {
  display: inline-block;
  min-width: 0.62em;
  text-align: center;
}
.countdown-flip .cf-digit.cf-flip { animation: cf-flip var(--dur-slow) var(--ease); }
.countdown-flip .cf-sep { opacity: 0.5; }

/* Home: live stats row */
.stats-row { display: flex; gap: var(--sp-3); }
.stat-pill {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
}
.stat-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.stat-label { color: var(--c-text-muted); font-size: 12px; }
.stat-pill--live .stat-value { color: var(--c-cool); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-cool); animation: live-dot-pulse 1.6s var(--ease) infinite; }

/* Home: my rank */
.me-card { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); }
.me-rank { font-weight: 600; font-size: 14px; }
.me-streak { color: var(--c-magenta); text-shadow: var(--glow-magenta); font-weight: 600; font-size: 13px; white-space: nowrap; }

/* Leaderboard screen: season rewards panel + "how it works" sheet */
.season-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.season-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.season-head .section-title { margin-top: 0; }
.season-rank-text { margin: 0; font-weight: 600; font-size: 15px; }
.season-tiers { display: flex; gap: var(--sp-2); }
.season-tier {
  flex: 1;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-size: 12px;
  font-weight: 600;
}
.season-tier--reached { border-color: var(--c-gold); color: var(--c-gold); text-shadow: var(--glow-gold); }
.season-sheet-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.season-sheet-body p { margin: 0; font-size: 14px; }
.season-sheet-body strong { color: var(--c-warm); }

/* Friends screen */
.invite-card { display: flex; flex-direction: column; gap: var(--sp-3); align-items: stretch; }
.invite-pitch { margin: 0; color: var(--c-text); font-size: 15px; }
.invite-pitch strong { color: var(--c-warm); }
.invite-link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.invite-link-code { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; color: var(--c-text-muted); font-size: 13px; }
.friends-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }

/* Home: live activity ticker */
.activity-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.activity-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); max-height: 220px; overflow: hidden; }
.activity-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
}
.activity-row--in { animation: activity-slide-in var(--dur-slow) var(--ease); }
.activity-text { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { color: var(--c-text-muted); font-size: 12px; flex-shrink: 0; }

/* Hero: mascot + pool + countdown + Play, above the fold on a phone */
.hero { position: relative; padding-top: var(--sp-3); }
.hero-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  width: 320px;
  height: 320px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(56, 225, 198, 0.16), rgba(255, 154, 60, 0.08) 55%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.hero-grid {
  position: absolute;
  inset: -8px -8px auto -8px;
  height: 220px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 16px 16px;
  -webkit-mask-image: radial-gradient(closest-side, black, transparent 85%);
  mask-image: radial-gradient(closest-side, black, transparent 85%);
  pointer-events: none;
  z-index: 0;
}
.hero-mascot { position: relative; z-index: 1; display: flex; justify-content: center; margin-bottom: var(--sp-2); }
.hero-mascot .mascot-svg { filter: drop-shadow(0 0 14px rgba(56, 225, 198, 0.35)); }
.hero-content { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.hero-eyebrow { margin: 0; text-align: center; color: var(--c-text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-play-btn { margin-top: var(--sp-1); }

@media (min-width: 760px) {
  .hero-mascot { position: absolute; left: -180px; top: 40px; margin: 0; }
  .hero-mascot .mascot-svg { width: 140px; height: 140px; }
}

/* Filter chips */
.chip-row { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.filter-chip:active { transform: scale(0.95); }
.filter-chip.active { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-cool); }

/* Hero carousel: 3 large living previews (newest, most played today, one daily), swipeable */
.hero-carousel { position: relative; border-radius: var(--r-lg); overflow: hidden; touch-action: pan-y; }
.hero-carousel-track { display: flex; transition: transform var(--dur-slow) var(--ease); }
.hero-slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-surface);
}
.hero-slide-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-slide-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6, 8, 14, 0.88) 0%, rgba(6, 8, 14, 0.25) 55%, transparent 80%);
}
.hero-slide-body { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.hero-slide-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.hero-slide-hook { color: var(--c-text-muted); font-size: 13px; }
.hero-slide-play { padding: 0 var(--sp-5); height: 40px; }
.hero-carousel-dots { position: absolute; left: 0; right: 0; bottom: var(--sp-2); display: flex; justify-content: center; gap: var(--sp-2); z-index: 1; }
.hero-dot { width: 6px; height: 6px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, 0.35); cursor: pointer; transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.hero-dot.active { background: var(--c-text); transform: scale(1.3); }

/* Game grid: 2 columns (3 on wide screens), 1:1 living tiles with a per-game colour glow */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
@media (min-width: 560px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
}
.game-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  overflow: hidden;
  background: var(--c-surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 0 hsla(var(--tile-hue, 190), 80%, 60%, 0);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
.game-card:active { transform: scale(0.96); }
.game-card:hover, .game-card:focus-visible {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 24px 0 hsla(var(--tile-hue, 190), 80%, 60%, 0.35);
  outline: none;
}
.game-card-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.game-card-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6, 8, 14, 0.85) 0%, rgba(6, 8, 14, 0.15) 50%, rgba(6, 8, 14, 0.35) 100%);
}
.game-card-badges { position: absolute; top: var(--sp-2); left: var(--sp-2); display: flex; gap: var(--sp-1); z-index: 1; }
.game-card-info {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(6, 8, 14, 0.55);
  color: var(--c-text);
  font-family: var(--font-display);
  font-size: 11px;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
}
.game-card-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.game-card-name { font-family: var(--font-display); font-weight: 600; font-size: 14px; line-height: 1.15; }
.game-card-sub { color: var(--c-text-muted); font-size: 11px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.game-card-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--c-text);
  background: rgba(6, 8, 14, 0.6);
  padding: 3px var(--sp-2);
  border-radius: var(--r-pill);
}
.badge-new {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #16110a;
  background: var(--c-warm);
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

/* Game detail sheet: tap-and-hold or the "i" badge on any tile */
.game-sheet-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.game-sheet-canvas {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  display: block;
}
.game-sheet-instructions { margin: 0; color: var(--c-text-muted); font-size: 13px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.game-sheet-top-label { margin: 0; }

/* Bottom tab bar */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding: var(--sp-2) calc(var(--sp-2) + var(--safe-left)) calc(var(--sp-2) + var(--safe-bottom)) calc(var(--sp-2) + var(--safe-right));
  background: rgba(19, 24, 38, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--c-border);
}
.tab-btn {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--sp-1) 0;
  border: 0;
  background: none;
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.tab-btn:active { transform: scale(0.94); }
.tab-btn.active { color: var(--c-cool); }
.tab-bar.hidden { display: none; }

/* Game screen */
.full-bleed {
  position: fixed;
  inset: 0;
  padding: calc(var(--sp-4) + var(--safe-top)) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom)) calc(var(--sp-4) + var(--safe-left));
  background: var(--c-ground);
  z-index: 10;
  gap: var(--sp-4);
}

.game-hud { position: relative; display: flex; align-items: center; justify-content: space-between; }
.hud-stat { display: flex; flex-direction: column; align-items: flex-start; min-width: 64px; }
.hud-stat--time { align-items: flex-end; }
.hud-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-muted); }
.hud-value { font-size: 32px; font-weight: 700; line-height: 1.1; }
#hud-score { color: var(--c-cool); text-shadow: var(--glow-cool); }
#hud-time { color: var(--c-text); transition: color var(--dur) var(--ease); }
#hud-time.urgent { color: var(--c-urgent); animation: pulse 1s var(--ease) infinite; }
.score-pop {
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--c-cool);
  pointer-events: none;
  animation: score-pop-rise 700ms var(--ease) forwards;
}
.game-name { font-size: 15px; color: var(--c-text-muted); font-weight: 500; align-self: center; }

.game-arena {
  position: relative;
  flex: 1;
  width: 100%;
  border-radius: var(--r-lg);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  overflow: hidden;
}

.tap-hud { display: none; } /* superseded by .game-hud; kept selector so tap.js markup stays valid */
.tap-arena { position: relative; width: 100%; height: 100%; }
.tap-target {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: var(--c-warm);
  box-shadow: 0 0 0 0 rgba(255, 154, 60, 0.5);
  transition: left var(--dur-fast) var(--ease), top var(--dur-fast) var(--ease);
}
.tap-target--hit { animation: hit-flash 150ms var(--ease); }

.seq-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-5); width: 100%; height: 100%; padding: var(--sp-5); }
.seq-level { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 15px; }
.seq-level-num { color: var(--c-text); }
.seq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); width: 100%; max-width: 280px; aspect-ratio: 1; }
.seq-pad {
  border: 0;
  border-radius: var(--r-md);
  opacity: 0.55;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.seq-pad[data-key='a'] { background: var(--c-warm); }
.seq-pad[data-key='b'] { background: var(--c-cool); }
.seq-pad[data-key='c'] { background: var(--c-gold); }
.seq-pad[data-key='d'] { background: var(--c-urgent); }
.seq-pad--lit { opacity: 1; transform: scale(0.96); box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08); }
.seq-pad--wrong { opacity: 1; box-shadow: 0 0 0 8px rgba(255, 92, 92, 0.35); }

.stack-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.swipe-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.flap-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.blocks-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.m3-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.bg-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.ck-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.cp-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.pm-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.tb-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.scw-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.hole-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.mg-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.breakout-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.ct-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-5); width: 100%; height: 100%; padding: var(--sp-5); }
.ct-target { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 17px; }
.ct-target-name { font-weight: 700; }
.ct-target-name[data-color='warm'] { color: var(--c-warm); }
.ct-target-name[data-color='cool'] { color: var(--c-cool); }
.ct-target-name[data-color='gold'] { color: var(--c-gold); }
.ct-target-name[data-color='urgent'] { color: var(--c-urgent); }
.ct-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); width: 100%; max-width: 320px; aspect-ratio: 1; }
.ct-tile {
  border: 0;
  border-radius: var(--r-md);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ct-tile[data-color='warm'] { background: var(--c-warm); }
.ct-tile[data-color='cool'] { background: var(--c-cool); }
.ct-tile[data-color='gold'] { background: var(--c-gold); }
.ct-tile[data-color='urgent'] { background: var(--c-urgent); }
.ct-tile--hit { animation: hit-flash 150ms var(--ease); }
.ct-tile--wrong { box-shadow: 0 0 0 8px rgba(255, 92, 92, 0.35); }

.mp-root { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: var(--sp-5); }
.mp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); width: 100%; max-width: 320px; aspect-ratio: 1; perspective: 800px; }
.mp-card { border: 0; background: none; padding: 0; }
.mp-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--dur-slow) var(--ease);
}
.mp-card--flipped .mp-card-inner { transform: rotateY(180deg); }
.mp-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  backface-visibility: hidden;
}
.mp-card-front { background: var(--c-surface-2); }
.mp-card-back { background: var(--c-surface); transform: rotateY(180deg); }
.mp-symbol { width: 44%; height: 44%; border-radius: 50%; }
.mp-card[data-kind='0'] .mp-symbol { background: var(--c-warm); }
.mp-card[data-kind='1'] .mp-symbol { background: var(--c-cool); }
.mp-card[data-kind='2'] .mp-symbol { background: var(--c-urgent); }
.mp-card[data-kind='3'] .mp-symbol { background: var(--c-gold); }
.mp-card[data-kind='4'] .mp-symbol { background: var(--c-magenta); }
.mp-card[data-kind='5'] .mp-symbol { background: var(--c-green); }
.mp-card[data-kind='6'] .mp-symbol { background: var(--c-silver); }
.mp-card[data-kind='7'] .mp-symbol { background: var(--c-bronze); }
.mp-card--matched { opacity: 0.45; }
.mp-card--wrong .mp-card-back { box-shadow: 0 0 0 6px rgba(255, 92, 92, 0.35); }

.wk-root { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: var(--sp-5); }
.wk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); width: 100%; max-width: 320px; aspect-ratio: 1; }
.wk-hole {
  position: relative;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--c-ground);
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.wk-mound {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -10%;
  height: 55%;
  border-radius: 50%;
  background: var(--c-bronze);
  opacity: 0.35;
}
.wk-mole {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 6%;
  height: 56%;
  border-radius: var(--r-md) var(--r-md) 40% 40%;
  background: var(--c-warm);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--dur-fast) var(--ease);
}
.wk-hole--up .wk-mole { transform: scaleY(1); }
.wk-hole--miss { box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(255, 92, 92, 0.35); }

.rx-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); width: 100%; height: 100%; padding: var(--sp-5); }
.rx-round { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 15px; }
.rx-round-num { color: var(--c-text); }
.rx-arena {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--c-text);
  transition: background var(--dur-fast) var(--ease);
  touch-action: manipulation;
}
.rx-arena--wait { background: var(--c-surface-2); }
.rx-arena--go { background: var(--c-cool); color: var(--c-ground); }
.rx-arena--hit { background: var(--c-gold); color: var(--c-ground); }
.rx-arena--false { background: var(--c-urgent); }

.mq-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-6); width: 100%; height: 100%; padding: var(--sp-5); }
.mq-card { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); width: 100%; max-width: 320px; }
.mq-equation { font-family: var(--font-display); font-weight: 700; font-size: 32px; color: var(--c-text); }
.mq-timerbar { width: 100%; height: 8px; border-radius: var(--r-md); background: var(--c-surface-2); overflow: hidden; }
.mq-timerbar-fill { height: 100%; background: var(--c-cool); transition: width 90ms linear; }
.mq-timerbar-fill--wrong { background: var(--c-urgent); }
.mq-actions { display: flex; gap: var(--sp-4); width: 100%; max-width: 320px; }
.mq-btn {
  flex: 1;
  border: 0;
  border-radius: var(--r-lg);
  padding: var(--sp-5) 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--c-ground);
  transition: transform var(--dur-fast) var(--ease);
  touch-action: manipulation;
}
.mq-btn--false { background: var(--c-urgent); }
.mq-btn--true { background: var(--c-green); }
.mq-btn--hit { animation: hit-flash 150ms var(--ease); }
.mq-btn--wrong { box-shadow: 0 0 0 8px rgba(255, 92, 92, 0.35); }

.game-intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  text-align: center;
  padding: var(--sp-5);
  background: rgba(10, 13, 20, 0.92);
  border-radius: var(--r-lg);
}
.game-intro p { margin: 0; color: var(--c-text-muted); max-width: 260px; }
.game-intro.hidden { display: none; }

/* Result screen */
.result-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); }
.result-mascot { margin-bottom: -4px; }
.result-mascot .mascot-svg { filter: drop-shadow(0 0 14px rgba(56, 225, 198, 0.35)); }
.eyebrow { margin: 0; color: var(--c-text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.result-score { font-family: var(--font-body); font-size: 56px; font-weight: 700; color: var(--c-cool); text-shadow: var(--glow-cool); margin: 0; }
.result-rank { margin: 0; color: var(--c-text); font-size: 15px; }
.result-delta { margin: 0; color: var(--c-cool); font-weight: 600; font-size: 13px; }
.pb-banner {
  background: rgba(255, 154, 60, 0.14);
  color: var(--c-warm);
  font-weight: 600;
  font-size: 13px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
}
.result-actions { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; margin-top: var(--sp-2); }

/* Leaderboard: podium for the top 3 + a pinned row for the player if they're off-board */
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.podium:empty { display: none; }
.podium-slot { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; }
.podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--c-ground);
}
.podium-slot--1 .podium-avatar { width: 60px; height: 60px; font-size: 20px; background: var(--c-gold); box-shadow: var(--glow-gold); }
.podium-slot--2 .podium-avatar { background: var(--c-silver); }
.podium-slot--3 .podium-avatar { background: var(--c-bronze); }
.podium-name { font-size: 12px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { font-size: 12px; color: var(--c-text-muted); }
.podium-bar { width: 100%; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--c-surface-2); }
.podium-slot--1 .podium-bar { height: 64px; background: rgba(244, 193, 77, 0.18); }
.podium-slot--2 .podium-bar { height: 44px; }
.podium-slot--3 .podium-bar { height: 30px; }

.board-pinned { position: sticky; bottom: calc(64px + var(--sp-3) + var(--safe-bottom)); }
.board-pinned .row { border: 1px solid var(--c-cool); background: rgba(56, 225, 198, 0.1); box-shadow: var(--shadow-card); }
.board-pinned-gap { color: var(--c-text-muted); font-size: 12px; margin: 0 0 var(--sp-1); text-align: center; }

/* Daily Sudoku */
.sd-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); width: 100%; height: 100%; padding: var(--sp-3); }
.sd-status { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; }
.sd-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  background: var(--c-surface);
  border: 2px solid var(--c-text);
  border-radius: var(--r-md);
  overflow: hidden;
}
.sd-cell {
  position: relative;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.sd-cell--border-l { border-left: 2px solid var(--c-text); }
.sd-cell--border-t { border-top: 2px solid var(--c-text); }
.sd-cell--peer { background: var(--c-surface-2); }
.sd-cell--selected { background: rgba(56, 225, 198, 0.25); }
.sd-cell--same-value:not(.sd-cell--selected) { color: var(--c-cool); }
.sd-cell--wrong { background: rgba(255, 92, 92, 0.35); animation: hit-flash 300ms var(--ease); }
.sd-val { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--c-text); }
.sd-cell--given .sd-val { color: var(--c-text-muted); }
.sd-notes { display: none; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; }
.sd-cell--empty .sd-notes { display: grid; }
.sd-cell--empty .sd-val { display: none; }
.sd-note { display: flex; align-items: center; justify-content: center; font-size: 9px; color: transparent; }
.sd-note--on { color: var(--c-text-muted); }
.sd-keypad { display: flex; flex-wrap: wrap; gap: var(--sp-2); width: 100%; max-width: 360px; justify-content: center; }
.sd-key {
  flex: 1 1 auto;
  min-width: 30px;
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  touch-action: manipulation;
}
.sd-notes-toggle {
  flex: 1 1 100%;
  border: 0;
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  touch-action: manipulation;
}
.sd-notes-toggle--active { background: var(--c-cool); color: var(--c-ground); }

/* Daily Solitaire */
.kd-root { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; height: 100%; padding: var(--sp-3); overflow-y: auto; }
.kd-status { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; text-align: center; flex-shrink: 0; }
.kd-top, .kd-tableau { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-2); flex-shrink: 0; }
.kd-tableau { flex: 1; align-items: start; }
.kd-slot { position: relative; aspect-ratio: 0.68; }
.kd-slot--empty { border: 2px dashed var(--c-border); border-radius: var(--r-sm); }
.kd-spacer { flex-shrink: 0; }
.kd-col { position: relative; display: flex; flex-direction: column; min-height: 24px; }
.kd-card {
  position: relative;
  width: 100%;
  aspect-ratio: 0.68;
  border: 0;
  border-radius: var(--r-sm);
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  background: var(--c-text);
  color: #16110a;
  box-shadow: var(--shadow-card);
  touch-action: manipulation;
}
.kd-col .kd-card:not(:first-child) { margin-top: -58%; }
.kd-card--red { color: var(--c-urgent); }
.kd-card--back { background: var(--c-cool); }
.kd-card--selected { outline: 3px solid var(--c-gold); outline-offset: -2px; z-index: 1; }
.kd-card-corner-top { line-height: 1; }
.kd-card-corner-bottom { align-self: flex-end; line-height: 1; transform: rotate(180deg); }
.kd-card-center { align-self: center; font-size: 15px; }
.kd-slot-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--c-text-muted); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sp-6) + var(--safe-bottom));
  transform: translate(-50%, 0);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-pill);
  font-size: 14px;
  z-index: 20;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 8px); }

.hidden { display: none !important; }

/* Confetti */
#confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall 1100ms linear forwards;
}

@keyframes hit-flash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 154, 60, 0.6); }
  50% { transform: scale(0.82); box-shadow: 0 0 0 10px rgba(255, 154, 60, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 154, 60, 0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.75; }
}
@keyframes confetti-fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(100vh) rotate(540deg); opacity: 0; }
}
@keyframes live-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
@keyframes activity-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes score-pop-rise {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-28px) scale(1.15); }
}
@keyframes pool-shimmer {
  from { background-position: 120% 0; }
  to { background-position: -20% 0; }
}
@keyframes cf-flip {
  0% { transform: rotateX(90deg); opacity: 0.3; }
  100% { transform: rotateX(0deg); opacity: 1; }
}
@keyframes tile-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes hero-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Home load: tiles fade/scale in staggered; hero slides in; leaderboard-shaped lists (teaser
   rows, the leaderboard screen, the game sheet's top 3) fade/slide in with a small stagger. */
.tile-in { animation: tile-in 320ms var(--ease) both; }
.hero.hero-in { animation: hero-in var(--dur-slow) var(--ease) both; }
.stagger-in { animation: activity-slide-in var(--dur-slow) var(--ease) both; }

/* Mascot + game icons: sized by their container, colored to match the surrounding surface */
.mascot-svg { display: block; margin: 0 auto; }
.row-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  text-align: center;
}
.empty-mascot { display: flex; justify-content: center; margin-bottom: var(--sp-2); opacity: 0.7; }
.empty-mascot .mascot-svg { width: 44px; height: 44px; }

/* Daily Word */
.wd-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); width: 100%; height: 100%; padding: var(--sp-3); }
.wd-status { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; min-height: 16px; }
.wd-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-2); width: 100%; max-width: 280px; }
.wd-cell {
  aspect-ratio: 1;
  border: 2px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--c-text);
}
.wd-cell--filled { border-color: var(--c-text-muted); }
.wd-cell--flip { animation: cf-flip var(--dur-slow) var(--ease); }
.wd-cell--shake { animation: hit-flash 300ms var(--ease); }
.wd-cell--correct { background: var(--c-green); border-color: var(--c-green); color: var(--c-ground); }
.wd-cell--present { background: var(--c-gold); border-color: var(--c-gold); color: var(--c-ground); }
.wd-cell--absent { background: var(--c-surface-2); border-color: var(--c-surface-2); color: var(--c-text-muted); }
.wd-keyboard { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; max-width: 360px; }
.wd-key-row { display: flex; gap: var(--sp-1); justify-content: center; }
.wd-key {
  flex: 1 1 0;
  min-width: 0;
  max-width: 34px;
  height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  touch-action: manipulation;
}
.wd-key--wide { flex: 1.6 1 0; max-width: 54px; font-size: 11px; }
.wd-key--correct { background: var(--c-green); color: var(--c-ground); }
.wd-key--present { background: var(--c-gold); color: var(--c-ground); }
.wd-key--absent { background: var(--c-surface); color: var(--c-text-muted); }

/* Groups (Connections) */
.cn-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); width: 100%; height: 100%; padding: var(--sp-3); }
.cn-status { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; min-height: 16px; text-align: center; }
.cn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); width: 100%; max-width: 340px; }
.cn-tile {
  aspect-ratio: 1.4;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  color: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-1);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  line-height: 1.1;
  touch-action: manipulation;
}
.cn-tile--selected { background: var(--c-surface); border-color: var(--c-cool); box-shadow: inset 0 0 0 2px var(--c-cool); }
.cn-tile--solved { color: var(--c-ground); }
.cn-tile--gold { background: var(--c-gold); border-color: var(--c-gold); }
.cn-tile--green { background: var(--c-green); border-color: var(--c-green); }
.cn-tile--cool { background: var(--c-cool); border-color: var(--c-cool); }
.cn-tile--magenta { background: var(--c-magenta); border-color: var(--c-magenta); }
.cn-mistakes { display: flex; gap: var(--sp-2); }
.cn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-surface-2); border: 1px solid var(--c-border); }
.cn-dot--used { background: var(--c-urgent); border-color: var(--c-urgent); }
.cn-controls { display: flex; gap: var(--sp-2); width: 100%; max-width: 340px; }
.cn-controls .btn { flex: 1 1 0; min-height: 44px; font-size: 13px; }

.sb-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); width: 100%; height: 100%; padding: var(--sp-3); }
.sb-status { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; min-height: 16px; text-align: center; }
.sb-current { font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: 0.06em; color: var(--c-text); min-height: 32px; text-transform: uppercase; }
.sb-current-center { color: var(--c-gold); text-shadow: var(--glow-gold); }
.sb-hive { position: relative; width: 260px; height: 260px; max-width: 80vw; max-height: 80vw; }
.sb-cell {
  position: absolute;
  width: 30%;
  height: 30%;
  transform: translate(-50%, -50%);
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  background: var(--c-surface-2);
  color: var(--c-text);
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.sb-cell:active { transform: translate(-50%, -50%) scale(0.92); }
.sb-cell--center { background: var(--c-gold); color: var(--c-ground); box-shadow: var(--glow-gold); }
.sb-controls { display: flex; gap: var(--sp-2); width: 100%; max-width: 300px; }
.sb-controls .btn { flex: 1 1 0; min-height: 44px; font-size: 13px; }
.sb-found { display: flex; flex-wrap: wrap; gap: var(--sp-1); justify-content: center; max-width: 320px; max-height: 90px; overflow-y: auto; }
.sb-found-item { font-family: var(--font-body); font-size: 12px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-muted); }
.sb-found-item--pangram { background: var(--c-gold); color: var(--c-ground); font-weight: 700; }

.tv-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); width: 100%; height: 100%; padding: var(--sp-5); }
.tv-head { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); width: 100%; max-width: 340px; }
.tv-progress { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; }
.tv-dots { display: flex; gap: var(--sp-1); }
.tv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-surface-2); border: 1px solid var(--c-border); }
.tv-dot--correct { background: var(--c-green); border-color: var(--c-green); }
.tv-dot--wrong { background: var(--c-urgent); border-color: var(--c-urgent); }
.tv-timerbar { width: 100%; max-width: 340px; height: 6px; border-radius: var(--r-md); background: var(--c-surface-2); overflow: hidden; }
.tv-timerbar-fill { height: 100%; background: var(--c-cool); transition: width 90ms linear; }
.tv-timerbar-fill--wrong { background: var(--c-urgent); }
.tv-question {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--c-text);
  text-align: center;
  min-height: 56px;
  width: 100%;
  max-width: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tv-choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); width: 100%; max-width: 340px; }
.tv-choice {
  min-height: 56px;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  touch-action: manipulation;
}
.tv-choice:active { transform: scale(0.97); }
.tv-choice--correct { background: var(--c-green); color: var(--c-ground); border-color: var(--c-green); }
.tv-choice--wrong { background: var(--c-urgent); color: var(--c-ground); border-color: var(--c-urgent); }

.cs-root { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); width: 100%; height: 100%; padding: var(--sp-4); }
.cs-status { font-family: var(--font-display); font-weight: 600; color: var(--c-text-muted); font-size: 13px; min-height: 16px; text-align: center; }
.cs-tubes { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: var(--sp-2); max-width: 380px; }
.cs-tube { background: none; border: none; padding: 0; cursor: pointer; touch-action: manipulation; transition: transform var(--dur-fast) var(--ease); }
.cs-tube:active { transform: scale(0.96); }
.cs-tube--selected { transform: translateY(-10px); }
.cs-tube-glass {
  display: flex;
  flex-direction: column-reverse;
  width: 44px;
  height: 160px;
  border: 2px solid var(--c-border);
  border-radius: var(--r-sm) var(--r-sm) var(--r-lg) var(--r-lg);
  background: var(--c-surface);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.cs-tube--selected .cs-tube-glass { border-color: var(--c-cool); box-shadow: var(--glow-cool); }
.cs-seg { flex: 1 1 0; width: 100%; }
.cs-seg--empty { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
