/* ========================================================
   NEON REBUS — Cyberpunk Guessing Game
   ======================================================== */

:root {
  --bg-0: #05000f;
  --bg-1: #0a0118;
  --bg-2: #120428;
  --bg-card: rgba(20, 6, 45, 0.72);
  --bg-card-solid: #14062d;

  --neon-pink: #ff2a93;
  --neon-pink-soft: #ff77c4;
  --neon-cyan: #00f0ff;
  --neon-cyan-soft: #79f8ff;
  --neon-purple: #b14bff;
  --neon-yellow: #ffea3a;
  --neon-green: #39ff88;
  --neon-red: #ff2a3a;

  --text: #ecdcff;
  --text-dim: #9686b4;
  --text-faint: #5a4d7a;

  --grid: rgba(177, 75, 255, 0.07);
  --border: rgba(255, 42, 147, 0.28);
  --border-cyan: rgba(0, 240, 255, 0.32);
  --shadow-pink: 0 0 24px rgba(255, 42, 147, 0.55), 0 0 60px rgba(255, 42, 147, 0.25);
  --shadow-cyan: 0 0 24px rgba(0, 240, 255, 0.55), 0 0 60px rgba(0, 240, 255, 0.2);

  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  touch-action: pan-y; /* allow vertical scroll inside containers, no pinch */
}

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text);
  position: fixed;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Internal scroll container */
.app-root {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ========================================================
   PRELOADER
   ======================================================== */

.preloader {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a0438 0%, #05000f 70%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-content {
  text-align: center;
  padding: 20px;
}

.preloader-logo {
  font-family: var(--font-display, sans-serif);
  font-weight: 900;
  font-size: 42px;
  letter-spacing: 0.14em;
  color: #fff;
  text-shadow:
    0 0 14px rgba(255, 42, 147, 0.8),
    0 0 30px rgba(255, 42, 147, 0.5),
    0 0 60px rgba(177, 75, 255, 0.4);
  animation: logo-pulse 1.5s ease-in-out infinite;
}

.preloader-logo-accent {
  display: block;
  color: #ff2a93;
  margin-top: 4px;
  text-shadow:
    0 0 14px rgba(0, 240, 255, 0.8),
    0 0 30px rgba(0, 240, 255, 0.5);
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.preloader-sub {
  margin-top: 18px;
  font-family: var(--font-body, sans-serif);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #9686b4;
  text-transform: uppercase;
}

.preloader-bar {
  width: 220px;
  height: 4px;
  background: rgba(255, 42, 147, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin: 18px auto 0;
  position: relative;
}

.preloader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff2a93, #b14bff, #00f0ff);
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(255, 42, 147, 0.8);
  border-radius: 2px;
  transition: width 0.3s ease;
  animation: bar-shimmer 1.5s linear infinite;
}

@keyframes bar-shimmer {
  to { background-position: -200% 0; }
}

/* ========================================================
   BACKGROUND LAYERS
   ======================================================== */

.bg-grid {
  position: fixed; inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 0, 15, 0.08), rgba(5, 0, 15, 0.16)),
    url('assets/bg-neon.webp') center bottom / cover no-repeat,
    radial-gradient(ellipse at 50% 0%, #2a0860 0%, #0a0118 55%, #05000f 100%);
  z-index: -3;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255, 42, 147, 0.22) 0%, rgba(177, 75, 255, 0.10) 35%, transparent 70%);
  filter: blur(44px);
  z-index: -2;
  pointer-events: none;
  animation: pulse-glow 6s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.bg-scan {
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 240, 255, 0.02) 0px,
    rgba(0, 240, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ========================================================
   TOPBAR
   ======================================================== */

.topbar {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(10, 1, 24, 0.92) 0%, rgba(10, 1, 24, 0.4) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.back-btn {
  width: 40px; height: 40px;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(255, 42, 147, 0.08);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--neon-pink);
  cursor: pointer;
  transition: all 0.2s;
}
.back-btn:active { transform: scale(0.94); background: rgba(255, 42, 147, 0.2); }
.back-btn.show { display: flex; }

.title-wrap { flex: 1; min-width: 0; }

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 12px rgba(255, 42, 147, 0.6), 0 0 24px rgba(255, 42, 147, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}
.subtitle.is-hidden { display: none; }

.coins {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(255, 234, 58, 0.12), rgba(255, 42, 147, 0.08));
  border: 1px solid rgba(255, 234, 58, 0.4);
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(255, 234, 58, 0.2);
  transition: transform 0.2s;
}
.coins.bump { animation: coin-bump 0.5s ease; }
@keyframes coin-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); box-shadow: 0 0 28px rgba(255, 234, 58, 0.6); }
  100% { transform: scale(1); }
}

.coin-icon {
  color: var(--neon-yellow);
  font-size: 16px;
  text-shadow: 0 0 8px rgba(255, 234, 58, 0.8);
  font-weight: 900;
}
.coin-icon.big { font-size: 36px; }
.coin-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--neon-yellow);
  min-width: 28px;
  text-align: right;
}

.lives {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(255, 42, 58, 0.14), rgba(255, 42, 147, 0.08));
  border: 1px solid rgba(255, 42, 58, 0.42);
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(255, 42, 58, 0.18);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.lives.bump,
.lives-chip.bump { animation: life-bump 0.45s ease; }
.lives.low,
.lives-chip.low { border-color: var(--neon-yellow); box-shadow: 0 0 18px rgba(255, 234, 58, 0.22); }
.lives.empty,
.lives-chip.empty { border-color: var(--neon-red); animation: life-empty-pulse 1.1s ease-in-out infinite; }
.life-icon {
  color: var(--neon-red);
  font-size: 16px;
  text-shadow: 0 0 8px rgba(255, 42, 58, 0.85);
  font-weight: 900;
}
.life-amount {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  color: #ffdce6;
  min-width: 18px;
  text-align: right;
}
@keyframes life-bump {
  0% { transform: scale(1); }
  38% { transform: scale(1.14); box-shadow: 0 0 28px rgba(255, 42, 58, 0.55); }
  100% { transform: scale(1); }
}
@keyframes life-empty-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 42, 58, 0.15); }
  50% { box-shadow: 0 0 26px rgba(255, 42, 58, 0.45); }
}

/* ========================================================
   SCREENS
   ======================================================== */

.screen {
  display: none;
  padding: 16px;
  padding-bottom: 32px;
  max-width: 720px;
  margin: 0 auto;
  animation: screen-in 0.4s ease;
}
.screen.active { display: block; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   HOME
   ======================================================== */

.home-hero {
  text-align: center;
  padding: 24px 8px 28px;
}

.hero-emoji {
  font-size: 42px;
  letter-spacing: 4px;
  filter: drop-shadow(0 0 18px rgba(255, 42, 147, 0.7));
  margin-bottom: 14px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.neon-pink {
  color: var(--neon-pink);
  text-shadow: 0 0 16px rgba(255, 42, 147, 0.8), 0 0 32px rgba(255, 42, 147, 0.4);
}

.hero-sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.cat-card {
  position: relative;
  padding: 18px 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: left;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cat-color, var(--neon-pink)), transparent);
  opacity: 0.8;
}

.cat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--cat-color-soft, rgba(255, 42, 147, 0.18)) 0%, transparent 60%);
  pointer-events: none;
}

.cat-card:active {
  transform: scale(0.96);
  border-color: var(--cat-color, var(--neon-pink));
  box-shadow: 0 0 24px var(--cat-color-glow, rgba(255, 42, 147, 0.4));
}

.cat-card.featured {
  grid-column: 1 / -1;
  min-height: 110px;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(255, 42, 147, 0.1));
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.25);
}

.cat-card.featured::before {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink), var(--neon-cyan));
  height: 3px;
  animation: shimmer-line 3s linear infinite;
  background-size: 200% 100%;
}

@keyframes shimmer-line {
  to { background-position: -200% 0; }
}

.cat-card.featured .cat-emoji {
  font-size: 48px;
  flex-shrink: 0;
}

.cat-card.featured .cat-name {
  margin-top: 0;
  font-size: 15px;
}

.cat-card.featured .cat-info {
  flex: 1;
}

.cat-card.featured .featured-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.4);
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.cat-emoji {
  font-size: 36px;
  filter: drop-shadow(0 0 10px var(--cat-color-glow, rgba(255, 42, 147, 0.5)));
  position: relative; z-index: 1;
}

.cat-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  position: relative; z-index: 1;
  margin-top: 8px;
}

.cat-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(255, 42, 147, 0.6);
  z-index: 2;
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.cat-progress {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  position: relative; z-index: 1;
}

.cat-progress-bar {
  flex: 1; height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.cat-progress-fill {
  height: 100%;
  background: var(--cat-color, var(--neon-pink));
  box-shadow: 0 0 6px var(--cat-color, var(--neon-pink));
  transition: width 0.4s ease;
}

.cat-progress-text {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.home-footer {
  margin-top: 28px;
  text-align: center;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
}
.ghost-btn:active { color: var(--neon-red); border-color: var(--neon-red); }

/* ========================================================
   LEVELS GRID
   ======================================================== */

.levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding-top: 4px;
}

.level-tile {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
}
.level-tile:active { transform: scale(0.92); }

.level-tile.solved {
  background: linear-gradient(135deg, rgba(57, 255, 136, 0.15), rgba(0, 240, 255, 0.05));
  border-color: rgba(57, 255, 136, 0.5);
  color: var(--neon-green);
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.25);
}
.level-tile.solved::after {
  content: '✓';
  position: absolute;
  top: 4px; right: 6px;
  font-size: 10px;
  color: var(--neon-green);
}

.level-tile.current {
  background: linear-gradient(135deg, rgba(255, 42, 147, 0.18), rgba(177, 75, 255, 0.1));
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  box-shadow: 0 0 18px rgba(255, 42, 147, 0.4);
  animation: pulse-current 1.8s ease-in-out infinite;
}

@keyframes pulse-current {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 42, 147, 0.4); }
  50% { box-shadow: 0 0 24px rgba(255, 42, 147, 0.7); }
}

.level-tile.locked {
  background: rgba(20, 6, 45, 0.4);
  border-color: rgba(90, 77, 122, 0.3);
  color: var(--text-faint);
  cursor: not-allowed;
}
.level-tile.locked::before {
  content: '🔒';
  font-size: 14px;
}
.level-tile.locked .lvl-num { display: none; }

/* ========================================================
   GAME
   ======================================================== */

.game-stats {
  display: flex; gap: 10px;
  margin-bottom: 16px;
}

.stat-chip {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  border-radius: 12px;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.stat-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.lives-chip .stat-val {
  color: #ffdce6;
  text-shadow: 0 0 8px rgba(255, 42, 58, 0.7);
}
.stat-sub {
  font-family: var(--font-display);
  font-size: 9px;
  line-height: 1;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.lives-chip.low .stat-sub { color: var(--neon-yellow); }
.lives-chip.empty .stat-sub { color: var(--neon-red); }

.timer-chip.warning .stat-val {
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 234, 58, 0.7);
}
.timer-chip.danger { animation: timer-shake 0.5s ease infinite; border-color: var(--neon-red); }
.timer-chip.danger .stat-val {
  color: var(--neon-red);
  text-shadow: 0 0 10px rgba(255, 42, 58, 0.9);
}
@keyframes timer-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.puzzle-card {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 6, 45, 0.9), rgba(10, 1, 24, 0.9));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 16px;
  text-align: center;
  overflow: hidden;
  margin-bottom: 18px;
}

.puzzle-card::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-pink), transparent);
  box-shadow: 0 0 12px var(--neon-pink);
}

.puzzle-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  box-shadow: 0 0 12px var(--neon-cyan);
}

.puzzle-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 220px; height: 220px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 42, 147, 0.18) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  animation: puzzle-pulse 3s ease-in-out infinite;
}
@keyframes puzzle-pulse {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

.puzzle-emoji {
  position: relative;
  font-size: 64px;
  line-height: 1.15;
  letter-spacing: 4px;
  filter: drop-shadow(0 0 18px rgba(255, 42, 147, 0.6)) drop-shadow(0 0 32px rgba(0, 240, 255, 0.3));
  word-break: break-word;
  z-index: 1;
}

.puzzle-emoji.hidden { display: none; }

.puzzle-image-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(100%, 460px);
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 240, 255, 0.4);
  box-shadow:
    0 0 24px rgba(0, 240, 255, 0.3),
    0 0 60px rgba(255, 42, 147, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  aspect-ratio: 16 / 9;
  background: #000;
  display: none;
}

.puzzle-image-wrap.show { display: block; }

.puzzle-image-wrap.zoomable {
  cursor: zoom-in;
}

.puzzle-image-wrap.zoomable:active {
  transform: scale(0.985);
}

.puzzle-image-wrap:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 4px;
}

.puzzle-image-zoom-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(5, 0, 15, 0.74);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 0 18px rgba(255, 42, 147, 0.5);
  pointer-events: none;
}

.puzzle-image-wrap.show .puzzle-image-zoom-badge {
  display: flex;
}

.puzzle-image-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(177, 75, 255, 0.06), transparent 30%, transparent 70%, rgba(0, 240, 255, 0.06));
  z-index: 2;
  pointer-events: none;
}

.puzzle-image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 240, 255, 0.04) 3px,
    transparent 4px
  );
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
}

.puzzle-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

.puzzle-card.has-image {
  padding: 14px;
}
.puzzle-card.has-image .puzzle-glow {
  opacity: 0.4;
}

.puzzle-hint {
  position: relative;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  z-index: 1;
}

/* ========================================================
   ANSWER ROW
   ======================================================== */

.answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-bottom: 18px;
  min-height: 48px;
}

.answer-row.compact {
  gap: 4px;
  margin-bottom: 10px;
  min-height: 34px;
}
.answer-row.compact .answer-cell {
  width: 25px;
  height: 32px;
  font-size: 15px;
  border-radius: 7px;
}
.answer-row.compact .answer-cell.space {
  width: 9px;
}

.answer-cell {
  width: 32px; height: 42px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-cyan);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}
.answer-cell.filled {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  text-shadow: 0 0 10px rgba(255, 42, 147, 0.7);
  background: rgba(255, 42, 147, 0.06);
}
.answer-cell.revealed {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 234, 58, 0.7);
  background: rgba(255, 234, 58, 0.08);
  cursor: not-allowed;
}
.answer-cell:active.filled { transform: scale(0.9); }
.answer-cell.space {
  width: 16px; border: none; background: transparent; cursor: default;
}
.answer-cell.pop { animation: cell-pop 0.3s ease; }
@keyframes cell-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.answer-cell.shake { animation: cell-shake 0.4s ease; border-color: var(--neon-red); color: var(--neon-red); }
@keyframes cell-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.answer-cell.correct {
  animation: cell-correct 0.5s ease forwards;
  border-color: var(--neon-green) !important;
  color: var(--neon-green) !important;
  text-shadow: 0 0 12px rgba(57, 255, 136, 0.8) !important;
  background: rgba(57, 255, 136, 0.1) !important;
}
@keyframes cell-correct {
  0% { transform: scale(1); }
  40% { transform: scale(1.2) rotate(-3deg); }
  100% { transform: scale(1); }
}

/* ========================================================
   HINTS
   ======================================================== */

.hints-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.hint-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-body);
  transition: all 0.15s;
}
.hint-btn:active { transform: scale(0.95); border-color: var(--neon-pink); }
.hint-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.hint-icon { font-size: 20px; filter: drop-shadow(0 0 6px rgba(255, 42, 147, 0.5)); }
.hint-text { font-size: 10px; letter-spacing: 0.04em; color: var(--text-dim); }
.hint-cost {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px rgba(255, 234, 58, 0.5);
}

/* ========================================================
   KEYBOARD
   ======================================================== */

.keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  position: relative;
}

.keyboard::before {
  content: '';
  position: absolute;
  top: -1px; left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.key {
  min-width: 30px;
  height: 38px;
  padding: 0 4px;
  background: linear-gradient(180deg, rgba(177, 75, 255, 0.18), rgba(255, 42, 147, 0.08));
  border: 1px solid rgba(255, 42, 147, 0.35);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.12s;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
  flex: 0 0 auto;
}
.key:active {
  transform: scale(0.85) translateY(2px);
  background: linear-gradient(180deg, var(--neon-pink), var(--neon-purple));
  box-shadow: 0 0 14px rgba(255, 42, 147, 0.7);
  border-color: var(--neon-pink);
}
.key.used {
  opacity: 0.2;
  pointer-events: none;
}
.key.removed {
  animation: key-disappear 0.25s ease forwards;
}
@keyframes key-disappear {
  to { opacity: 0; transform: scale(0); pointer-events: none; width: 0; min-width: 0; padding: 0; margin: 0; border: 0; }
}

.key.backspace {
  background: linear-gradient(180deg, rgba(255, 42, 58, 0.2), rgba(255, 42, 58, 0.08));
  border-color: rgba(255, 42, 58, 0.4);
  color: var(--neon-red);
}
.key.backspace:active {
  background: linear-gradient(180deg, var(--neon-red), #b00020);
  box-shadow: 0 0 14px rgba(255, 42, 58, 0.7);
}

/* ========================================================
   MODAL
   ======================================================== */

.modal {
  position: fixed; inset: 0;
  background: rgba(5, 0, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modal-in 0.3s ease;
}
.modal.show { display: flex; }
@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, var(--bg-card-solid), #0a0118);
  border: 1.5px solid var(--neon-pink);
  border-radius: 22px;
  padding: 28px 20px 22px;
  text-align: center;
  box-shadow: var(--shadow-pink);
  overflow: hidden;
  animation: modal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lives-modal-card {
  border-color: var(--neon-red);
  box-shadow: 0 0 24px rgba(255, 42, 58, 0.45), 0 0 60px rgba(255, 42, 147, 0.18);
}
@keyframes modal-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.image-zoom-modal {
  z-index: 320;
  padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(3, 0, 10, 0.94);
  flex-direction: column;
  gap: 10px;
}

.image-zoom-stage {
  position: relative;
  width: 100%;
  height: min(82dvh, 820px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.image-zoom-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  box-shadow:
    0 0 32px rgba(0, 240, 255, 0.28),
    0 0 80px rgba(255, 42, 147, 0.22);
  cursor: zoom-out;
  user-select: none;
  -webkit-user-drag: none;
}

.image-zoom-close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 330;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(20, 6, 45, 0.86);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  box-shadow: var(--shadow-pink);
}

.image-zoom-tip {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.04em;
  padding-bottom: 2px;
}

.win-glow {
  position: absolute;
  top: -100px; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(57, 255, 136, 0.25) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  animation: pulse-glow 2.5s ease-in-out infinite;
}

.win-emoji, .lose-emoji {
  font-size: 56px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(57, 255, 136, 0.7));
  position: relative;
  animation: emoji-bounce 0.6s ease;
}
.lose-emoji { filter: drop-shadow(0 0 20px rgba(255, 42, 58, 0.7)); }
@keyframes emoji-bounce {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

.win-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.14em;
  color: var(--neon-green);
  text-shadow: 0 0 16px rgba(57, 255, 136, 0.7);
  margin-bottom: 12px;
  position: relative;
}
.win-title.red {
  color: var(--neon-red);
  text-shadow: 0 0 16px rgba(255, 42, 58, 0.7);
}

.win-answer {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
  position: relative;
  line-height: 1.4;
}

.win-reward {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 234, 58, 0.1);
  border: 1px solid rgba(255, 234, 58, 0.4);
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: 0 0 14px rgba(255, 234, 58, 0.2);
  position: relative;
}
.win-reward-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 234, 58, 0.7);
}

.modal-buttons {
  display: flex; gap: 10px;
  margin-top: 4px;
}

.primary-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  border: none;
  border-radius: 14px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 20px rgba(255, 42, 147, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.15s;
}
.primary-btn:active { transform: scale(0.96); }
.primary-btn.small { padding: 12px 16px; font-size: 12px; }

.secondary-btn {
  flex: 1;
  padding: 14px 16px;
  background: rgba(177, 75, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.secondary-btn:active { transform: scale(0.96); }

.rewarded-icon { font-size: 16px; }

/* ========================================================
   TOAST
   ======================================================== */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card-solid);
  border: 1px solid var(--neon-pink);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-pink);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================================
   TOPBAR RIGHT — sound + coins
   ======================================================== */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 42, 147, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 42, 147, 0.2);
}
.icon-btn .ico-sound-off { display: none; }
.icon-btn.muted { color: var(--text-faint); }
.icon-btn.muted .ico-sound-on { display: none; }
.icon-btn.muted .ico-sound-off { display: block; }

/* ========================================================
   TOTAL PROGRESS + DAILY
   ======================================================== */

.total-progress {
  margin: 18px auto 0;
  max-width: 320px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  border-radius: 14px;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.12);
}

.total-progress-text {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.total-progress-text > span:first-child { color: var(--text-dim); }
.total-progress-text > span:last-child {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
  font-weight: 700;
}

.total-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.total-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 0 10px rgba(255, 42, 147, 0.6);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.daily-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px auto 0;
  max-width: 320px;
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(255, 234, 58, 0.15), rgba(255, 42, 147, 0.1));
  border: 1px solid rgba(255, 234, 58, 0.5);
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 234, 58, 0.18);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
  text-align: left;
}
.daily-btn:active { transform: scale(0.97); }
.daily-btn.claimed {
  opacity: 0.5;
  cursor: default;
}
.daily-btn.claimed::after {
  content: '✓';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(57, 255, 136, 0.7);
}

.daily-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 234, 58, 0.7));
}
.daily-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.daily-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.daily-sub {
  font-size: 11px;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px rgba(255, 234, 58, 0.5);
}

.cloud-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px auto 0;
  max-width: 320px;
  width: 100%;
  padding: 10px 16px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  text-align: left;
}
.cloud-btn:active {
  transform: scale(0.97);
  background: rgba(0, 240, 255, 0.12);
}
.cloud-icon {
  font-size: 22px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}
.cloud-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.cloud-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.cloud-sub {
  font-size: 10px;
  color: var(--text-dim);
}

/* ========================================================
   ONBOARDING
   ======================================================== */

.onboard-emoji {
  font-size: 44px;
  letter-spacing: 6px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 12px rgba(255, 42, 147, 0.7));
}

.onboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0 22px;
  text-align: left;
}

.onboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 42, 147, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
}

.onboard-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 42, 147, 0.5);
}

.neon-yellow-inline {
  color: var(--neon-yellow);
  text-shadow: 0 0 6px rgba(255, 234, 58, 0.6);
  font-weight: 700;
}

/* ========================================================
   RESPONSIVE
   ======================================================== */

@media (max-width: 380px) {
  .puzzle-emoji { font-size: 52px; }
  .answer-cell { width: 28px; height: 38px; font-size: 17px; }
  .key { min-width: 27px; height: 36px; font-size: 14px; }
  .hint-text { font-size: 9px; }
}

@media (min-width: 500px) {
  .categories { grid-template-columns: repeat(3, 1fr); }
  .levels-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 720px) {
  .categories { grid-template-columns: repeat(4, 1fr); }
  .levels-grid { grid-template-columns: repeat(8, 1fr); }
  .puzzle-emoji { font-size: 80px; }
}


/* ========================================================
   PLATFORM MOBILE SAFETY FIXES
   ======================================================== */
html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden !important;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

.scroll-area {
  min-height: 0;
  height: 100%;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

body.game-active .scroll-area {
  overflow: hidden;
  touch-action: none;
}

#screenGame.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

#screenGame.active .game-stats,
#screenGame.active .puzzle-card,
#screenGame.active .answer-row,
#screenGame.active .hints-row,
#screenGame.active .keyboard {
  flex-shrink: 0;
}

#screenGame.active .keyboard {
  margin-bottom: max(4px, env(safe-area-inset-bottom));
}

.modal {
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}

.modal-card {
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 380px), (max-height: 640px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .back-btn { width: 34px; height: 34px; border-radius: 10px; }
  .icon-btn { width: 34px; height: 34px; }
  .coins, .lives { padding: 7px 9px; }
  .title { font-size: 16px; }
  .subtitle { font-size: 9px; letter-spacing: 0.08em; }

  #screenGame.active { padding: 8px 10px max(6px, env(safe-area-inset-bottom)); }
  #screenGame.active .game-stats { gap: 8px; margin-bottom: 8px; }
  #screenGame.active .stat-chip { padding: 6px 8px; }
  #screenGame.active .stat-val { font-size: 16px; }

  #screenGame.active .puzzle-card { margin-bottom: 8px; padding: 10px; border-radius: 16px; }
  #screenGame.active .puzzle-card.has-image { padding: 8px; }
  #screenGame.active .puzzle-image-wrap { max-width: 100%; }
  #screenGame.active .puzzle-emoji { font-size: 46px; }

  #screenGame.active .answer-row { gap: 4px; margin-bottom: 8px; min-height: 34px; }
  #screenGame.active .answer-cell { width: 26px; height: 34px; font-size: 16px; border-radius: 7px; }
  #screenGame.active .answer-row.compact { gap: 3px; margin-bottom: 6px; min-height: 28px; }
  #screenGame.active .answer-row.compact .answer-cell { width: 20px; height: 27px; font-size: 13px; border-radius: 6px; }
  #screenGame.active .answer-cell.space { width: 10px; }

  #screenGame.active .hints-row { gap: 6px; margin-bottom: 8px; }
  #screenGame.active .hint-btn { padding: 6px 4px; border-radius: 10px; }
  #screenGame.active .hint-icon { font-size: 16px; }
  #screenGame.active .hint-text { font-size: 8px; }
  #screenGame.active .hint-cost { font-size: 10px; }

  #screenGame.active .keyboard { gap: 4px; padding: 8px 5px; border-radius: 14px; }
  #screenGame.active .key { min-width: 25px; height: 31px; font-size: 13px; border-radius: 7px; }
}

@media (max-height: 560px) {
  #screenGame.active .puzzle-card { padding: 8px; }
  #screenGame.active .puzzle-card.has-image { padding: 6px; }
  #screenGame.active .puzzle-image-wrap { max-width: 100%; }
  #screenGame.active .puzzle-emoji { font-size: 38px; }
  #screenGame.active .puzzle-hint { display: none; }
  #screenGame.active .hint-icon { display: none; }
  #screenGame.active .hint-btn { padding: 5px 3px; }
  #screenGame.active .keyboard { padding: 6px 4px; }
  #screenGame.active .key { min-width: 23px; height: 28px; font-size: 12px; }
}

.subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================
   MODERATION FIXES — desktop fit, no clipping, no selection
   ======================================================== */
.app-root,
.app-root *,
.modal,
.modal * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

img,
button,
.puzzle-image-wrap,
.answer-cell,
.key {
  -webkit-user-drag: none;
  user-drag: none;
}

body.game-active {
  touch-action: pan-y;
}

body.game-active .app-root .scroll-area {
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  scrollbar-width: none;
}

body.game-active .app-root .scroll-area::-webkit-scrollbar {
  display: none;
}

#screenGame.active {
  --game-gap: clamp(5px, 1.1dvh, 10px);
  display: flex;
  flex-direction: column;
  gap: var(--game-gap);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: clamp(6px, 1.2dvh, 12px);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

#screenGame.active .game-stats,
#screenGame.active .puzzle-card,
#screenGame.active .answer-row,
#screenGame.active .hints-row,
#screenGame.active .keyboard {
  margin-bottom: 0;
}

#screenGame.active .game-stats {
  gap: clamp(6px, 1dvh, 10px);
}

#screenGame.active .stat-chip {
  padding-top: clamp(5px, 1dvh, 10px);
  padding-bottom: clamp(5px, 1dvh, 10px);
}

#screenGame.active .puzzle-card {
  flex: 1 1 auto;
  min-height: 122px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(7px, 1.4dvh, 14px);
}

#screenGame.active .puzzle-card.has-image {
  padding: clamp(6px, 1.2dvh, 12px);
}

#screenGame.active .puzzle-image-wrap {
  --puzzle-img-h: clamp(122px, 30dvh, 250px);
  width: min(100%, calc(var(--puzzle-img-h) * 1.7778));
  height: var(--puzzle-img-h);
  max-width: 100%;
}

#screenGame.active .puzzle-emoji {
  font-size: clamp(42px, 10dvh, 80px);
}

#screenGame.active .answer-row {
  min-height: auto;
}

#screenGame.active .hints-row {
  gap: clamp(5px, 1dvh, 8px);
}

#screenGame.active .hint-btn {
  padding-top: clamp(5px, 1.2dvh, 10px);
  padding-bottom: clamp(5px, 1.2dvh, 10px);
}

#screenGame.active .keyboard {
  padding: clamp(6px, 1.4dvh, 12px) 6px;
  gap: clamp(4px, 0.8dvh, 5px);
}

#screenGame.active .key {
  height: clamp(29px, 5dvh, 38px);
}

@media (min-width: 700px) and (max-height: 860px) {
  #screenGame.active {
    /* The platform desktop page can overlay a bottom carousel; reserve space for it. */
    padding-bottom: clamp(72px, 12dvh, 108px);
  }

  #screenGame.active .puzzle-image-wrap {
    --puzzle-img-h: clamp(118px, 25dvh, 220px);
  }

  #screenGame.active .puzzle-emoji {
    font-size: clamp(38px, 8dvh, 64px);
  }
}

@media (max-height: 620px) {
  #screenGame.active {
    --game-gap: 5px;
  }

  #screenGame.active .stat-label,
  #screenGame.active .hint-text {
    letter-spacing: 0.08em;
  }

  #screenGame.active .puzzle-image-wrap {
    --puzzle-img-h: clamp(105px, 24dvh, 170px);
  }
}


/* ========================================================
   NEON SCROLLBARS
   ======================================================== */
.scroll-area,
#screenGame.active,
.modal-card {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 42, 147, 0.85) rgba(8, 1, 24, 0.55);
}

.scroll-area::-webkit-scrollbar,
#screenGame.active::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.scroll-area::-webkit-scrollbar-track,
#screenGame.active::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(8, 1, 24, 0.84), rgba(20, 6, 45, 0.54));
  border-left: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: 12px;
}

.scroll-area::-webkit-scrollbar-thumb,
#screenGame.active::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neon-pink), var(--neon-purple), var(--neon-cyan));
  border: 2px solid rgba(5, 0, 15, 0.84);
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(255, 42, 147, 0.55), inset 0 0 6px rgba(255, 255, 255, 0.22);
}

.scroll-area::-webkit-scrollbar-thumb:hover,
#screenGame.active::-webkit-scrollbar-thumb:hover,
.modal-card::-webkit-scrollbar-thumb:hover {
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.65), inset 0 0 7px rgba(255, 255, 255, 0.28);
}

body.game-active .app-root .scroll-area {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.86) rgba(8, 1, 24, 0.55);
}

body.game-active .app-root .scroll-area::-webkit-scrollbar {
  display: block;
  width: 11px;
}

@media (max-width: 420px) {
  .topbar-right { gap: 5px; }
  .coins, .lives { padding: 7px 8px; }
  .coin-icon, .life-icon { font-size: 14px; }
  .coin-amount, .life-amount { font-size: 13px; min-width: 18px; }
  .game-stats { gap: 6px; }
  .stat-chip { padding-left: 7px; padding-right: 7px; }
  .stat-val { font-size: 16px; }
  .stat-sub { font-size: 8px; }
}
