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

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Nunito', sans-serif;
  background: #DFF3F6;
  overscroll-behavior: none;
}

.app-root {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 10%, #EAF8F0 0%, #DFF3F6 55%, #D7ECEF 100%);
  padding: 24px 10px;
}

.phone-frame {
  width: 390px;
  height: 780px;
  max-width: 100%;
  max-height: 100dvh;
  background: #FFFDF8;
  border-radius: 40px;
  box-shadow: 0 24px 60px -20px rgba(27,67,50,0.35), 0 0 0 10px #1B4332;
  overflow: hidden;
  position: relative;
}

/* When installed as a standalone app, go full-bleed edge-to-edge */
@media (display-mode: standalone), (display-mode: fullscreen) {
  .app-root { padding: 0; background: #FFFDF8; }
  .phone-frame {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 20px max(26px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.topbar-title {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  color: #1B4332;
  font-size: 17px;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  border: none;
  background: #EFEAE0;
  color: #1B4332;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 17px;
  padding: 0;
}
.icon-btn:active { transform: scale(0.94); }

.spacer34 { width: 36px; }

.stars-pill {
  display: flex; align-items: center; gap: 5px;
  background: #FFF3D0;
  border: 1.5px solid #FFD23F;
  color: #8A5B00;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 14px;
}

/* HOME */
.home-screen { justify-content: space-between; align-items: center; text-align: center; }
.home-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; }
.hero-badge {
  background: #52B788; color: #fff; font-weight: 800; font-size: 12px;
  padding: 5px 14px; border-radius: 999px; letter-spacing: 0.03em;
}
.home-screen h1 {
  font-family: 'Baloo 2', sans-serif;
  font-size: 34px;
  color: #1B4332;
  line-height: 1.05;
  margin: 8px 0 4px;
}
.cta-btn {
  width: 100%;
  background: linear-gradient(180deg, #FFDE59, #FFC93F);
  border: none;
  color: #6B4400;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 19px;
  padding: 16px;
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 0 #E5A700, 0 14px 24px -8px rgba(229,167,0,0.6);
  cursor: pointer;
}
.cta-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 #E5A700; }
.home-hint { color: #7A7264; font-size: 13px; font-weight: 700; margin-top: 10px; }

/* MAP */
.map-screen { padding-bottom: 0; }
.trail-wrap { position: relative; flex: 1; margin-top: 8px; }
.trail-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.level-node {
  position: absolute;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 96px;
}
.level-node .node-circle {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--lvl-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15), 0 0 0 6px var(--lvl-glow);
}
.level-node.locked .node-circle {
  background: #E4E0D6;
  box-shadow: 0 6px 0 rgba(0,0,0,0.08);
}
.level-node .node-label {
  font-family: 'Baloo 2', sans-serif;
  font-size: 12.5px; font-weight: 700; color: #1B4332;
  background: #fff; padding: 2px 8px; border-radius: 8px;
}
.level-node.locked .node-label { color: #A79E8C; }
.star-row { display: flex; gap: 3px; }
.star-row .star { font-size: 12px; opacity: 0.35; }
.star-row .star.on { opacity: 1; }

/* GAME */
.game-screen { align-items: center; }
.game-mascot-row { display: flex; align-items: center; gap: 16px; margin: 6px 0 4px; }
.speaker-btn {
  width: 54px; height: 54px; border-radius: 50%;
  border: none; background: var(--lvl-color); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  cursor: pointer;
  font-size: 22px;
}
.speaker-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.word-emoji { font-size: 64px; margin: 2px 0; }
.prompt-text {
  font-family: 'Baloo 2', sans-serif;
  color: #5C5647; font-weight: 700; font-size: 15px; margin-bottom: 14px;
}
.progress-track { display: flex; gap: 6px; }
.progress-dot { width: 20px; height: 8px; border-radius: 6px; background: #EAE4D6; }
.progress-dot.filled { background: var(--lvl-color); }

.choices-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: auto;
}
.choices-grid.letters { grid-template-columns: repeat(3, 1fr); }
.choice-btn {
  background: #fff;
  border: 3px solid #EDE7D8;
  border-radius: 20px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  color: #1B4332;
  padding: 22px 10px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 5px 0 #E4DECE;
}
.choices-grid.letters .choice-btn { font-size: 34px; padding: 22px 4px; }
.choice-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #E4DECE; }
.choice-btn.is-correct { background: #E8F8EE; border-color: #52B788; color: #1B4332; }

.confetti-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetto {
  position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px;
  animation: confetti-fall 0.9s ease-in forwards;
}
@keyframes confetti-fall { to { transform: translateY(760px) rotate(280deg); opacity: 0; } }

/* RESULT */
.result-screen { align-items: center; justify-content: center; text-align: center; }
.result-card { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.result-card .trophy { font-size: 52px; }
.result-card h2 { font-family: 'Baloo 2', sans-serif; color: #1B4332; font-size: 26px; margin: 4px 0 0; }
.result-card p { color: #7A7264; font-weight: 700; margin: 0; }
.result-actions { width: 260px; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ghost-text-btn { background: none; border: none; color: #7A7264; font-weight: 800; padding: 6px; cursor: pointer; }

/* PARENT */
.parent-list { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; overflow-y: auto; }
.parent-card { display: flex; gap: 12px; background: #F6F2E7; border-radius: 16px; padding: 14px; }
.parent-num {
  width: 26px; height: 26px; border-radius: 50%; background: #52B788; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.parent-t { font-family: 'Baloo 2', sans-serif; font-weight: 700; color: #1B4332; font-size: 14.5px; }
.parent-d { color: #6B6455; font-size: 13px; margin-top: 2px; line-height: 1.4; }
.parent-footer { margin-top: 12px; text-align: center; color: #9A917E; font-size: 12px; font-weight: 700; }

/* KIKI */
.kiki { line-height: 0; }
.kiki.idle { animation: kiki-breathe 2.4s ease-in-out infinite; }
.kiki.happy { animation: kiki-bounce 0.6s ease-in-out; }
.kiki.sad { animation: kiki-shake 0.4s ease-in-out; }
@keyframes kiki-breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes kiki-bounce { 0% { transform: scale(1); } 30% { transform: scale(1.15) rotate(-4deg); } 60% { transform: scale(1.05) rotate(3deg); } 100% { transform: scale(1); } }
@keyframes kiki-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  .kiki.idle, .kiki.happy, .kiki.sad, .confetto { animation: none !important; }
}
