:root {
  --bg-top: #eaf1ff;
  --bg-bottom: #f8faff;
  --dot: #d3e2fb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent-orange: #ff6b4a;
  --accent-orange-dark: #e04f2e;
  --accent-yellow: #fbbf24;
  --accent-green: #10b981;
  --accent-pink: #ec4899;
  --text-dark: #26314d;
  --text-muted: #5b6785;
  --card-radius: 28px;
  --font-display: 'Baloo 2', 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 4 Magical Worlds inspired by StarJar */
body[data-world="space"] {
  --bg-top: #eaf1ff;
  --bg-bottom: #f3e8ff;
  --dot: #cddcfb;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
}

body[data-world="ocean"] {
  --bg-top: #dff4ff;
  --bg-bottom: #e0f2fe;
  --dot: #bae6fd;
  --primary: #0284c7;
  --primary-dark: #0369a1;
}

body[data-world="jungle"] {
  --bg-top: #e3f9eb;
  --bg-bottom: #fef9c3;
  --dot: #bbf7d0;
  --primary: #16a34a;
  --primary-dark: #15803d;
}

body[data-world="candy"] {
  --bg-top: #fce7f3;
  --bg-bottom: #fff1f2;
  --dot: #fbcfe8;
  --primary: #db2777;
  --primary-dark: #be185d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  background:
    radial-gradient(circle, var(--dot) 1.3px, transparent 1.5px) 0 0 / 22px 22px,
    linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--text-dark);
  transition: background 0.4s ease;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* Ambient Orbits & World Decorations */
.world-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 2px dashed rgba(59, 130, 246, 0.14);
}

.orbit-1 {
  width: 560px;
  height: 560px;
  top: -180px;
  right: -140px;
}

.orbit-2 {
  width: 440px;
  height: 440px;
  bottom: -160px;
  left: -120px;
}

.float-deco {
  position: absolute;
  font-size: 2.6rem;
  opacity: 0.22;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.04));
  animation: floatSlow 8s ease-in-out infinite alternate;
}

.deco-1 { top: 12%; left: 1.2%; animation-duration: 7s; }
.deco-2 { top: 72%; right: 1.2%; animation-duration: 9s; }
.deco-3 { bottom: 6%; left: 1.5%; animation-duration: 8.5s; }

@keyframes floatSlow {
  0% { transform: translateY(0px) rotate(-6deg); }
  100% { transform: translateY(-14px) rotate(8deg); }
}

/* App Shell */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1260px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 18px 28px;
  gap: 12px;
}

/* Header / Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  padding: 10px 18px;
  border-radius: 26px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06), 0 4px 0 rgba(255, 255, 255, 0.9);
  border: 2px solid #ffffff;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.mascot-avatar-wrap {
  position: relative;
}

.mascot-avatar {
  font-size: 2.3rem;
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 3px solid #ffffff;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.18);
}

.online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.age-badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
}

.brand-text .subtitle {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.6px;
}

/* Age Level Switcher (1-2yo vs 3yo+) */
.age-switcher {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 16px;
  gap: 4px;
}

.age-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 12px;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.age-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

/* World Theme Switcher (4 Worlds) */
.world-switcher {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.world-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.world-chip.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  transform: translateY(-1px);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.space-dot { background: #3b82f6; }
.ocean-dot { background: #06b6d4; }
.jungle-dot { background: #22c55e; }
.candy-dot { background: #ec4899; }

/* Top Right Actions */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-guide-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff758f 0%, #ff5c77 100%);
  color: #ffffff;
  border: 2px solid #ffffff;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #d9385a;
  transition: transform 0.15s ease;
}

.voice-guide-pill:active {
  transform: translateY(2px);
}

.jar-trigger-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fffbeb;
  border: 2.5px solid #fcd34d;
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #b45309;
  box-shadow: 0 4px 0 #f59e0b;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.jar-trigger-btn.pop {
  transform: scale(1.25);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 2px solid #ffffff;
  background: #f1f5f9;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cbd5e1;
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 18px;
  border: 2px solid #ffffff;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-dark);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(148, 163, 184, 0.35);
  transition: all 0.15s ease;
}

.mode-tab .tab-icon {
  font-size: 1.35rem;
}

.mode-tab.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 5px 0 var(--primary-dark);
  transform: translateY(-2px);
}

/* StarJar Subject Cards Bar */
.category-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  padding: 4px 0;
}

.cat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 20px;
  border: 2.5px solid #ffffff;
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cat-pill:hover {
  transform: translateY(-2px);
}

.cat-pill.active {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 6px 0 var(--primary), 0 10px 20px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.cat-emoji {
  font-size: 2rem;
  width: 44px;
  height: 44px;
  background: #f1f5f9;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cat-text {
  display: flex;
  flex-direction: column;
}

.cat-text strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
  color: var(--text-dark);
  line-height: 1.15;
}

.cat-text small {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Stage Container */
.stage-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-view {
  display: none;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  animation: fadeIn 0.25s ease;
}

.game-view.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mascot Speech Banner */
.mascot-speech-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  border: 2.5px solid #e2e8f0;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.banner-mascot {
  font-size: 2.3rem;
  animation: bounceMascot 2.2s infinite ease-in-out;
}

@keyframes bounceMascot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.banner-text-wrap {
  flex: 1;
}

.eyebrow-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

.mascot-speech-banner p {
  font-family: var(--font-display);
  font-size: 1.12rem;
  color: var(--text-dark);
}

.mini-speak-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #dbeafe;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #93c5fd;
  flex-shrink: 0;
}

/* Cards Grid (Explore Mode) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 18px;
  padding: 4px 2px 24px;
}

.vocab-card {
  position: relative;
  border-radius: var(--card-radius);
  padding: 44px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: 4px solid #ffffff;
  box-shadow: 0 10px 0 rgba(15, 23, 42, 0.09), 0 14px 28px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  min-height: 235px;
  overflow: hidden;
}

.vocab-card:hover {
  transform: translateY(-4px) scale(1.02);
}

.vocab-card:active,
.vocab-card.speaking {
  transform: translateY(3px) scale(1.04);
  border-color: var(--primary);
}

.vocab-card.speaking .card-emoji {
  animation: happyJump 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes happyJump {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.25) rotate(-10deg); }
  70% { transform: scale(1.18) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.card-sound-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.92);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  z-index: 2;
}

.card-star-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #d97706;
  z-index: 2;
}

.card-letter-pill {
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  padding: 1px 12px;
  border-radius: 999px;
  border: 2px solid rgba(59, 130, 246, 0.25);
  line-height: 1.2;
}

.card-emoji {
  width: 94px;
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.35rem;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.1));
  text-align: center;
  max-width: 100%;
  flex-shrink: 0;
}

.card-number-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: 130px;
  min-height: 16px;
}

.num-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.card-color-swatch {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 5px solid #ffffff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  flex-shrink: 0;
}

.card-word-en {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-dark);
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  word-break: break-word;
}

.card-word-vi {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.78);
  padding: 3px 12px;
  border-radius: 999px;
  text-align: center;
  max-width: 100%;
}

body.hide-vi .card-word-vi {
  display: none;
}

/* MODE 2: STARJAR QUIZ */
.quiz-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  padding: 18px 24px;
  border-radius: 28px;
  border: 3px solid #bfdbfe;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.08);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  flex-wrap: wrap;
}

.replay-audio-btn {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--primary-dark);
  flex-shrink: 0;
}

.replay-audio-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--primary-dark);
}

.quiz-prompt-content {
  flex: 1;
  text-align: center;
}

.quiz-badge {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.quiz-sub {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.quiz-target-word {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--accent-orange);
}

.difficulty-toggle {
  display: flex;
  gap: 6px;
}

.diff-btn {
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
}

.diff-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.quiz-choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 920px;
  width: 100%;
  margin: 8px auto;
}

.quiz-card {
  min-height: 250px;
}

.quiz-card.wrong-shake {
  animation: gentleWobble 0.45s ease;
  opacity: 0.72;
}

.quiz-card.correct-celebrate {
  animation: winnerBounce 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-color: #fbbf24;
  box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.45), 0 12px 24px rgba(0, 0, 0, 0.12);
}

@keyframes gentleWobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px) rotate(-3deg); }
  75% { transform: translateX(10px) rotate(3deg); }
}

@keyframes winnerBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.14) rotate(4deg); }
  70% { transform: scale(1.08) rotate(-4deg); }
  100% { transform: scale(1.05); }
}

/* MODE 3: INTERACTIVE STAR JAR & GARDEN (StarJar Signature Feature) */
.jar-garden-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  padding: 6px 0 24px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 32px;
  padding: 24px;
  border: 3px solid #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  background: #dbeafe;
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 999px;
}

.small-pill {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 999px;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  color: var(--text-dark);
  line-height: 1.2;
}

.feature-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Physics Glass Jar */
.physics-jar-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
}

.jar-glow-halo {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.32) 0%, rgba(59, 130, 246, 0.05) 70%);
  pointer-events: none;
}

.jar-vessel {
  position: relative;
  width: 260px;
  height: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  transform: rotate(var(--jar-tilt, 0deg));
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
  touch-action: none;
}

.jar-vessel:active {
  cursor: grabbing;
}

.jar-vessel.shaking {
  animation: shakeJarAnim 0.45s ease;
}

@keyframes shakeJarAnim {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-9deg) translateY(-4px); }
  45% { transform: rotate(9deg) translateY(-6px); }
  75% { transform: rotate(-6deg); }
}

.jar-lid-cap {
  width: 146px;
  height: 26px;
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
  border-radius: 12px 12px 6px 6px;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  z-index: 3;
}

.jar-neck {
  width: 126px;
  height: 14px;
  background: rgba(255, 255, 255, 0.65);
  border-left: 4px solid rgba(147, 197, 253, 0.8);
  border-right: 4px solid rgba(147, 197, 253, 0.8);
  z-index: 2;
}

#jarPhysicsCanvas {
  width: 240px;
  height: 260px;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.55) 0%, rgba(219, 234, 254, 0.78) 100%);
  border-radius: 42px 42px 58px 58px;
  border: 5px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.9),
    inset -12px -12px 24px rgba(59, 130, 246, 0.14),
    0 16px 32px rgba(30, 64, 175, 0.14);
  z-index: 1;
}

.jar-glass-shine {
  position: absolute;
  top: 56px;
  left: 34px;
  width: 22px;
  height: 170px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0.08) 100%);
  pointer-events: none;
  z-index: 4;
}

.jar-count-pill {
  margin-top: -12px;
  z-index: 5;
  background: #ffffff;
  border: 2.5px solid #fcd34d;
  padding: 6px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
}

.jar-controls-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  padding: 12px 20px;
  border-radius: 18px;
  border: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.action-btn:active {
  transform: translateY(3px);
}

.primary-action {
  background: var(--accent-orange);
  color: #ffffff;
  box-shadow: 0 5px 0 var(--accent-orange-dark);
}

.secondary-action {
  background: #eff6ff;
  color: var(--primary);
  border: 2px solid #bfdbfe;
  box-shadow: 0 5px 0 #bfdbfe;
}

/* Mini Garden Grid */
.garden-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0;
}

.garden-plot {
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
  border: 3px solid #bbf7d0;
  border-radius: 22px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.garden-plot.locked {
  background: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.72;
}

.garden-plot:hover {
  transform: translateY(-3px);
}

.plot-emoji {
  font-size: 3rem;
}

.plot-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.reward-milestone-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fffbeb;
  border: 2px solid #fde68a;
  padding: 12px 16px;
  border-radius: 20px;
}

.milestone-icon {
  font-size: 2.2rem;
}

.reward-milestone-box strong {
  font-size: 0.95rem;
  color: #92400e;
}

.reward-milestone-box p {
  font-size: 0.85rem;
  color: #b45309;
}

/* MODE 4: BALLOON HARVEST */
.balloon-stage {
  position: relative;
  flex: 1;
  min-height: 440px;
  background: linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.82) 100%);
  border-radius: 32px;
  border: 4px solid #ffffff;
  overflow: hidden;
}

.balloon {
  position: absolute;
  bottom: -150px;
  width: 125px;
  height: 150px;
  border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset -12px -12px 24px rgba(0, 0, 0, 0.15),
              inset 10px 10px 20px rgba(255, 255, 255, 0.55),
              0 12px 24px rgba(0, 0, 0, 0.12);
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -30px;
  width: 3px;
  height: 30px;
  background: rgba(0, 0, 0, 0.22);
}

.balloon-emoji {
  font-size: 3.4rem;
}

.balloon-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.balloon.popping {
  animation: popAnim 0.28s ease-out forwards;
  pointer-events: none;
}

@keyframes popAnim {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.8; }
  100% { transform: scale(0.2); opacity: 0; }
}

/* MODE 5: PIANO */
.piano-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #ffffff;
  padding: 18px 28px;
  border-radius: 28px;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.piano-focus-emoji {
  font-size: 4.4rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.piano-focus-emoji.bounce {
  transform: scale(1.3) rotate(10deg);
}

.piano-focus-text h2 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  color: var(--primary);
}

.piano-keyboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 290px;
  padding: 10px 4px 20px;
}

.piano-keyboard.alphabet-26-grid {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 12px;
  min-height: auto;
}

.piano-key {
  border-radius: 24px;
  border: 4px solid #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 8px 18px;
  cursor: pointer;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.15);
  color: #ffffff;
  font-family: var(--font-display);
  gap: 6px;
  overflow: hidden;
}

.piano-key:active,
.piano-key.playing {
  transform: translateY(7px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.key-emoji {
  font-size: 2.6rem;
  background: rgba(255, 255, 255, 0.28);
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.key-letter {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
}

.key-word-mini {
  font-size: 0.92rem;
  font-weight: 800;
  opacity: 0.95;
  text-align: center;
}

.key-note {
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  text-align: center;
}

/* Modals & Spotlight */
.spotlight-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.hidden {
  display: none !important;
}

.spotlight-card,
.modal-card {
  background: #ffffff;
  border-radius: 32px;
  max-width: 540px;
  width: 100%;
  padding: 26px 28px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
  animation: popInModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spotlight-card {
  text-align: center;
  max-width: 440px;
  border: 5px solid #fbbf24;
}

@keyframes popInModal {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.spotlight-emoji {
  font-size: 8rem;
  line-height: 1.1;
}

.spotlight-en {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--primary);
}

.spotlight-sound {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--accent-orange);
}

.spotlight-vi {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-muted);
  margin: 4px 0;
}

.spotlight-guide {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  background: #eff6ff;
  padding: 8px 14px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.spotlight-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.spot-btn {
  padding: 12px 22px;
  border-radius: 16px;
  border: none;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  color: white;
}

.repeat-btn { background: var(--primary); }
.close-btn { background: var(--accent-orange); }

/* Parent Progress Modal */
.profile-summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  padding: 14px 18px;
  border-radius: 20px;
  margin-bottom: 16px;
  border: 2px solid #e2e8f0;
}

.profile-avatar {
  font-size: 2.5rem;
  background: #dbeafe;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subject-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prog-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prog-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 800;
}

.prog-track {
  height: 12px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Settings Modal */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.close-modal-btn {
  background: #f1f5f9;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 14px;
}

.setting-row p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.voice-select-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-test-voice-btn {
  padding: 8px 11px;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: #eff6ff;
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
}

.mini-test-voice-btn:active {
  transform: translateY(2px);
}

.setting-select,
.setting-input {
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  max-width: 215px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(24px); }

.modal-footer {
  margin-top: 14px;
  background: #eff6ff;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  color: #1e40af;
}

/* Pack Studio Button & Form */
.studio-pill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  border: 2px solid #ffffff;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #5b21b6;
}

.studio-pill-btn:active {
  transform: translateY(2px);
}

.studio-intro {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.studio-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
}

.form-row label {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-dark);
}

.full-w {
  max-width: 100% !important;
  width: 100%;
}

.studio-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* StarJar Fun Fact Banner after Quiz Answer */
.fun-fact-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 3px solid #fbbf24;
  border-radius: 22px;
  padding: 14px 20px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.16);
  animation: popInModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fact-icon {
  font-size: 2.3rem;
}

.fact-text-box strong {
  color: #b45309;
  font-size: 0.95rem;
}

.fact-text-box p {
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: #78350f;
}

/* MODE 3: MATCHING & LISTEN-GUESS */
.submode-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.submode-btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 2.5px solid #cbd5e1;
  background: #ffffff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.submode-btn.active {
  background: var(--accent-orange);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 4px 0 var(--accent-orange-dark);
}

.matching-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 780px;
  width: 100%;
  margin: 10px auto;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.match-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 24px;
  border: 4px solid #e2e8f0;
  cursor: pointer;
  box-shadow: 0 6px 0 #cbd5e1;
  transition: all 0.18s ease;
}

.match-item-card:hover {
  transform: translateY(-2px);
}

.match-item-card.selected {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 6px 0 var(--primary);
  transform: scale(1.03);
}

.match-item-card.matched {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 4px 0 #10b981;
  opacity: 0.78;
  pointer-events: none;
}

.match-emoji {
  font-size: 3.1rem;
}

.match-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text-dark);
}

.match-text small {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-muted);
}

.listen-hero-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 20px;
  border-radius: 28px;
  max-width: 680px;
  width: 100%;
  margin: 6px auto;
  border: 3px solid #bfdbfe;
  text-align: center;
}

.big-sound-mystery-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 0 #1d4ed8;
}

.big-sound-mystery-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #1d4ed8;
}

/* MODE 4: MAGICAL EGG HATCHING */
.egg-game-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  align-items: stretch;
}

.egg-incubator-card,
.egg-question-card {
  background: #ffffff;
  border-radius: 30px;
  padding: 22px;
  border: 3px solid #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.egg-incubator-card {
  align-items: center;
  text-align: center;
}

.egg-stage {
  position: relative;
  height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.egg-glow {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.42) 0%, transparent 70%);
}

.egg-visual {
  font-size: 6.2rem;
  line-height: 1;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: eggBreath 2.4s ease-in-out infinite;
}

@keyframes eggBreath {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.06) rotate(2deg); }
}

.egg-visual.cracking {
  animation: shakeJarAnim 0.5s ease;
}

.egg-nest {
  font-size: 3.1rem;
  line-height: 1;
  margin-top: -10px;
  z-index: 1;
}

.egg-crack-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 800;
}

.hatched-pets-bar {
  width: 100%;
  background: #fffbeb;
  border: 2px solid #fde68a;
  padding: 10px 12px;
  border-radius: 18px;
  font-size: 0.85rem;
  font-weight: 800;
}

.pets-shelf {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 1.9rem;
}

.egg-q-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  padding: 14px 18px;
  border-radius: 20px;
}

.egg-q-header h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--primary);
}

.egg-choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 16px;
  flex: 1;
}

/* MODE 5: OCEAN FISHING */
.fishing-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #ffffff;
  padding: 14px 22px;
  border-radius: 24px;
  border: 3px solid #bae6fd;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.replay-audio-btn.small {
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
}

.fishing-mission {
  flex: 1;
}

.fishing-mission p {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.fishing-target-preview {
  font-size: 2.8rem;
  background: #e0f2fe;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ocean-pond {
  position: relative;
  flex: 1;
  min-height: 410px;
  background: linear-gradient(180deg, #bae6fd 0%, #0284c7 35%, #0369a1 100%);
  border-radius: 32px;
  border: 4px solid #ffffff;
  overflow: hidden;
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.12);
}

.fishing-boat {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3.4rem;
  z-index: 4;
  transition: left 0.35s ease;
}

.fishing-line {
  position: absolute;
  top: 58px;
  left: 50%;
  width: 3px;
  height: 40px;
  background: #ffffff;
  z-index: 3;
  transition: height 0.25s ease, left 0.35s ease;
}

.fish-swim-layer {
  position: absolute;
  inset: 90px 0 0 0;
}

.swimming-fish {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 18px;
  border-radius: 999px;
  border: 3px solid #38bdf8;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.swimming-fish:hover {
  transform: scale(1.08);
}

.fish-carrier {
  font-size: 2.2rem;
}

.fish-item-emoji {
  font-size: 2.6rem;
}

.fish-item-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #0369a1;
}

@media (max-width: 820px) {
  .egg-game-layout {
    grid-template-columns: 1fr;
  }
  .matching-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .top-bar { justify-content: center; }
  .world-switcher { display: none; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .piano-keyboard { grid-template-columns: repeat(4, 1fr); }
  .category-bar { grid-template-columns: repeat(2, 1fr); }
}
