:root {
  --bg-cream: #FFF9EE;
  --bg-card: #FFFFFF;
  --bg-warm-tint: #FFF2D8;
  --ink: #3B2E26;
  --ink-soft: #756256;
  --meadow: #52B788;
  --meadow-dark: #388E65;
  --amber: #F4A261;
  --amber-deep: #D97A2E;
  --sky: #56CFE1;
  --coral: #E76F51;
  --gold: #FFB703;
  --border-warm: #EFE3CE;
  --shadow-soft: 0 10px 26px rgba(90, 62, 36, 0.1);
  --shadow-press: 0 4px 10px rgba(90, 62, 36, 0.14);
  --radius-lg: 26px;
  --radius-md: 20px;
  --font-round: 'Fredoka', 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 224, 158, 0.45), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(168, 228, 198, 0.38), transparent 40%),
    var(--bg-cream);
  color: var(--ink);
  font-family: var(--font-round);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ==================== TOP BAR ==================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(255, 249, 238, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border-warm);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-badge {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.1;
  font-weight: 800;
  color: var(--ink);
}

.brand-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--meadow-dark);
  letter-spacing: 0.02em;
}

.star-jar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #FFF2C6;
  border: 2px solid #F4CA64;
  font-weight: 800;
  font-size: 0.95rem;
  color: #8A5300;
  box-shadow: 0 3px 0 rgba(217, 152, 24, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-jar.is-popping {
  transform: scale(1.18);
}

.jar-star-icon {
  display: inline-flex;
  align-items: center;
}

.parent-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 2px solid var(--border-warm);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(180, 158, 128, 0.24);
  transition: transform 0.14s ease, background 0.14s ease;
}

.pill-btn.icon-only {
  width: 38px;
  padding: 0;
}

.pill-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(180, 158, 128, 0.24);
}

.lang-btn.is-bilingual {
  background: #E8F8F0;
  border-color: var(--meadow);
  color: var(--meadow-dark);
}

.timer-pill {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* ==================== MAIN STAGE ==================== */
.main-stage {
  flex: 1;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prompt-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 2px solid var(--border-warm);
  box-shadow: var(--shadow-soft);
}

.prompt-copy {
  min-width: 0;
}

.prompt-en {
  margin: 0;
  font-size: clamp(1.08rem, 3.8vw, 1.38rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.prompt-zh {
  margin: 3px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.speak-big-btn {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFD166, #F4A261);
  color: #4D2B0B;
  display: grid;
  place-items: center;
  box-shadow: 0 5px 0 #C8732F;
  transition: transform 0.14s ease;
}

.speak-big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #C8732F;
}

/* ==================== SAFARI MODE ==================== */
.habitat-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.habitat-pills::-webkit-scrollbar {
  display: none;
}

.habitat-tab {
  flex-shrink: 0;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 2px solid var(--border-warm);
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(180, 158, 128, 0.22);
  transition: all 0.18s ease;
}

.habitat-tab.is-active {
  background: var(--meadow);
  border-color: var(--meadow-dark);
  color: #FFFFFF;
  box-shadow: 0 4px 0 var(--meadow-dark);
}

.habitat-panorama {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-soft);
  aspect-ratio: 900 / 420;
  min-height: 210px;
  background: #DDF4FF;
}

.panorama-bg {
  position: absolute;
  inset: 0;
}

.panorama-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.panorama-actors {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.scene-animal-btn {
  position: absolute;
  transform: translate(-50%, -92%) scale(var(--sc, 1));
  width: clamp(78px, 16.5%, 136px);
  min-height: 72px;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scene-animal-btn svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.16));
}

.scene-animal-btn:active,
.scene-animal-btn.is-excited {
  transform: translate(-50%, -100%) scale(calc(var(--sc, 1) * 1.15));
  z-index: 5;
}

.animals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .animals-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

.animal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 174px;
  padding: 10px 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 2.5px solid var(--border-warm);
  box-shadow: var(--shadow-soft);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.animal-card:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-press);
}

.animal-card.is-excited {
  border-color: var(--amber);
  background: #FFFDF6;
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 28px rgba(244, 162, 97, 0.28);
}

.animal-svg-box {
  width: 100%;
  max-width: 150px;
  height: 122px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.animal-svg-box svg {
  width: 100%;
  height: 100%;
}

.animal-card-label {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.animal-en {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.animal-zh {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.zoom-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #FFF5E1;
  border: 1.5px solid #F4CA85;
  color: #9A5B13;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

/* ==================== SVG ALIVE ANIMATIONS ==================== */
@keyframes tailWag {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(7deg); }
}

@keyframes earTwitch {
  0%, 84%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(-6deg); }
  95% { transform: rotate(4deg); }
}

@keyframes wingFlutter {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-5deg) scale(1.03); }
}

@keyframes spoutBounce {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.9; }
  50% { transform: translateY(-5px) scale(1.06); opacity: 1; }
}

@keyframes critterBreathe {
  0%, 100% { transform: scale(1, 1) translateY(0); }
  50% { transform: scale(1.02, 0.98) translateY(0.5px); }
}

@keyframes critterHop {
  0%, 100% { transform: scale(1, 1) translateY(0) rotate(0deg); }
  30% { transform: scale(1.05, 0.95) translateY(0.6px) rotate(-2deg); }
  65% { transform: scale(0.96, 1.05) translateY(-1.8px) rotate(2deg); }
}

.svg-critter {
  transform-box: fill-box;
  transform-origin: 50% 90%;
  animation: critterBreathe 3.2s ease-in-out infinite;
}

.animal-card:nth-child(even) .svg-critter,
.scene-animal-btn:nth-child(even) .svg-critter {
  animation-delay: -1.4s;
}

.is-excited .svg-critter {
  animation: critterHop 0.48s ease-in-out 2;
}

.svg-tail {
  animation: tailWag 2.8s ease-in-out infinite;
}

.svg-ear {
  animation: earTwitch 4.2s ease-in-out infinite;
}

.svg-wing {
  animation: wingFlutter 2.6s ease-in-out infinite;
}

.svg-spout {
  animation: spoutBounce 2s ease-in-out infinite;
}

.is-excited .svg-tail {
  animation-duration: 0.45s;
}

.is-excited .svg-wing,
.is-excited .svg-ear,
.is-excited .svg-trunk {
  animation: wingFlutter 0.38s ease-in-out infinite;
}

/* ==================== PEEK-A-BOO MODE ==================== */
.peek-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 580px) {
  .peek-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.peek-card {
  position: relative;
  min-height: 175px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #E8F8ED, #D2EED9);
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.peek-card:active {
  transform: scale(0.97);
}

.peek-animal-layer {
  position: relative;
  width: 148px;
  height: 138px;
  transform: translateY(28px) scale(0.84);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.peek-animal-layer svg {
  width: 100%;
  height: 100%;
}

.peek-cover-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.peek-cover-layer svg {
  width: 100%;
  height: 100%;
}

.peek-cover-layer .spot-left,
.peek-cover-layer .spot-right {
  transition: transform 0.52s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.peek-card.is-peeking .peek-cover-layer .spot-left {
  transform: translateX(-36%) rotate(-5deg);
}

.peek-card.is-peeking .peek-cover-layer .spot-right {
  transform: translateX(36%) rotate(5deg);
}

.peek-card.is-peeking .peek-animal-layer {
  transform: translateY(6px) scale(0.96);
}

.peek-card.is-revealed .peek-cover-layer .spot-left {
  transform: translateX(-78%) rotate(-10deg);
  opacity: 0.2;
}

.peek-card.is-revealed .peek-cover-layer .spot-right {
  transform: translateX(78%) rotate(10deg);
  opacity: 0.2;
}

.peek-card.is-revealed .peek-animal-layer {
  transform: translateY(-6px) scale(1.06);
}

.peek-name-badge {
  position: relative;
  z-index: 4;
  margin-top: 2px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  font-weight: 800;
  color: var(--ink);
  font-size: 1rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* ==================== FEED FRUITS MODE ==================== */
.feed-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 14px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #FFFDF8 0%, #FFEED1 100%);
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.feed-bubble {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 22px;
  background: #FFFFFF;
  border: 2.5px solid #F4CA85;
  box-shadow: 0 6px 14px rgba(173, 114, 34, 0.12);
  margin-bottom: 6px;
}

.feed-bubble-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.feed-hint-fruit {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #FFF6E0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.feed-hint-fruit.is-visible {
  opacity: 0.78;
  transform: scale(1);
}

.feed-hint-fruit svg {
  width: 38px;
  height: 38px;
}

.feed-animal-wrap {
  position: relative;
  width: 210px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feed-animal-wrap svg {
  width: 100%;
  height: 100%;
}

.feed-animal-wrap.is-munching {
  animation: munchBounce 0.55s ease-in-out 2;
}

@keyframes munchBounce {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.09) translateY(-6px); }
}

.hearts-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

@keyframes floatHeart {
  0% { transform: translateY(16px) scale(0.5); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-68px) scale(1.15); opacity: 0; }
}

.burst-heart {
  position: absolute;
  animation: floatHeart 1.1s ease-out forwards;
}

.fruit-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.fruit-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 128px;
  padding: 10px 6px;
  border-radius: var(--radius-lg);
  background: #FFFFFF;
  border: 3px solid var(--border-warm);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fruit-btn:active {
  transform: scale(0.93);
}

.fruit-btn svg {
  width: 84px;
  height: 84px;
}

.fruit-btn span {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink);
}

.flying-fruit-clone {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.55s ease;
}

/* ==================== BALLOONS MODE ==================== */
.balloon-sky {
  position: relative;
  height: clamp(360px, 55dvh, 490px);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #88D7FF 0%, #D9F5FF 68%, #FFF7DC 100%);
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.sky-clouds-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.balloon-entity {
  position: absolute;
  width: 102px;
  height: 142px;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform;
}

.balloon-entity svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 12px rgba(34, 98, 138, 0.22));
}

.balloon-color-tag {
  margin-top: -16px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
}

.balloon-surprise {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 2.5px solid #FFD166;
  box-shadow: 0 10px 22px rgba(42, 79, 108, 0.2);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.balloon-surprise-svg {
  width: 66px;
  height: 60px;
}

.balloon-surprise-svg svg {
  width: 100%;
  height: 100%;
}

.balloon-surprise-text strong {
  display: block;
  font-size: 1rem;
  color: var(--ink);
}

.balloon-surprise-text span {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.pop-confetti {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  pointer-events: none;
  animation: confettiFly 0.65s ease-out forwards;
}

@keyframes confettiFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; }
}

@keyframes popIn {
  0% { transform: translateX(-50%) scale(0.7); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ==================== STARLIGHT 1-5 MODE ==================== */
.starlight-sky {
  position: relative;
  min-height: 390px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #172A4A 0%, #244775 56%, #2F5D62 100%);
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-soft);
  padding: 18px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: #FFFDF5;
}

.stars-row {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 12px;
}

.sky-star-btn {
  width: 92px;
  height: 92px;
  background: transparent;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sky-star-btn:nth-child(even) {
  transform: translateY(16px);
}

.sky-star-btn.is-lit {
  transform: scale(1.12);
}

.sky-star-btn:nth-child(even).is-lit {
  transform: translateY(16px) scale(1.12);
}

.sky-star-btn svg {
  width: 78px;
  height: 78px;
}

.star-num-tag {
  margin-top: -6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #FFEAA7;
}

.starlight-watchers {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  margin-top: 16px;
  padding-top: 10px;
}

.watcher-animal {
  width: 102px;
  height: 92px;
  opacity: 0.94;
}

.watcher-animal svg {
  width: 100%;
  height: 100%;
}

.starlight-footer {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 4px;
}

.night-replay-btn {
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFE07D, #F4B942);
  color: #462D07;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 0 #BC8116;
}

/* Starlight Math Sub-Modes (5-within Addition & Subtraction) */
.star-sub-pills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.star-sub-tab {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 2px solid var(--border-warm);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(180, 158, 128, 0.22);
  transition: transform 0.16s ease, background 0.16s ease;
}

.star-sub-tab.is-active {
  background: linear-gradient(180deg, #FFE07D, #F4B942);
  border-color: #D4941A;
  color: #462D07;
  box-shadow: 0 4px 0 #BC8116;
}

.math-equation-bar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.math-equation-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 236, 179, 0.65);
  color: #FFFDF2;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(10, 20, 42, 0.25);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease;
}

.math-equation-pill.is-solved {
  background: rgba(82, 183, 136, 0.92);
  border-color: #FFE07D;
  transform: scale(1.1);
}

.math-clouds-stage,
.math-sub-stage {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 156px;
  padding: 8px 4px;
}

.star-cloud {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(4px);
  max-width: 44%;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease;
}

.star-cloud.cloud-left {
  transform: translateX(-72px);
  opacity: 0.72;
}

.star-cloud.cloud-right {
  transform: translateX(72px);
  opacity: 0.72;
}

.math-clouds-stage.is-joined .star-cloud.cloud-left,
.math-clouds-stage.is-joined .star-cloud.cloud-right {
  transform: translateX(0);
  opacity: 1;
}

.math-plus-sign {
  font-size: 2rem;
  font-weight: 900;
  color: #FFE07D;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: scale(0.4);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.math-clouds-stage.is-joined .math-plus-sign {
  opacity: 1;
  transform: scale(1);
}

.math-count-star {
  position: relative;
  width: 68px;
  height: 68px;
  padding: 2px;
  background: transparent;
  display: grid;
  place-items: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.math-count-star:active,
.math-count-star.is-counted {
  transform: scale(1.12);
}

.math-count-star svg {
  width: 62px;
  height: 62px;
}

.star-tap-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  background: #FFB703;
  color: #422503;
  font-size: 0.85rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  animation: popBadge 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popBadge {
  0% { transform: scale(0.4); }
  100% { transform: scale(1); }
}

.bright-stars-group {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 234, 167, 0.36);
}

.owl-hidden-group {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 234, 167, 0.36);
  transition: background 0.55s ease, border-color 0.55s ease;
}

.owl-hidden-group.is-pocket-closed {
  background: rgba(15, 26, 48, 0.5);
  border: 2px dashed rgba(255, 236, 179, 0.45);
}

.hideable-star {
  position: relative;
  width: 68px;
  height: 68px;
  padding: 2px;
  display: grid;
  place-items: center;
}

.hideable-star-svg {
  width: 62px;
  height: 62px;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.55s ease, filter 0.55s ease;
}

.hideable-star-svg svg {
  width: 100%;
  height: 100%;
}

.mini-night-cloud {
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 62px;
  height: 34px;
  transform: translateX(-50%) translateY(14px) scale(0.75);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.45s ease;
}

.hideable-star.is-hidden-now .hideable-star-svg {
  transform: scale(0.76) translateY(-4px);
  opacity: 0.28;
  filter: saturate(0.45);
}

.hideable-star.is-hidden-now .mini-night-cloud {
  opacity: 0.94;
  transform: translateX(-50%) translateY(2px) scale(1);
}

.math-owl-actor {
  width: 78px;
  height: 74px;
  padding: 0;
  background: transparent;
  margin-left: 2px;
  opacity: 0;
  transform: translate(145px, -110px) rotate(-15deg) scale(0.76);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.math-sub-stage.is-owl-swooping .math-owl-actor {
  animation: owlSwoopIn 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes owlSwoopIn {
  0% { opacity: 0; transform: translate(145px, -110px) rotate(-15deg) scale(0.76); }
  35% { opacity: 1; transform: translate(-24px, -36px) rotate(-10deg) scale(1.12); }
  72% { opacity: 1; transform: translate(6px, -8px) rotate(6deg) scale(1.04); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}

.math-owl-actor.is-flying .svg-wing,
.math-owl-actor.is-flying .svg-critter {
  animation: wingFlutter 0.22s ease-in-out infinite;
}

.math-owl-actor:active {
  transform: scale(1.12);
}

.math-owl-actor svg {
  width: 100%;
  height: 100%;
}

.math-choices-row {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.math-choice-btn {
  min-height: 92px;
  padding: 8px 6px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFFDF7, #FFEEC4);
  border: 3px solid #F6D587;
  color: #462D07;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 5px 0 #C89731;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.18s ease;
}

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

.math-choice-btn.is-correct {
  background: linear-gradient(180deg, #8CE0AC, #52B788);
  border-color: #FFE07D;
  color: #FFFFFF;
  box-shadow: 0 5px 0 #2D7D56;
  transform: scale(1.06);
}

.math-choice-btn.is-gentle-shake {
  animation: gentleShake 0.4s ease;
}

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

.choice-digit {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.choice-mini-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
}

.choice-mini-stars svg {
  width: 15px;
  height: 15px;
}

/* ==================== BOTTOM DOCK ==================== */
.mode-dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 960px;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 251, 243, 0.96);
  backdrop-filter: blur(12px);
  border-top: 2px solid var(--border-warm);
  box-shadow: 0 -6px 20px rgba(74, 52, 31, 0.08);
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 62px;
  padding: 6px 4px;
  border-radius: 18px;
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.18s ease;
}

.dock-btn.is-active {
  background: #E8F8EF;
  color: var(--meadow-dark);
  transform: translateY(-2px);
}

.dock-svg {
  width: 34px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.dock-label {
  font-size: 0.78rem;
  font-weight: 800;
}

/* ==================== MODALS & CELEBRATIONS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(38, 28, 20, 0.56);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: 28px;
  background: #FFFDF9;
  padding: 24px 20px 22px;
  box-shadow: 0 24px 50px rgba(24, 16, 10, 0.28);
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #F4ECE0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.spotlight-stage {
  width: 220px;
  height: 200px;
  margin: 0 auto 8px;
  cursor: pointer;
}

.spotlight-stage svg {
  width: 100%;
  height: 100%;
}

.spotlight-meta h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
}

.spotlight-zh {
  margin: 2px 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--meadow-dark);
}

.spotlight-phrase {
  margin: 0 0 16px;
  font-size: 0.98rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.spotlight-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.big-action-btn {
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #68CA9A, #45A676);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 5px 0 #2D7D56;
}

.big-action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #2D7D56;
}

.sound-action-btn {
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFB85C, #E8872A);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 5px 0 #B86112;
}

.sound-action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #B86112;
}

/* 5-Star Celebration Overlay */
.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 65;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.celebration-card {
  background: rgba(255, 250, 232, 0.96);
  border: 3px solid #FFD166;
  border-radius: 28px;
  padding: 20px 26px;
  text-align: center;
  box-shadow: 0 18px 42px rgba(74, 52, 20, 0.25);
  animation: celebPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

.celebration-stars svg {
  width: 42px;
  height: 42px;
}

.celebration-card h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #A45B00;
}

.celebration-card p {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--ink);
}

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

/* Eye-Care Break Modal */
.eyebreak-illustration {
  width: 170px;
  height: 150px;
  margin: 0 auto 8px;
}

.eyebreak-card h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.eyebreak-en {
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--meadow-dark);
}

.eyebreak-zh {
  margin: 0 0 18px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.hold-unlock-btn {
  width: 100%;
  min-height: 56px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #52B788, #3B966B);
  color: #FFFFFF;
  font-size: 0.96rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 0 #2B7351;
}

/* Share / Add-to-Home-Screen Modal */
.share-card {
  text-align: left;
}

.share-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.share-desc {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.share-url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.share-url-box input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid var(--border-warm);
  background: #FFF9EE;
  font-size: 0.84rem;
  color: var(--ink);
}

.copy-url-btn {
  flex-shrink: 0;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--amber);
  color: #FFFFFF;
  font-weight: 800;
}

.share-tips {
  background: #F6FBF8;
  border: 1.5px solid #CFEAD9;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.share-tips p {
  margin: 0 0 6px;
}

.share-tips p:last-child {
  margin-bottom: 0;
}
