:root {
  --ink: #253047;
  --muted: #65708a;
  --paper: #fffdf7;
  --sky: #aee7ff;
  --blue: #43a4f4;
  --mint: #7bd8b8;
  --leaf: #38b287;
  --coral: #ff7d6e;
  --yellow: #ffd76a;
  --lavender: #d7c6ff;
  --line: rgba(37, 48, 71, 0.14);
  --shadow: 0 18px 45px rgba(31, 47, 76, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 215, 106, 0.42), transparent 24%),
    radial-gradient(circle at 90% 8%, rgba(123, 216, 184, 0.38), transparent 26%),
    linear-gradient(135deg, #e9f8ff 0%, #fff8e4 52%, #ffe7e1 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
}

.topbar,
.lesson-tabs,
.stage,
.controls {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(255, 253, 247, 0.92);
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  position: relative;
  background: linear-gradient(145deg, var(--blue), #76d0ff);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.brand-mark::before {
  left: 15px;
}

.brand-mark::after {
  right: 15px;
}

.brand-mark span {
  position: absolute;
  left: 17px;
  bottom: 13px;
  width: 20px;
  height: 7px;
  border-radius: 0 0 16px 16px;
  border-bottom: 3px solid #fff;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 38px);
}

.class-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--muted);
}

.class-meta span,
.class-meta strong {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.lesson-tabs {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 125, 110, 0.16), rgba(255, 215, 106, 0.16), rgba(123, 216, 184, 0.16), rgba(67, 164, 244, 0.16)),
    rgba(255, 255, 255, 0.88);
}

.tab {
  min-height: 42px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.54)),
    var(--tab-gradient, linear-gradient(135deg, #ffe8a3, #bfefff));
  color: #35415d;
  font-weight: 700;
  border: 1px solid rgba(37, 48, 71, 0.1);
  box-shadow: 0 8px 16px rgba(31, 47, 76, 0.08);
  transform-origin: center;
}

.tab::after {
  content: "";
  position: absolute;
  inset: -40%;
  opacity: 0;
  background:
    radial-gradient(circle at 20% 35%, rgba(255, 255, 255, 0.92) 0 4px, transparent 5px),
    radial-gradient(circle at 56% 18%, rgba(255, 255, 255, 0.78) 0 3px, transparent 4px),
    radial-gradient(circle at 76% 68%, rgba(255, 255, 255, 0.82) 0 5px, transparent 6px);
  transform: rotate(12deg) translateX(-22%);
  transition: opacity 180ms ease, transform 320ms ease;
}

.tab:hover {
  animation: tabBounce 420ms ease;
  box-shadow: 0 13px 22px rgba(31, 47, 76, 0.14);
}

.tab:hover::after {
  opacity: 1;
  transform: rotate(12deg) translateX(12%);
}

.tab.is-active {
  background: var(--tab-gradient, linear-gradient(135deg, var(--coral), var(--yellow)));
  color: #fff;
  text-shadow: 0 1px 0 rgba(37, 48, 71, 0.18);
  box-shadow: 0 12px 22px rgba(31, 47, 76, 0.18);
}

.tab:nth-child(1) {
  --tab-gradient: linear-gradient(135deg, #ff7d6e, #ffd76a);
}

.tab:nth-child(2) {
  --tab-gradient: linear-gradient(135deg, #43a4f4, #7bd8b8);
}

.tab:nth-child(3) {
  --tab-gradient: linear-gradient(135deg, #d7c6ff, #ff9ac2);
}

.tab:nth-child(4) {
  --tab-gradient: linear-gradient(135deg, #ffd76a, #7bd8b8);
}

.tab:nth-child(5) {
  --tab-gradient: linear-gradient(135deg, #7bd8b8, #43a4f4);
}

.tab:nth-child(6) {
  --tab-gradient: linear-gradient(135deg, #ffb36a, #ff7d6e);
}

.tab:nth-child(7) {
  --tab-gradient: linear-gradient(135deg, #8bd2ff, #d7c6ff);
}

.tab:nth-child(8) {
  --tab-gradient: linear-gradient(135deg, #ffd76a, #ff9ac2);
}

.tab:nth-child(9) {
  --tab-gradient: linear-gradient(135deg, #7bd8b8, #ffd76a);
}

.tab:nth-child(10) {
  --tab-gradient: linear-gradient(135deg, #ffb36a, #ffd76a);
}

.tab:nth-child(11) {
  --tab-gradient: linear-gradient(135deg, #43a4f4, #d7c6ff);
}

.tab:nth-child(12) {
  --tab-gradient: linear-gradient(135deg, #ff7d6e, #7bd8b8);
}

.tab:nth-child(13) {
  --tab-gradient: linear-gradient(135deg, #7bd8b8, #ffd76a);
}

@keyframes tabBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(-4px) scale(1.035);
  }
  72% {
    transform: translateY(1px) scale(0.99);
  }
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.6) 1px, transparent 1px),
    rgba(255, 253, 247, 0.92);
  background-size: 28px 28px;
}

.slide {
  display: none;
  min-height: 560px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 28px;
  align-items: start;
  padding: clamp(22px, 4vw, 52px);
  padding-top: 170px;
}

.slide.is-active {
  display: grid;
}

.slide-copy {
  max-width: 680px;
}

.step-label {
  display: inline-block;
  margin-bottom: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--leaf);
  border: 1px solid rgba(56, 178, 135, 0.22);
  font-weight: 800;
  font-size: 18px;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(30px, 4.8vw, 58px);
  line-height: 1.08;
  letter-spacing: 0;
}

.slide-copy h2 {
  position: absolute;
  top: 72px;
  left: clamp(22px, 4vw, 52px);
  right: clamp(22px, 4vw, 52px);
  width: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead {
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.7;
}

.teacher-card,
.board,
.story-card,
.prompt-card,
.detective-card,
.gift-panel,
.certificate,
.art-panel,
.image-panel,
.lili-lab,
.game-panel,
.icebreaker-stage,
.learning-board,
.final-magic-board {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 25px rgba(31, 47, 76, 0.1);
  clip-path: polygon(3% 0, 96% 2%, 100% 88%, 94% 100%, 5% 98%, 0 10%);
}

.teacher-card {
  max-width: 520px;
  margin: 20px 0;
  padding: 16px;
  border-left: 8px solid var(--yellow);
}

.teacher-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.primary-action,
.secondary-action,
.small-action,
.control-button,
.mic,
.play-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 10px 16px rgba(255, 125, 110, 0.22);
}

.secondary-action,
.small-action,
.control-button,
.mic,
.play-button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.play-button {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff 0 18%, var(--yellow) 19% 54%, var(--coral) 55% 100%);
  box-shadow: 0 10px 18px rgba(255, 125, 110, 0.26);
  vertical-align: middle;
}

.play-button span {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid #fff;
  filter: drop-shadow(0 1px 0 rgba(37, 48, 71, 0.2));
}

.play-button:hover {
  animation: tabBounce 420ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-action:active,
.secondary-action:active,
.control-button:active,
.mic:active {
  transform: translateY(1px);
}

.magic-world,
.mascot-stage {
  min-height: 420px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px 20px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(174, 231, 255, 0.9), rgba(255, 255, 255, 0.72)),
    linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.6) 18px 20px);
  border: 1px solid rgba(67, 164, 244, 0.2);
}

.icebreaker-slide .lead {
  max-width: 660px;
}

.life-examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.life-examples article {
  min-height: 126px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  clip-path: polygon(5% 0, 100% 6%, 95% 100%, 0 92%);
  text-align: center;
}

.life-examples strong,
.life-examples small {
  display: block;
}

.life-examples small {
  color: var(--muted);
  font-weight: 800;
}

.example-icon {
  width: 48px;
  height: 48px;
  position: relative;
  display: block;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--mint));
}

.example-icon::before,
.example-icon::after {
  content: "";
  position: absolute;
}

.speaker-icon::before {
  left: 13px;
  top: 12px;
  width: 22px;
  height: 24px;
  border-radius: 8px;
  background: #fff;
}

.speaker-icon::after {
  right: 7px;
  top: 15px;
  width: 10px;
  height: 18px;
  border-right: 4px solid #fff;
  border-radius: 50%;
}

.vacuum-icon {
  background: linear-gradient(135deg, var(--coral), var(--yellow));
}

.vacuum-icon::before {
  inset: 12px 8px 10px;
  border-radius: 999px;
  background: #fff;
}

.vacuum-icon::after {
  left: 19px;
  top: 20px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

.car-icon {
  background: linear-gradient(135deg, var(--lavender), var(--blue));
}

.car-icon::before {
  left: 9px;
  top: 18px;
  width: 30px;
  height: 17px;
  border-radius: 10px 10px 5px 5px;
  background: #fff;
}

.car-icon::after {
  left: 13px;
  top: 30px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 16px 0 var(--ink);
}

.icebreaker-stage {
  min-height: 390px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 22px;
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 215, 106, 0.42), transparent 24%),
    radial-gradient(circle at 75% 20%, rgba(255, 125, 110, 0.28), transparent 26%),
    #fff;
}

.costume-card {
  width: min(100%, 300px);
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8da, #e2f7ff);
  border: 1px solid var(--line);
  text-align: center;
  clip-path: polygon(7% 0, 96% 8%, 100% 86%, 86% 100%, 4% 94%, 0 12%);
}

.costume-card strong {
  font-size: 24px;
}

.costume-card span,
.hidden-ai p {
  color: var(--muted);
  font-weight: 900;
}

.wizard-hat {
  width: 116px;
  height: 116px;
  position: relative;
}

.wizard-hat::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 4px;
  width: 68px;
  height: 86px;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.wizard-hat::after {
  content: "";
  position: absolute;
  left: 6px;
  bottom: 16px;
  width: 104px;
  height: 22px;
  border-radius: 999px;
  background: var(--yellow);
}

.wizard-hat i {
  position: absolute;
  right: 25px;
  top: 34px;
  width: 22px;
  height: 22px;
  background: var(--yellow);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.cape {
  width: 126px;
  height: 74px;
  border-radius: 14px 14px 54px 54px;
  background: linear-gradient(135deg, var(--coral), #ff9ac2);
  transform: rotate(-2deg);
}

.hidden-ai {
  display: grid;
  place-items: center;
  gap: 4px;
}

.hidden-ai span {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--blue));
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(31, 47, 76, 0.18);
}

#magicCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mascot {
  width: 118px;
  height: 150px;
  border-radius: 8px 8px 26px 26px;
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  animation: floaty 3.5s ease-in-out infinite;
}

.mascot:nth-child(2) {
  animation-delay: 0.4s;
}

.mascot:nth-child(3) {
  animation-delay: 0.8s;
}

.mascot p {
  position: absolute;
  bottom: -38px;
  width: 100%;
  text-align: center;
  font-weight: 800;
}

.mascot.is-selected {
  outline: 4px solid var(--yellow);
  outline-offset: 5px;
  box-shadow: 0 0 0 10px rgba(255, 215, 106, 0.22);
}

.magic-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  opacity: 0;
  z-index: 2;
}

.magic-burst i {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--yellow);
}

.magic-burst i:nth-child(1) { --i: 1; background: var(--yellow); }
.magic-burst i:nth-child(2) { --i: 2; background: var(--coral); }
.magic-burst i:nth-child(3) { --i: 3; background: var(--mint); }
.magic-burst i:nth-child(4) { --i: 4; background: var(--blue); }
.magic-burst i:nth-child(5) { --i: 5; background: var(--lavender); }
.magic-burst i:nth-child(6) { --i: 6; background: #fff; }

.magic-burst.is-active {
  opacity: 1;
}

.magic-burst.is-active i {
  animation: burstPop 820ms ease forwards;
}

@keyframes burstPop {
  0% {
    transform: rotate(calc(var(--i) * 60deg)) translateY(0) scale(0.4);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: rotate(calc(var(--i) * 60deg)) translateY(-150px) scale(1.4);
    opacity: 0;
  }
}

.robot {
  background: var(--blue);
}

.bunny {
  background: #fff;
  border: 3px solid var(--lavender);
}

.kitten {
  background: #ffb36a;
}

.antenna {
  position: absolute;
  top: -30px;
  width: 4px;
  height: 30px;
  background: var(--ink);
}

.antenna::after {
  content: "";
  position: absolute;
  left: -7px;
  top: -11px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--yellow);
}

.ears,
.ears.cat {
  position: absolute;
  top: -38px;
  width: 84px;
  height: 45px;
}

.ears::before,
.ears::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 54px;
  border-radius: 18px 18px 8px 8px;
  background: #fff;
  border: 3px solid var(--lavender);
}

.ears::before {
  left: 10px;
  transform: rotate(-10deg);
}

.ears::after {
  right: 10px;
  transform: rotate(10deg);
}

.ears.cat::before,
.ears.cat::after {
  width: 0;
  height: 0;
  border-radius: 0;
  background: transparent;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 42px solid #ffb36a;
}

.ears.cat::before {
  left: 0;
}

.ears.cat::after {
  right: 0;
}

.face {
  width: 72px;
  height: 46px;
  border-radius: 8px;
  background: #fff;
  position: relative;
}

.face span {
  position: absolute;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

.face span:first-child {
  left: 17px;
}

.face span:last-child {
  right: 17px;
}

.face::after {
  content: "";
  position: absolute;
  left: 27px;
  bottom: 9px;
  width: 18px;
  height: 8px;
  border-bottom: 3px solid var(--coral);
  border-radius: 0 0 18px 18px;
}

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

.floating-mascot {
  position: fixed;
  right: 18px;
  bottom: 96px;
  width: 78px;
  height: 96px;
  z-index: 20;
  display: none;
  border-radius: 8px 8px 22px 22px;
  place-items: center;
  background: var(--blue);
  box-shadow: 0 16px 28px rgba(31, 47, 76, 0.2);
  animation: floaty 3.2s ease-in-out infinite;
}

.floating-mascot.is-visible {
  display: grid;
}

.floating-mascot p {
  position: absolute;
  bottom: -30px;
  margin: 0;
  width: 120px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.floating-mascot .face {
  width: 58px;
}

.floating-mascot.robot .ears,
.floating-mascot.bunny .antenna,
.floating-mascot.kitten .antenna {
  display: none;
}

.floating-mascot.bunny {
  background: #fff;
  border: 3px solid var(--lavender);
}

.floating-mascot.kitten {
  background: #ffb36a;
}

.floating-mascot.kitten .ears::before,
.floating-mascot.kitten .ears::after {
  width: 0;
  height: 0;
  border-radius: 0;
  background: transparent;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-bottom: 36px solid #ffb36a;
}

.idea-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.idea-grid article {
  min-height: 150px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.idea-grid h3 {
  margin: 12px 0 8px;
  font-size: 24px;
}

.idea-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

.icon-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.icon-dot.blue {
  background: var(--blue);
}

.icon-dot.coral {
  background: var(--coral);
}

.icon-dot.green {
  background: var(--mint);
}

.board {
  padding: 28px;
  background: #253047;
  color: #fff;
}

.board p {
  color: var(--yellow);
  font-weight: 800;
}

.board strong {
  display: block;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.24;
}

.board .small-action {
  margin-top: 20px;
}

.signal-board {
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 215, 106, 0.3), transparent 28%),
    linear-gradient(160deg, #253047, #42506f);
}

.concept-visual {
  width: min(100%, 330px);
  min-height: 250px;
  position: relative;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 215, 106, 0.36), transparent 24%),
    radial-gradient(circle at 78% 24%, rgba(123, 216, 184, 0.34), transparent 24%),
    rgba(255, 255, 255, 0.18);
  clip-path: polygon(6% 0, 96% 5%, 100% 84%, 90% 100%, 4% 94%, 0 12%);
}

.concept-image {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(31, 47, 76, 0.18));
  animation: conceptPop 360ms ease both;
}

.is-listen .concept-image {
  transform-origin: 46% 58%;
}

.is-draw .concept-image {
  transform-origin: 58% 55%;
}

.is-mistake .concept-image {
  transform-origin: 52% 48%;
}

.concept-bot {
  width: 92px;
  height: 96px;
  position: relative;
  border-radius: 8px 8px 24px 24px;
  background: var(--blue);
}

.concept-bot span {
  position: absolute;
  top: 38px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}

.concept-bot span:first-child { left: 28px; }
.concept-bot span:last-child { right: 28px; }

.sound-wave,
.paint-demo,
.oops-demo {
  position: absolute;
  display: none;
}

.is-listen .sound-wave {
  display: flex;
  gap: 8px;
  left: 24px;
  top: 72px;
}

.sound-wave i {
  width: 12px;
  height: 54px;
  border-radius: 99px;
  background: var(--yellow);
  animation: soundWave 800ms ease-in-out infinite;
}

.sound-wave i:nth-child(2) { animation-delay: 100ms; }
.sound-wave i:nth-child(3) { animation-delay: 200ms; }

.is-draw .paint-demo {
  display: flex;
  right: 16px;
  bottom: 42px;
  gap: 8px;
}

.paint-demo b {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 8px;
  background: var(--coral);
  animation: dotBounce 900ms ease-in-out infinite;
}

.paint-demo b:nth-child(2) { background: var(--yellow); animation-delay: 120ms; }
.paint-demo b:nth-child(3) { background: var(--mint); animation-delay: 240ms; }

.is-mistake .oops-demo {
  display: grid;
  place-items: center;
  right: 28px;
  top: 28px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 54px;
  font-weight: 900;
  animation: tabBounce 900ms ease-in-out infinite;
}

@keyframes soundWave {
  0%,
  100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

@keyframes conceptPop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.92) rotate(-1deg);
  }
  65% {
    opacity: 1;
    transform: translateY(-3px) scale(1.03) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

.signal-board p {
  margin-bottom: 18px;
  color: #fff;
  font-size: 18px;
}

.signal-stack {
  display: grid;
  grid-template-columns: repeat(3, 82px);
  gap: 12px;
}

.signal {
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  box-shadow: inset 0 -8px rgba(0, 0, 0, 0.12), 0 10px 18px rgba(0, 0, 0, 0.18);
  animation: signalPulse 1.8s ease-in-out infinite;
}

.signal.red {
  background: var(--coral);
}

.signal.yellow {
  background: var(--yellow);
  animation-delay: 0.22s;
}

.signal.green {
  background: var(--mint);
  animation-delay: 0.44s;
}

@keyframes signalPulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.08);
    filter: brightness(1.18);
  }
}

.word-inputs,
.prompt-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  max-width: 620px;
}

.compact-inputs {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 650px;
  margin: 16px 0;
}

.word-bank button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fff, #f3fbff);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 7px 12px rgba(31, 47, 76, 0.08);
}

.word-bank button.is-selected {
  background: linear-gradient(135deg, var(--yellow), var(--coral));
  color: #fff;
}

.prompt-builder.compact-inputs {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.cute-prompt-builder label {
  position: relative;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  clip-path: polygon(4% 0, 100% 5%, 96% 100%, 0 94%);
}

.cute-prompt-builder em {
  font-style: normal;
  color: var(--muted);
}

.cute-prompt-builder input {
  grid-column: 1 / -1;
}

.input-icon,
.cartoon-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), var(--coral));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 8px 14px rgba(255, 125, 110, 0.2);
}

.cartoon-icon {
  position: relative;
  background: linear-gradient(135deg, var(--yellow), #fff);
}

.cartoon-icon::before,
.cartoon-icon::after {
  content: "";
  position: absolute;
}

.cat-icon::before {
  inset: 8px;
  border-radius: 50%;
  background: #ffb36a;
}

.cat-icon::after {
  left: 10px;
  top: 5px;
  width: 16px;
  height: 12px;
  background: #ffb36a;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

.color-icon::before {
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(var(--coral), var(--yellow), var(--mint), var(--blue), var(--coral));
}

.place-icon::before {
  left: 9px;
  top: 8px;
  width: 18px;
  height: 21px;
  background: var(--blue);
  clip-path: polygon(50% 100%, 0 34%, 0 0, 100% 0, 100% 34%);
}

.action-icon::before {
  left: 9px;
  top: 9px;
  width: 18px;
  height: 18px;
  border: 4px solid var(--mint);
  border-left-color: transparent;
  border-radius: 50%;
}

.mood-icon::before {
  inset: 8px;
  border-radius: 50%;
  background: var(--coral);
}

.mood-icon::after {
  left: 13px;
  top: 17px;
  width: 10px;
  height: 6px;
  border-bottom: 3px solid #fff;
  border-radius: 0 0 12px 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(67, 164, 244, 0.14);
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.6;
}

.wide-field {
  max-width: 640px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.story-card,
.prompt-card,
.detective-card {
  min-height: 340px;
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 16px;
  font-size: 22px;
  line-height: 1.75;
  position: relative;
  overflow: hidden;
}

.card-title {
  margin-bottom: 0;
  color: var(--leaf);
  font-weight: 900;
  font-size: 16px;
}

.story-card {
  border-top: 8px solid var(--yellow);
}

.prompt-card {
  border-top: 8px solid var(--mint);
  position: relative;
  overflow: hidden;
}

.prompt-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.prompt-compare article {
  min-height: 150px;
  padding: 12px;
  display: grid;
  place-items: center;
  gap: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.prompt-compare p,
.prompt-compare small {
  margin: 0;
  font-weight: 900;
}

.simple-cat,
.magic-cat {
  width: 68px;
  height: 62px;
  position: relative;
  border-radius: 8px 8px 22px 22px;
  background: #ffb36a;
}

.simple-cat::before,
.magic-cat::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 26px 0 var(--ink);
}

.magic-cat {
  background: linear-gradient(135deg, #ffb36a, var(--yellow));
  animation: tabBounce 1.2s ease-in-out infinite;
}

.magic-cat i {
  position: absolute;
  right: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  background: var(--yellow);
  clip-path: polygon(50% 0, 60% 36%, 100% 50%, 60% 64%, 50% 100%, 40% 64%, 0 50%, 40% 36%);
}

.detective-card {
  border-top: 8px solid var(--coral);
}

.detective-slide {
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 24px;
}

.detective-slide .slide-copy {
  max-width: none;
}

.detective-slide .lead {
  max-width: 360px;
}

.detective-slide .detective-actions {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 300px;
  margin-top: 24px;
}

.detective-slide .detective-card {
  min-height: 390px;
  align-content: start;
  grid-template-columns: minmax(0, 1.15fr) minmax(190px, 0.85fr);
  gap: 14px;
  padding: 22px;
  font-size: 19px;
  line-height: 1.55;
}

.detective-slide .card-title,
.detective-slide #detectiveCase,
.detective-slide .detective-feedback,
.detective-slide .play-button {
  grid-column: 1 / -1;
}

.detective-slide #detectiveCase {
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 248, 218, 0.78);
  border: 1px solid rgba(255, 215, 106, 0.45);
  font-weight: 800;
}

.detective-slide .error-demo,
.detective-slide .detective-choices {
  align-self: stretch;
}

.detective-slide .error-demo {
  min-width: 0;
}

.detective-slide .detective-choices {
  align-content: center;
}

.detective-slide .detective-feedback {
  font-size: 17px;
}

.wand-svg {
  width: 180px;
  height: 70px;
  justify-self: end;
}

.wand-svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 7;
  stroke-linecap: round;
}

.wand-svg circle {
  fill: var(--yellow);
  stroke: var(--ink);
  stroke-width: 5;
}

.image-panel,
.lili-lab {
  min-height: 390px;
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: center;
}

.image-frame,
.lili-preview {
  min-height: 320px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(67, 164, 244, 0.22);
  background: linear-gradient(180deg, rgba(174, 231, 255, 0.62), rgba(255, 255, 255, 0.9));
}

.picture-placeholder,
.lili-preview svg {
  width: min(100%, 420px);
  height: auto;
}

.picture-placeholder rect {
  fill: #ddf3ff;
}

.picture-placeholder circle {
  fill: var(--yellow);
}

.picture-placeholder path {
  fill: #8bd2a6;
}

.picture-placeholder text,
.lili-preview text {
  text-anchor: middle;
  font-size: 34px;
  font-weight: 900;
  fill: var(--ink);
}

#generatedImage,
#liliImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 220ms ease;
}

#generatedImage.is-visible,
#liliImage.is-visible {
  opacity: 1;
}

.cartoon-loader,
.loading-sparkles {
  position: absolute;
  inset: 18px;
  display: none;
  place-items: center;
  align-content: center;
  gap: 14px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 215, 106, 0.42), transparent 22%),
    radial-gradient(circle at 78% 20%, rgba(123, 216, 184, 0.36), transparent 22%),
    rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  z-index: 4;
}

.cartoon-loader.is-visible,
.loading-sparkles.is-visible {
  display: grid;
}

.cartoon-loader p {
  margin: 0;
  font-size: 18px;
}

.loader-bot {
  width: 82px;
  height: 76px;
  position: relative;
  border-radius: 8px 8px 22px 22px;
  background: linear-gradient(145deg, var(--blue), #83d7ff);
  animation: botBob 900ms ease-in-out infinite;
}

.loader-bot::before {
  content: "";
  position: absolute;
  left: 38px;
  top: -22px;
  width: 5px;
  height: 24px;
  background: var(--ink);
}

.loader-bot::after {
  content: "";
  position: absolute;
  left: 30px;
  top: -30px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--yellow);
}

.loader-bot span {
  position: absolute;
  top: 29px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1.8s ease-in-out infinite;
}

.loader-bot span:first-child {
  left: 24px;
}

.loader-bot span:last-child {
  right: 24px;
}

.loader-cloud,
.paint-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 24px;
}

.loader-cloud b,
.paint-dots b {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: block;
  animation: dotBounce 900ms ease-in-out infinite;
}

.loader-cloud b:nth-child(1),
.paint-dots b:nth-child(1) {
  background: var(--coral);
}

.loader-cloud b:nth-child(2),
.paint-dots b:nth-child(2) {
  background: var(--yellow);
  animation-delay: 120ms;
}

.loader-cloud b:nth-child(3),
.paint-dots b:nth-child(3) {
  background: var(--mint);
  animation-delay: 240ms;
}

.story-loader {
  inset: 14px;
}

@keyframes botBob {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

@keyframes blink {
  0%,
  88%,
  100% {
    transform: scaleY(1);
  }
  92% {
    transform: scaleY(0.18);
  }
}

@keyframes dotBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.08);
  }
}

.lili-preview svg circle {
  fill: #e8f7ff;
}

.lili-preview svg path:nth-of-type(1) {
  fill: #7bd8b8;
  stroke: var(--ink);
  stroke-width: 8;
}

.lili-preview svg circle:nth-of-type(2),
.lili-preview svg circle:nth-of-type(3) {
  fill: var(--ink);
}

.lili-preview svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lili-preview svg path:nth-of-type(5) {
  fill: var(--coral);
  stroke: none;
}

.badge-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.game-slide {
  grid-template-columns: minmax(330px, 470px) minmax(0, 1fr);
}

.game-slide .slide-copy {
  max-width: none;
}

.scene-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.scene-card {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  clip-path: polygon(5% 0, 100% 8%, 94% 100%, 0 92%);
}

.scene-card.is-selected {
  border-color: var(--mint);
  background: linear-gradient(135deg, #fff8da, #e7fff4);
  box-shadow: 0 12px 20px rgba(31, 47, 76, 0.12);
}

.scene-icon {
  width: 42px;
  height: 42px;
  position: relative;
  display: block;
  border-radius: 50%;
  background: var(--blue);
}

.rainbow-scene {
  background: conic-gradient(var(--coral), var(--yellow), var(--mint), var(--blue), var(--lavender), var(--coral));
}

.forest-scene {
  background: radial-gradient(circle at 35% 32%, var(--yellow) 0 18%, transparent 19%), linear-gradient(135deg, var(--mint), #4fb889);
}

.space-scene {
  background: radial-gradient(circle at 30% 28%, #fff 0 8%, transparent 9%), linear-gradient(135deg, var(--ink), var(--lavender));
}

.ocean-scene {
  background: radial-gradient(circle at 35% 35%, #fff 0 9%, transparent 10%), linear-gradient(135deg, var(--blue), #77e2ff);
}

.library-scene {
  background: linear-gradient(90deg, var(--coral) 0 28%, var(--yellow) 28% 56%, var(--blue) 56% 82%, var(--mint) 82%);
}

.moon-scene {
  background: radial-gradient(circle at 60% 38%, var(--yellow) 0 26%, transparent 27%), linear-gradient(135deg, var(--ink), var(--blue));
}

.game-panel {
  min-height: 450px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 215, 106, 0.36), transparent 23%),
    radial-gradient(circle at 84% 18%, rgba(67, 164, 244, 0.26), transparent 24%),
    #fff;
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-head p,
.game-head strong {
  margin: 0;
  font-weight: 900;
}

.game-head p {
  color: var(--leaf);
  font-size: 20px;
}

.game-head strong {
  min-width: 76px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--yellow);
  text-align: center;
}

.game-stage {
  min-height: 330px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(118px, 1fr) minmax(118px, 1fr) minmax(98px, 0.72fr) minmax(118px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(67, 164, 244, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.86)),
    linear-gradient(135deg, #e2f7ff, #fff8da);
}

.theme-rainbow { background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.9)), linear-gradient(135deg, #ffe6ee, #e2f7ff, #e7fff4); }
.theme-forest { background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.9)), linear-gradient(135deg, #e7fff4, #fff1c2); }
.theme-space { background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.8), transparent 3%), linear-gradient(135deg, #253047, #6d77d8); }
.theme-space .matching-card,
.theme-space .game-lili p { color: var(--ink); }
.theme-ocean { background: linear-gradient(180deg, rgba(226, 247, 255, 0.78), rgba(255, 255, 255, 0.88)), linear-gradient(135deg, #43a4f4, #7bd8b8); }
.theme-library { background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.9)), linear-gradient(135deg, #fff1c2, #ffe6ee); }
.theme-moon { background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.9)), linear-gradient(135deg, #d7c6ff, #e2f7ff); }

.match-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.rainbow-match-line {
  fill: none;
  stroke: url("#rainbowLine");
  stroke-width: 8;
  stroke-linecap: round;
  filter: drop-shadow(0 5px 6px rgba(31, 47, 76, 0.16));
  animation: lineGrow 320ms ease both;
}

.match-column,
.game-lili {
  position: relative;
  z-index: 2;
}

.match-column {
  display: grid;
  gap: 10px;
}

.left-column::before,
.english-column::before,
.picture-column::before {
  display: block;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.left-column::before {
  content: "汉字";
}

.english-column::before {
  content: "English";
}

.picture-column::before {
  content: "图形";
}

.matching-card {
  min-height: 70px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid rgba(67, 164, 244, 0.22);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 8px 15px rgba(31, 47, 76, 0.08);
}

.matching-card.is-picked {
  border-color: var(--yellow);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 20px rgba(255, 215, 106, 0.28);
}

.matching-card.is-matched {
  border-color: var(--mint);
  background: linear-gradient(135deg, #e7fff4, #fff8da);
}

.matching-card.is-pop {
  animation: matchPop 620ms ease both;
}

.matching-card.is-wrong {
  border-color: var(--coral);
  animation: shake 420ms ease;
}

.picture-card em {
  font-style: normal;
  color: var(--muted);
  font-size: 15px;
}

.english-card {
  color: var(--blue);
  font-size: 22px;
}

.picture-card {
  min-height: 70px;
}

.mini-picture {
  width: 42px;
  height: 34px;
  position: relative;
  display: block;
}

.mini-picture::before,
.mini-picture::after {
  content: "";
  position: absolute;
}

.ball-picture::before { inset: 2px 6px; border-radius: 50%; background: var(--blue); }
.bag-picture::before { left: 8px; right: 8px; top: 10px; bottom: 2px; border-radius: 8px; background: var(--coral); }
.bag-picture::after { left: 15px; top: 3px; width: 12px; height: 12px; border: 4px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; }
.run-picture::before { left: 14px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--yellow); }
.run-picture::after { left: 7px; top: 16px; width: 30px; height: 13px; background: var(--mint); clip-path: polygon(22% 0, 48% 0, 58% 56%, 100% 45%, 100% 72%, 52% 100%, 34% 48%, 0 72%, 0 42%); }
.apple-picture::before { left: 9px; top: 5px; width: 25px; height: 25px; border-radius: 50%; background: var(--coral); }
.banana-picture::before { left: 6px; top: 7px; width: 30px; height: 22px; border: 7px solid var(--yellow); border-top: 0; border-left-color: transparent; border-radius: 0 0 30px 30px; }
.cake-picture::before { left: 5px; top: 13px; width: 32px; height: 18px; border-radius: 6px; background: linear-gradient(180deg, #fff 0 35%, var(--coral) 36%); }
.star-picture::before { inset: 2px 5px; background: var(--yellow); clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%); }
.moon-picture::before { left: 8px; top: 3px; width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); }
.moon-picture::after { left: 18px; top: 0; width: 26px; height: 30px; border-radius: 50%; background: #fff; }
.rocket-picture::before { left: 14px; top: 2px; width: 15px; height: 26px; border-radius: 50% 50% 6px 6px; background: var(--blue); }
.rocket-picture::after { left: 11px; top: 24px; width: 21px; height: 10px; background: var(--coral); clip-path: polygon(50% 100%, 0 0, 100% 0); }
.fish-picture::before { left: 6px; top: 8px; width: 25px; height: 18px; border-radius: 50%; background: var(--blue); }
.fish-picture::after { right: 5px; top: 11px; width: 12px; height: 12px; background: var(--mint); clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.shell-picture::before { left: 8px; top: 8px; width: 28px; height: 23px; border-radius: 999px 999px 8px 8px; background: #ff9ac2; }
.bubble-picture::before { left: 5px; top: 5px; width: 18px; height: 18px; border: 4px solid var(--blue); border-radius: 50%; }
.bubble-picture::after { right: 5px; bottom: 2px; width: 12px; height: 12px; border: 3px solid var(--mint); border-radius: 50%; }
.book-picture::before { left: 7px; top: 7px; width: 28px; height: 23px; border-radius: 4px; background: linear-gradient(90deg, var(--blue) 0 48%, #fff 49% 51%, var(--coral) 52%); }
.pen-picture::before { left: 18px; top: 3px; width: 8px; height: 30px; border-radius: 8px; background: var(--ink); transform: rotate(28deg); }
.lamp-picture::before { left: 9px; top: 5px; width: 24px; height: 17px; border-radius: 20px 20px 4px 4px; background: var(--yellow); }
.lamp-picture::after { left: 18px; top: 20px; width: 6px; height: 13px; background: var(--ink); }
.boat-picture::before { left: 6px; top: 18px; width: 30px; height: 12px; border-radius: 0 0 18px 18px; background: var(--blue); }
.boat-picture::after { left: 17px; top: 3px; width: 17px; height: 18px; background: var(--yellow); clip-path: polygon(0 100%, 0 0, 100% 100%); }
.cloud-picture::before { left: 5px; top: 14px; width: 32px; height: 14px; border-radius: 999px; background: #bdeeff; }
.cloud-picture::after { left: 12px; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: #bdeeff; }
.sleep-picture::before { left: 5px; top: 16px; width: 30px; height: 11px; border-radius: 999px; background: var(--lavender); }
.sleep-picture::after { right: 4px; top: 0; content: "Z"; color: var(--ink); font-weight: 900; }

.game-lili {
  display: grid;
  place-items: center;
  gap: 6px;
  align-self: end;
  text-align: center;
  font-weight: 900;
  color: var(--muted);
}

.game-lili img {
  display: none;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 12px 20px rgba(31, 47, 76, 0.16);
}

.game-lili.has-custom-lili img {
  display: block;
}

.game-lili.has-custom-lili .game-lili-default {
  display: none;
}

.game-lili-default {
  width: 104px;
  height: 104px;
  position: relative;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--blue));
  box-shadow: 0 12px 20px rgba(31, 47, 76, 0.16);
}

.game-lili-default span {
  position: absolute;
  left: 28px;
  top: 36px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 38px 0 #fff;
}

.game-lili-default b {
  position: absolute;
  left: 36px;
  top: 64px;
  width: 32px;
  height: 14px;
  border-bottom: 5px solid #fff;
  border-radius: 0 0 22px 22px;
}

.game-feedback {
  margin: 0;
  min-height: 48px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 215, 106, 0.22);
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

@keyframes lineGrow {
  from {
    stroke-dasharray: 1 500;
    opacity: 0.2;
  }
  to {
    stroke-dasharray: 500 0;
    opacity: 1;
  }
}

@keyframes matchPop {
  0% {
    transform: scale(1);
  }
  38% {
    transform: translateY(-7px) scale(1.08) rotate(-1deg);
  }
  100% {
    transform: scale(1);
  }
}

.sparkle-now .stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 215, 106, 0.7), transparent 4%),
    radial-gradient(circle at 72% 18%, rgba(123, 216, 184, 0.55), transparent 4%),
    radial-gradient(circle at 82% 64%, rgba(255, 125, 110, 0.46), transparent 4%),
    radial-gradient(circle at 38% 72%, rgba(67, 164, 244, 0.48), transparent 4%);
  animation: sparkleFade 700ms ease forwards;
}

.full-magic {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
  display: none;
}

.full-magic.is-active {
  display: block;
}

.full-magic span {
  position: absolute;
  left: calc(var(--x, 10) * 1%);
  bottom: -60px;
  font-size: clamp(42px, 7vw, 96px);
  color: var(--coral);
  text-shadow: 0 10px 22px rgba(31, 47, 76, 0.18);
  animation: fullMagicFloat 1.7s ease-out forwards;
}

.full-magic span:nth-child(1) { --x: 8; color: var(--yellow); animation-delay: 0ms; }
.full-magic span:nth-child(2) { --x: 22; color: var(--coral); animation-delay: 120ms; }
.full-magic span:nth-child(3) { --x: 36; color: var(--mint); animation-delay: 40ms; }
.full-magic span:nth-child(4) { --x: 50; color: var(--blue); animation-delay: 180ms; }
.full-magic span:nth-child(5) { --x: 64; color: var(--lavender); animation-delay: 80ms; }
.full-magic span:nth-child(6) { --x: 78; color: var(--coral); animation-delay: 160ms; }
.full-magic span:nth-child(7) { --x: 88; color: var(--yellow); animation-delay: 20ms; }
.full-magic span:nth-child(8) { --x: 14; color: var(--blue); animation-delay: 240ms; }

@keyframes fullMagicFloat {
  0% {
    transform: translateY(0) rotate(-8deg) scale(0.7);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: translateY(-105vh) rotate(18deg) scale(1.15);
    opacity: 0;
  }
}

@keyframes sparkleFade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.art-panel {
  padding: 18px;
}

.classroom-scene {
  position: relative;
  height: 320px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(67, 164, 244, 0.22);
  background:
    linear-gradient(180deg, #bdeeff 0 62%, #9bd99c 62% 100%);
}

.banner {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--yellow);
  font-weight: 900;
}

.desk {
  position: absolute;
  left: 38px;
  right: 38px;
  bottom: 48px;
  height: 30px;
  border-radius: 8px;
  background: #e79857;
}

.mini {
  position: absolute;
  bottom: 76px;
  width: 56px;
  height: 62px;
  border-radius: 8px 8px 18px 18px;
}

.robot-mini {
  left: 58px;
  background: var(--blue);
}

.robot-mini::before,
.cat-mini::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 21px 0 #fff;
}

.cat-mini {
  background: #ffb36a;
}

.cat-mini:nth-of-type(4) {
  left: 155px;
}

.cat-mini:nth-of-type(5) {
  left: 232px;
}

.cat-mini:nth-of-type(6) {
  left: 309px;
}

.cat-mini::after {
  content: "";
  position: absolute;
  left: 9px;
  top: -18px;
  width: 38px;
  height: 22px;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

.hat-red::after {
  background: var(--coral);
}

.hat-blue::after {
  background: var(--blue);
}

.hat-yellow::after {
  background: var(--yellow);
}

.classroom-scene.surprise .mini {
  animation: hop 520ms ease;
}

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

.checkline {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.detective-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.detective-choices {
  display: grid;
  gap: 10px;
}

.detective-choice {
  min-height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #f0fbff);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 900;
}

.detective-choice.is-correct {
  background: linear-gradient(135deg, var(--mint), var(--yellow));
  color: #fff;
}

.detective-choice.is-wrong {
  background: linear-gradient(135deg, #ffe7e3, #fff);
}

.detective-feedback {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 215, 106, 0.22);
  color: var(--muted);
  font-weight: 900;
}

.error-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.demo-card {
  min-height: 86px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--mint);
  text-align: center;
  font-weight: 900;
}

.demo-card.wrong {
  border-color: var(--coral);
  background: #fff1ef;
}

.demo-card b {
  width: 38px;
  height: 28px;
  display: block;
  border-radius: 999px 999px 10px 10px;
  background: var(--blue);
}

.demo-card.wrong b {
  background: var(--coral);
  transform: rotate(-8deg);
}

.count-demo {
  grid-template-columns: repeat(3, auto);
}

.count-demo span {
  grid-column: 1 / -1;
}

.count-demo b {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.guess-demo b {
  border-radius: 50%;
  width: 32px;
  height: 32px;
}

.gift-panel {
  min-height: 380px;
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 215, 106, 0.36), transparent 22%),
    radial-gradient(circle at 82% 16%, rgba(255, 125, 110, 0.28), transparent 24%),
    #fff;
}

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

.fireworks i,
.firework {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 18px 0 var(--coral), -18px 0 var(--mint), 0 18px var(--blue), 0 -18px var(--lavender);
  animation: firework 1.6s ease-in-out infinite;
}

.fireworks i:nth-child(1) { left: 22%; top: 24%; }
.fireworks i:nth-child(2) { right: 24%; top: 18%; animation-delay: 0.35s; }
.fireworks i:nth-child(3) { left: 70%; bottom: 24%; animation-delay: 0.72s; }

@keyframes firework {
  0%,
  100% {
    transform: scale(0.55);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

.award-card {
  width: min(100%, 300px);
  min-height: 104px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 16px;
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(135deg, #fff8d9, #ffe4ee);
  border: 1px solid var(--line);
  clip-path: polygon(6% 0, 96% 8%, 100% 86%, 88% 100%, 4% 94%, 0 14%);
  text-align: center;
}

.award-card span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-weight: 900;
}

.award-card strong {
  font-size: 24px;
}

.award-card em {
  font-style: normal;
  color: var(--muted);
  font-size: 14px;
}

.award-card.kind-question { background: linear-gradient(135deg, #e2f7ff, #fff); }
.award-card.kind-imagine { background: linear-gradient(135deg, #fff1c2, #ffe6ee); }
.award-card.kind-check { background: linear-gradient(135deg, #dff8ed, #fff); }
.award-card.kind-prompt { background: linear-gradient(135deg, #eee7ff, #fff7cf); }

.gift-box {
  width: 160px;
  height: 130px;
  position: relative;
  border-radius: 8px;
  background: var(--coral);
  box-shadow: inset 0 -16px rgba(0, 0, 0, 0.08);
}

.gift-box::before {
  content: "";
  position: absolute;
  left: -12px;
  top: -28px;
  width: 184px;
  height: 42px;
  border-radius: 8px;
  background: var(--yellow);
}

.gift-box span {
  position: absolute;
  left: 69px;
  top: -28px;
  width: 22px;
  height: 158px;
  background: #fff;
}

.gift-box.is-shaking {
  animation: shake 550ms ease;
}

@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-4deg);
  }
  75% {
    transform: rotate(4deg);
  }
}

#giftResult {
  margin: 0;
  min-height: 38px;
  font-size: 28px;
  font-weight: 900;
}

.star-wall {
  width: 100%;
  min-height: 70px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.star {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: #8a5c00;
  font-weight: 900;
}

.learning-slide .lead {
  max-width: 690px;
}

.learning-points {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.learning-points article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  clip-path: polygon(3% 0, 100% 6%, 96% 100%, 0 92%);
}

.learning-points span {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: #8a5c00;
  font-weight: 900;
}

.learning-points strong,
.learning-points small {
  display: block;
}

.learning-points small {
  color: var(--muted);
  font-weight: 800;
}

.learning-board {
  min-height: 390px;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 22px;
  background:
    radial-gradient(circle at 22% 18%, rgba(123, 216, 184, 0.34), transparent 24%),
    radial-gradient(circle at 78% 20%, rgba(255, 215, 106, 0.36), transparent 24%),
    #fff;
}

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

.apple-card {
  min-height: 122px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(67, 164, 244, 0.18);
  text-align: center;
  font-weight: 900;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.apple-card:hover {
  transform: translateY(-5px) rotate(-1deg);
  box-shadow: 0 14px 22px rgba(31, 47, 76, 0.12);
}

.apple-card b {
  width: 58px;
  height: 58px;
  position: relative;
  display: block;
  border-radius: 48% 52% 50% 50%;
  background: var(--coral);
  box-shadow: inset -10px -12px rgba(0, 0, 0, 0.08);
}

.apple-card b::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -16px;
  width: 8px;
  height: 22px;
  border-radius: 8px;
  background: #8a5c00;
  transform: rotate(18deg);
}

.apple-card b::after {
  content: "";
  position: absolute;
  left: 35px;
  top: -11px;
  width: 22px;
  height: 14px;
  border-radius: 14px 14px 14px 2px;
  background: var(--mint);
  transform: rotate(-16deg);
}

.green-apple b {
  background: var(--mint);
}

.bite-apple b::after {
  left: 42px;
  top: 13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
}

.tomato-card {
  border-color: rgba(255, 125, 110, 0.45);
  background: #fff1ef;
}

.tomato-card b {
  border-radius: 50%;
  background: #ff5b4f;
}

.tomato-card b::after {
  left: 15px;
  top: -10px;
  width: 34px;
  height: 22px;
  border-radius: 0;
  background: var(--mint);
  clip-path: polygon(50% 0, 62% 40%, 100% 20%, 72% 56%, 92% 100%, 50% 72%, 8% 100%, 28% 56%, 0 20%, 38% 40%);
}

.knowledge-candy {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 248, 218, 0.88);
  color: var(--muted);
  text-align: center;
}

.knowledge-candy i {
  width: 22px;
  height: 22px;
  display: inline-block;
  margin: 0 4px;
  border-radius: 50% 50% 50% 8px;
  background: var(--coral);
  animation: dotBounce 1.1s ease-in-out infinite;
}

.knowledge-candy i:nth-child(2) { background: var(--yellow); animation-delay: 90ms; }
.knowledge-candy i:nth-child(3) { background: var(--mint); animation-delay: 180ms; }
.knowledge-candy i:nth-child(4) { background: var(--blue); animation-delay: 270ms; }
.knowledge-candy i:nth-child(5) { background: var(--lavender); animation-delay: 360ms; }

.magician-slide .lead {
  max-width: 700px;
}

.chant-spell {
  width: min(100%, 560px);
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8da, #e7fff4);
  border: 1px solid var(--line);
  clip-path: polygon(4% 0, 98% 6%, 100% 84%, 88% 100%, 0 94%);
}

.chant-spell strong {
  color: var(--leaf);
}

.chant-spell p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 900;
  line-height: 1.18;
}

.final-magic-board {
  min-height: 390px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 215, 106, 0.48), transparent 24%),
    radial-gradient(circle at 78% 26%, rgba(67, 164, 244, 0.28), transparent 24%),
    #fff;
}

.big-wand {
  width: 220px;
  height: 90px;
  position: relative;
}

.big-wand::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 54px;
  width: 160px;
  height: 12px;
  border-radius: 999px;
  background: var(--ink);
  transform: rotate(-20deg);
}

.big-wand::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 8px;
  width: 50px;
  height: 50px;
  background: var(--yellow);
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  animation: tabBounce 1s ease-in-out infinite;
}

.final-magic-board article {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
}

.final-magic-board article span,
.final-magic-board article strong {
  display: block;
  font-weight: 900;
}

.final-magic-board article span {
  color: var(--coral);
}

.final-magic-board article p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.future-kids {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.future-kids b {
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mint), var(--blue));
  color: #fff;
}

.rules {
  display: grid;
  gap: 12px;
  max-width: 620px;
}

.rules article {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 900;
}

.rules strong {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}

.certificate {
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 215, 106, 0.45), rgba(123, 216, 184, 0.32)),
    #fff;
}

.certificate p {
  margin: 0;
  color: var(--coral);
  font-weight: 900;
}

.certificate strong {
  font-size: clamp(32px, 4vw, 52px);
}

.certificate span {
  color: var(--muted);
  font-weight: 800;
}

.badge-gift {
  margin-top: 10px;
  display: grid;
  place-items: center;
  gap: 8px;
}

.badge-gift b {
  width: 92px;
  height: 92px;
  display: block;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #fff 0 22%, transparent 23%),
    conic-gradient(from 30deg, var(--yellow), var(--coral), var(--mint), var(--blue), var(--yellow));
  box-shadow: 0 12px 24px rgba(31, 47, 76, 0.18);
}

.badge-gift em {
  font-style: normal;
  color: var(--coral);
  font-weight: 900;
}

.controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.94);
}

.progress-wrap {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.progress-wrap p {
  margin: 0;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(37, 48, 71, 0.12);
}

.progress-track span {
  display: block;
  width: 12.5%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--mint), var(--yellow));
  transition: width 220ms ease;
}

.is-listening {
  background: var(--blue);
  color: #fff;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 18px, 760px);
    margin: 9px auto;
  }

  .topbar,
  .controls {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .lesson-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .slide,
  .slide.is-active {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .stage {
    min-height: auto;
  }

  .idea-grid {
    grid-template-columns: 1fr;
  }

  .magic-world,
  .mascot-stage {
    min-height: 280px;
  }

  .mascot {
    width: 88px;
    height: 118px;
  }

  .story-card,
  .prompt-card,
  .detective-card {
    min-height: 260px;
    font-size: 19px;
  }

  .detective-slide .detective-card {
    grid-template-columns: 1fr;
  }

  .game-slide {
    grid-template-columns: 1fr;
  }

  .game-stage {
    grid-template-columns: 1fr;
  }

  .game-lili {
    order: -1;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .lesson-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .word-inputs,
  .prompt-builder,
  .compact-inputs,
  .prompt-builder.compact-inputs,
  .scene-picker,
  .badge-row {
    grid-template-columns: 1fr;
  }

  .mic {
    width: 100%;
  }

  .classroom-scene {
    height: 280px;
  }

  .cat-mini:nth-of-type(4) {
    left: 118px;
  }

  .cat-mini:nth-of-type(5) {
    left: 188px;
  }

  .cat-mini:nth-of-type(6) {
    left: 258px;
  }
}
