/* Luella's Learning Playground — pastel rainbow, big & friendly */
:root {
  --pink: #ffb3d9;
  --peach: #ffd6a5;
  --yellow: #ffecb3;
  --mint: #b8f1cc;
  --sky: #bde0fe;
  --lav: #d5b3f2;
  --ink: #5b4a68;
  --ink-soft: #7d6b8a;
  --card: #ffffff;
  --shadow: 0 6px 0 rgba(91, 74, 104, 0.12);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Fredoka", "Comic Sans MS", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #fff3f8 0%, #fff9ec 30%, #eefbf3 60%, #eef4ff 100%);
  background-attachment: fixed;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(160deg, rgba(255,243,248,.96), rgba(255,249,236,.96));
  border-radius: 0 0 24px 24px;
}

.greeting {
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 700;
  background: linear-gradient(90deg, #ff6fae, #ff9d5c, #b388eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.star-counter {
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid #fff;
  border-radius: 999px;
  padding: 8px 20px;
  min-height: 64px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* ---------- screens ---------- */
main { flex: 1; }
.screen { display: none; animation: pop-in .25s ease; }
.screen.active { display: block; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(.98); }
  to { opacity: 1; transform: scale(1); }
}

.screen-title {
  font-size: clamp(24px, 5vw, 34px);
  text-align: center;
  margin: 12px 0 18px;
}

.game-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}
.game-head h2 {
  font-size: clamp(24px, 5vw, 34px);
  margin: 0;
  flex: 1;
  text-align: center;
}

.back-btn {
  font-size: 34px;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  border: 4px solid #fff;
  background: var(--sky);
  box-shadow: var(--shadow);
  cursor: pointer;
  flex: none;
}
.back-btn:active { transform: scale(.94); }

.speak-btn {
  font-size: 28px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: var(--mint);
  box-shadow: var(--shadow);
  cursor: pointer;
  vertical-align: middle;
  flex: none;
}
.speak-btn:active { transform: scale(.9); }

.age-badge {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-soft);
  background: #fff;
  display: table;
  margin: 0 auto 18px;
  padding: 8px 26px;
  border-radius: 999px;
  border: 3px solid var(--lav);
  box-shadow: var(--shadow);
}

.level-badge {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff9d5c, #ff6fae);
  padding: 4px 16px;
  border-radius: 999px;
  margin-top: 4px;
}

/* word builder slots */
.word-slots {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0 8px;
}
.word-slot {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  border: 5px dashed #c9b8e0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: var(--ink);
}
.word-slot.filled {
  border-style: solid;
  border-color: #7be3a0;
  background: var(--mint);
  animation: popstar .4s ease;
}

/* ---------- home game grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  padding: 6px 2px 30px;
}

.game-card {
  font-family: inherit;
  background: var(--card);
  border: 5px solid #fff;
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 22px 12px 16px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  transition: transform .12s ease;
}
.game-card:active { transform: scale(.95); }
.game-card .card-emoji { font-size: 64px; line-height: 1; }
.game-card .card-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}
.game-card .card-say {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--mint);
  cursor: pointer;
}

/* ---------- mode tabs ---------- */
.mode-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.mode-btn {
  font-family: inherit;
  font-size: 22px;
  font-weight: 600;
  padding: 14px 24px;
  min-height: 64px;
  border-radius: 999px;
  border: 4px solid #fff;
  background: #efe9f7;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.mode-btn.active {
  background: linear-gradient(135deg, var(--pink), var(--lav));
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
}

/* ---------- generic game bits ---------- */
.prompt {
  text-align: center;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 600;
  margin: 6px 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.big-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 10px 0 24px;
}

.choice-btn {
  font-family: inherit;
  font-size: 44px;
  font-weight: 700;
  min-width: 110px;
  min-height: 110px;
  padding: 14px 20px;
  border-radius: 28px;
  border: 5px solid #fff;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.choice-btn:active { transform: scale(.93); }
.choice-btn.correct {
  background: var(--mint);
  animation: wiggle .5s ease;
}
.choice-btn.wrong { animation: shake .4s ease; }

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-6deg) scale(1.06); }
  75% { transform: rotate(6deg) scale(1.06); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.round-btn {
  font-family: inherit;
  display: block;
  margin: 18px auto;
  font-size: 26px;
  font-weight: 700;
  padding: 16px 40px;
  min-height: 72px;
  border-radius: 999px;
  border: 5px solid #fff;
  background: linear-gradient(135deg, var(--sky), var(--mint));
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.round-btn:active { transform: scale(.95); }

/* ---------- ABC ---------- */
.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 12px;
  padding-bottom: 24px;
}
.letter-tile {
  font-family: inherit;
  aspect-ratio: 1;
  font-size: 40px;
  font-weight: 700;
  border-radius: 24px;
  border: 4px solid #fff;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  min-height: 76px;
}
.letter-tile:active { transform: scale(.9); background: var(--yellow); }
.letter-tile:nth-child(6n+1) { background: #ffe3ef; }
.letter-tile:nth-child(6n+2) { background: #ffeed3; }
.letter-tile:nth-child(6n+3) { background: #fff6cf; }
.letter-tile:nth-child(6n+4) { background: #d9f7e3; }
.letter-tile:nth-child(6n+5) { background: #dbeeff; }
.letter-tile:nth-child(6n+6) { background: #e9dcfb; }

/* ---------- counting ---------- */
.meadow {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  background: rgba(184, 241, 204, .45);
  border: 5px dashed #8fdcae;
  border-radius: 32px;
  padding: 26px 16px;
  margin-bottom: 20px;
  min-height: 220px;
}
.critter {
  font-size: 64px;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: #fff;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease;
}
.critter.counted {
  transform: scale(1.15) rotate(-8deg);
  background: var(--yellow);
  pointer-events: none;
}
.count-label {
  text-align: center;
  font-size: 30px;
  font-weight: 700;
  margin: 4px 0 14px;
}

/* ---------- colors & shapes ---------- */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.swatch {
  font-family: inherit;
  border: 5px solid #fff;
  border-radius: 26px;
  box-shadow: var(--shadow);
  min-height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.35);
}
.swatch:active { transform: scale(.93); }
.swatch .shape { width: 56px; height: 56px; margin: 14px auto 4px; }

.shape-circle { border-radius: 50%; }
.shape-square { border-radius: 12px; }
.shape-triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }
.shape-star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.shape-oval { border-radius: 50% / 60%; transform: scaleX(1.25); }

.find-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  margin: 12px 0 24px;
}
.find-choice {
  width: 130px;
  height: 130px;
  border-radius: 30px;
  border: 6px solid #fff;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.find-choice:active { transform: scale(.92); }
.find-choice .shape { width: 72px; height: 72px; }
.find-choice.correct { outline: 6px solid #7be3a0; animation: wiggle .5s ease; }
.find-choice.wrong { animation: shake .4s ease; }

/* ---------- memory ---------- */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 560px;
  margin: 0 auto 24px;
}
.mem-card {
  aspect-ratio: .86;
  min-height: 96px;
  border-radius: 24px;
  border: 5px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--lav), var(--pink));
  color: #fff;
  transition: transform .25s ease;
  font-family: inherit;
}
.mem-card.flipped, .mem-card.matched {
  background: #fff;
  transform: rotateY(180deg);
}
.mem-card.matched {
  outline: 5px solid #7be3a0;
  cursor: default;
  animation: wiggle .5s ease;
}
.memory-board.mem-wide { grid-template-columns: repeat(5, 1fr); }

/* ---------- stories ---------- */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.story-card {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 5px solid #fff;
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 16px 20px;
  min-height: 96px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.story-card:active { transform: scale(.98); }
.story-card .story-emoji { font-size: 56px; }
.story-card .story-title { font-size: 26px; font-weight: 700; }
.story-card .story-blurb { font-size: 18px; color: var(--ink-soft); }

.story-view { display: none; }
.story-view.open { display: block; }
.story-text {
  background: #fff;
  border: 5px solid #fff;
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 26px 24px;
  font-size: 26px;
  line-height: 1.75;
  margin-bottom: 18px;
}
.story-text .sent {
  border-radius: 12px;
  padding: 2px 6px;
  cursor: pointer;
  transition: background .15s;
}
.story-text .sent:active, .story-text .sent.reading { background: var(--yellow); }

/* ---------- paint ---------- */
.paint-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.paint-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.paint-colors { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.paint-color {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.paint-color.active { outline: 5px solid var(--ink); transform: scale(1.1); }
.paint-stamps { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.stamp-btn {
  font-size: 36px;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.stamp-btn.active { outline: 5px solid var(--ink); background: var(--yellow); }
.tool-btn {
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  min-height: 64px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 4px solid #fff;
  background: #efe9f7;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.tool-btn.active { background: var(--peach); }
#paint-canvas {
  width: 100%;
  max-width: 860px;
  height: 52vh;
  min-height: 320px;
  background: #fff;
  border: 6px solid #fff;
  border-radius: 28px;
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: crosshair;
}

/* ---------- word pop ---------- */
.wordpop-stage { text-align: center; }
.wordpop-pic { font-size: 130px; line-height: 1.2; animation: float 3s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.wordpop-pic.popped { animation: popstar .6s ease; }
@keyframes popstar {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1); }
}
.word-choices {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.word-btn {
  font-family: inherit;
  font-size: 40px;
  font-weight: 700;
  min-width: 150px;
  min-height: 100px;
  padding: 12px 26px;
  border-radius: 28px;
  border: 5px solid #fff;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  letter-spacing: 2px;
}
.word-btn:active { transform: scale(.93); }
.word-btn.correct { background: var(--mint); animation: wiggle .5s ease; }
.word-btn.wrong { animation: shake .4s ease; }

/* ---------- celebrate overlay ---------- */
.celebrate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(2px);
  z-index: 200;
  pointer-events: none;
  transition: opacity .3s;
}
.celebrate.hidden { opacity: 0; }
.celebrate-stars { font-size: 90px; animation: stardown 1s ease infinite alternate; }
@keyframes stardown {
  from { transform: scale(1) rotate(-6deg); }
  to { transform: scale(1.2) rotate(6deg); }
}
.celebrate-text {
  font-size: 44px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  padding: 14px 36px;
  border-radius: 999px;
  border: 5px solid var(--yellow);
  box-shadow: var(--shadow);
}

/* ---------- footer ---------- */
.footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 17px;
  padding: 26px 0 8px;
  opacity: .85;
}

@media (max-width: 520px) {
  .memory-board { grid-template-columns: repeat(3, 1fr); }
  .memory-board.mem-wide { grid-template-columns: repeat(4, 1fr); }
  .game-grid { grid-template-columns: repeat(2, 1fr); }
  .wordpop-pic { font-size: 100px; }
}

/* ---------- Math Sprint ---------- */
.sprint-intro, .sprint-end { text-align: center; padding: 10px 0 30px; }
.sprint-big-emoji { font-size: 84px; line-height: 1.2; }
.sprint-best { font-size: 22px; font-weight: 700; margin: 10px 0; }
.sprint-hud { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.sprint-timer { font-size: clamp(28px, 6vw, 40px); font-weight: 700; min-width: 118px; }
.sprint-bar-wrap { flex: 1; height: 18px; background: #ead9ec; border-radius: 999px; overflow: hidden; }
.sprint-bar { height: 100%; width: 100%; background: #4ecb71; border-radius: 999px; transition: width 1s linear, background .5s ease; }
.sprint-score { font-size: clamp(22px, 5vw, 30px); font-weight: 700; min-width: 96px; text-align: right; }
.sprint-stage { text-align: center; }
.sprint-qrow { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0 4px; }
.sprint-problem { font-size: clamp(54px, 13vw, 92px); font-weight: 700; letter-spacing: 2px; }
.choice-btn.sprint-ans { font-size: 40px; min-width: 124px; }
.sprint-count { font-size: 20px; font-weight: 600; opacity: .75; margin-top: 4px; }
.sprint-encourage { font-size: 26px; font-weight: 700; margin-top: 10px; animation: popstar .5s ease; }
.sprint-final { font-size: clamp(64px, 16vw, 110px); font-weight: 700; line-height: 1.1; }

/* ---------- Maze Adventure (added 2026-09-20) ---------- */
.season-banner { text-align: center; font-size: 20px; margin: 4px 0 12px; }
.season-banner.halloween {
  background: linear-gradient(135deg, #3a1c5a, #7b2d8b);
  color: #ffd93c; font-weight: 700; font-size: 22px;
  border-radius: 18px; padding: 10px 16px; margin: 4px 12px 10px;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.spooky-decor { text-align: center; font-size: 44px; margin: 0 0 8px; letter-spacing: 6px; }
.spooky-decor span { display: inline-block; animation: floaty 3s ease-in-out infinite; }
.spooky-decor span:nth-child(2) { animation-delay: .4s; }
.spooky-decor span:nth-child(3) { animation-delay: .8s; }
.spooky-decor span:nth-child(4) { animation-delay: 1.2s; }
.spooky-decor span:nth-child(5) { animation-delay: 1.6s; }
.spooky-decor span:nth-child(6) { animation-delay: 2s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-12px) rotate(6deg); }
}
.maze-wrap { display: flex; flex-direction: column; align-items: center; }
.maze-grid { display: grid; gap: 2px; width: min(430px, 94vw); background: #c8e6c9; padding: 10px; border-radius: 14px; }
.maze-cell { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; border-radius: 3px; font-size: clamp(10px, 3.5vw, 24px); line-height: 1; }
.maze-cell.wall { background: #a1887f; }
.maze-cell.path { background: #f1f8e9; }
.maze-arrows { display: grid; grid-template-columns: repeat(3, 68px); grid-template-rows: repeat(3, 68px); gap: 8px; justify-content: center; margin-top: 18px; }
.maze-arrow { font-family: inherit; font-size: 30px; border: 0; border-radius: 18px; background: #fff3e0; box-shadow: 0 3px 0 #e0c9a6; cursor: pointer; min-height: 68px; }
.maze-arrow:active { transform: translateY(2px); box-shadow: none; }
.maze-pad-spacer { visibility: hidden; }
.maze-wrap .round-btn { margin-top: 16px; }
