/* ═══════════════════════════════════════════════════════════════
   Space Puzzler — Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

:root {
  --clr-bg:      #05000f;
  --clr-primary: #00d9ff;
  --clr-accent:  #ff1464;
  --clr-gold:    #ffd700;
  --clr-text:    #ffffff;
  --clr-muted:   rgba(0,217,255,0.5);
  --clr-panel:   rgba(2,6,25,0.95);
  --font-main:   'ROSTEX', 'Orbitron', 'Courier New', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--clr-bg);
  font-family: var(--font-main);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Canvas ───────────────────────────────────────────────────── */
#gameCanvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  touch-action: none;              /* prevent Android scroll/zoom on canvas */
  -webkit-touch-callout: none;     /* prevent iOS long-press menu */
}

/* ── UI Root overlay ──────────────────────────────────────────── */
#ui-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ── Generic screen panel ─────────────────────────────────────── */
.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.screen.active {
  display: flex;
}

/* Sharp panel card */
.panel {
  background: var(--clr-panel);
  border: 2px solid var(--clr-primary);
  border-top: 4px solid var(--clr-accent);
  border-radius: 0;
  padding: 36px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 420px;
  width: 90%;
  box-shadow:
    0 0 40px rgba(0,217,255,0.15),
    0 0 0 1px rgba(0,217,255,0.08),
    0 8px 32px rgba(0,0,0,0.7);
}

/* ── Typography ───────────────────────────────────────────────── */
.game-title {
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--clr-primary);
  text-align: center;
  text-shadow: 0 0 24px rgba(0,217,255,0.7), 0 0 60px rgba(0,217,255,0.3);
  margin-bottom: 4px;
  overflow: visible;
}
.title-word {
  display: inline-block;
  text-decoration: underline;
  text-decoration-color: var(--clr-accent);
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}
.title-letter {
  display: inline-block;
  cursor: default;
}

.subtitle {
  font-size: 0.7rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--clr-muted);
  text-align: center;
  margin-top: -8px;
}

.screen-title {
  font-size: 1.8rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--clr-primary);
  font-weight: 700;
  text-align: center;
  width: 100%;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--clr-accent);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 36px;
  border: none;
  border-radius: 0;
  clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s, box-shadow 0.1s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 160px;
}
.btn:active { transform: scale(0.95); }

.btn-primary {
  background: var(--clr-accent);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,20,100,0.5);
}
.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 32px rgba(255,20,100,0.8);
}

.btn-secondary {
  background: transparent;
  clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
  color: var(--clr-primary);
  border: none;
  box-shadow: 0 0 10px rgba(0,217,255,0.2);
  /* Simulated border via outline+shadow since clip-path clips borders */
  filter: drop-shadow(0 0 1px var(--clr-primary)) drop-shadow(0 0 3px rgba(0,217,255,0.3));
}
.btn-secondary:hover {
  background: rgba(0,217,255,0.1);
  box-shadow: 0 0 20px rgba(0,217,255,0.4);
}

.btn-danger {
  background: #b91c1c;
  color: #fff;
  box-shadow: 0 4px 16px rgba(185,28,28,0.5);
  clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
}
.btn-danger:hover { filter: brightness(1.15); }

/* ── HUD ──────────────────────────────────────────────────────── */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(5,0,20,0.92) 0%, rgba(5,0,20,0) 100%);
  pointer-events: auto;
  z-index: 20;
}
#hud.active { display: flex; }

.hud-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}
.hud-label {
  font-size: 0.52rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-bottom: 1px;
}
.hud-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: 1px;
}
.hud-value.highlight { color: var(--clr-gold); }

/* Score progress bar */
#score-bar-wrap {
  flex: 1;
  max-width: 200px;
  margin: 0 10px;
}
#score-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
#score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clr-accent), var(--clr-primary));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

#btn-pause {
  width: 36px; height: 36px;
  border-radius: 0;
  border: 2px solid var(--clr-primary);
  background: transparent;
  color: var(--clr-primary);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, box-shadow 0.15s;
  padding: 0;
  font-family: var(--font-main);
  letter-spacing: 1px;
}
#btn-pause:hover { background: rgba(0,217,255,0.15); box-shadow: 0 0 10px rgba(0,217,255,0.4); }

/* ── Level Select ─────────────────────────────────────────────── */
#screen-level-select .panel {
  max-width: 520px;
  max-height: 85vh;
  overflow: hidden;
  padding: 28px 28px 24px;
}

#level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
  overflow-y: auto;
  max-height: 55vh;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,0.4) transparent;
}
#level-grid::-webkit-scrollbar { width: 4px; }
#level-grid::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.4); border-radius: 2px; }

.level-btn {
  aspect-ratio: 1;
  border-radius: 0;
  border: 2px solid rgba(0,217,255,0.3);
  background: rgba(0,10,30,0.8);
  color: var(--clr-text);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
  padding: 6px 2px;
  min-height: 60px;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}
.level-btn:hover:not(.locked) {
  background: rgba(0,217,255,0.12);
  border-color: var(--clr-primary);
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(0,217,255,0.4);
}
.level-btn:active:not(.locked) { transform: scale(0.95); }

.level-btn.locked {
  opacity: 0.3;
  cursor: default;
}
.level-btn.completed {
  border-color: var(--clr-gold);
  background: rgba(255,215,0,0.06);
}
.level-btn .level-num { font-size: 1rem; }
.level-btn .level-stars {
  font-size: 0.6rem;
  letter-spacing: 1px;
  color: var(--clr-gold);
  height: 10px;
}
.level-btn .lock-icon { font-size: 0.85rem; opacity: 0.7; }

/* ── Overlays: Level Complete / Game Over / Pause ─────────────── */
.stars-display {
  display: flex;
  gap: 10px;
  font-size: 2.4rem;
  filter: drop-shadow(0 0 8px rgba(251,191,36,0.7));
}
.star-icon { transition: transform 0.3s; }
.star-icon.earned { animation: starPop 0.4s ease forwards; }
@keyframes starPop {
  0%   { transform: scale(0) rotate(-20deg); }
  60%  { transform: scale(1.35) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.score-display {
  font-size: 2rem;
  font-weight: 900;
  color: var(--clr-primary);
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(0,217,255,0.6);
}

.score-label {
  font-size: 0.62rem;
  letter-spacing: 3px;
  color: var(--clr-muted);
  text-transform: uppercase;
  margin-top: -10px;
}

.divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--clr-primary), transparent);
}

/* ── Score Float (score pop-up) ───────────────────────────────── */
.score-float {
  position: absolute;
  color: #fde68a;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 900;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(251,191,36,0.8);
  animation: floatUp 0.9s ease-out forwards;
}
.score-float.combo {
  color: #f0abfc;
  font-size: 22px;
  text-shadow: 0 0 14px rgba(240,171,252,0.9);
}
@keyframes floatUp {
  0%   { transform: translateY(0) scale(1);   opacity: 1; }
  30%  { transform: translateY(-20px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-70px) scale(0.8); opacity: 0; }
}

/* ── Combo popup ──────────────────────────────────────────────── */
.combo-popup {
  position: absolute;
  font-family: var(--font-main);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--clr-accent);
  text-shadow: 0 0 20px rgba(255,20,100,0.9), 0 0 50px rgba(255,20,100,0.5);
  pointer-events: none;
  z-index: 55;
  white-space: nowrap;
  animation: comboPop 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  transform-origin: center bottom;
  border: 2px solid var(--clr-accent);
  padding: 4px 14px;
  background: rgba(5,0,30,0.65);
  box-shadow: 0 0 20px rgba(255,20,100,0.4), inset 0 0 12px rgba(255,20,100,0.15);
}
@keyframes comboPop {
  0%   { transform: scale(0.4) translateY(0);    opacity: 0; }
  20%  { transform: scale(1.3) translateY(-10px); opacity: 1; }
  60%  { transform: scale(1.0) translateY(-30px); opacity: 1; }
  100% { transform: scale(0.8) translateY(-80px); opacity: 0; }
}

/* ── Challenge banner ─────────────────────────────────────────── */
.challenge-banner {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 28px;
  background: rgba(5,0,30,0.9);
  border: 2px solid var(--clr-gold);
  border-top: 3px solid var(--clr-accent);
  z-index: 60;
  pointer-events: none;
  animation: challengeSlide 3.5s ease-in-out forwards;
  font-family: var(--font-main);
}
.challenge-label {
  font-size: 0.55rem;
  letter-spacing: 5px;
  color: var(--clr-gold);
  text-transform: uppercase;
}
.challenge-desc {
  font-size: 0.85rem;
  color: var(--clr-text);
  letter-spacing: 2px;
  text-align: center;
}
.challenge-reward {
  font-size: 0.7rem;
  color: var(--clr-gold);
  letter-spacing: 2px;
}
@keyframes challengeSlide {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ── Power tile popup ─────────────────────────────────────────── */
.power-popup {
  color: var(--clr-gold) !important;
  text-shadow: 0 0 20px rgba(255,215,0,0.9), 0 0 50px rgba(255,215,0,0.5) !important;
  border: 2px solid var(--clr-gold);
  padding: 4px 14px;
  background: rgba(5,0,30,0.7);
}

/* ── Reshuffle notice ─────────────────────────────────────────── */
#reshuffle-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--clr-panel);
  border: 2px solid var(--clr-primary);
  border-radius: 0;
  padding: 12px 28px;
  color: var(--clr-primary);
  font-size: 0.85rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 60;
  box-shadow: 0 0 20px rgba(0,217,255,0.3);
}
#reshuffle-notice.show { opacity: 1; }

/* ── Debug Panel ──────────────────────────────────────────────── */
#debug-panel {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,100,0,0.6);
  border-radius: 10px;
  padding: 10px 14px;
  color: #ff9900;
  font-size: 0.7rem;
  font-family: 'Courier New', monospace;
  z-index: 9999;
  pointer-events: auto;
  min-width: 180px;
  display: none;
}
#debug-panel.active { display: block; }
#debug-panel h4 {
  font-size: 0.75rem;
  margin-bottom: 8px;
  color: #ff6600;
  letter-spacing: 2px;
  text-transform: uppercase;
}
#debug-panel label { display: block; margin: 4px 0 2px; font-size: 0.65rem; }
#debug-panel input[type=number] {
  width: 50px; padding: 2px 5px;
  background: rgba(255,255,255,0.1); border: 1px solid #ff6600;
  color: #ff9900; border-radius: 4px; font-family: inherit; font-size: 0.7rem;
}
#debug-panel select {
  padding: 2px 4px;
  background: rgba(0,0,0,0.7); border: 1px solid #ff6600;
  color: #ff9900; border-radius: 4px; font-family: inherit; font-size: 0.65rem;
}
#debug-panel button {
  margin: 3px 3px 0 0;
  padding: 3px 8px;
  background: rgba(255,100,0,0.2);
  border: 1px solid #ff6600;
  color: #ff9900; border-radius: 4px;
  font-family: inherit; font-size: 0.65rem; cursor: pointer;
}
#debug-panel button:hover { background: rgba(255,100,0,0.4); }
#debug-panel .debug-fps {
  margin-top: 6px;
  font-size: 0.65rem;
  color: #88ff44;
  border-top: 1px solid rgba(255,100,0,0.3);
  padding-top: 5px;
}

/* ── Responsive tweaks ────────────────────────────────────────── */

/* Short viewports (iframe containers like 922×487, 938×503) */
@media (max-height: 600px) {
  .panel { padding: 16px 24px; gap: 10px; }
  .game-title { font-size: 1.6rem; }
  #level-grid { max-height: 44vh; }
  .screen-title { font-size: 1.4rem; }
  .btn { padding: 10px 28px; font-size: 0.95rem; }
}
@media (max-height: 520px) {
  #hud { height: 48px; padding: 0 10px; }
  .hud-block { min-width: 56px; }
  .hud-value { font-size: 0.9rem; }
  .hud-label { font-size: 0.45rem; }
  #score-bar-wrap { max-width: 140px; }
  #ability-strip { bottom: 8px; right: 8px; gap: 6px; }
  .ability-icon-v2 { width: 42px; height: 42px; border-radius: 10px; }
  .ability-img { width: 26px; height: 26px; }
  .panel { padding: 14px 20px; gap: 8px; }
  .game-title { font-size: 1.4rem; }
  .screen-title { font-size: 1.2rem; }
  .pre-level-panel { padding: 18px 22px; }
  .btn { padding: 8px 22px; font-size: 0.88rem; min-width: 120px; }
  .route-footer { height: 48px; }
  .route-map-container { bottom: 48px; }
  .route-node { width: 48px; height: 48px; font-size: 0.85rem; }
  .playing-badge { font-size: 0.5rem; padding: 2px 6px; }
  #hud-objectives { top: 48px; }
}

/* Narrow viewports */
@media (max-width: 360px) {
  #level-grid { grid-template-columns: repeat(4, 1fr); }
  .btn { padding: 11px 22px; font-size: 0.82rem; min-width: 130px; }
}

/* Landscape iframe: wide but short */
@media (max-height: 520px) and (min-width: 800px) {
  .main-menu-panel { padding: 20px 40px; }
  .main-menu-panel .game-title { font-size: 1.6rem; margin-bottom: 6px; }
  .main-menu-panel .btn { margin: 4px 0; }
  .shop-panel { max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 2: Ability Strip, Shop, Tutorial
   ═══════════════════════════════════════════════════════════ */

/* ── Ability strip ─────────────────────────────────────────── */
#ability-strip {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  z-index: 25;
}
#ability-strip.active {
  display: flex;
}

.ability-icon {
  width: 58px;
  height: 40px;
  border-radius: 0;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
  border: 2px solid var(--clr-primary);
  background: rgba(0,10,30,0.9);
  color: var(--clr-primary);
  font-size: 0.5rem;
  font-family: var(--font-main);
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ability-icon:hover {
  border-color: var(--clr-primary);
  box-shadow: 0 0 12px rgba(0,217,255,0.5);
}

.ability-icon.active {
  border-color: var(--clr-gold);
  color: var(--clr-gold);
  box-shadow: 0 0 18px rgba(255,215,0,0.8);
  animation: abilityPulse 0.8s ease-in-out infinite alternate;
}

@keyframes abilityPulse {
  from { box-shadow: 0 0 8px rgba(255,215,0,0.5); }
  to   { box-shadow: 0 0 24px rgba(255,215,0,1.0); }
}

.ability-emoji {
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  text-transform: uppercase;
}

.count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #7c3aed;
  color: #fff;
  font-size: 0.55rem;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* ── Shop screen ───────────────────────────────────────────── */
.shop-balance {
  font-size: 1.3rem;
  color: #fbbf24;
  letter-spacing: 2px;
  text-align: center;
  margin: 4px 0;
}

.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 10px;
  padding: 12px 16px;
  gap: 12px;
}

.shop-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shop-item-name {
  font-size: 0.9rem;
  color: #e2d9ff;
  letter-spacing: 1px;
}

.shop-item-desc {
  font-size: 0.65rem;
  color: rgba(180,160,255,0.55);
}

.shop-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  white-space: nowrap;
}

.shop-item-cost {
  font-size: 0.85rem;
  color: #fbbf24;
}

.shop-item-owned {
  font-size: 0.6rem;
  color: rgba(167,139,250,0.6);
}

/* ── Shop v2 (large icons) ───────────────────────────────── */
.shop-panel { gap: 14px !important; }
.shop-item-v2 {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 14px;
  padding: 14px 16px;
  gap: 14px;
  transition: border-color 0.2s;
}
.shop-item-v2:hover {
  border-color: rgba(0,217,255,0.4);
}
.shop-icon-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(0,217,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,217,255,0.15);
}
.shop-icon-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: brightness(1.1) drop-shadow(0 0 4px rgba(0,217,255,0.3));
}
.shop-icon-fallback {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--clr-primary);
}
.shop-item-info-v2 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.shop-item-name-v2 {
  font-size: 1rem;
  font-weight: 700;
  color: #e8e0ff;
  letter-spacing: 1px;
}
.shop-item-desc-v2 {
  font-size: 0.7rem;
  color: rgba(180,160,255,0.55);
  line-height: 1.3;
}
.shop-item-right-v2 {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  white-space: nowrap;
}
.shop-item-cost-v2 {
  font-size: 0.95rem;
  color: #fbbf24;
  font-weight: 700;
}
.shop-item-owned-v2 {
  font-size: 0.6rem;
  color: rgba(167,139,250,0.6);
}
.shop-buy-btn {
  font-size: 0.85rem !important;
  padding: 8px 18px !important;
  min-width: 60px !important;
}
.shop-ad-item {
  border-color: rgba(251, 191, 36, 0.25);
  background: linear-gradient(135deg, rgba(251,191,36,0.08), rgba(0,0,0,0));
}
.shop-ad-item:hover {
  border-color: rgba(251, 191, 36, 0.5);
}
.shop-ad-icon-wrap {
  background: rgba(251, 191, 36, 0.15) !important;
  border-color: rgba(251, 191, 36, 0.25) !important;
}
.shop-ad-icon {
  font-size: 1.6rem;
  color: #fbbf24;
}
.shop-ad-free {
  color: #34d399 !important;
  font-weight: 700;
}
.shop-ad-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
}
.shop-back-btn {
  font-size: 0.95rem !important;
  padding: 12px 24px !important;
}

/* ── Ability strip v2 (image icons) ─────────────────────── */
.ability-icon-v2 {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 2px solid rgba(0,217,255,0.3);
  background: rgba(0,10,30,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  padding: 0;
}
.ability-icon-v2:hover {
  border-color: var(--clr-primary);
  box-shadow: 0 0 14px rgba(0,217,255,0.4);
  transform: scale(1.08);
}
.ability-icon-v2.active {
  border-color: var(--clr-accent);
  box-shadow: 0 0 18px rgba(255,20,100,0.5);
  animation: abilityPulse 0.8s ease-in-out infinite alternate;
}
@keyframes abilityPulse {
  from { box-shadow: 0 0 10px rgba(255,20,100,0.3); }
  to { box-shadow: 0 0 22px rgba(255,20,100,0.6); }
}
.ability-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: brightness(1.2) drop-shadow(0 0 3px rgba(0,217,255,0.3));
}
.ability-fallback {
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--clr-primary);
  letter-spacing: 1px;
}
.ability-icon-v2 .count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--clr-accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255,20,100,0.4);
}

/* ── Reward row in pre-level popup ────────────────────────── */
.reward-row {
  background: rgba(255,170,0,0.1) !important;
  border: 1px solid rgba(255,170,0,0.3);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 6px;
}
.reward-label {
  color: #ffaa00;
  font-weight: 700;
  font-size: 0.8rem;
}
.reward-desc {
  color: #ffd700;
  font-size: 0.8rem;
}

/* ── Tutorial overlay ──────────────────────────────────────── */
#tutorial-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5,0,30,0.78);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 40px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#tutorial-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

#tutorial-box {
  background: rgba(20,8,60,0.96);
  border: 1px solid rgba(167,139,250,0.5);
  border-radius: 18px;
  padding: 26px 32px;
  max-width: 380px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 40px rgba(109,40,217,0.5);
}

.tutorial-title {
  font-size: 1.05rem;
  color: #c4b5fd;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.tutorial-title {
  font-size: 1.2rem;
}

.tutorial-body {
  font-size: 0.95rem;
  color: rgba(220,210,255,0.85);
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════
   ROUTE MAP LEVEL SELECT
   ═══════════════════════════════════════════════════════════ */

/* Override level-select to be full-screen, no panel */
#screen-level-select {
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}
#screen-level-select .panel { display: none; }

/* Footer bar (bottom-anchored) */
.route-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(0deg, rgba(5,0,20,0.98) 0%, rgba(5,0,20,0.8) 60%, transparent 100%);
  z-index: 30;
  pointer-events: auto;
}
.route-back-btn, .route-shop-btn {
  font-size: 0.92rem !important;
  min-width: auto !important;
  padding: 10px 20px !important;
  letter-spacing: 2px !important;
  font-weight: 700 !important;
}
.route-star-total {
  font-family: var(--font-main);
  font-size: 1.25rem;
  color: var(--clr-gold);
  letter-spacing: 2px;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(255,215,0,0.4);
}

.route-map-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 60px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,217,255,0.3) transparent;
  cursor: grab;
}
.route-map-container::-webkit-scrollbar { width: 4px; }
.route-map-container::-webkit-scrollbar-thumb { background: rgba(0,217,255,0.3); }

.route-map-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100%;
  background: linear-gradient(180deg,
    #020005 0%,     /* Deep Space (L16-20, top) */
    #050010 20%,
    #0f0020 25%,    /* Nebula Zone (L11-15) */
    #1a0040 45%,
    #100a00 50%,    /* Asteroid Belt (L6-10) */
    #1a0f05 70%,
    #050020 75%,    /* Near Earth (L1-5, bottom) */
    #0a0040 100%
  );
  pointer-events: none;
}

.space-star-dot {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255,255,255,0.6);
  animation: starTwinkle 2.5s ease-in-out infinite alternate;
}
.space-star-dot.bright {
  width: 3px;
  height: 3px;
  box-shadow: 0 0 8px rgba(200,220,255,0.9), 0 0 16px rgba(100,150,255,0.4);
}
@keyframes starTwinkle {
  0% { opacity: 0.15; }
  50% { opacity: 0.7; }
  100% { opacity: 0.95; }
}

.space-planet-v2 {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: planetFloat 12s ease-in-out infinite alternate;
}
.planet-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotateX(65deg);
  border: 1.5px solid rgba(200,200,255,0.25);
  border-radius: 50%;
  pointer-events: none;
}
@keyframes planetFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.space-nebula {
  position: absolute;
  pointer-events: none;
  filter: blur(30px);
  animation: nebulaGlow 8s ease-in-out infinite alternate;
}
@keyframes nebulaGlow {
  from { opacity: 0.4; }
  to { opacity: 0.8; }
}

/* Animated space elements */
.anim-shooting-star {
  position: absolute;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fff, rgba(100,200,255,0.8), transparent);
  border-radius: 2px;
  animation: shootingStar 1s linear forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes shootingStar {
  from { transform: translateX(0) translateY(0) rotate(-25deg); opacity: 1; }
  to { transform: translateX(300px) translateY(120px) rotate(-25deg); opacity: 0; }
}

.anim-asteroid {
  position: absolute;
  right: -20px;
  background: radial-gradient(circle at 30% 30%, #8a7a6a, #4a3a2a, #2a1a0a);
  border-radius: 40% 50% 45% 55%;
  box-shadow: inset -3px -2px 4px rgba(0,0,0,0.6), 0 0 6px rgba(100,80,60,0.3);
  animation: asteroidDrift 6s linear forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes asteroidDrift {
  from { transform: translateX(0) rotate(0deg); opacity: 0.7; }
  to { transform: translateX(-400px) rotate(180deg); opacity: 0; }
}

.anim-supernova {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: supernovaFlash 1.8s ease-out forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes supernovaFlash {
  0% { transform: scale(0.5); box-shadow: 0 0 4px #fff; opacity: 1; }
  30% { transform: scale(3); box-shadow: 0 0 30px #00d9ff, 0 0 60px #ff1464, 0 0 90px #9933ff; opacity: 0.9; }
  100% { transform: scale(6); box-shadow: 0 0 60px transparent; opacity: 0; }
}

/* Rocket animation */
.anim-rocket {
  position: absolute;
  width: 18px;
  height: 8px;
  background: linear-gradient(90deg, #ff4400, #ff8800, #ffcc00);
  border-radius: 4px 8px 8px 4px;
  box-shadow: 0 0 8px rgba(255,100,0,0.6);
  pointer-events: none;
  z-index: 3;
  animation: rocketFlyRight 4s linear forwards;
}
.anim-rocket.left {
  background: linear-gradient(270deg, #ff4400, #ff8800, #ffcc00);
  border-radius: 8px 4px 4px 8px;
  animation: rocketFlyLeft 4s linear forwards;
}
.anim-rocket::after {
  content: '';
  position: absolute;
  right: -14px;
  top: 1px;
  width: 14px;
  height: 6px;
  background: linear-gradient(90deg, rgba(255,100,0,0.7), rgba(255,200,0,0.3), transparent);
  border-radius: 0 3px 3px 0;
  filter: blur(2px);
}
.anim-rocket.left::after {
  right: auto;
  left: -14px;
  background: linear-gradient(270deg, rgba(255,100,0,0.7), rgba(255,200,0,0.3), transparent);
  border-radius: 3px 0 0 3px;
}
@keyframes rocketFlyRight {
  from { left: -30px; opacity: 0.9; }
  to { left: calc(100% + 30px); opacity: 0; }
}
@keyframes rocketFlyLeft {
  from { right: -30px; opacity: 0.9; }
  to { right: calc(100% + 30px); opacity: 0; }
}

/* Game background rocket layer */
.game-bg-rockets {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* Cinematic main menu background */
.menu-space-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.main-menu-panel {
  position: relative;
  z-index: 1;
}

.route-paths-svg {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  pointer-events: none;
}

.route-nodes-container {
  position: relative;
  width: 320px;
  margin: 0 auto;
  min-height: 100%;
}

/* ── Route Nodes ──────────────────────────────────────────── */
.route-node {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 5;
}
.route-node:hover:not(.locked) {
  transform: scale(1.12);
}

.route-node.completed {
  background: radial-gradient(circle at 40% 35%, rgba(0,230,255,0.35), rgba(0,100,200,0.15));
  border: 3px solid #00e0ff;
  box-shadow: 0 0 18px rgba(0,230,255,0.6), 0 0 40px rgba(0,180,255,0.25), inset 0 0 12px rgba(0,200,255,0.15);
  color: #fff;
}

.route-node.current {
  background: radial-gradient(circle at 40% 35%, rgba(255,30,100,0.4), rgba(200,0,80,0.15));
  border: 3px solid #ff2070;
  box-shadow: 0 0 22px rgba(255,30,100,0.7), 0 0 50px rgba(255,20,80,0.3), inset 0 0 12px rgba(255,50,120,0.2);
  color: #fff;
  animation: currentPulse 2s ease-in-out infinite alternate;
}
@keyframes currentPulse {
  from { box-shadow: 0 0 18px rgba(255,30,100,0.5), 0 0 35px rgba(255,20,80,0.15); }
  to   { box-shadow: 0 0 28px rgba(255,30,100,0.9), 0 0 60px rgba(255,20,80,0.4); }
}

.route-node.available {
  background: radial-gradient(circle at 40% 35%, rgba(0,200,255,0.18), rgba(0,80,150,0.06));
  border: 2.5px solid rgba(0,200,255,0.6);
  box-shadow: 0 0 12px rgba(0,200,255,0.3), inset 0 0 8px rgba(0,150,255,0.1);
  color: rgba(255,255,255,0.85);
}

.route-node.locked {
  background: radial-gradient(circle, rgba(40,35,60,0.6), rgba(20,18,35,0.4));
  border: 2.5px solid rgba(100,90,120,0.5);
  color: rgba(150,140,170,0.6);
  cursor: default;
}

.route-node-num {
  font-size: 1.3rem;
  letter-spacing: 1px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.route-node-lock {
  font-size: 1rem;
  opacity: 0.6;
}
.route-node-req {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: rgba(255,215,0,0.5);
  white-space: nowrap;
  letter-spacing: 1px;
}

/* Playing badge */
.playing-badge {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ff2070, #ff4090);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255,30,100,0.5);
}

/* Node stars */
.node-stars {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  white-space: nowrap;
}
.node-star {
  font-size: 0.7rem;
  color: rgba(100,80,50,0.3);
}
.node-star.earned {
  color: var(--clr-gold);
  text-shadow: 0 0 6px rgba(255,215,0,0.7);
}

/* Node reward badge */
.node-reward-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ffaa00, #ff6600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255,170,0,0.6);
  z-index: 6;
}
.reward-icon {
  font-size: 0.65rem;
  line-height: 1;
}

/* Shake animation for locked nodes */
.route-node.shake {
  animation: nodeShake 0.4s ease;
}
@keyframes nodeShake {
  0%, 100% { transform: translateX(0); }
  25%  { transform: translateX(-6px); }
  75%  { transform: translateX(6px); }
}

/* ═══════════════════════════════════════════════════════════
   SCREEN TRANSITION ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

.screen.slide-in-right  { animation: slideInRight 400ms ease-out forwards; }
.screen.slide-out-left  { animation: slideOutLeft 400ms ease-in forwards; display: flex !important; }
.screen.slide-in-left   { animation: slideInLeft 400ms ease-out forwards; }
.screen.slide-out-right { animation: slideOutRight 400ms ease-in forwards; display: flex !important; }
.screen.slide-in-up     { animation: slideInUp 400ms ease-out forwards; }
.screen.slide-out-down  { animation: slideOutDown 400ms ease-in forwards; display: flex !important; }
.screen.slide-in-down   { animation: slideInDown 400ms ease-out forwards; }
.screen.slide-out-up    { animation: slideOutUp 400ms ease-in forwards; display: flex !important; }
.screen.fall-in         { animation: fallIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.screen.fade-in         { animation: fadeIn 300ms ease-out forwards; }
.screen.fade-out        { animation: fadeOut 300ms ease-in forwards; display: flex !important; }
.screen.rocket-out      { animation: rocketOut 500ms ease-in forwards; display: flex !important; }

@keyframes slideInRight  { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes slideOutLeft  { from { transform: translateX(0); opacity:1; } to { transform: translateX(-100%); opacity:0; } }
@keyframes slideInLeft   { from { transform: translateX(-100%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity:1; } to { transform: translateX(100%); opacity:0; } }
@keyframes slideInUp     { from { transform: translateY(100%); opacity:0; } to { transform: translateY(0); opacity:1; } }
@keyframes slideOutDown  { from { transform: translateY(0); opacity:1; } to { transform: translateY(100%); opacity:0; } }
@keyframes slideInDown   { from { transform: translateY(-100%); opacity:0; } to { transform: translateY(0); opacity:1; } }
@keyframes slideOutUp    { from { transform: translateY(0); opacity:1; } to { transform: translateY(-100%); opacity:0; } }
@keyframes fallIn        { from { transform: translateY(-80px) scale(0.85); opacity:0; } to { transform: translateY(0) scale(1); opacity:1; } }
@keyframes fadeIn        { from { opacity:0; } to { opacity:1; } }
@keyframes fadeOut       { from { opacity:1; } to { opacity:0; } }
@keyframes rocketOut     { from { transform: scale(1) rotate(0); opacity:1; } to { transform: scale(0.3) rotate(-8deg) translateY(-40%); opacity:0; } }

/* ═══════════════════════════════════════════════════════════
   PRE-LEVEL POPUP
   ═══════════════════════════════════════════════════════════ */

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: inset 0 0 120px rgba(0,0,0,0.4);
}
.overlay-backdrop.show {
  display: flex;
}
.overlay-backdrop .panel {
  box-shadow: 0 0 60px rgba(0,217,255,0.2), 0 0 0 1px rgba(0,217,255,0.1), 0 12px 48px rgba(0,0,0,0.8);
}

.pre-level-panel {
  max-width: 380px;
  width: 90%;
  padding: 28px 32px;
}
.pre-level-panel.fall-in {
  animation: fallIn 350ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.pre-level-info {
  display: flex;
  justify-content: space-around;
  width: 100%;
  font-size: 1rem;
  color: var(--clr-text);
  letter-spacing: 1px;
}

.pre-level-obj-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.obj-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
}
.obj-row.done {
  color: var(--clr-gold);
}
.obj-star {
  font-size: 1.1rem;
  min-width: 20px;
  text-align: center;
}
.obj-row.done .obj-star {
  color: var(--clr-gold);
  text-shadow: 0 0 6px rgba(255,215,0,0.5);
}

.pre-level-btn-row {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   HUD OBJECTIVE TRACKER
   ═══════════════════════════════════════════════════════════ */

#hud-objectives {
  position: absolute;
  top: 64px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  z-index: 21;
}

.hud-obj-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-main);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 1px;
  transition: color 0.3s;
}
.hud-obj-row.done {
  color: var(--clr-gold);
}
.hud-obj-check {
  font-size: 0.85rem;
  min-width: 14px;
}
.hud-obj-row.done .hud-obj-check {
  color: var(--clr-gold);
  text-shadow: 0 0 4px rgba(255,215,0,0.5);
}
.hud-obj-desc {
  font-size: 0.7rem;
}

/* ═══════════════════════════════════════════════════════════
   LEVEL COMPLETE OBJECTIVES
   ═══════════════════════════════════════════════════════════ */

.complete-obj-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0;
}

.complete-obj-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  letter-spacing: 1px;
}
.complete-obj-row.done {
  color: var(--clr-gold);
}
.complete-obj-row.grey {
  color: rgba(255,255,255,0.25);
}
.complete-obj-row .obj-star {
  font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════
   ONBOARDING OVERLAYS
   ═══════════════════════════════════════════════════════════ */

.onboarding-panel {
  max-width: 400px;
  width: 90%;
  padding: 28px 32px;
}
.onboarding-panel.fall-in {
  animation: fallIn 350ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.onboarding-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.onboarding-text {
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: rgba(220,210,255,0.85);
  line-height: 1.6;
  letter-spacing: 0.5px;
}
.onboarding-text.highlight {
  color: var(--clr-gold);
  font-weight: 700;
}
.onboarding-text strong {
  color: var(--clr-primary);
}

.onboarding-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0;
}

.onboarding-item {
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: rgba(220,210,255,0.8);
  letter-spacing: 0.5px;
  padding: 4px 0;
}
.onboarding-item strong {
  color: var(--clr-primary);
}

/* ── Startup Tip ─────────────────────────────────────────────── */
.startup-tip {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,10,30,0.85);
  border: 1px solid rgba(0,217,255,0.3);
  border-radius: 10px;
  padding: 12px 24px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: rgba(200,220,255,0.9);
  letter-spacing: 0.5px;
  text-align: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
  max-width: 90%;
  box-shadow: 0 0 20px rgba(0,217,255,0.15);
}
.startup-tip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   Settings Volume Sliders
   ═══════════════════════════════════════════════════════════════ */
.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 0;
}
.settings-slider-label {
  font-family: var(--font-main);
  font-size: 0.8rem;
  color: rgba(220,210,255,0.85);
  letter-spacing: 1px;
  min-width: 90px;
  text-align: right;
}
.settings-slider-value {
  font-family: var(--font-main);
  font-size: 0.75rem;
  color: var(--clr-primary);
  min-width: 36px;
  text-align: center;
}
.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--clr-primary);
  box-shadow: 0 0 8px rgba(0,217,255,0.5);
  cursor: pointer;
}
.settings-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--clr-primary);
  box-shadow: 0 0 8px rgba(0,217,255,0.5);
  border: none;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   Phase Celebration Overlay
   ═══════════════════════════════════════════════════════════════ */
.phase-celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: auto;
}
.phase-celebration-overlay.show {
  opacity: 1;
}
.phase-celebration-overlay.fade-out-celebration {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.phase-celebration-text {
  font-family: var(--font-main);
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    0 0 20px rgba(0,217,255,0.9),
    0 0 50px rgba(255,20,100,0.6),
    0 0 80px rgba(153,51,255,0.4);
  z-index: 2;
  text-align: center;
  padding: 0 20px;
  animation: celebrationTextPulse 1.5s ease-in-out infinite;
}

@keyframes celebrationTextPulse {
  0%, 100% { transform: scale(1); text-shadow: 0 0 20px rgba(0,217,255,0.9), 0 0 50px rgba(255,20,100,0.6); }
  50% { transform: scale(1.06); text-shadow: 0 0 30px rgba(0,217,255,1), 0 0 70px rgba(255,20,100,0.8), 0 0 100px rgba(153,51,255,0.6); }
}

/* Celebration variants — faster/denser */
.celebration-rocket { animation-duration: 1.5s !important; }
.celebration-star { animation-duration: 0.5s !important; }
.celebration-asteroid {
  animation-duration: 2s !important;
  width: 18px !important;
  height: 18px !important;
}
.celebration-supernova {
  animation-duration: 1.2s !important;
  width: 14px !important;
  height: 14px !important;
}

/* ═══════════════════════════════════════════════════════════════
   Title Impact Animation
   ═══════════════════════════════════════════════════════════════ */
.title-impact-anomaly {
  position: fixed;
  font-size: 2.5rem;
  z-index: 100;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(255,200,0,0.8));
}

.title-impact-flash {
  position: fixed;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,200,0,0.5) 40%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  z-index: 99;
  pointer-events: none;
  animation: impactFlash 0.5s ease-out forwards;
}

@keyframes impactFlash {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

.title-impact-particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffcc00;
  box-shadow: 0 0 8px rgba(255,200,0,0.8);
  z-index: 101;
  pointer-events: none;
  animation: impactParticle 0.6s ease-out forwards;
}

@keyframes impactParticle {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Pre-Level Popup Button Animations
   ═══════════════════════════════════════════════════════════════ */
.btn-entrance-play {
  animation: btnBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}
.btn-entrance-cancel {
  animation: btnSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

@keyframes btnBounceIn {
  0% { transform: scale(0.3) translateY(20px); opacity: 0; }
  60% { transform: scale(1.08) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes btnSlideUp {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
