/* ═══════════════════════════════════════════════════════════════
   DON'T CLICK RED — styles.css
   Professional game UI with neon/dark theme
   ═══════════════════════════════════════════════════════════════ */

/* ── CUSTOM PROPERTIES ───────────────────────────────────────── */
:root {
  --bg-deep:      #050810;
  --bg-dark:      #0a0e1a;
  --bg-panel:     #0f1528;
  --bg-card:      #141b30;
  --border-dim:   #1e2a4a;
  --border-glow:  #2a3f7a;

  --accent-cyan:  #00d4ff;
  --accent-blue:  #0066ff;
  --accent-purple:#8b5cf6;
  --accent-gold:  #ffd700;
  --danger-red:   #ff2244;
  --success-green:#00ff88;
  --warn-orange:  #ff8c00;

  --text-primary:  #e8eaf6;
  --text-secondary:#8892b0;
  --text-dim:      #4a5568;

  --font-game:  'Orbitron', monospace;
  --font-ui:    'Rajdhani', sans-serif;

  --tile-size:  90px;
  --tile-gap:   10px;
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-glow:  0 0 20px rgba(0,212,255,.35);
  --shadow-panel: 0 8px 40px rgba(0,0,0,.6);
  --transition:   .18s cubic-bezier(.4,0,.2,1);
}

/* ── RESET & BASE ────────────────────────────────────────────── */
*,::before,::after { box-sizing:border-box; margin:0; padding:0; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  background: var(--bg-deep);
  color: var(--text-primary);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── GAME CONTAINER — FULLSCREEN ─────────────────────────────── */
#game-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  overflow: hidden;
}

/* ── AD MODAL — INTERSTITIAL ─────────────────────────────────── */
.ad-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: adModalIn .25s ease both;
}
.ad-modal.visible { display: flex; }

@keyframes adModalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ad-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 20px 24px 28px;
  max-width: 380px;
  width: 92%;
  box-shadow: var(--shadow-panel), 0 0 60px rgba(0,102,255,.15);
  animation: adPanelIn .3s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes adPanelIn {
  from { transform: scale(.88) translateY(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.ad-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-dim);
}
.ad-modal-label {
  font-family: var(--font-game);
  font-size: .6rem;
  letter-spacing: .15em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.ad-skip-btn {
  font-family: var(--font-game);
  font-size: .7rem;
  letter-spacing: .1em;
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 100px;
  color: var(--text-secondary);
  cursor: not-allowed;
  transition: var(--transition);
  white-space: nowrap;
}
.ad-skip-btn:not(:disabled) {
  cursor: pointer;
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  animation: skipReady .4s ease both;
}
@keyframes skipReady {
  from { transform: scale(.95); }
  to   { transform: scale(1); box-shadow: 0 0 12px rgba(0,212,255,.35); }
}

.ad-modal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 100px;
  width: 100%;
}

/* ── REWARDED AD MODAL ───────────────────────────────────────── */
.rewarded-modal .ad-modal-inner.rewarded-inner {
  max-width: 420px;
  gap: 18px;
}

.rewarded-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rewarded-icon {
  font-size: 4rem;
  animation: heartBeat .8s ease-in-out infinite alternate;
}
@keyframes heartBeat {
  from { transform: scale(1); }
  to   { transform: scale(1.18); filter: drop-shadow(0 0 14px rgba(255,34,68,.7)); }
}

.rewarded-title {
  font-family: var(--font-game);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: .18em;
  color: var(--accent-cyan);
  text-shadow: var(--shadow-glow);
}
.rewarded-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.rewarded-subtitle strong {
  color: var(--success-green);
  font-size: 1.05rem;
}

.rewarded-ad-body {
  min-height: 80px;
}

/* Progress bar for rewarded watch time */
.rewarded-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  display: none;
}
.rewarded-progress-wrap.visible { display: flex; }
.rewarded-progress-bar {
  height: 6px;
  background: var(--border-dim);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.rewarded-progress-bar::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent-cyan), var(--success-green));
  border-radius: 3px;
  width: 0%;
  transition: width .1s linear;
}
.rewarded-progress-bar.filling::after {
  animation: fillProgress var(--fill-duration, 5s) linear forwards;
}
@keyframes fillProgress {
  from { width: 0%; }
  to   { width: 100%; }
}
.rewarded-progress-label {
  font-family: var(--font-game);
  font-size: .65rem;
  letter-spacing: .12em;
  color: var(--text-secondary);
  text-align: center;
}

.rewarded-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.rewarded-actions .btn { width: 100%; text-align: center; }

.rewarded-timer-wrap {
  font-size: .8rem;
  color: var(--text-dim);
  letter-spacing: .05em;
}
.rewarded-timer-wrap span {
  font-family: var(--font-game);
  color: var(--warn-orange);
}

/* ── SCREENS ─────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: screenIn .3s ease both;
}
.screen.active { display: flex; }

@keyframes screenIn {
  from { opacity:0; transform:scale(.97) translateY(8px); }
  to   { opacity:1; transform:none; }
}

/* ── SCREEN HEADER ───────────────────────────────────────────── */
.screen-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(10,14,26,.8);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.screen-header h2 {
  font-family: var(--font-game);
  font-size: 1.1rem;
  letter-spacing: .1em;
  color: var(--accent-cyan);
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-game);
  font-size: .85rem;
  letter-spacing: .12em;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content:'';
  position:absolute;
  inset:0;
  background:rgba(255,255,255,0);
  transition:background .15s;
}
.btn:hover::after  { background:rgba(255,255,255,.07); }
.btn:active::after { background:rgba(255,255,255,.14); }
.btn:active { transform:scale(.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,212,255,.4);
}
.btn-glow {
  animation: btnPulse 2.4s ease-in-out infinite;
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(0,212,255,.4); }
  50%      { box-shadow: 0 4px 40px rgba(0,212,255,.75), 0 0 60px rgba(0,102,255,.3); }
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}
.btn-secondary:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

.btn-danger {
  background: rgba(255,34,68,.15);
  color: var(--danger-red);
  border: 1px solid rgba(255,34,68,.4);
}
.btn-danger:hover { background: rgba(255,34,68,.28); }

.btn-back {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-dim);
  padding: 8px 16px;
  font-size: .75rem;
}
.btn-back:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }

.btn-sm { padding: 10px 20px; font-size: .75rem; }

/* ── MAIN MENU ───────────────────────────────────────────────── */
.menu-bg-anim {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.menu-bg-anim::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 45% at 50% 30%, rgba(0,212,255,.06), transparent 70%),
    radial-gradient(ellipse 55% 40% at 50% 85%, rgba(139,92,246,.07), transparent 70%);
}

.menu-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 40px 30px;
  height: 100%;
}

.logo-wrap { text-align: center; }

.game-title {
  font-family: var(--font-game);
  line-height: 1.05;
  text-align: center;
}
.title-dont, .title-click {
  display: inline-block;
  font-size: clamp(1.5rem, 4.5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: .42em;
  margin-right: -.42em; /* visually recenters tracked text */
}
.title-dont { color: var(--text-secondary); opacity: .85; }
.title-click {
  color: var(--accent-cyan);
  text-shadow: 0 0 24px rgba(0,212,255,.45);
}
.title-red   {
  display: inline-block;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  font-weight: 900;
  color: var(--danger-red);
  letter-spacing: .18em;
  margin-right: -.18em;
  text-shadow: 0 0 30px rgba(255,34,68,.8), 0 0 60px rgba(255,34,68,.4);
  animation: redPulse 1.8s ease-in-out infinite;
}
@keyframes redPulse {
  0%,100% { text-shadow: 0 0 30px rgba(255,34,68,.8), 0 0 60px rgba(255,34,68,.4); }
  50%     { text-shadow: 0 0 50px rgba(255,34,68,1),  0 0 100px rgba(255,34,68,.6); }
}

.tagline {
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: .95rem;
  letter-spacing: .06em;
  opacity: .8;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(300px, 86vw);
}
.menu-buttons .btn {
  text-align: center;
  padding: 15px 32px;
  font-size: .9rem;
  border-radius: 14px;
}

.best-score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 16px 44px;
  background: linear-gradient(180deg, rgba(255,215,0,.06), rgba(255,215,0,.02));
  border: 1px solid rgba(255,215,0,.22);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 30px rgba(255,215,0,.07), inset 0 1px 0 rgba(255,255,255,.04);
}
.best-score-display .label {
  font-family: var(--font-game);
  font-size: .62rem;
  letter-spacing: .3em;
  margin-right: -.3em;
  color: var(--text-secondary);
}
.best-score-display .value {
  font-family: var(--font-game);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.1;
  color: var(--accent-gold);
  text-shadow: 0 0 24px rgba(255,215,0,.55);
}

/* ── GAME MODES ──────────────────────────────────────────────── */
.modes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 90px 24px 24px;
  width: 100%;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 24px 18px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.mode-card:hover:not(.locked) {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0,212,255,.2);
  transform: translateY(-3px);
}
.mode-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(0,212,255,.08);
}
.mode-card.locked { opacity: .5; cursor: not-allowed; }
.mode-icon { font-size: 2.5rem; margin-bottom: 10px; }
.mode-card h3 {
  font-family: var(--font-game);
  font-size: .85rem;
  letter-spacing: .1em;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}
.mode-card p { font-size: .85rem; color: var(--text-secondary); line-height: 1.4; }
.lock-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--warn-orange);
  color: #000;
  font-size: .6rem;
  font-family: var(--font-game);
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: .08em;
}

/* ── COUNTDOWN ───────────────────────────────────────────────── */
#screen-countdown { gap: 20px; }
.countdown-mode-label {
  font-family: var(--font-game);
  font-size: .85rem;
  letter-spacing: .2em;
  color: var(--accent-cyan);
  border: 1px solid var(--border-glow);
  padding: 6px 20px;
  border-radius: 100px;
}
.countdown-number {
  font-family: var(--font-game);
  font-size: 10rem;
  font-weight: 900;
  color: var(--accent-cyan);
  text-shadow: var(--shadow-glow);
  animation: countPop .5s ease both;
  line-height: 1;
}
@keyframes countPop {
  from { transform:scale(1.5); opacity:0; }
  to   { transform:scale(1);   opacity:1; }
}
.countdown-hint {
  font-size: 1.1rem;
  color: var(--text-secondary);
  letter-spacing: .06em;
}
.countdown-hint .red-word {
  color: var(--danger-red);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255,34,68,.7);
}

/* ── HUD ─────────────────────────────────────────────────────── */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(5,8,16,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-dim);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}
.hud-left, .hud-right {
  display: flex;
  gap: 20px;
}
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hud-label {
  font-family: var(--font-game);
  font-size: .55rem;
  letter-spacing: .15em;
  color: var(--text-dim);
}
.hud-value {
  font-family: var(--font-game);
  font-size: 1.1rem;
  color: var(--text-primary);
  min-width: 40px;
  text-align: center;
  transition: color .2s, transform .15s;
}
.hud-value.bump { transform:scale(1.25); color: var(--accent-cyan); }

.forbidden-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.forbidden-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,.2);
  box-shadow: 0 0 14px rgba(0,0,0,.5);
  transition: background .4s;
}

.lives-icons { display:flex; gap:5px; }
.life-icon {
  font-size: 1.1rem;
  transition: opacity .3s, transform .3s;
}
.life-icon.lost { opacity:.2; transform:scale(.8); }
.lives-icons.grace .life-icon { animation: gracePulse 1s ease-in-out infinite; }
@keyframes gracePulse {
  0%,100% { filter: drop-shadow(0 0 2px rgba(0,255,136,.0)); transform: scale(1); }
  50%     { filter: drop-shadow(0 0 7px rgba(0,255,136,.9)); transform: scale(1.12); }
}

/* ── PAUSE BUTTON ────────────────────────────────────────────── */
.btn-pause {
  position: absolute;
  top: 60px;
  right: 16px;
  z-index: 20;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border-dim);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 1rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items:center; justify-content:center;
}
.btn-pause:hover { background:rgba(255,255,255,.14); color:#fff; }

/* ── TILE GRID ───────────────────────────────────────────────── */
#screen-game {
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}

#tile-grid {
  flex: 1;
  display: grid;
  gap: var(--tile-gap);
  padding: 20px;
  align-content: center;
  justify-content: center;
  justify-items: center;
}

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.08);
  transition: transform .1s ease, box-shadow .15s;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-game);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  will-change: transform;
}
.tile::before {
  content:'';
  position:absolute;
  inset:0;
  background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 60%);
  pointer-events:none;
}
.tile:hover { transform:scale(1.06); box-shadow: 0 0 20px rgba(255,255,255,.2); }
.tile:active { transform:scale(.93); }

.tile.tile-correct {
  animation: tileCorrect .3s ease both;
}
@keyframes tileCorrect {
  0%  { transform:scale(1.15); box-shadow:0 0 30px rgba(0,255,136,.6); }
  100%{ transform:scale(0);    opacity:0; }
}

.tile.tile-wrong {
  animation: tileWrong .4s ease both;
}
@keyframes tileWrong {
  0%  { transform:scale(1); }
  25% { transform:scale(1.2) rotate(-5deg); box-shadow:0 0 40px rgba(255,34,68,.8); }
  100%{ transform:scale(0) rotate(5deg); opacity:0; }
}

.tile.tile-missed {
  animation: tileMissed .5s ease both;
}
@keyframes tileMissed {
  0%  { opacity:1; }
  50% { transform:scale(1.1); box-shadow:0 0 30px rgba(255,140,0,.6); }
  100%{ transform:scale(0); opacity:0; }
}

/* tile color label */
.tile-label {
  pointer-events: none;
  color: rgba(255,255,255,.85);
  font-size: .55rem;
}

/* ── WAVE BANNER ─────────────────────────────────────────────── */
.wave-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) scale(0);
  background: linear-gradient(135deg, var(--bg-panel), var(--bg-card));
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 18px 48px;
  font-family: var(--font-game);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent-cyan);
  text-shadow: var(--shadow-glow);
  letter-spacing: .15em;
  pointer-events: none;
  z-index: 30;
  box-shadow: var(--shadow-glow), var(--shadow-panel);
  white-space: nowrap;
}
.wave-banner.show {
  animation: wavePop .8s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes wavePop {
  0%   { transform:translate(-50%,-50%) scale(0); opacity:0; }
  50%  { transform:translate(-50%,-50%) scale(1.05); opacity:1; }
  80%  { transform:translate(-50%,-50%) scale(1); opacity:1; }
  100% { transform:translate(-50%,-50%) scale(0); opacity:0; }
}

/* ── COMBO POPUP ─────────────────────────────────────────────── */
.combo-popup {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-game);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(255,215,0,.7);
  pointer-events: none;
  z-index: 25;
  opacity: 0;
}
.combo-popup.show {
  animation: comboShow .7s ease both;
}
@keyframes comboShow {
  0%   { transform:translateX(-50%) translateY(0) scale(.8); opacity:0; }
  30%  { transform:translateX(-50%) translateY(-10px) scale(1.1); opacity:1; }
  70%  { transform:translateX(-50%) translateY(-18px) scale(1); opacity:1; }
  100% { transform:translateX(-50%) translateY(-30px) scale(.9); opacity:0; }
}

/* ── OVERLAY PANELS (pause/gameover) ────────────────────────── */
.overlay-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 90%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-panel);
}
.overlay-panel h2 {
  font-family: var(--font-game);
  font-size: 1.8rem;
  letter-spacing: .15em;
  color: var(--accent-cyan);
}
.pause-score {
  font-size: 1rem;
  color: var(--text-secondary);
}
.pause-score strong {
  font-family: var(--font-game);
  color: var(--accent-gold);
}

/* ── GAME OVER ───────────────────────────────────────────────── */
.gameover-panel { gap: 20px; }
.gameover-title {
  font-family: var(--font-game);
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: .15em;
  color: var(--danger-red);
  text-shadow: 0 0 30px rgba(255,34,68,.7);
  animation: redPulse 1.8s ease-in-out infinite;
}

.score-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid var(--border-dim);
}
.score-row {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-dim);
}
.score-row:last-child { border-bottom: none; }
.score-row span:last-child {
  font-family: var(--font-game);
  font-size: .9rem;
  color: var(--text-primary);
}
.score-row.highlight {
  color: var(--accent-gold);
  background: rgba(255,215,0,.05);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}
.score-row.highlight span:last-child { color: var(--accent-gold); }

/* ad-interstitial is now a separate full-screen modal — see .ad-modal */

/* ── AD FALLBACK BOX (shown when Y8 SDK handles ad off-screen) ── */
.ad-fallback-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 300px;
  height: 160px;
  background: var(--bg-card);
  border: 1px dashed var(--border-glow);
  border-radius: var(--radius-md);
  padding: 20px;
}
.ad-fallback-icon { font-size: 2.4rem; }
.ad-fallback-text {
  font-family: var(--font-game);
  font-size: .75rem;
  letter-spacing: .15em;
  color: var(--text-secondary);
}
.ad-fallback-sub {
  font-size: .78rem;
  color: var(--text-dim);
}

/* ── SETTINGS ────────────────────────────────────────────────── */
/* ── SETTINGS ───────────────────────────────────────────────── */
/* Full-height scroll body under the fixed header — nothing gets cut off
   on short viewports (the old centered max-height box clipped the last
   sections: Colorblind, Data). */
.settings-body {
  position: absolute;
  inset: 0;
  padding: 92px 20px 36px;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.settings-section {
  flex-shrink: 0; /* never squash sections to fit — scroll instead
                     (overflow:hidden makes min-height:auto resolve to 0,
                     which collapsed sections on short viewports) */
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0) 90px),
    var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 10px 34px rgba(0,0,0,.45),
    inset 0 1px 0 rgba(255,255,255,.04);
}
.settings-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-game);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(0,212,255,.35);
  padding: 16px 22px;
  background:
    linear-gradient(90deg, rgba(0,212,255,.10), rgba(0,212,255,.02) 60%, transparent),
    var(--bg-panel);
  border-bottom: 1px solid var(--border-dim);
}
.settings-section h3::before {
  content: '';
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0,212,255,.8);
}
.sec-icon { font-size: 1rem; letter-spacing: 0; margin-right: 2px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-dim);
  transition: background var(--transition);
}
.setting-row:hover { background: rgba(255,255,255,.025); }
.setting-row:last-child { border-bottom: none; }
.setting-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.setting-row label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.setting-row .hint {
  font-size: .74rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Data section — card actions */
.data-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 22px 18px;
}
.data-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  text-align: left;
  font-family: var(--font-ui);
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}
.data-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,.12), 0 6px 18px rgba(0,0,0,.35);
  transform: translateY(-1px);
}
.data-card:active { transform: translateY(0) scale(.98); }
.data-card .data-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  border-radius: 12px;
  background: rgba(0,212,255,.08);
  border: 1px solid rgba(0,212,255,.18);
}
.data-card.danger .data-icon {
  background: rgba(255,34,68,.08);
  border-color: rgba(255,34,68,.25);
}
.data-card.danger:hover {
  border-color: var(--danger-red);
  box-shadow: 0 0 0 3px rgba(255,34,68,.12), 0 6px 18px rgba(0,0,0,.35);
}
.data-card .data-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.data-card .data-text strong { font-size: .88rem; font-weight: 700; }
.data-card .data-text small { font-size: .72rem; color: var(--text-secondary); }

.slider-wrap { display:flex; align-items:center; gap:12px; }
input[type=range] {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-cyan) var(--fill), var(--border-glow) var(--fill));
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0,212,255,.7);
  transition: transform var(--transition);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-val {
  font-family: var(--font-game);
  font-size: .74rem;
  color: var(--accent-cyan);
  background: rgba(0,212,255,.08);
  border: 1px solid rgba(0,212,255,.18);
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 46px;
  text-align: center;
}

.select-input {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  padding: 10px 34px 10px 14px;
  font-family: var(--font-ui);
  font-size: .9rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2300d4ff' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.select-input:hover { border-color: var(--accent-cyan); }
.select-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,.15);
}
.select-input option { background: var(--bg-panel); color: var(--text-primary); }

/* Toggle Switch */
.toggle-switch { position:relative; display:inline-block; flex:0 0 auto; width:52px; height:28px; cursor:pointer; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-slider {
  position:absolute; inset:0;
  background: var(--border-dim);
  border-radius: 28px;
  transition: var(--transition);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
}
.toggle-slider::before {
  content:'';
  position:absolute;
  height:22px; width:22px;
  left:3px; bottom:3px;
  background:linear-gradient(180deg,#fff,#dfe5f5);
  border-radius:50%;
  transition: var(--transition);
  box-shadow:0 2px 6px rgba(0,0,0,.45);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-cyan);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.25), 0 0 12px rgba(0,212,255,.45);
}
.toggle-switch input:checked + .toggle-slider::before { transform:translateX(24px); }
.toggle-switch input:focus-visible + .toggle-slider { outline:2px solid var(--accent-cyan); outline-offset:2px; }

/* ── LEADERBOARD ─────────────────────────────────────────────── */
.lb-tabs {
  position: absolute;
  top: 72px; left: 24px; right: 24px;
  display: flex;
  gap: 8px;
  z-index: 5;
}
.lb-tab {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-game);
  font-size: .7rem;
  letter-spacing: .12em;
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.lb-tab.active {
  background: rgba(0,212,255,.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.lb-body {
  position: absolute;
  top: 125px; bottom: 0; left: 0; right: 0;
  overflow-y: auto;
  padding: 16px 24px;
}
.lb-panel { display:none; }
.lb-panel.active { display:block; }

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.lb-table th {
  font-family: var(--font-game);
  font-size: .62rem;
  letter-spacing: .14em;
  color: var(--text-dim);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-dim);
}
.lb-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(30,42,74,.5);
  color: var(--text-secondary);
}
.lb-table tr:first-child td { color: var(--accent-gold); }
.lb-table tr:nth-child(2) td { color: var(--text-primary); }
.lb-table tr:nth-child(3) td { color: #cd7f32; }
.lb-table tr:hover td { background: rgba(0,212,255,.04); }
.lb-table td:nth-child(2) { font-family:var(--font-game); color:var(--accent-cyan); }

.lb-loading {
  text-align:center;
  color:var(--text-secondary);
  padding:40px;
  font-size:.9rem;
}

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: .88rem;
  pointer-events: none;
  opacity: 0;
  z-index: 9999;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── PARTICLE CANVAS ─────────────────────────────────────────── */
#particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  width: 100%;
  height: 100%;
}

/* ── SCREEN SHAKE ────────────────────────────────────────────── */
@keyframes shake {
  0%,100%{ transform:translate(0,0); }
  20%    { transform:translate(-8px, 4px); }
  40%    { transform:translate(8px,-4px); }
  60%    { transform:translate(-5px, 3px); }
  80%    { transform:translate(5px,-3px); }
}
.shake { animation: shake .35s ease both; }

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-glow); border-radius:3px; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --tile-size: 60px; --tile-gap: 8px; }
  .hud-value  { font-size: .9rem; }
  .btn { font-size: .8rem; padding: 13px 22px; }
  .overlay-panel { padding: 28px 20px; }
  .gameover-title { font-size: 1.8rem; }
  #hud { padding: 10px 14px; }
  .ad-modal-inner, .rewarded-inner { padding: 16px 14px 22px; }
  .rewarded-title { font-size: 1.7rem; }
  .settings-body { padding: 84px 14px 28px; }
  .setting-row { padding: 14px 14px; }
  .data-actions { grid-template-columns: 1fr; padding: 14px 14px 16px; }
}

@media (max-height: 700px) {
  :root { --tile-size: 55px; --tile-gap: 6px; }
  .menu-content { gap: 22px; }
  .title-red { font-size: 2.8rem; }
  .rewarded-icon { font-size: 2.8rem; }
  .rewarded-ad-body { display: none; } /* hide ad unit on very short screens */
}

/* ── ANIMATED BACKGROUND BLOBS ───────────────────────────────── */
.bg-blob {
  position:absolute;
  border-radius:50%;
  filter:blur(60px);
  opacity:.12;
  pointer-events:none;
  animation:blobFloat linear infinite;
}
@keyframes blobFloat {
  0%   { transform:translate(0,0) scale(1); }
  33%  { transform:translate(20px,-30px) scale(1.1); }
  66%  { transform:translate(-15px,20px) scale(.9); }
  100% { transform:translate(0,0) scale(1); }
}

/* ── COLORBLIND OVERLAYS ─────────────────────────────────────── */
body.colorblind-deuteranopia  { filter:url('#cb-deuteranopia'); }
body.colorblind-protanopia    { filter:url('#cb-protanopia'); }
body.colorblind-tritanopia    { filter:url('#cb-tritanopia'); }

/* ── UTILITY ─────────────────────────────────────────────────── */
.hidden { display:none !important; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
