/**
 * Lingokids Web - Playlearning Adventure
 * Signature Lingokids Aesthetic: Vibrant, Rounded, Tactile, Bouncy, Kid-Centric
 */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@600;700;800;900&display=swap');

:root {
  --font-display: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Lingokids Signature Palette */
  --c-teal: #00C9B7;
  --c-teal-dark: #009E90;
  --c-yellow: #FFD13B;
  --c-yellow-dark: #D9A814;
  --c-pink: #FF6584;
  --c-pink-dark: #D94665;
  --c-blue: #4D96FF;
  --c-blue-dark: #256CEB;
  --c-green: #6BCB77;
  --c-green-dark: #45A852;
  --c-purple: #9B51E0;
  --c-purple-dark: #742DC4;
  --c-orange: #FF9F1C;
  --c-orange-dark: #D97E06;

  --bg-sky: linear-gradient(180deg, #60A5FA 0%, #93C5FD 45%, #BAE6FD 75%, #E0F2FE 100%);
  --bg-canvas: #F8FAFC;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 14px;
  --radius-pill: 9999px;

  --shadow-tactile: 0 8px 0 rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.06);
  --shadow-btn: 0 6px 0 rgba(0, 0, 0, 0.15);
  --shadow-btn-pressed: 0 2px 0 rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background: var(--bg-sky);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* === TOP UTILITY APP BAR === */
.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border-bottom: 3px solid #E2E8F0;
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.logo-symbol {
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.logo-text-group {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--c-pink) 0%, var(--c-purple) 50%, var(--c-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  font-weight: 800;
  color: var(--c-teal-dark);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Status Badges */
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  background: #FFF;
  border: 2px solid #E2E8F0;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.status-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.star-pill {
  background: #FFFDF0;
  border-color: #FDE68A;
  color: #B45309;
}

.streak-pill {
  background: #FFF1F2;
  border-color: #FECDD3;
  color: #BE123C;
}

.companion-pill {
  padding: 4px 12px 4px 6px;
  background: #F0FDFA;
  border-color: #99F6E4;
}

.comp-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #FFF;
  border: 2px solid var(--c-teal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.comp-avatar-circle svg {
  width: 100%;
  height: 100%;
}

.comp-name-label {
  font-weight: 800;
  font-size: 14px;
  color: var(--c-teal-dark);
}

/* Utility buttons */
.top-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #E2E8F0;
  background: #FFF;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, background-color 0.15s;
}

.top-icon-btn:hover {
  background: #F8FAFC;
}

.top-icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.top-icon-btn.parent-btn {
  background: #F5F3FF;
  border-color: #DDD6FE;
}

/* === MAIN PLAYLEARNING ISLAND MAP VIEW === */
.main-viewport {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.map-hero-banner {
  text-align: center;
  margin-bottom: 32px;
}

.map-hero-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: #1E293B;
  text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
}

.map-hero-subtitle {
  font-size: 17px;
  color: #334155;
  font-weight: 700;
  margin-top: 4px;
}

/* Clouds Animation */
.floating-cloud {
  position: absolute;
  font-size: 48px;
  opacity: 0.7;
  pointer-events: none;
  animation: floatCloud linear infinite;
}

@keyframes floatCloud {
  0% { transform: translateX(-150px); }
  100% { transform: translateX(110vw); }
}

/* Island Cards Grid */
.islands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.map-island-card {
  background: #FFF;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-tactile);
  border: 4px solid #FFF;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.map-island-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: var(--island-accent, var(--c-teal));
}

.map-island-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
}

.map-island-card:active {
  transform: translateY(2px) scale(0.98);
}

.island-icon-badge {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--island-bg, #F0FDFA);
  border: 4px solid var(--island-accent, var(--c-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  margin-bottom: 16px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-island-card:hover .island-icon-badge {
  transform: scale(1.1) rotate(5deg);
}

.island-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.island-desc {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 18px;
  min-height: 40px;
}

.island-play-btn {
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: #FFF;
  background: var(--island-accent, var(--c-teal));
  border: none;
  box-shadow: var(--shadow-btn);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

/* === MINIGAME VIEW FRAMEWORK === */
.game-view-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-stage-container {
  background: #FFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tactile);
  border: 4px solid #FFF;
  padding: 24px;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.game-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  background: #FFF;
  color: var(--text-dark);
  border: 3px solid #E2E8F0;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
  transition: transform 0.15s;
}

.back-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.game-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 3px dashed #F1F5F9;
  margin-bottom: 20px;
}

.game-badge {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-teal-dark);
}

.word-counter {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  background: #F1F5F9;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

/* Companion Footer Cheer Bar */
.game-footer-companion {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 3px dashed #F1F5F9;
}

.mini-char-thumb {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.mini-char-thumb svg {
  width: 100%;
  height: 100%;
}

.speech-bubble {
  background: #F8FAFC;
  border: 3px solid #E2E8F0;
  border-radius: 20px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  position: relative;
  flex-grow: 1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 12px 8px 0;
  border-style: solid;
  border-color: transparent #E2E8F0 transparent transparent;
}

/* === BUTTON STYLES === */
.kid-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kid-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-btn-pressed) !important;
}

.kid-btn-primary {
  background: var(--c-teal);
  color: #FFF;
  box-shadow: 0 5px 0 var(--c-teal-dark);
}

.kid-btn-secondary {
  background: #F1F5F9;
  color: var(--text-dark);
  box-shadow: 0 5px 0 #CBD5E1;
}

/* === 1. PHONICS SAFARI STYLES === */
.phonics-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 10px 0 24px;
}

.word-art-card {
  width: 140px;
  height: 140px;
  background: #F8FAFC;
  border-radius: 28px;
  border: 4px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.word-art-card svg {
  width: 100%;
  height: 100%;
}

.word-hint-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  font-style: italic;
}

.slots-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 8px 0;
}

.letter-slot {
  width: 64px;
  height: 68px;
  border-radius: 18px;
  border: 3px dashed #CBD5E1;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.letter-slot.filled {
  border-style: solid;
  border-color: var(--c-teal);
  background: #F0FDFA;
  color: var(--c-teal-dark);
  box-shadow: 0 4px 0 #99F6E4;
}

.letter-slot.correct {
  border-color: var(--c-green);
  background: #F0FDF4;
  color: var(--c-green-dark);
  box-shadow: 0 4px 0 #86EFAC;
}

.tiles-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.letter-tile {
  width: 62px;
  height: 64px;
  border-radius: 18px;
  background: #FFF;
  border: 3px solid #E2E8F0;
  box-shadow: 0 6px 0 #CBD5E1;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.letter-tile:hover {
  transform: translateY(-4px);
  border-color: var(--c-yellow);
}

.letter-tile:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #CBD5E1;
}

.letter-tile.used {
  opacity: 0.35;
  pointer-events: none;
  transform: scale(0.9);
}

/* === 2. NUMBER BAKERY STYLES === */
.bakery-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.bakery-banner {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.target-number-badge {
  background: var(--c-yellow);
  color: #78350F;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
}

.kitchen-workspace {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
}

.mixing-bowl-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bowl-art {
  width: 220px;
  height: 160px;
  position: relative;
}

.bowl-svg {
  width: 100%;
  height: 100%;
}

.bowl-contents {
  position: absolute;
  top: 15px;
  left: 20px;
  right: 20px;
  bottom: 30px;
  pointer-events: none;
}

.ingredient-in-bowl {
  position: absolute;
  width: 44px;
  height: 44px;
}

.bowl-counter-tag {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  background: #F0FDFA;
  border: 2px solid #99F6E4;
  color: var(--c-teal-dark);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
}

.pantry-shelf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pantry-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.ingredient-dispenser {
  width: 130px;
  padding: 16px 12px;
  border-radius: 24px;
  background: #FFF;
  border: 3px solid #E2E8F0;
  box-shadow: 0 6px 0 #CBD5E1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.ingredient-dispenser svg {
  width: 60px;
  height: 60px;
}

.dispenser-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.ingredient-dispenser:hover {
  transform: scale(1.05);
}

.ingredient-dispenser:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #CBD5E1;
}

/* Math Addition Equation */
.math-equation-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.math-group-card {
  background: #F8FAFC;
  border: 3px solid #E2E8F0;
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.math-items-tray {
  display: flex;
  gap: 6px;
  min-height: 44px;
  align-items: center;
}

.mini-item-icon svg {
  width: 36px;
  height: 36px;
}

.math-group-number {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--c-blue-dark);
}

.math-symbol {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  color: var(--c-purple);
}

.math-answer-box {
  width: 90px;
  height: 90px;
  border-radius: 24px;
  border: 4px dashed #CBD5E1;
  background: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--c-yellow-dark);
}

.math-answer-box.correct {
  border: 4px solid var(--c-green);
  background: #F0FDF4;
  color: var(--c-green-dark);
}

.math-choices-row {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.math-choice-btn {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: #FFF;
  border: 3px solid #E2E8F0;
  box-shadow: 0 6px 0 #CBD5E1;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  color: var(--text-dark);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.math-choice-btn:hover {
  border-color: var(--c-yellow);
  transform: translateY(-4px);
}

.math-choice-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #CBD5E1;
}

/* === 3. ART STUDIO STYLES === */
.art-studio-layout {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.art-toolbar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #F8FAFC;
  border-radius: 24px;
  padding: 16px;
  border: 2px solid #E2E8F0;
}

.tool-group-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.tool-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tool-btn {
  height: 42px;
  border-radius: 12px;
  border: 2px solid #E2E8F0;
  background: #FFF;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #E2E8F0;
}

.tool-btn.active {
  background: #E0F2FE;
  border-color: #38BDF8;
  box-shadow: 0 3px 0 #0284C7;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #FFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-swatch.active {
  transform: scale(1.25);
  outline: 3px solid #1E293B;
}

.stamps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stamp-pick-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid #E2E8F0;
  background: #FFF;
  font-size: 18px;
  cursor: pointer;
}

.stamp-pick-btn.active {
  border-color: var(--c-yellow);
  background: #FEF3C7;
}

.size-buttons-row {
  display: flex;
  gap: 8px;
}

.size-btn {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 2px solid #E2E8F0;
  background: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.size-btn span {
  background: #334155;
  border-radius: 50%;
  display: inline-block;
}

.size-btn.active {
  border-color: var(--c-teal);
  background: #F0FDFA;
}

.canvas-viewport {
  flex-grow: 1;
  background: #FFF;
  border-radius: 24px;
  border: 3px solid #E2E8F0;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

#paintCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* === 4. MEMORY SAFARI STYLES === */
.memory-stage {
  display: flex;
  justify-content: center;
  padding: 10px 0 24px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 600px;
  width: 100%;
}

.memory-card {
  aspect-ratio: 1 / 1;
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 0 #CBD5E1;
  border: 3px solid #E2E8F0;
}

.card-back {
  background: linear-gradient(135deg, #38BDF8 0%, #0284C7 100%);
  border-color: #BAE6FD;
}

.card-star-icon {
  font-size: 34px;
}

.card-front {
  background: #FFF;
  transform: rotateY(180deg);
  padding: 8px;
}

.card-emoji {
  font-size: 42px;
}

.card-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 4px;
}

.memory-card.matched .card-front {
  border-color: var(--c-green) !important;
  background: #F0FDF4;
}

/* === 5. MUSICAL LAGOON STYLES === */
.music-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.song-progress-banner {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.song-dots-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.song-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #E2E8F0;
}

.song-dot.current {
  background: var(--c-yellow);
  transform: scale(1.3);
  box-shadow: 0 0 8px var(--c-yellow);
}

.song-dot.done {
  background: var(--c-green);
}

.xylophone-body {
  width: 100%;
  max-width: 680px;
  background: #854D0E;
  padding: 24px 20px;
  border-radius: 28px;
  border: 4px solid #713F12;
  box-shadow: 0 10px 0 #45240A, 0 16px 24px rgba(0, 0, 0, 0.15);
}

.xylophone-frame {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 260px;
  gap: 8px;
}

.xylo-bar {
  flex: 1;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  color: #FFF;
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease, filter 0.15s ease;
  position: relative;
}

.xylo-bar:hover {
  filter: brightness(1.1);
}

.xylo-bar.bar-hit {
  transform: translateY(6px) scale(0.97);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.xylo-bar.glow-target {
  outline: 4px solid #FFF;
  box-shadow: 0 0 20px #FFD13B;
}

.bar-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E2E8F0;
  border: 2px solid #64748B;
}

.bar-note-name {
  font-size: 20px;
}

.bar-solfege {
  font-size: 11px;
  opacity: 0.9;
}

.bar-keyboard-num {
  font-size: 13px;
  background: rgba(0, 0, 0, 0.15);
  padding: 2px 6px;
  border-radius: 6px;
}

/* === 6. DAILY HABITS STYLES === */
.habits-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.habits-banner {
  font-size: 19px;
  font-weight: 700;
  text-align: center;
}

.teeth-mouth-stage {
  width: 100%;
  max-width: 440px;
}

.giant-smile-wrap {
  width: 100%;
  position: relative;
}

.smile-svg {
  width: 100%;
  height: auto;
}

.germs-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.plaque-germ {
  position: absolute;
  font-size: 42px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  user-select: none;
}

.plaque-germ.popped {
  transform: scale(1.6);
  opacity: 0;
  pointer-events: none;
}

.brush-instruction {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Lunchbox Styles */
.lunchbox-workspace {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 720px;
}

.lunchbox-card {
  flex: 1;
  background: #FFF;
  border: 4px solid #38BDF8;
  border-radius: 28px;
  padding: 16px;
  box-shadow: 0 8px 0 #0284C7;
}

.lunchbox-lid {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #0284C7;
  text-align: center;
  margin-bottom: 12px;
}

.lunchbox-tray {
  background: #F0FDFA;
  border-radius: 20px;
  min-height: 180px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.packed-food-badge {
  background: #FFF;
  border: 2px solid #99F6E4;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.food-shelf {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.food-item-btn {
  background: #FFF;
  border: 3px solid #E2E8F0;
  box-shadow: 0 4px 0 #CBD5E1;
  border-radius: 18px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.food-item-btn:hover {
  transform: translateY(-2px);
}

.food-item-btn.used {
  opacity: 0.35;
  pointer-events: none;
}

.food-icon {
  font-size: 32px;
}

.food-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dark);
}

/* === MODALS & OVERLAYS === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 2;
  background: #FFF;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  border: 4px solid #FFF;
  max-width: 640px;
  width: 100%;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.close-modal-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #E2E8F0;
  background: #F8FAFC;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Companion Picker Grid */
.companion-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.companion-pick-card {
  background: #F8FAFC;
  border: 3px solid #E2E8F0;
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.companion-pick-card:hover {
  transform: translateY(-4px);
  border-color: var(--c-teal);
}

.companion-pick-card.selected {
  border-color: var(--c-teal);
  background: #F0FDFA;
  box-shadow: 0 6px 0 #99F6E4;
}

.comp-card-avatar {
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
}

.comp-card-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.comp-card-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

.comp-card-tagline {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 4px;
  font-style: italic;
}

/* Sticker Album Styles */
.sticker-playground-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sticker-playfield {
  height: 220px;
  background: linear-gradient(180deg, #BAE6FD 0%, #60A5FA 60%, #86EFAC 60%, #22C55E 100%);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  border: 3px solid #E2E8F0;
}

.playfield-sun {
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 36px;
}

.placed-sticker-el {
  position: absolute;
  cursor: grab;
  user-select: none;
}

.stickers-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0;
}

.sticker-tray-item {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 16px;
  padding: 10px;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sticker-item-icon {
  font-size: 34px;
}

.sticker-item-name {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.stamp-to-scene-btn, .unlock-sticker-btn {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  border: none;
  cursor: pointer;
}

.stamp-to-scene-btn {
  background: var(--c-teal);
  color: #FFF;
}

.unlock-sticker-btn {
  background: var(--c-yellow);
  color: #78350F;
}

/* Parent Area & Gate */
.gate-math-challenge {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  color: var(--c-purple);
  text-align: center;
  margin: 16px 0;
}

.gate-input-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.gate-input {
  width: 110px;
  height: 48px;
  border-radius: 14px;
  border: 2px solid #CBD5E1;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-display);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 18px;
  padding: 14px;
  text-align: center;
}

.metric-val {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-dark);
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.dash-section {
  margin-bottom: 20px;
}

.dash-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.skills-progress-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.progress-bar-track {
  height: 12px;
  background: #E2E8F0;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.limit-buttons-row, .stage-selector-row {
  display: flex;
  gap: 8px;
}

.limit-btn, .stage-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid #E2E8F0;
  background: #FFF;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.limit-btn.active, .stage-btn.active {
  border-color: var(--c-purple);
  background: #F5F3FF;
  color: var(--c-purple);
}

/* === KEYFRAME ANIMATIONS === */
.bounce-in {
  animation: bounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.bounce-pop {
  animation: popScale 0.3s ease;
}

@keyframes popScale {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.shake {
  animation: shakeEffect 0.4s ease;
}

@keyframes shakeEffect {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.celebrate-jump {
  animation: jumpCelebrate 0.8s ease infinite;
}

@keyframes jumpCelebrate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px) rotate(4deg); }
}

.dance-step {
  animation: danceAnim 0.4s ease;
}

@keyframes danceAnim {
  0% { transform: rotate(0); }
  25% { transform: translateY(-8px) rotate(-10deg); }
  75% { transform: translateY(-8px) rotate(10deg); }
  100% { transform: rotate(0); }
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Mobile Responsiveness & Touch Optimization for iPhone & Android */
* {
  -webkit-tap-highlight-color: transparent;
}

button, .status-pill, .map-island-card, .xylo-bar, .letter-tile, .card-inner, .color-swatch, .tool-btn {
  touch-action: manipulation;
}

@media (max-width: 768px) {
  .top-app-bar {
    padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  }
  .brand-name {
    font-size: 18px;
  }
  .islands-grid {
    grid-template-columns: 1fr;
    padding: 0 12px 24px;
  }
  .art-studio-layout {
    flex-direction: column;
  }
  .art-toolbar {
    width: 100%;
  }
  .kitchen-workspace {
    flex-direction: column;
  }
  .lunchbox-workspace {
    flex-direction: column;
  }
  .xylophone-frame {
    height: 200px;
  }
}

@media (max-width: 480px) {
  .top-bar-left, .top-bar-right {
    gap: 6px;
  }
  .brand-sub {
    display: none;
  }
  .streak-pill span:last-child {
    display: none;
  }
  .companion-pill {
    padding: 6px 10px;
  }
  .comp-name-label {
    display: none;
  }
  .status-pill {
    padding: 6px 10px;
    font-size: 13px;
  }
  .top-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .map-hero-banner {
    padding: 18px 12px 10px;
  }
  .map-hero-title {
    font-size: 22px;
  }
  .map-hero-subtitle {
    font-size: 14px;
  }
  .game-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .game-actions {
    width: 100%;
    justify-content: space-between;
  }
  .game-actions .kid-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .modal-card {
    max-width: 95vw;
    padding: 20px 14px;
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .main-viewport {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

