:root {
  --ink: #183042;
  --muted: #5e6f78;
  --paper: #fffaf0;
  --sun: #ffd166;
  --leaf: #37b26c;
  --sky: #4dabf7;
  --berry: #ef476f;
  --grape: #6c63ff;
  --line: #1f3b4d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 209, 102, 0.55), transparent 22rem),
    radial-gradient(circle at 82% 8%, rgba(77, 171, 247, 0.32), transparent 20rem),
    linear-gradient(135deg, #fff7d6 0%, #e8fbff 45%, #f6f1ff 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: center;
  min-height: 230px;
  overflow: hidden;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(3.6rem, 10vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow: 4px 4px 0 rgba(255, 209, 102, 0.75);
}

.eyebrow,
.label {
  margin: 0 0 10px;
  color: #2a7f62;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.8;
}

.number-orbit {
  position: relative;
  height: 230px;
  border: 4px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 9px 9px 0 rgba(24, 48, 66, 0.13);
  animation: floaty 5s ease-in-out infinite;
}

.number-orbit span {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  font-size: 1.5rem;
  font-weight: 900;
  transform: rotate(calc(var(--i) * 60deg)) translate(92px) rotate(calc(var(--i) * -60deg));
}

.lesson-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.tab,
.story-button,
.term-card {
  cursor: pointer;
  border: 3px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 4px 4px 0 rgba(24, 48, 66, 0.2);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.tab {
  min-height: 54px;
  border-radius: 16px;
  font-weight: 900;
}

.tab:hover,
.story-button:hover,
.term-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(24, 48, 66, 0.18);
}

.tab.active,
.story-button.active,
.term-card.active {
  background: var(--sun);
}

.lesson {
  display: none;
  border: 4px solid var(--line);
  border-radius: 28px;
  padding: clamp(18px, 4vw, 34px);
  background: rgba(255, 250, 240, 0.86);
  box-shadow: 12px 12px 0 rgba(24, 48, 66, 0.12);
}

.lesson.active {
  display: block;
  animation: popIn 280ms ease both;
}

.lesson-text {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.lesson-text h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0;
}

.lesson-text p {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 3px dashed rgba(31, 59, 77, 0.35);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.56);
  font-weight: 900;
}

.controls input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--berry);
}

.controls strong {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--sky);
  color: #fff;
  font-size: 1.35rem;
}

.math-stage {
  display: grid;
  gap: 18px;
  align-items: center;
  min-height: 260px;
}

.addition-stage {
  grid-template-columns: 1fr auto 1fr auto 160px;
}

.basket {
  display: flex;
  min-height: 210px;
  flex-wrap: wrap;
  gap: 12px;
  align-content: center;
  justify-content: center;
  border: 4px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(#ffffff 0 64%, #e6b16a 64% 100%);
}

.item {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--berry);
  color: #fff;
  box-shadow: 2px 4px 0 rgba(24, 48, 66, 0.18);
  animation: drop 260ms ease both;
}

.item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 10px 2px 10px 2px;
  background: #62c370;
  transform: translate(10px, -18px) rotate(-20deg);
}

.operator {
  font-size: 3rem;
  font-weight: 900;
}

.result-cloud {
  display: grid;
  min-height: 130px;
  place-items: center;
  border: 4px solid var(--line);
  border-radius: 42px;
  background: #fff;
  color: var(--berry);
  font-size: 4rem;
  font-weight: 900;
}

.sentence {
  margin: 18px 0 0;
  border-left: 8px solid var(--leaf);
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(55, 178, 108, 0.13);
  font-size: 1.16rem;
  font-weight: 800;
  line-height: 1.6;
}

.subtraction-stage {
  grid-template-columns: minmax(0, 1fr) 220px;
}

.ten-frame {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  min-height: 250px;
  border: 4px solid var(--line);
  border-radius: 26px;
  padding: 18px;
  background: #fff;
}

.counter {
  display: grid;
  min-height: 78px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--sky);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
}

.counter.removed {
  background: repeating-linear-gradient(45deg, #ffe5ec 0 8px, #fff 8px 16px);
  color: var(--berry);
  text-decoration: line-through;
  animation: fadeAway 380ms ease both;
}

.result-panel {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 4px solid var(--line);
  border-radius: 28px;
  background: var(--sun);
  font-weight: 900;
}

.result-panel span {
  font-size: 1.2rem;
}

.result-panel strong {
  font-size: 5rem;
  line-height: 1;
}

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

.term-card {
  display: grid;
  gap: 6px;
  min-height: 96px;
  border-radius: 18px;
  padding: 12px;
  text-align: left;
}

.term-card span {
  font-size: 1.25rem;
  font-weight: 900;
}

.term-card strong {
  color: var(--muted);
}

.concept-spotlight {
  display: grid;
  gap: 18px;
  justify-items: center;
  border: 4px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  background: #fff;
}

.formula {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.4rem, 8vw, 5.2rem);
  font-weight: 900;
}

.formula span {
  display: grid;
  min-width: 70px;
  min-height: 70px;
  place-items: center;
}

.formula .highlight {
  border: 4px solid var(--line);
  border-radius: 22px;
  background: var(--sun);
  animation: pulse 1.3s ease-in-out infinite;
}

.concept-spotlight p {
  margin: 0;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.7;
}

.story-switch {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.story-button {
  min-height: 48px;
  border-radius: 15px;
  padding: 0 18px;
  font-weight: 900;
}

.story-scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.pond {
  display: flex;
  min-height: 270px;
  flex-wrap: wrap;
  gap: 14px;
  align-content: center;
  justify-content: center;
  border: 4px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.15)),
    repeating-linear-gradient(-8deg, #b9fbc0 0 18px, #98f5e1 18px 36px);
}

.bug {
  position: relative;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--berry);
  color: #fff;
  font-weight: 900;
  animation: wiggle 1.4s ease-in-out infinite;
}

.bug.new {
  background: var(--grape);
  animation: flyIn 520ms ease both, wiggle 1.4s ease-in-out 520ms infinite;
}

.bug.gone {
  opacity: 0.32;
  filter: grayscale(1);
  transform: translateY(18px) rotate(18deg);
}

.story-card {
  display: grid;
  align-content: center;
  gap: 20px;
  border: 4px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  background: #fff;
}

.story-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.8;
}

.answer-line {
  display: grid;
  min-height: 84px;
  place-items: center;
  border-radius: 22px;
  background: var(--sun);
  font-size: 2.2rem;
  font-weight: 900;
}

.practice-topline {
  display: grid;
  grid-template-columns: 130px 130px minmax(160px, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.score-card,
.next-question {
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 4px 4px 0 rgba(24, 48, 66, 0.18);
}

.score-card {
  display: grid;
  min-height: 80px;
  place-items: center;
  padding: 8px;
  font-weight: 900;
}

.score-card span {
  color: var(--muted);
  font-size: 0.95rem;
}

.score-card strong {
  color: var(--berry);
  font-size: 2rem;
  line-height: 1;
}

.next-question {
  cursor: pointer;
  min-height: 80px;
  background: var(--leaf);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.next-question:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(24, 48, 66, 0.18);
}

.practice-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: stretch;
}

.practice-visual {
  display: flex;
  min-height: 330px;
  flex-wrap: wrap;
  gap: 14px;
  align-content: center;
  justify-content: center;
  border: 4px solid var(--line);
  border-radius: 30px;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.45)),
    repeating-linear-gradient(12deg, #dff7ff 0 18px, #fff4c7 18px 36px);
}

.practice-visual .group-break {
  flex-basis: 100%;
  height: 0;
}

.practice-dot {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--sun);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 3px 5px 0 rgba(24, 48, 66, 0.16);
  animation: drop 260ms ease both;
}

.practice-dot.second {
  background: var(--sky);
  color: #fff;
}

.practice-dot.removed {
  background: repeating-linear-gradient(45deg, #ffe5ec 0 8px, #fff 8px 16px);
  color: var(--berry);
  text-decoration: line-through;
  transform: scale(0.92);
}

.practice-card {
  display: grid;
  align-content: center;
  gap: 18px;
  border: 4px solid var(--line);
  border-radius: 30px;
  padding: 22px;
  background: #fff;
}

.practice-type {
  width: fit-content;
  margin: 0;
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--sun);
  font-weight: 900;
}

.practice-card h3 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.35;
  letter-spacing: 0;
}

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

.answer-choice {
  cursor: pointer;
  min-height: 70px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: rgba(77, 171, 247, 0.16);
  color: var(--ink);
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: 4px 4px 0 rgba(24, 48, 66, 0.16);
  transition: transform 150ms ease, background 150ms ease;
}

.answer-choice:hover:not(:disabled) {
  transform: translateY(-3px);
}

.answer-choice.correct {
  background: var(--leaf);
  color: #fff;
  animation: pulse 650ms ease;
}

.answer-choice.wrong {
  background: var(--berry);
  color: #fff;
}

.answer-choice:disabled {
  cursor: default;
}

.practice-feedback {
  min-height: 58px;
  margin: 0;
  border-left: 8px solid var(--sky);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(77, 171, 247, 0.12);
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.65;
}

.practice-feedback.good {
  border-left-color: var(--leaf);
  background: rgba(55, 178, 108, 0.14);
  color: #22734f;
}

.practice-feedback.try {
  border-left-color: var(--berry);
  background: rgba(239, 71, 111, 0.12);
  color: #a5314e;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

@keyframes floaty {
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-18px) scale(0.85);
  }
}

@keyframes fadeAway {
  from {
    transform: scale(1.05);
  }
}

@keyframes pulse {
  50% {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 rgba(24, 48, 66, 0.12);
  }
}

@keyframes wiggle {
  50% {
    transform: translateY(-4px) rotate(-4deg);
  }
}

@keyframes flyIn {
  from {
    opacity: 0;
    transform: translate(44px, -50px) rotate(28deg) scale(0.7);
  }
}

@media (max-width: 820px) {
  .hero,
  .addition-stage,
  .subtraction-stage,
  .story-scene,
  .practice-zone {
    grid-template-columns: 1fr;
  }

  .number-orbit {
    display: none;
  }

  .lesson-tabs,
  .controls,
  .term-board,
  .practice-topline {
    grid-template-columns: repeat(2, 1fr);
  }

  .next-question {
    grid-column: 1 / -1;
  }

  .operator {
    text-align: center;
  }

  .ten-frame {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 520px) {
  .lesson-tabs,
  .controls,
  .term-board,
  .practice-topline,
  .answer-grid {
    grid-template-columns: 1fr;
  }

  .lesson {
    border-radius: 20px;
  }

  .formula span {
    min-width: 52px;
    min-height: 52px;
  }
}
