/* ===== Per-vertical theming variables (set on body by subject) ===== */
:root {
  --subject-accent: #ff7a00;
  --subject-accent-2: #ff3b3b;
  --subject-glow: rgba(255, 100, 0, 0.4);
}
body.subject-math    { --subject-accent: #ff7a00; --subject-accent-2: #ff3b3b; --subject-glow: rgba(255, 100, 0, 0.4); }
body.subject-words   { --subject-accent: #00b8a3; --subject-accent-2: #00d6c3; --subject-glow: rgba(0, 180, 160, 0.4); }
body.subject-story   { --subject-accent: #a560e8; --subject-accent-2: #d680f8; --subject-glow: rgba(180, 100, 240, 0.4); }
body.subject-logic   { --subject-accent: #3a78d8; --subject-accent-2: #5a98ff; --subject-glow: rgba(80, 140, 240, 0.4); }
body.subject-code    { --subject-accent: #5ae050; --subject-accent-2: #7af070; --subject-glow: rgba(80, 220, 80, 0.4); }
body.subject-history { --subject-accent: #d68a30; --subject-accent-2: #f0a850; --subject-glow: rgba(220, 150, 50, 0.4); }
body.subject-geo     { --subject-accent: #3aa860; --subject-accent-2: #5ac880; --subject-glow: rgba(80, 180, 100, 0.4); }
body.subject-chem    { --subject-accent: #80d840; --subject-accent-2: #a0f060; --subject-glow: rgba(140, 220, 60, 0.4); }
body.subject-bio     { --subject-accent: #e8508a; --subject-accent-2: #ff70a8; --subject-glow: rgba(240, 100, 140, 0.4); }
body.subject-money   { --subject-accent: #e8c020; --subject-accent-2: #ffe040; --subject-glow: rgba(240, 200, 50, 0.4); }
body.subject-phonics { --subject-accent: #ff7058; --subject-accent-2: #ff9080; --subject-glow: rgba(255, 120, 80, 0.4); }
body.subject-music   { --subject-accent: #c860e8; --subject-accent-2: #e080ff; --subject-glow: rgba(200, 100, 240, 0.4); }
body.subject-astro   { --subject-accent: #5878d8; --subject-accent-2: #7898ff; --subject-glow: rgba(100, 140, 240, 0.4); }
body.subject-lang    { --subject-accent: #3098d8; --subject-accent-2: #50b8f8; --subject-glow: rgba(60, 160, 240, 0.4); }

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

/* ===== Splash screen ===== */
#splash {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, #1a1f4a 0%, #0a0e27 60%, #050818 100%);
  z-index: 9999;
  display: flex;
  align-items: center; justify-content: center;
  overflow: hidden;
  animation: splashFade 0.5s 1.8s forwards;
}
#splash.dismiss { animation: splashFade 0.3s forwards; }
@keyframes splashFade {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}
.splash-content {
  text-align: center;
  position: relative; z-index: 2;
  animation: splashIn 0.7s ease-out forwards;
  opacity: 0;
  transform: translateY(16px);
}
@keyframes splashIn {
  to { opacity: 1; transform: translateY(0); }
}
.splash-mark {
  font-size: 84px;
  background: linear-gradient(135deg, #ff7a00, #ff3b3b);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 120, 0, 0.6));
  line-height: 1;
  margin-bottom: 14px;
  animation: splashSpin 6s linear infinite;
  transform-origin: center;
}
@keyframes splashSpin {
  to { transform: rotate(360deg); }
}
.splash-brand {
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fff, #b9d4ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(120, 200, 255, 0.3);
}
.splash-tag {
  font-size: 11px;
  letter-spacing: 4px;
  color: #b9d4ff;
  opacity: 0.7;
  margin-top: 10px;
}
.splash-meteor {
  position: absolute;
  width: 100px; height: 3px;
  background: linear-gradient(90deg, transparent, #ffaa00, #ff5500, transparent);
  filter: blur(0.5px) drop-shadow(0 0 8px #ff7700);
  border-radius: 99px;
  transform-origin: right center;
  animation: streak 1.8s ease-out forwards;
  opacity: 0;
}
.splash-meteor.m1 { top: 18%; animation-delay: 0.3s; }
.splash-meteor.m2 { top: 58%; animation-delay: 0.6s; }
.splash-meteor.m3 { top: 38%; animation-delay: 0.95s; }
@keyframes streak {
  0% { left: -120px; transform: rotate(-18deg); opacity: 0; }
  15% { opacity: 1; }
  100% { left: 120vw; transform: rotate(-18deg); opacity: 0; }
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0e27;
  color: #fff;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

/* On iOS Safari the address bar can shrink the viewport mid-game.
   Use dvh where supported so we never get cut off. */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
  #game { height: 100dvh; }
}

#game {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  background: radial-gradient(ellipse at center, #1a1f4a 0%, #0a0e27 60%, #050818 100%);
}

.hidden { display: none !important; }

/* ===== HUD ===== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.hud-top {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 8px));
  left: 8px; right: 8px;
  display: flex; gap: 5px;
  pointer-events: auto;
  align-items: center;
  flex-wrap: nowrap;
}
@media (min-width: 480px) {
  .hud-top { gap: 8px; left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top, 12px)); }
}

.hud-pill {
  background: rgba(20, 25, 60, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 160, 255, 0.3);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #b9d4ff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
@media (min-width: 480px) {
  .hud-pill { padding: 8px 16px; font-size: 13px; letter-spacing: 1px; }
}
.hud-pill span { color: #fff; margin-left: 4px; }
@media (min-width: 480px) { .hud-pill span { margin-left: 6px; } }

.combo-pill {
  background: linear-gradient(135deg, rgba(255, 100, 50, 0.6), rgba(255, 200, 50, 0.4));
  border-color: rgba(255, 200, 50, 0.6);
  color: #fff;
}
.combo-pill span { color: #fff; margin: 0; font-size: 14px; }
@media (min-width: 480px) { .combo-pill span { font-size: 16px; } }
.combo-flash { animation: comboFlash 0.3s ease-out; }
@keyframes comboFlash {
  0% { transform: scale(1.4); box-shadow: 0 0 20px gold; }
  100% { transform: scale(1); box-shadow: none; }
}

.icon-btn {
  border: 1px solid rgba(120, 160, 255, 0.3);
  cursor: pointer;
  margin-left: auto;
  font-family: inherit;
  min-width: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
}

.objective-bar {
  position: absolute;
  top: calc(max(8px, env(safe-area-inset-top, 8px)) + 48px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 25, 60, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 200, 255, 0.4);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 11px;
  letter-spacing: 1px;
  font-weight: 700;
  color: #c2dfff;
  pointer-events: none;
  white-space: nowrap;
  max-width: 92%;
  text-overflow: ellipsis;
  overflow: hidden;
}
@media (min-width: 480px) {
  .objective-bar { top: calc(env(safe-area-inset-top, 12px) + 56px); padding: 6px 18px; font-size: 13px; letter-spacing: 1.5px; }
}

#answerBuffer {
  position: absolute;
  bottom: calc(232px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  font-size: 34px;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid rgba(120, 200, 255, 0.4);
  border-radius: 14px;
  padding: 4px 20px;
  min-width: 110px;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 14px rgba(120, 200, 255, 0.8);
  letter-spacing: 3px;
  pointer-events: none;
}

@media (min-width: 480px) {
  #answerBuffer { font-size: 42px; padding: 5px 24px; min-width: 128px; letter-spacing: 4px; }
}
@media (min-width: 768px) {
  #answerBuffer { font-size: 56px; padding: 6px 28px; min-width: 140px; bottom: 32px; border-radius: 16px; }
}

.keypad {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
  pointer-events: auto;
}
.keypad button {
  background: rgba(30, 40, 80, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 160, 255, 0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  font-family: inherit;
  padding: 10px 0;
  min-height: 44px;
  cursor: pointer;
  transition: transform 0.05s, background 0.1s;
}
@media (min-width: 400px) {
  .keypad { gap: 5px; padding: 8px; }
  .keypad button { font-size: 24px; padding: 12px 0; border-radius: 11px; }
}
@media (min-width: 600px) {
  .keypad { gap: 6px; padding: 12px; }
  .keypad button { font-size: 28px; padding: 14px 0; border-radius: 12px; }
}
.keypad button:active {
  transform: scale(0.94);
  background: rgba(120, 160, 255, 0.4);
}
.keypad .back { background: rgba(80, 30, 30, 0.85); }
.keypad .clear { background: rgba(80, 30, 30, 0.85); font-size: 16px; }
.keypad .neg { background: rgba(50, 60, 100, 0.85); }
.keypad .wide { grid-column: span 2; }
@media (min-width: 600px) { .keypad .clear { font-size: 18px; } }

@media (min-width: 768px) and (hover: hover) {
  .keypad { display: none; }
  #answerBuffer { bottom: 40px; }
}

/* Alphabet keypad for Word Storm — 7 columns, 4 rows */
.keypad-alpha {
  grid-template-columns: repeat(7, 1fr);
}
.keypad-alpha button {
  font-size: 16px;
  padding: 10px 0;
  min-height: 42px;
  border-radius: 8px;
}
@media (min-width: 400px) {
  .keypad-alpha button { font-size: 18px; padding: 12px 0; }
}
@media (min-width: 600px) {
  .keypad-alpha button { font-size: 22px; padding: 14px 0; }
}
.keypad-alpha .alpha-back { background: rgba(80, 30, 30, 0.85); grid-column: span 4; font-size: 16px; }
.keypad-alpha .alpha-clear { background: rgba(80, 30, 30, 0.85); grid-column: span 3; font-size: 14px; }

/* ===== Generic overlay ===== */
.overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(20, 30, 80, 0.85) 0%, rgba(10, 14, 39, 0.95) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 100;
  padding: 20px;
  text-align: center;
  animation: overlayIn 0.35s ease-out;
}
@keyframes overlayIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

h2 {
  font-size: clamp(22px, 6vw, 48px);
  letter-spacing: 3px;
  font-weight: 900;
  text-align: center;
}
@media (min-width: 480px) { h2 { letter-spacing: 4px; } }

.big-btn {
  background: linear-gradient(135deg, #ff7a00, #ff3b3b);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 30px rgba(255, 100, 0, 0.4);
  transition: transform 0.1s, box-shadow 0.15s;
}
@media (min-width: 480px) {
  .big-btn { padding: 16px 48px; font-size: 20px; letter-spacing: 3px; }
}
.big-btn:active { transform: scale(0.96); }
.big-btn:hover { box-shadow: 0 12px 40px rgba(255, 100, 0, 0.55); }
.alt-btn {
  background: linear-gradient(135deg, #3a78d8, #5a48c8);
  box-shadow: 0 8px 30px rgba(80, 100, 200, 0.4);
}
.alt-btn:hover { box-shadow: 0 12px 40px rgba(80, 100, 200, 0.55); }

.ghost-btn {
  background: transparent;
  color: #b9d4ff;
  border: 1px solid rgba(120, 160, 255, 0.3);
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
}

.score-final {
  font-size: 14px;
  letter-spacing: 2px;
  color: #b9d4ff;
}
@media (min-width: 480px) {
  .score-final { font-size: 16px; letter-spacing: 3px; }
}
.score-final span {
  display: block;
  font-size: clamp(34px, 11vw, 80px);
  color: #fff;
  font-weight: 900;
  text-shadow: 0 0 40px rgba(255, 200, 50, 0.6);
  line-height: 1.05;
}

.stars-earned {
  font-size: clamp(38px, 12vw, 80px);
  letter-spacing: 8px;
  color: gold;
  text-shadow: 0 0 30px rgba(255, 200, 50, 0.8);
  line-height: 1;
  min-height: 60px;
  display: flex;
  justify-content: center;
  gap: 6px;
}
@media (min-width: 480px) {
  .stars-earned { letter-spacing: 12px; min-height: 84px; gap: 8px; }
}
.stars-earned .star {
  display: inline-block;
  opacity: 0;
  transform: scale(0) rotate(-180deg);
  animation: starPop 0.55s ease-out forwards;
}
.stars-earned .star.s1 { animation-delay: 0.15s; }
.stars-earned .star.s2 { animation-delay: 0.55s; }
.stars-earned .star.s3 { animation-delay: 0.95s; }
.stars-earned .star.empty {
  color: rgba(255, 255, 255, 0.18);
  text-shadow: none;
  animation-name: starPopEmpty;
}
@keyframes starPop {
  0%   { opacity: 0; transform: scale(0) rotate(-180deg); }
  60%  { opacity: 1; transform: scale(1.45) rotate(0deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes starPopEmpty {
  0%   { opacity: 0; transform: scale(0); }
  100% { opacity: 1; transform: scale(1); }
}

.new-high {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffd700;
  animation: highBlink 0.6s infinite alternate;
}
@keyframes highBlink { from { opacity: 0.6; } to { opacity: 1; } }

/* ===== Level intro ===== */
.intro-text {
  font-family: inherit;
  font-size: 16px;
  color: #b9d4ff;
  letter-spacing: 1px;
  white-space: pre-wrap;
  text-align: center;
  margin: 0;
  line-height: 1.5;
  max-width: 360px;
}

/* ============================================
   HOME / LANDING (the main entry screen)
   ============================================ */
.overlay-home {
  background: linear-gradient(180deg, #0d1340 0%, #0a0e27 50%, #050818 100%);
  display: block;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
}

/* Top bar */
.home-topbar {
  position: sticky; top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top, 10px));
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(120, 160, 255, 0.12);
}
@media (min-width: 600px) {
  .home-topbar { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top, 14px)); }
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  font-size: 22px;
  display: inline-block;
  background: linear-gradient(135deg, #ff7a00, #ff3b3b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 120, 0, 0.4));
}
.brand-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 3px;
}
.topbar-stats { display: flex; gap: 8px; align-items: center; }
.stat-pill {
  background: rgba(255, 200, 50, 0.12);
  border: 1px solid rgba(255, 200, 50, 0.4);
  color: gold;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
}
.stat-pill span { color: #fff; }
.stat-pill.icon {
  cursor: pointer;
  background: rgba(120, 160, 255, 0.15);
  border-color: rgba(120, 160, 255, 0.4);
  color: #b9d4ff;
  font-family: inherit;
  width: 32px; height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
}

/* Hero */
.hero {
  position: relative;
  padding: 22px 16px 28px;
  overflow: hidden;
  border-bottom: 1px solid rgba(120, 160, 255, 0.1);
}
@media (min-width: 600px) {
  .hero { padding: 36px 20px 48px; }
}
.hero-stars-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.6), transparent 50%),
    radial-gradient(1px 1px at 70% 20%, rgba(180,200,255,0.7), transparent 50%),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 85% 65%, rgba(180,200,255,0.6), transparent 50%),
    radial-gradient(2px 2px at 15% 70%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 55% 50%, rgba(180,200,255,0.6), transparent 50%);
  pointer-events: none;
  opacity: 0.7;
}
.hero-meteors {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hm {
  position: absolute;
  font-size: 22px;
  color: #ff9a3d;
  filter: drop-shadow(0 0 14px rgba(255, 120, 50, 0.7));
  opacity: 0;
  animation: drift linear infinite;
}
.hm1 { animation-duration: 14s; animation-delay: 1s; }
.hm2 { animation-duration: 22s; animation-delay: 6s; }
.hm3 { animation-duration: 18s; animation-delay: 11s; }
@keyframes drift {
  0%   { left: -6%;  top: -6%;  opacity: 0; transform: rotate(-30deg); }
  6%   { opacity: 0.9; }
  94%  { opacity: 0.9; }
  100% { left: 110%; top: 110%; opacity: 0; transform: rotate(-30deg); }
}
.hero-content {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}
.hero-greeting {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #b9d4ff;
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0.85;
}
.hero-title {
  font-size: clamp(26px, 7vw, 56px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #fff, #c2dfff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.hero-accent {
  background: linear-gradient(180deg, #ffaa00, #ff3b3b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 13px;
  color: #b9d4ff;
  line-height: 1.5;
  letter-spacing: 0.3px;
  max-width: 480px;
  margin-bottom: 18px;
}
@media (min-width: 600px) {
  .hero-sub { font-size: 14px; margin-bottom: 24px; }
}
.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.hero-hint {
  font-size: 11px;
  color: rgba(180, 200, 255, 0.7);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-left: 4px;
}

/* Section heading */
.section-head {
  padding: 28px 20px 14px;
  max-width: 1080px;
  margin: 0 auto;
}
.section-head h2 {
  font-size: 18px;
  letter-spacing: 4px;
  font-weight: 900;
  margin-bottom: 4px;
}
.section-sub {
  font-size: 12px;
  color: rgba(180, 200, 255, 0.7);
  letter-spacing: 1.5px;
}

/* Worlds list */
.worlds-section { padding-bottom: 8px; }
.worlds-scroll {
  padding: 0 16px;
  max-width: 1080px;
  margin: 0 auto;
}

.world-section {
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid rgba(120, 160, 255, 0.18);
  border-left: 4px solid var(--world-color, #5a4a3a);
  border-radius: 14px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 600px) {
  .world-section { margin-bottom: 18px; padding: 18px; border-radius: 18px; }
}
.world-section::before {
  content: '';
  position: absolute;
  top: -40%; right: -20%;
  width: 240px; height: 240px;
  background: radial-gradient(circle, var(--world-color, #5a4a3a) 0%, transparent 70%);
  opacity: 0.18;
  pointer-events: none;
}

.world-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
}
.world-icon {
  font-size: 24px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--world-color, #5a4a3a);
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
@media (min-width: 600px) {
  .world-header { gap: 14px; margin-bottom: 16px; }
  .world-icon { font-size: 32px; width: 52px; height: 52px; border-radius: 14px; }
}
.world-meta { flex: 1; min-width: 0; }
.world-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.8px;
}
.world-sub {
  font-size: 10px;
  color: #b9d4ff;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
@media (min-width: 600px) {
  .world-name { font-size: 17px; letter-spacing: 1.2px; }
  .world-sub { font-size: 11px; letter-spacing: 1px; margin-top: 3px; }
}
.world-stars {
  font-size: 12px;
  font-weight: 800;
  color: gold;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  background: rgba(255, 200, 50, 0.1);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 200, 50, 0.3);
  white-space: nowrap;
}
@media (min-width: 600px) {
  .world-stars { font-size: 15px; padding: 6px 12px; letter-spacing: 1px; }
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
@media (min-width: 480px) {
  .level-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
}
@media (min-width: 768px) {
  .level-grid { grid-template-columns: repeat(5, 1fr); gap: 10px; }
}

.level-node {
  background: linear-gradient(180deg, rgba(40, 50, 90, 0.9), rgba(20, 25, 50, 0.9));
  border: 1px solid rgba(120, 160, 255, 0.3);
  border-radius: 10px;
  padding: 8px 4px 6px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 76px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 480px) {
  .level-node { padding: 10px 6px 8px; min-height: 90px; border-radius: 14px; gap: 4px; }
}
.level-node:active { transform: scale(0.96); }
.level-node:hover:not(.locked):not(:disabled) {
  background: linear-gradient(180deg, rgba(60, 90, 160, 0.95), rgba(30, 50, 100, 0.9));
  border-color: rgba(120, 200, 255, 0.6);
}
.level-node.locked {
  background: rgba(20, 25, 50, 0.5);
  border-style: dashed;
  cursor: not-allowed;
  opacity: 0.5;
}
.level-node.mini {
  border-color: rgba(255, 180, 50, 0.7);
  background: linear-gradient(180deg, rgba(120, 80, 30, 0.85), rgba(30, 40, 80, 0.85));
}
.level-node.boss {
  border-color: rgba(255, 80, 80, 0.7);
  background: linear-gradient(180deg, rgba(140, 30, 30, 0.9), rgba(40, 20, 50, 0.85));
}
.level-node.perfect {
  box-shadow: 0 0 0 2px gold inset, 0 0 16px rgba(255, 200, 50, 0.4);
  border-color: gold;
}
.node-id {
  font-size: 10px;
  color: #b9d4ff;
  letter-spacing: 0.5px;
  font-weight: 700;
}
@media (min-width: 480px) {
  .node-id { font-size: 11px; letter-spacing: 1px; }
}
.node-name {
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.2px;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 480px) {
  .node-name { font-size: 10px; line-height: 1.2; letter-spacing: 0.3px; }
}
.node-stars {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: gold;
  font-weight: 700;
}
@media (min-width: 480px) {
  .node-stars { font-size: 13px; letter-spacing: 2px; }
}
.level-node.boss .node-id::before { content: '👑 '; }
.level-node.mini .node-id::before { content: '⚔ '; }

.node-pattern {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffd060;
  background: rgba(255, 200, 50, 0.18);
  border: 1px solid rgba(255, 200, 50, 0.5);
  border-radius: 999px;
  padding: 2px 6px;
  margin-top: 2px;
}
.level-node.has-pattern {
  outline: 1px solid rgba(255, 200, 50, 0.4);
}

/* Footer (curriculum reassurance) */
.home-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 14px 12px max(20px, env(safe-area-inset-bottom, 20px));
  max-width: 720px;
  margin: 8px auto 0;
  border-top: 1px solid rgba(120, 160, 255, 0.1);
  text-align: center;
}
.footer-cell { padding: 8px 4px; }
.footer-num {
  font-size: 18px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff, #b9d4ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
@media (min-width: 480px) {
  .footer-cell { padding: 14px 4px; }
  .footer-num { font-size: 24px; }
  .home-footer { padding: 20px 16px max(28px, env(safe-area-inset-bottom, 28px)); gap: 8px; }
}
.footer-lbl {
  font-size: 9px;
  color: rgba(180, 200, 255, 0.6);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}
@media (min-width: 480px) {
  .footer-lbl { font-size: 10px; letter-spacing: 2px; }
}

/* ===== Subject Galaxy ===== */
.overlay-galaxy {
  background: linear-gradient(180deg, #0d1340 0%, #0a0e27 50%, #050818 100%);
  display: block;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
}

.galaxy-hero {
  position: relative;
  padding: 22px 16px 28px;
  overflow: hidden;
  border-bottom: 1px solid rgba(120, 160, 255, 0.1);
}
@media (min-width: 600px) {
  .galaxy-hero { padding: 36px 20px 48px; }
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 0 12px 24px;
  max-width: 1080px;
  margin: 0 auto;
}
@media (min-width: 480px) {
  .subjects-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 0 16px 32px; }
}

.subject-tile {
  position: relative;
  background: linear-gradient(180deg, rgba(40, 50, 90, 0.75), rgba(20, 25, 50, 0.85));
  border: 1px solid var(--tile-accent-soft, rgba(120, 160, 255, 0.3));
  border-radius: 16px;
  padding: 18px 14px 14px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 150px;
  overflow: hidden;
}
.subject-tile:active { transform: scale(0.97); }
.subject-tile:hover:not(.locked) {
  box-shadow: 0 8px 30px var(--tile-glow, rgba(120, 160, 255, 0.3));
  border-color: var(--tile-accent, #ffaa00);
}
.subject-tile.locked {
  opacity: 0.7;
  cursor: pointer;
}
.subject-tile.locked .tile-state { color: rgba(180, 200, 255, 0.6); }
.subject-tile::after {
  content: '';
  position: absolute;
  top: -30%; right: -20%;
  width: 140px; height: 140px;
  background: radial-gradient(circle, var(--tile-accent, #ffaa00) 0%, transparent 70%);
  opacity: 0.2;
  pointer-events: none;
}

.tile-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 0 14px var(--tile-glow, rgba(120, 160, 255, 0.5)));
  margin-bottom: 6px;
  z-index: 1;
}
.tile-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
  z-index: 1;
  line-height: 1.15;
}
.tile-sub {
  font-size: 10px;
  color: #b9d4ff;
  letter-spacing: 0.5px;
  z-index: 1;
}
.tile-state {
  margin-top: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--tile-accent, gold);
  z-index: 1;
}
.tile-progress {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
  z-index: 1;
}
.tile-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--tile-accent), var(--tile-accent-2));
  border-radius: 999px;
}
.tile-tier-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(180, 200, 255, 0.8);
  z-index: 2;
}

/* Subject preview modal extras */
.subject-preview-icon {
  font-size: 64px;
  text-align: center;
  filter: drop-shadow(0 0 30px var(--subject-glow, rgba(255, 120, 0, 0.5)));
  margin-bottom: 4px;
}
.subject-preview-sub {
  font-size: 12px;
  letter-spacing: 2px;
  color: #b9d4ff;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}
.subject-preview-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 10px;
  letter-spacing: 1px;
  margin: 8px 0;
}
.subject-preview-meta span {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180,200,255,0.2);
  border-radius: 999px;
  padding: 4px 10px;
  color: #b9d4ff;
}

/* ===== Cosmic Story (Narrative Branching) UI ===== */
.overlay-story {
  background: linear-gradient(180deg, #3a2810 0%, #1a0e08 60%, #0a0608 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.overlay-story .home-topbar {
  background: rgba(60, 40, 16, 0.85);
  border-bottom: 1px solid rgba(255, 200, 80, 0.2);
}
.story-title-banner {
  font-size: 14px; font-weight: 900;
  letter-spacing: 1.5px; text-align: center;
  flex: 1; color: #ffe9a0;
}
.story-stars { font-size: 18px; letter-spacing: 2px; color: gold; font-weight: 800; }
.story-star-reveal { animation: starPop 0.6s ease-out; }
.story-year-banner {
  text-align: center;
  font-size: 11px;
  letter-spacing: 4px;
  color: rgba(255, 200, 80, 0.7);
  padding: 12px 16px 4px;
  font-weight: 800;
  text-transform: uppercase;
}
.story-history {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 4px 16px 8px;
  min-height: 18px;
}
.story-history-pill {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 900;
}
.story-history-pill.right {
  background: rgba(90, 224, 80, 0.2);
  border: 1px solid rgba(90, 224, 80, 0.5);
  color: #5ae050;
}
.story-history-pill.wrong {
  background: rgba(255, 80, 80, 0.2);
  border: 1px solid rgba(255, 80, 80, 0.5);
  color: #ff7080;
}
.story-text {
  font-family: 'Georgia', serif;
  font-size: clamp(16px, 3.5vw, 20px);
  line-height: 1.65;
  letter-spacing: 0.2px;
  color: #f0e0c0;
  background: rgba(80, 50, 20, 0.3);
  border: 1px solid rgba(255, 200, 80, 0.2);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 8px 16px 16px;
  text-align: left;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.story-text.fade-in { animation: storyFadeIn 0.45s ease-out; }
@keyframes storyFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.story-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px;
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
}
.story-choice {
  background: linear-gradient(135deg, rgba(160, 100, 40, 0.85), rgba(110, 65, 25, 0.85));
  border: 1px solid rgba(255, 200, 80, 0.4);
  border-radius: 12px;
  color: #ffe9a0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.2s;
  text-align: left;
}
.story-choice:active { transform: scale(0.98); }
.story-choice:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(180, 120, 50, 0.95), rgba(130, 80, 30, 0.95));
  border-color: rgba(255, 200, 80, 0.8);
}
.story-choice.correct-choice {
  background: linear-gradient(135deg, rgba(60, 180, 80, 0.85), rgba(40, 140, 60, 0.85));
  border-color: rgba(90, 224, 80, 0.7);
}
.story-choice.wrong-choice {
  background: linear-gradient(135deg, rgba(180, 60, 60, 0.85), rgba(140, 40, 40, 0.85));
  border-color: rgba(255, 80, 80, 0.7);
}
.story-status {
  text-align: center;
  font-size: 13px; letter-spacing: 1px; font-weight: 700;
  padding: 0 16px 18px; min-height: 22px;
}
.story-status.win  { color: #5ae050; text-shadow: 0 0 12px rgba(90, 224, 80, 0.5); }
.story-status.fail { color: #ff7080; }

/* ===== Cosmic Run (Endless Runner) UI ===== */
.overlay-run {
  background: linear-gradient(180deg, #0d2050 0%, #0a0e27 60%, #050818 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.overlay-run .home-topbar { position: sticky; top: 0; z-index: 5; }
.run-title { font-size: 14px; font-weight: 900; letter-spacing: 1.5px; text-align: center; flex: 1; }
.run-stars { font-size: 18px; letter-spacing: 2px; color: gold; font-weight: 800; }
.run-star-reveal { animation: starPop 0.6s ease-out; }
.run-stats {
  display: flex; gap: 8px; padding: 8px 12px; justify-content: center; flex-wrap: wrap;
}
.run-question-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(120, 200, 255, 0.3);
  border-radius: 12px;
  margin: 4px 16px;
  padding: 10px;
  text-align: center;
}
.run-question-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(180, 200, 255, 0.7);
  margin-bottom: 4px;
}
.run-question {
  font-family: 'Courier New', monospace;
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
  word-break: break-word;
}
.run-canvas-wrap {
  display: flex; justify-content: center; padding: 6px 12px;
}
.run-canvas {
  border: 2px solid rgba(120, 160, 255, 0.3);
  border-radius: 12px;
  max-width: 100%;
  touch-action: manipulation;
  cursor: pointer;
}
.run-intro {
  font-size: 12px; color: #b9d4ff;
  text-align: center; padding: 6px 20px;
  line-height: 1.4;
}
.run-status {
  text-align: center; font-size: 13px;
  letter-spacing: 0.5px; font-weight: 700;
  padding: 4px 16px 16px; min-height: 22px;
}
.run-status.win  { color: #5ae050; }
.run-status.fail { color: #ff7080; }

/* ===== Cosmic Defense (Tower Defense) UI ===== */
.overlay-tower {
  background: linear-gradient(180deg, #2a1010 0%, #0a0e27 60%, #050818 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.overlay-tower .home-topbar { position: sticky; top: 0; z-index: 5; }
.tower-title {
  font-size: 14px; font-weight: 900; letter-spacing: 1.5px;
  text-align: center; flex: 1;
}
.tower-stars { font-size: 18px; letter-spacing: 2px; color: gold; font-weight: 800; }
.tower-star-reveal { animation: starPop 0.6s ease-out; }
.tower-stats {
  display: flex; gap: 8px; padding: 10px 12px; justify-content: center; flex-wrap: wrap;
}
.tower-canvas-wrap { display: flex; justify-content: center; padding: 6px 12px; }
.tower-canvas {
  border: 2px solid rgba(255, 120, 100, 0.3);
  border-radius: 12px; background: #0a1a2e;
  max-width: 100%;
}
.tower-intro {
  font-size: 12px; color: #b9d4ff;
  text-align: center; padding: 6px 20px;
  line-height: 1.4;
}
.tower-help {
  font-size: 11px; color: rgba(180, 200, 255, 0.7);
  text-align: center; padding: 0 20px 8px;
  letter-spacing: 0.3px;
}
.tower-status {
  text-align: center; font-size: 13px;
  letter-spacing: 0.5px; font-weight: 700;
  padding: 4px 16px 16px; min-height: 22px;
}
.tower-status.win  { color: #5ae050; }
.tower-status.fail { color: #ff7080; }

/* Quiz modal (overlays the tower game) */
.tower-quiz-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.tower-quiz-card {
  background: linear-gradient(180deg, #2a1626, #1a0d2e);
  border: 2px solid rgba(255, 120, 100, 0.5);
  border-radius: 18px;
  padding: 22px 26px;
  max-width: 440px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.tower-quiz-header {
  font-size: 11px; letter-spacing: 2px;
  color: rgba(255, 200, 80, 0.9);
  text-transform: uppercase;
  font-weight: 800; margin-bottom: 14px;
}
.tower-quiz-question {
  font-size: clamp(24px, 5vw, 36px);
  font-family: 'Courier New', monospace;
  font-weight: 900;
  color: #fff;
  padding: 14px 8px;
  background: rgba(255, 200, 80, 0.08);
  border: 1px solid rgba(255, 200, 80, 0.3);
  border-radius: 12px;
  margin-bottom: 16px;
  letter-spacing: 1px;
  word-break: break-word;
}
.tower-quiz-input {
  width: 100%;
  font-family: inherit; font-size: 20px; font-weight: 800;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid rgba(120, 200, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 14px;
  outline: none;
}
.tower-quiz-input:focus {
  border-color: rgba(120, 200, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
}
.tower-quiz-buttons {
  display: flex; gap: 10px; justify-content: center;
}
.tower-quiz-buttons .big-btn { padding: 12px 24px; font-size: 16px; }

/* ===== Memory Match UI ===== */
.overlay-match {
  background: linear-gradient(180deg, #1a0d2e 0%, #0a0e27 60%, #050818 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.overlay-match .home-topbar { position: sticky; top: 0; z-index: 5; }
.match-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-align: center;
  flex: 1;
}
.match-stars {
  font-size: 18px;
  letter-spacing: 2px;
  color: gold;
  font-weight: 800;
}
.match-star-reveal { animation: starPop 0.6s ease-out; }
.match-stats {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.match-intro {
  font-size: 12px;
  color: #b9d4ff;
  text-align: center;
  padding: 0 20px 8px;
  line-height: 1.4;
}
.match-grid {
  display: grid;
  gap: 8px;
  padding: 8px 14px;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
}
.match-card {
  aspect-ratio: 1;
  perspective: 1000px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.match-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform-style: preserve-3d;
}
.match-card.flipped .match-card-inner {
  transform: rotateY(180deg);
}
.match-card-back, .match-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 2px solid;
  font-weight: 900;
  font-family: inherit;
  text-align: center;
  padding: 4px;
}
.match-card-back {
  background: linear-gradient(135deg, #a560e8, #6a40b8);
  color: #fff;
  font-size: 32px;
  border-color: rgba(180, 100, 240, 0.6);
  box-shadow: 0 4px 14px rgba(165, 96, 232, 0.3);
}
.match-card-face {
  background: linear-gradient(135deg, #ffd060, #ff9a3d);
  color: #1a1a3a;
  font-size: 14px;
  letter-spacing: 0.3px;
  border-color: rgba(255, 200, 80, 0.7);
  transform: rotateY(180deg);
  word-break: break-word;
  line-height: 1.1;
}
@media (min-width: 480px) {
  .match-card-face { font-size: 16px; }
  .match-card-back { font-size: 36px; }
}
.match-card.matched .match-card-face {
  background: linear-gradient(135deg, #5ae050, #3aa848);
  color: #fff;
  border-color: rgba(90, 224, 80, 0.7);
  animation: matchedPop 0.4s ease-out;
}
@keyframes matchedPop {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(1); }
}
.match-status {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.5px;
  font-weight: 700;
  padding: 6px 16px 16px;
  min-height: 22px;
}
.match-status.win { color: #5ae050; }
.match-status.fail { color: #ff7080; }

/* ===== Atlas Quest (drag-to-target) UI ===== */
.overlay-drag {
  background: linear-gradient(180deg, #061a2e 0%, #0a0e27 60%, #050818 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.overlay-drag .home-topbar { position: sticky; top: 0; z-index: 5; }
.drag-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-align: center;
  flex: 1;
}
.drag-stars {
  font-size: 18px;
  letter-spacing: 2px;
  color: gold;
  font-weight: 800;
}
.drag-star-reveal { animation: starPop 0.6s ease-out; }
.drag-stats {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.drag-canvas-wrap {
  display: flex;
  justify-content: center;
  padding: 6px 12px;
}
.drag-canvas {
  border: 2px solid rgba(120, 200, 255, 0.3);
  border-radius: 12px;
  background: #0a1a30;
  max-width: 100%;
  touch-action: none;
}
.drag-intro {
  font-size: 12px;
  color: #b9d4ff;
  text-align: center;
  padding: 8px 20px 4px;
  line-height: 1.4;
}
.drag-section-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(180, 200, 255, 0.6);
  text-transform: uppercase;
  padding: 10px 16px 4px;
  font-weight: 800;
  text-align: center;
}
.drag-tray {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 12px 12px;
  min-height: 60px;
}
.drag-tile {
  background: linear-gradient(135deg, rgba(60,180,80,0.95), rgba(40,140,60,0.95));
  border: 2px solid rgba(90, 224, 80, 0.7);
  border-radius: 14px;
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 14px 24px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 6px 20px rgba(60, 180, 80, 0.3);
  transition: transform 0.08s, box-shadow 0.15s;
}
.drag-tile:active { transform: scale(0.97); cursor: grabbing; }
.drag-tile.dragging {
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 12px 40px rgba(60, 180, 80, 0.6);
  transform: scale(1.08);
}
.drag-tray-done {
  font-size: 16px;
  color: gold;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
}
.drag-status {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.5px;
  font-weight: 700;
  padding: 4px 16px 16px;
  min-height: 22px;
}
.drag-status.win  { color: #5ae050; text-shadow: 0 0 12px rgba(90, 224, 80, 0.5); }
.drag-status.fail { color: #ff7080; }

/* ===== Bot Logic UI ===== */
.overlay-bot {
  background: linear-gradient(180deg, #0a1a14 0%, #0a0e27 60%, #050818 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.overlay-bot .home-topbar {
  position: sticky; top: 0;
  z-index: 5;
}
.bot-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-align: center;
  flex: 1;
}
.bot-stars {
  font-size: 18px;
  letter-spacing: 2px;
  color: gold;
  font-weight: 800;
}
.bot-star-reveal { animation: starPop 0.6s ease-out; }

.bot-canvas-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 16px;
}
.bot-canvas {
  border: 2px solid rgba(120, 200, 255, 0.3);
  border-radius: 12px;
  background: rgba(10, 14, 39, 0.6);
  max-width: 100%;
}

.bot-intro {
  font-size: 13px;
  color: #b9d4ff;
  text-align: center;
  padding: 0 20px 8px;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

.bot-section-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(180, 200, 255, 0.6);
  text-transform: uppercase;
  padding: 14px 16px 6px;
  font-weight: 800;
}

.bot-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px;
}
.bot-program {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px;
  min-height: 50px;
}
.bot-program-empty {
  font-size: 12px;
  color: rgba(180, 200, 255, 0.4);
  font-style: italic;
  padding: 10px 4px;
  letter-spacing: 0.5px;
}
.bot-prog-count {
  align-self: center;
  font-size: 11px;
  color: rgba(180, 200, 255, 0.6);
  margin-left: auto;
  padding: 0 6px;
  letter-spacing: 1px;
}

.bot-block {
  background: rgba(40, 80, 60, 0.85);
  border: 1px solid rgba(90, 224, 80, 0.4);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
  min-height: 40px;
  white-space: nowrap;
}
.bot-block:active { transform: scale(0.94); }
.bot-block:hover { background: rgba(60, 120, 80, 0.95); }

.bot-block.cmd-forward { background: linear-gradient(135deg, rgba(60,180,80,0.85), rgba(40,140,60,0.85)); }
.bot-block.cmd-turn-left { background: linear-gradient(135deg, rgba(180,140,40,0.85), rgba(140,100,30,0.85)); border-color: rgba(220,180,80,0.5); }
.bot-block.cmd-turn-right { background: linear-gradient(135deg, rgba(40,140,180,0.85), rgba(30,100,160,0.85)); border-color: rgba(80,180,220,0.5); }

.bot-prog-block {
  position: relative;
}
.bot-prog-block::after {
  content: '×';
  position: absolute;
  top: -5px; right: -5px;
  width: 16px; height: 16px;
  background: #ff5050;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  line-height: 1;
  font-weight: 900;
}

.bot-controls {
  display: flex;
  gap: 10px;
  padding: 16px;
  justify-content: center;
  align-items: center;
}
.bot-controls .big-btn {
  padding: 14px 32px;
  font-size: 18px;
  letter-spacing: 2px;
}

.bot-status {
  text-align: center;
  font-size: 13px;
  letter-spacing: 1px;
  font-weight: 700;
  padding: 0 16px 16px;
  min-height: 24px;
}
.bot-status.warn { color: #ffd060; }
.bot-status.fail { color: #ff7080; }
.bot-status.win  { color: #5ae050; text-shadow: 0 0 12px rgba(90, 224, 80, 0.5); }

/* ===== Streak pill ===== */
.streak-pill {
  background: rgba(255, 100, 50, 0.15) !important;
  border-color: rgba(255, 120, 60, 0.5) !important;
  color: #ff9050 !important;
}
.streak-pill span { color: #fff; }

/* ===== Daily Quest ===== */
.daily-quest-section {
  padding-bottom: 0;
  margin-bottom: 0;
}
.daily-quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  padding: 0 16px 16px;
  max-width: 1080px;
  margin: 0 auto;
}
@media (min-width: 480px) {
  .daily-quest-grid { gap: 10px; }
}
.daily-quest-card {
  background: linear-gradient(180deg, rgba(255, 180, 60, 0.18), rgba(255, 120, 40, 0.08));
  border: 1px solid rgba(255, 180, 60, 0.4);
  border-radius: 12px;
  padding: 12px 10px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.08s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 92px;
}
.daily-quest-card:active { transform: scale(0.97); }
.daily-quest-card:hover:not(:disabled) {
  border-color: rgba(255, 200, 80, 0.8);
  box-shadow: 0 6px 20px rgba(255, 150, 50, 0.2);
}
.daily-quest-card.completed {
  background: linear-gradient(180deg, rgba(90, 224, 80, 0.18), rgba(60, 180, 60, 0.08));
  border-color: rgba(90, 224, 80, 0.6);
}
.daily-quest-card.completed::before {
  content: '✓';
  position: absolute;
}
.dq-emoji {
  font-size: 24px;
}
.dq-subject {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffd060;
  text-transform: uppercase;
}
.dq-level {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.dq-tag {
  margin-top: auto;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: rgba(255, 200, 80, 0.7);
}
.daily-quest-card.completed .dq-tag {
  color: #5ae050;
}

/* ===== Achievements modal ===== */
.ach-modal {
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.ach-summary {
  font-size: 13px;
  color: #b9d4ff;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.ach-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  padding-right: 4px;
}
.ach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(120, 160, 255, 0.15);
}
.ach-item.earned {
  background: linear-gradient(135deg, rgba(255, 200, 60, 0.12), rgba(255, 150, 50, 0.05));
  border-color: rgba(255, 200, 80, 0.5);
}
.ach-emoji {
  font-size: 28px;
  filter: grayscale(1) opacity(0.4);
  flex-shrink: 0;
}
.ach-item.earned .ach-emoji {
  filter: none;
}
.ach-meta {
  flex: 1;
  min-width: 0;
}
.ach-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fff;
}
.ach-item:not(.earned) .ach-name {
  color: rgba(255, 255, 255, 0.6);
}
.ach-desc {
  font-size: 11px;
  color: rgba(180, 200, 255, 0.6);
  letter-spacing: 0.3px;
}
.ach-item.earned .ach-desc {
  color: rgba(180, 200, 255, 0.8);
}
.ach-status {
  font-size: 16px;
  flex-shrink: 0;
}

/* Toast notification for newly earned achievement */
.ach-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffaa00, #ff5500);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 14px;
  box-shadow: 0 12px 40px rgba(255, 100, 0, 0.5);
  z-index: 9999;
  animation: achToast 3s ease-out forwards;
}
@keyframes achToast {
  0%   { opacity: 0; transform: translate(-50%, -10px); }
  10%  { opacity: 1; transform: translate(-50%, 0); }
  90%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* ===== How-to-play modal ===== */
.modal-card {
  background: linear-gradient(180deg, #1a2050, #0d1340);
  border: 1px solid rgba(120, 160, 255, 0.3);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: left;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.modal-card h2 { text-align: center; margin-bottom: 18px; font-size: 22px; }
.how-list {
  list-style: none;
  margin-bottom: 24px;
}
.how-list li {
  padding: 10px 0 10px 28px;
  position: relative;
  font-size: 14px;
  line-height: 1.5;
  color: #d2e0ff;
  border-bottom: 1px solid rgba(120, 160, 255, 0.1);
}
.how-list li:last-child { border-bottom: none; }
.how-list li::before {
  content: '☄';
  position: absolute;
  left: 0; top: 10px;
  color: #ff9a3d;
  font-size: 14px;
}
.how-list b { color: #fff; }
.modal-card .big-btn { width: 100%; padding: 14px; }

/* ============================================================
   NOZZL THEME — in-app overrides for Galaxy / Home / Subject tiles
   Matches the landing page (teal/navy/yellow cartoon-playful).
   Gameplay canvas screens keep their darker space look.
   ============================================================ */
:root {
  --nz-teal:   #2ba090;
  --nz-teal-2: #34c2a8;
  --nz-navy:   #1a1640;
  --nz-navy-2: #221c52;
  --nz-navy-3: #14102f;
  --nz-yellow: #ffd35a;
  --nz-orange: #ff9a3d;
  --nz-cream:  #fff7e0;
  --nz-purple: #6c4ad8;
}

/* Splash — teal/navy with yellow comet */
#splash {
  background: radial-gradient(ellipse at center, #2a2566 0%, var(--nz-navy) 55%, var(--nz-navy-3) 100%);
}
.splash-mark {
  background: linear-gradient(135deg, var(--nz-yellow), var(--nz-orange));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 211, 90, 0.6));
}
.splash-brand {
  background: linear-gradient(180deg, #fff, #b7eadd);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(43, 160, 144, 0.35);
}
.splash-tag { color: #9adcce; }
.splash-meteor {
  background: linear-gradient(90deg, transparent, var(--nz-yellow), var(--nz-orange), transparent);
  filter: blur(0.5px) drop-shadow(0 0 8px var(--nz-orange));
}

/* Cartoon-italic brand logo across all in-app topbars */
.brand-mark {
  background: linear-gradient(135deg, var(--nz-yellow), var(--nz-orange));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 154, 61, 0.45));
}
.brand-name {
  font-style: italic;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #fff, #c8efe5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Stat pills — Nozzl yellow on dark navy */
.stat-pill {
  background: linear-gradient(180deg, rgba(255, 211, 90, 0.18), rgba(255, 154, 61, 0.10));
  border: 1px solid rgba(255, 211, 90, 0.55);
  color: var(--nz-yellow);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.08);
}
.stat-pill.icon {
  background: linear-gradient(180deg, rgba(43, 160, 144, 0.22), rgba(43, 160, 144, 0.08));
  border-color: rgba(52, 194, 168, 0.55);
  color: #b7eadd;
}

/* Streak pill keeps orange family (warmer accent) */
.streak-pill {
  background: linear-gradient(180deg, rgba(255, 154, 61, 0.22), rgba(255, 90, 60, 0.10)) !important;
  border-color: rgba(255, 154, 61, 0.65) !important;
  color: #ffc18a !important;
}

/* PLAY / CONTINUE button — Nozzl orange */
.big-btn {
  background: linear-gradient(180deg, var(--nz-orange), #ff6b3b);
  box-shadow: 0 10px 30px rgba(255, 110, 50, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
.big-btn:hover { box-shadow: 0 14px 40px rgba(255, 110, 50, 0.55), inset 0 1px 0 rgba(255,255,255,0.25); }
.alt-btn {
  background: linear-gradient(180deg, var(--nz-teal-2), var(--nz-teal));
  box-shadow: 0 10px 30px rgba(43, 160, 144, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.alt-btn:hover { box-shadow: 0 14px 40px rgba(43, 160, 144, 0.55), inset 0 1px 0 rgba(255,255,255,0.2); }
.ghost-btn {
  color: #c8efe5;
  border-color: rgba(52, 194, 168, 0.45);
}

/* Galaxy + Math Meteors home — navy backdrop */
.overlay-galaxy,
.overlay-home {
  background: linear-gradient(180deg, var(--nz-navy-2) 0%, var(--nz-navy) 50%, var(--nz-navy-3) 100%);
}
.home-topbar {
  background: rgba(20, 16, 47, 0.85);
  border-bottom: 1px solid rgba(52, 194, 168, 0.18);
}

/* Hero — softer teal-tinted top, yellow accent word */
.galaxy-hero,
.hero {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(52, 194, 168, 0.22), transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 211, 90, 0.12), transparent 70%);
  border-bottom: 1px solid rgba(52, 194, 168, 0.15);
}
.hero-greeting { color: #9adcce; }
.hero-title {
  font-style: italic;
  background: linear-gradient(180deg, #fff, #c8efe5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-accent {
  background: linear-gradient(180deg, var(--nz-yellow), var(--nz-orange));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: #b7d3ce; }
.hero-hint { color: rgba(154, 220, 206, 0.75); }
.hm { color: var(--nz-yellow); filter: drop-shadow(0 0 14px rgba(255, 211, 90, 0.7)); }

/* Section headings — italic + teal subline */
.section-head h2 {
  font-style: italic;
  background: linear-gradient(180deg, #fff, #c8efe5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-sub { color: rgba(154, 220, 206, 0.75); }

/* Daily Quest — Nozzl yellow on navy */
.daily-quest-card {
  background: linear-gradient(180deg, rgba(34, 28, 82, 0.95), rgba(20, 16, 47, 0.95));
  border: 1px solid rgba(255, 211, 90, 0.45);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.daily-quest-card:hover:not(:disabled) {
  border-color: rgba(255, 211, 90, 0.85);
  box-shadow: 0 10px 28px rgba(255, 211, 90, 0.18);
}
.daily-quest-card.completed {
  background: linear-gradient(180deg, rgba(43, 160, 144, 0.28), rgba(20, 16, 47, 0.95));
  border-color: rgba(52, 194, 168, 0.7);
}
.dq-subject { color: var(--nz-yellow); }
.dq-tag { color: rgba(255, 211, 90, 0.8); }
.daily-quest-card.completed .dq-tag { color: var(--nz-teal-2); }

/* Subject tiles — navy card with teal glow + yellow tier badge */
.subject-tile {
  background: linear-gradient(180deg, var(--nz-navy-2), var(--nz-navy-3));
  border: 1px solid rgba(52, 194, 168, 0.28);
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}
.subject-tile:hover:not(.locked) {
  border-color: var(--nz-teal-2);
  box-shadow: 0 12px 36px rgba(43, 160, 144, 0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.subject-tile::after {
  background: radial-gradient(circle, var(--tile-accent, var(--nz-teal-2)) 0%, transparent 70%);
  opacity: 0.22;
}
.tile-name {
  font-style: italic;
  letter-spacing: 0.8px;
}
.tile-sub { color: #9adcce; }
.tile-state { color: var(--nz-yellow); }
.tile-tier-badge {
  background: linear-gradient(180deg, rgba(52, 194, 168, 0.28), rgba(43, 160, 144, 0.12));
  border: 1px solid rgba(52, 194, 168, 0.6);
  color: #b7eadd;
  letter-spacing: 1.2px;
}

/* Footer numbers — yellow/teal gradient */
.home-footer {
  border-top: 1px solid rgba(52, 194, 168, 0.18);
}
.footer-num {
  background: linear-gradient(180deg, var(--nz-yellow), var(--nz-orange));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.footer-lbl { color: rgba(154, 220, 206, 0.7); }

/* Subject preview modal — match palette */
.subject-preview-sub { color: #9adcce; }
.subject-preview-meta span {
  background: rgba(52, 194, 168, 0.10);
  border: 1px solid rgba(52, 194, 168, 0.35);
  color: #b7eadd;
}

/* ============================================================
   NOZZL THEME — individual game overlays
   Story / Run / Tower / Match / Drag / Bot all pulled
   into the navy/teal palette with a subtle subject hue.
   ============================================================ */
.overlay-story,
.overlay-run,
.overlay-tower,
.overlay-match,
.overlay-drag,
.overlay-bot {
  background: linear-gradient(180deg, var(--nz-navy-2) 0%, var(--nz-navy) 55%, var(--nz-navy-3) 100%);
}
.overlay-story::before,
.overlay-run::before,
.overlay-tower::before,
.overlay-match::before,
.overlay-drag::before,
.overlay-bot::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%, rgba(52, 194, 168, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 30% at 85% 15%, rgba(255, 211, 90, 0.10), transparent 70%);
  z-index: 0;
}
.overlay-story > *,
.overlay-run > *,
.overlay-tower > *,
.overlay-match > *,
.overlay-drag > *,
.overlay-bot > * { position: relative; z-index: 1; }

/* Topbars on game overlays */
.overlay-story .home-topbar,
.overlay-run .home-topbar,
.overlay-tower .home-topbar,
.overlay-match .home-topbar,
.overlay-drag .home-topbar,
.overlay-bot .home-topbar {
  background: rgba(20, 16, 47, 0.85);
  border-bottom: 1px solid rgba(52, 194, 168, 0.18);
}

/* Title banners + stars */
.story-title-banner,
.run-title,
.tower-title,
.match-title,
.drag-title,
.bot-title {
  font-style: italic;
  background: linear-gradient(180deg, #fff, #c8efe5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.story-stars,
.run-stars,
.tower-stars,
.match-stars,
.drag-stars,
.bot-stars { color: var(--nz-yellow); text-shadow: 0 0 12px rgba(255, 211, 90, 0.45); }

/* Year banner in story overlay */
.story-year-banner { color: rgba(255, 211, 90, 0.85); }

/* Status text colors — keep semantic green/red but tone yellow→nozzl-yellow */
.bot-status.warn,
.run-status.warn,
.tower-status.warn,
.match-status.warn,
.drag-status.warn,
.story-status.warn { color: var(--nz-yellow); }

/* Tower quiz modal — navy/teal card */
.tower-quiz-card {
  background: linear-gradient(180deg, var(--nz-navy-2), var(--nz-navy-3));
  border: 1px solid rgba(52, 194, 168, 0.4);
}
.tower-quiz-input {
  background: rgba(20, 16, 47, 0.6);
  border: 1px solid rgba(52, 194, 168, 0.4);
  color: #fff;
}

/* Modal cards (Achievements, How-to-play, intro/pause/gameover overlays) */
.modal-card {
  background: linear-gradient(180deg, var(--nz-navy-2), var(--nz-navy-3));
  border: 1px solid rgba(52, 194, 168, 0.28);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Achievements modal — yellow/teal accents */
.ach-item.earned {
  background: linear-gradient(135deg, rgba(255, 211, 90, 0.14), rgba(43, 160, 144, 0.08));
  border-color: rgba(255, 211, 90, 0.55);
}

/* Buttons in bot palette / commands keep visual hierarchy */
.bot-controls .big-btn,
.bot-run-btn { box-shadow: 0 10px 26px rgba(255, 110, 50, 0.35); }

/* Intro / section labels */
.bot-section-label,
.drag-section-label {
  color: #9adcce;
  letter-spacing: 2px;
}

/* "How to play" star bullets — Nozzl yellow */
.how-list li::before { color: var(--nz-yellow); }

/* Streak heart fire keeps its orange family but slightly warmer */
.streak-pill { box-shadow: 0 4px 14px rgba(255, 154, 61, 0.25), inset 0 1px 0 rgba(255,255,255,0.08); }

/* Level / world nodes (the grid inside each game's "select level" screen) —
   give them the same Nozzl card feel */
.world-card,
.level-node {
  background: linear-gradient(180deg, var(--nz-navy-2), var(--nz-navy-3)) !important;
  border-color: rgba(52, 194, 168, 0.28) !important;
}
.world-card:hover:not(.locked),
.level-node:hover:not(.locked) {
  border-color: var(--nz-teal-2) !important;
  box-shadow: 0 10px 28px rgba(43, 160, 144, 0.3) !important;
}

/* Pulse ring on the CONTINUE / PLAY buttons inside the app to draw the eye */
.big-btn { animation: appCtaGlow 2.8s ease-in-out infinite; }
@keyframes appCtaGlow {
  0%, 100% { box-shadow: 0 10px 30px rgba(255, 110, 50, 0.32), inset 0 1px 0 rgba(255,255,255,0.25); }
  50%      { box-shadow: 0 14px 40px rgba(255, 110, 50, 0.55), 0 0 0 5px rgba(255, 154, 61, 0.18), inset 0 1px 0 rgba(255,255,255,0.25); }
}
.big-btn:hover, .big-btn:active { animation: none; }

/* Subject tiles in galaxy — entrance bounce */
.subjects-grid .subject-tile {
  animation: tileIn 0.55s cubic-bezier(.2,1.4,.4,1) both;
}
.subjects-grid .subject-tile:nth-child(1)  { animation-delay: 0.02s; }
.subjects-grid .subject-tile:nth-child(2)  { animation-delay: 0.05s; }
.subjects-grid .subject-tile:nth-child(3)  { animation-delay: 0.08s; }
.subjects-grid .subject-tile:nth-child(4)  { animation-delay: 0.11s; }
.subjects-grid .subject-tile:nth-child(5)  { animation-delay: 0.14s; }
.subjects-grid .subject-tile:nth-child(6)  { animation-delay: 0.17s; }
.subjects-grid .subject-tile:nth-child(7)  { animation-delay: 0.20s; }
.subjects-grid .subject-tile:nth-child(8)  { animation-delay: 0.23s; }
.subjects-grid .subject-tile:nth-child(9)  { animation-delay: 0.26s; }
.subjects-grid .subject-tile:nth-child(10) { animation-delay: 0.29s; }
.subjects-grid .subject-tile:nth-child(11) { animation-delay: 0.32s; }
.subjects-grid .subject-tile:nth-child(12) { animation-delay: 0.35s; }
@keyframes tileIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.subject-tile:hover:not(.locked) .tile-icon {
  animation: tileIconBounce 0.7s ease-out;
}
@keyframes tileIconBounce {
  0%, 100% { transform: scale(1) rotate(0); }
  40%      { transform: scale(1.18) rotate(8deg); }
}

/* Daily quest cards entrance */
.daily-quest-card {
  animation: dqIn 0.5s cubic-bezier(.2,1.4,.4,1) both;
}
.daily-quest-card:nth-child(1) { animation-delay: 0.05s; }
.daily-quest-card:nth-child(2) { animation-delay: 0.15s; }
.daily-quest-card:nth-child(3) { animation-delay: 0.25s; }
@keyframes dqIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .big-btn, .subjects-grid .subject-tile, .daily-quest-card { animation: none !important; }
}

/* ============================================================
   LIGHT THEME — in-app navigation surfaces match the landing page
   (white bg, navy text, teal primary, yellow/orange accents).
   Gameplay canvas + per-game overlays keep their darker context.
   ============================================================ */
:root {
  --lt-bg:       #f6fbfa;
  --lt-bg-sky:   linear-gradient(180deg, #b8e0e8 0%, #c8e8de 50%, #e8f5f3 100%);
  --lt-bg-alt:   #eaf5f3;
  --lt-text:     #1a1f3a;
  --lt-text-2:   #5a6478;
  --lt-text-3:   #8b94a8;
  --lt-border:   #d6e8e4;
  --lt-teal:     #2ba090;
  --lt-teal-2:   #34c2a8;
  --lt-teal-dk:  #1f8273;
  --lt-yellow:   #ffd35a;
  --lt-orange:   #ff9a3d;
  --lt-navy:     #1a1640;
}

/* Galaxy + Math Meteors home — light bg with sky-gradient hero zone */
.overlay-galaxy,
.overlay-home {
  background: var(--lt-bg) !important;
  color: var(--lt-text);
}

/* Topbar — white frosted */
.home-topbar {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid rgba(43, 160, 144, 0.15) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Logo wordmark — navy text with teal drop-shadow (matches landing nav) */
.brand-name {
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-navy) !important;
  color: var(--lt-navy) !important;
  text-shadow:
    -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff,
    2px 2px 0 rgba(43, 160, 144, 0.5);
}

/* Stat pills — white with teal text */
.stat-pill {
  background: #fff !important;
  border: 1px solid var(--lt-border) !important;
  color: var(--lt-navy) !important;
  box-shadow: 0 4px 14px rgba(26, 22, 64, 0.06) !important;
}
.stat-pill span { color: var(--lt-teal) !important; font-weight: 800; }
.stat-pill.icon {
  background: rgba(43, 160, 144, 0.10) !important;
  border-color: rgba(43, 160, 144, 0.35) !important;
  color: var(--lt-teal) !important;
}
.streak-pill {
  background: rgba(255, 154, 61, 0.12) !important;
  border-color: rgba(255, 154, 61, 0.45) !important;
  color: var(--lt-orange) !important;
}
.streak-pill span { color: var(--lt-orange) !important; }

/* Hero — light sky gradient */
.galaxy-hero,
.hero {
  background: var(--lt-bg-sky) !important;
  border-bottom: 1px solid rgba(43, 160, 144, 0.15) !important;
}
.hero-greeting {
  color: var(--lt-teal) !important;
  font-weight: 800;
  letter-spacing: 3px;
}
.hero-title {
  font-style: italic;
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-navy) !important;
  color: var(--lt-navy) !important;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.4);
}
.hero-accent {
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-teal) !important;
  color: var(--lt-teal) !important;
}
.hero-sub {
  color: var(--lt-text-2) !important;
  font-weight: 500;
}
.hero-hint {
  color: var(--lt-text-3) !important;
}
.hm { color: var(--lt-teal) !important; filter: drop-shadow(0 0 14px rgba(43, 160, 144, 0.4)) !important; opacity: 0.6; }
.hero-stars-bg { opacity: 0.3 !important; }

/* Section heads — navy italic with teal-yellow underline */
.section-head h2 {
  font-style: italic;
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-navy) !important;
  color: var(--lt-navy) !important;
}
.section-sub {
  color: var(--lt-text-2) !important;
}

/* PLAY / CONTINUE — solid teal (matches landing primary) */
.big-btn {
  background: var(--lt-teal) !important;
  color: #fff !important;
  box-shadow: 0 8px 28px rgba(43, 160, 144, 0.35) !important;
  animation: appCtaGlowLight 2.6s ease-in-out infinite;
}
.big-btn:hover {
  background: var(--lt-teal-dk) !important;
  box-shadow: 0 12px 36px rgba(43, 160, 144, 0.5) !important;
}
@keyframes appCtaGlowLight {
  0%, 100% { box-shadow: 0 8px 28px rgba(43, 160, 144, 0.35); }
  50%      { box-shadow: 0 12px 38px rgba(43, 160, 144, 0.55), 0 0 0 6px rgba(43, 160, 144, 0.12); }
}
.alt-btn {
  background: linear-gradient(180deg, var(--lt-yellow), var(--lt-orange)) !important;
  color: var(--lt-navy) !important;
  box-shadow: 0 8px 28px rgba(255, 154, 61, 0.35) !important;
}
.ghost-btn {
  background: #fff !important;
  color: var(--lt-teal) !important;
  border: 2px solid var(--lt-teal) !important;
}
.ghost-btn:hover { background: var(--lt-teal) !important; color: #fff !important; }

/* Daily quest cards — white with soft border + yellow tag */
.daily-quest-card {
  background: #fff !important;
  border: 1px solid var(--lt-border) !important;
  color: var(--lt-text) !important;
  box-shadow: 0 6px 18px rgba(26, 22, 64, 0.05) !important;
}
.daily-quest-card:hover:not(:disabled) {
  border-color: var(--lt-teal) !important;
  box-shadow: 0 12px 28px rgba(43, 160, 144, 0.15) !important;
}
.daily-quest-card.completed {
  background: linear-gradient(180deg, rgba(43, 160, 144, 0.10), rgba(255, 255, 255, 1)) !important;
  border-color: var(--lt-teal) !important;
}
.dq-subject { color: var(--lt-orange) !important; }
.dq-level   { color: var(--lt-navy) !important; }
.dq-tag     { color: var(--lt-teal) !important; }
.daily-quest-card.completed .dq-tag { color: var(--lt-teal-dk) !important; }

/* Subject tiles — white cards with teal hover + colored top corner glow */
.subject-tile {
  background: #fff !important;
  border: 1px solid var(--lt-border) !important;
  border-radius: 22px !important;
  color: var(--lt-text) !important;
  box-shadow: 0 8px 22px rgba(26, 22, 64, 0.06) !important;
}
.subject-tile:hover:not(.locked) {
  border-color: var(--lt-teal) !important;
  box-shadow: 0 16px 40px rgba(43, 160, 144, 0.18) !important;
  transform: translateY(-4px);
}
.subject-tile.locked { opacity: 0.55; }
.subject-tile::after {
  opacity: 0.14 !important;
}
.tile-name { color: var(--lt-navy) !important; font-style: italic; }
.tile-sub  { color: var(--lt-text-2) !important; }
.tile-state{ color: var(--lt-orange) !important; }
.tile-progress { background: rgba(43, 160, 144, 0.10) !important; }
.tile-tier-badge {
  background: rgba(43, 160, 144, 0.12) !important;
  border: 1px solid rgba(43, 160, 144, 0.35) !important;
  color: var(--lt-teal-dk) !important;
}

/* Footer (curriculum reassurance) — light */
.home-footer {
  background: var(--lt-bg-alt) !important;
  border-top: 1px solid var(--lt-border) !important;
}
.footer-num {
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-teal) !important;
  color: var(--lt-teal) !important;
  font-weight: 900;
}
.footer-lbl { color: var(--lt-text-3) !important; letter-spacing: 1.5px; }

/* Subject preview "coming soon" modal — light card */
.modal-card {
  background: #fff !important;
  border: 1px solid var(--lt-border) !important;
  color: var(--lt-text) !important;
  box-shadow: 0 24px 60px rgba(26, 22, 64, 0.18) !important;
}
.modal-card h2 {
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-navy) !important;
  color: var(--lt-navy) !important;
}
.subject-preview-sub { color: var(--lt-text-2) !important; }
.subject-preview-meta span {
  background: rgba(43, 160, 144, 0.10) !important;
  border: 1px solid rgba(43, 160, 144, 0.30) !important;
  color: var(--lt-teal-dk) !important;
}
.intro-text { color: var(--lt-text-2) !important; }
.how-list li {
  color: var(--lt-text) !important;
  border-bottom: 1px solid var(--lt-border) !important;
}
.how-list b { color: var(--lt-navy) !important; }
.how-list li::before { color: var(--lt-orange) !important; }

/* Achievements modal — light */
.ach-summary { color: var(--lt-text-2) !important; }
.ach-item {
  background: rgba(26, 22, 64, 0.03) !important;
  border: 1px solid var(--lt-border) !important;
}
.ach-item.earned {
  background: linear-gradient(135deg, rgba(255, 211, 90, 0.18), rgba(43, 160, 144, 0.08)) !important;
  border-color: rgba(255, 211, 90, 0.6) !important;
}
.ach-name { color: var(--lt-navy) !important; }
.ach-item:not(.earned) .ach-name { color: var(--lt-text-3) !important; }
.ach-desc { color: var(--lt-text-2) !important; }

/* Splash — keep dark for the brief launch moment, but warmer */
#splash {
  background: radial-gradient(ellipse at center, #c8e8de 0%, #b8e0e8 60%, #8fc8c8 100%) !important;
}
.splash-brand {
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: var(--lt-navy) !important;
  color: var(--lt-navy) !important;
  text-shadow: 0 4px 20px rgba(255, 255, 255, 0.6) !important;
}
.splash-tag { color: var(--lt-teal-dk) !important; opacity: 0.8 !important; }

/* Stars in earned line stay gold for celebration */
.stars-earned { color: var(--lt-orange) !important; }

/* Score final in modal */
.score-final { color: var(--lt-text-2) !important; }
.score-final span {
  color: var(--lt-navy) !important;
  text-shadow: 0 0 24px rgba(255, 211, 90, 0.4) !important;
}
