:root {
  color-scheme: light;
  --ink: #21313c;
  --muted: #65727d;
  --paper: #fffdfa;
  --line: #dbe5e5;
  --green: #2f9b72;
  --blue: #3b82c4;
  --coral: #e76f51;
  --yellow: #f4c542;
  --mint: #d9f2e7;
  --sky: #dfeefa;
  --peach: #ffe1d5;
  --shadow: 0 18px 48px rgba(33, 49, 60, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(244, 197, 66, 0.26), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(47, 155, 114, 0.2), transparent 30%),
    linear-gradient(135deg, #f9f7ef 0%, #edf7f4 54%, #f8f0ec 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.topbar,
.lesson-panel,
.view,
.tabs,
.feedback,
.progress-note {
  border: 1px solid rgba(219, 229, 229, 0.9);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(255, 253, 250, 0.88);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--green);
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
}

h2 {
  font-size: 1.35rem;
}

.icon-button,
.speak-card,
.choice-card,
.letter-button,
.math-answer,
.primary-button,
.secondary-button,
.tab,
.stage-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.icon-button {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  font-size: 1.6rem;
  background: var(--blue);
  color: white;
  box-shadow: 0 10px 24px rgba(59, 130, 196, 0.28);
}

.voice-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  border: 2px solid transparent;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.voice-picker-button.female {
  background: var(--coral);
  box-shadow: 0 8px 20px rgba(231, 111, 81, 0.22);
}

.voice-picker-button.male {
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(59, 130, 196, 0.22);
}

.voice-picker {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(33, 49, 60, 0.48);
}

.voice-picker[hidden] {
  display: none;
}

.voice-picker-panel {
  width: min(100%, 560px);
  padding: clamp(28px, 5vw, 42px);
  background: var(--paper);
  border: 1px solid rgba(219, 229, 229, 0.96);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(33, 49, 60, 0.28);
  text-align: center;
}

.voice-picker-panel h2 {
  font-size: clamp(1.65rem, 4vw, 2.2rem);
}

.voice-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.voice-option {
  display: grid;
  min-height: 178px;
  place-items: center;
  gap: 7px;
  padding: 18px 12px;
  border: 3px solid currentColor;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.voice-option:hover,
.voice-option:focus-visible,
.voice-picker-button:hover,
.voice-picker-button:focus-visible {
  transform: translateY(-2px);
}

.voice-option.selected {
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px rgba(33, 49, 60, 0.1), 0 14px 28px rgba(33, 49, 60, 0.18);
}

.voice-option.female {
  color: var(--coral);
  background: #fff0ec;
  box-shadow: 0 12px 24px rgba(231, 111, 81, 0.16);
}

.voice-option.male {
  color: var(--blue);
  background: #edf6fe;
  box-shadow: 0 12px 24px rgba(59, 130, 196, 0.16);
}

.voice-option-dot {
  font-size: 2.5rem;
  line-height: 1;
}

.voice-option strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.voice-option small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  background: rgba(255, 253, 250, 0.82);
  border-radius: 8px;
}

.tab {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
  padding: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  text-align: left;
}

.tab span {
  display: grid;
  grid-row: 1 / 3;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--mint);
  font-size: 0.86rem;
  font-weight: 950;
}

.tab strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.1;
}

.tab small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
}

.tab.active {
  color: white;
  background: var(--green);
}

.tab.active span {
  color: var(--green);
  background: white;
}

.tab.active strong,
.tab.active small {
  color: white;
}

.view {
  display: none;
  padding: 18px;
  background: rgba(255, 253, 250, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.view.active {
  display: block;
}

.lesson-panel {
  padding: 18px;
  border-radius: 8px;
  background: var(--paper);
}

.lesson-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  color: var(--muted);
}

.progress-track {
  height: 12px;
  margin: 14px 0 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 0.25s ease;
}

.stage-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.round-size-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -6px 0 16px;
  color: var(--muted);
  font-weight: 900;
}

.round-size-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.round-size-button.active {
  border-color: var(--green);
  background: var(--mint);
  color: #1f6a52;
}

#mathView .lesson-panel {
  padding: 16px;
}

#mathView .section-heading {
  margin-bottom: 8px;
}

#mathView .section-heading .eyebrow {
  margin-bottom: 2px;
}

#mathView .section-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

#mathView .lesson-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  margin-bottom: 8px;
  text-align: center;
}

#mathView .lesson-status span:first-child {
  text-align: left;
}

#mathView .lesson-status span:last-child {
  text-align: right;
}

#mathView .round-size-switch {
  margin: 0 0 10px;
}

#mathView .progress-track {
  margin: 8px 0 12px;
}

.stage-button {
  display: grid;
  gap: 2px;
  padding: 12px;
  text-align: left;
  color: var(--muted);
  border: 1px solid var(--line);
  background: white;
}

.stage-button span {
  font-size: 0.78rem;
  font-weight: 800;
}

.stage-button strong {
  color: var(--ink);
  font-size: 1rem;
}

.stage-button.active {
  border-color: var(--green);
  background: var(--mint);
}

.prompt-area {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 8px 0 20px;
  text-align: center;
}

.prompt-kicker,
.hint {
  margin: 0;
  color: var(--muted);
}

.speak-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(100%, 420px);
  padding: 18px;
  color: white;
  background: var(--blue);
  box-shadow: 0 14px 28px rgba(59, 130, 196, 0.26);
}

.speaker-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: white;
}

#spokenWord {
  font-size: 2rem;
  font-weight: 900;
}

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

.choice-grid.spelling-mode {
  grid-template-columns: 1fr;
}

.choice-card {
  display: grid;
  min-height: 152px;
  padding: 14px;
  place-items: center;
  border: 2px solid var(--line);
  background: #ffffff;
}

.choice-card:hover,
.choice-card:focus-visible,
.letter-button:hover,
.letter-button:focus-visible,
.speak-card:hover,
.speak-card:focus-visible,
.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.tab:hover,
.stage-button:hover {
  transform: translateY(-2px);
}

.choice-card.correct {
  border-color: var(--green);
  background: var(--mint);
}

.choice-card.wrong {
  border-color: var(--coral);
  background: var(--peach);
}

.visual {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 24px;
  font-size: 3.4rem;
  background: var(--sky);
}

.image-visual {
  overflow: hidden;
  background: #fffaf1;
}

.word-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.desk-visual {
  background: #eaf6ff;
}

.table-visual {
  background: #fff2de;
}

.desk-icon {
  width: 72px;
  height: 72px;
  overflow: visible;
}

.table-icon {
  width: 74px;
  height: 74px;
  overflow: visible;
}

.desk-board {
  fill: #d99a56;
  stroke: #7b4f2f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.desk-front {
  fill: #b97739;
  stroke: #7b4f2f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.desk-line,
.desk-leg-svg,
.desk-foot {
  fill: none;
  stroke: #6f4429;
  stroke-width: 6;
  stroke-linecap: round;
}

.desk-shadow {
  fill: rgba(55, 76, 91, 0.14);
}

.table-top {
  fill: #d99a56;
  stroke: #7b4f2f;
  stroke-width: 4;
}

.table-edge,
.table-leg {
  fill: none;
  stroke: #704126;
  stroke-width: 6;
  stroke-linecap: round;
}

.table-shadow {
  fill: rgba(55, 76, 91, 0.14);
}

.choice-name {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  text-align: center;
  font-weight: 900;
}

.choice-name small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.spell-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  min-height: 280px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.repeat-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  min-height: 300px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.spell-card .visual {
  width: 104px;
  height: 104px;
  font-size: 4rem;
}

.repeat-card .visual {
  width: 112px;
  height: 112px;
  font-size: 4.2rem;
}

.repeat-target {
  font-size: clamp(1.65rem, 7vw, 3rem);
  font-weight: 950;
  line-height: 1.15;
}

.repeat-meaning,
.repeat-result {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.mic-button {
  min-height: 58px;
  padding: 12px 20px;
}

.mic-button.listening {
  color: white;
  background: var(--blue);
}

.spell-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.letter-slot {
  display: grid;
  width: 42px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: var(--sky);
  font-size: 1.55rem;
  font-weight: 950;
}

.letter-slot.blank {
  border: 2px dashed var(--blue);
  background: #ffffff;
}

.letter-bank {
  display: grid;
  width: min(100%, 520px);
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.letter-button {
  display: grid;
  min-height: 54px;
  place-items: center;
  color: var(--ink);
  border: 2px solid var(--line);
  background: #ffffff;
  font-size: 1.35rem;
  font-weight: 950;
}

.letter-button.correct {
  border-color: var(--green);
  background: var(--mint);
}

.letter-button.wrong {
  border-color: var(--coral);
  background: var(--peach);
}

.math-card {
  display: grid;
  width: 100%;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  border: 2px solid #cfe0e2;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fdff 0%, #ffffff 72%);
  text-align: center;
}

.pinyin-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

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

.pinyin-speak {
  background: var(--green);
  box-shadow: 0 14px 28px rgba(47, 155, 114, 0.24);
}

.pinyin-choice-grid {
  display: grid;
  width: min(100%, 620px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pinyin-option {
  min-height: 68px;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 1.55rem;
  font-weight: 950;
}

.pinyin-option:hover,
.pinyin-option:focus-visible {
  transform: translateY(-2px);
}

.pinyin-option.correct {
  border-color: var(--green);
  background: var(--mint);
}

.pinyin-option.wrong {
  border-color: var(--coral);
  background: var(--peach);
}

.math-visual {
  display: block;
  width: 100%;
}

.math-game-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 0.72;
  border: 2px solid #c4dde6;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 16% 20%, rgba(255, 255, 255, 0.95) 0 28px, transparent 30px),
    radial-gradient(ellipse at 23% 18%, rgba(255, 255, 255, 0.85) 0 22px, transparent 24px),
    radial-gradient(ellipse at 78% 26%, rgba(255, 255, 255, 0.9) 0 32px, transparent 34px),
    linear-gradient(180deg, #dff5ff 0%, #f6fcff 58%, #edf8e8 76%, #cce8bd 100%);
}

.math-sky {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  min-height: 66%;
  padding: 24px 28px 0;
}

.math-ground {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 25%;
  background:
    radial-gradient(ellipse at 16% 100%, rgba(74, 139, 85, 0.28) 0 58px, transparent 60px),
    radial-gradient(ellipse at 82% 105%, rgba(74, 139, 85, 0.22) 0 72px, transparent 74px),
    linear-gradient(180deg, rgba(216, 239, 201, 0.62) 0%, #bfe1aa 100%);
}

.math-bird {
  position: absolute;
  bottom: 2%;
  left: 50%;
  z-index: 2;
  width: clamp(105px, 24%, 135px);
  aspect-ratio: 1338 / 1117;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 9px rgba(27, 70, 94, 0.18));
  animation: birdBob 1.35s ease-in-out infinite;
}

.math-bird-art {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.math-cannon {
  width: clamp(82px, 17%, 118px);
  aspect-ratio: 296 / 430;
}

.math-cannon-art {
  filter: saturate(1.08) contrast(1.06);
}

.bird-body,
.bird-head,
.bird-wing,
.bird-tail,
.bird-eye,
.bird-beak,
.bird-foot,
.bird-bow {
  position: absolute;
}

.bird-body {
  left: 66px;
  bottom: 22px;
  width: 28px;
  height: 70px;
  border-radius: 55% 55% 45% 45%;
  background: linear-gradient(180deg, #1285d8 0%, #0d67b0 100%);
  box-shadow:
    inset 7px 2px 0 rgba(255, 255, 255, 0.16),
    inset -5px 0 0 rgba(9, 74, 135, 0.2);
}

.bird-head {
  left: 58px;
  bottom: 66px;
  width: 44px;
  height: 42px;
  border-radius: 52% 50% 48% 50%;
  background: linear-gradient(180deg, #158be0 0%, #0d70bd 100%);
  box-shadow: inset -5px 0 0 rgba(10, 84, 146, 0.18);
}

.bird-wing {
  right: 16px;
  bottom: 10px;
  width: 74px;
  height: 88px;
  border-radius: 8px 74px 18px 84px;
  background: linear-gradient(145deg, #1fa1e6 0%, #0b75c5 72%);
  transform: rotate(25deg);
  transform-origin: left bottom;
  box-shadow: inset 8px 0 0 rgba(255, 255, 255, 0.13);
}

.bird-tail {
  left: 4px;
  bottom: 12px;
  width: 74px;
  height: 88px;
  border-radius: 74px 8px 84px 18px;
  background: linear-gradient(215deg, #1fa1e6 0%, #0b75c5 74%);
  transform: rotate(-25deg);
  transform-origin: right bottom;
  box-shadow: inset -8px 0 0 rgba(255, 255, 255, 0.13);
}

.bird-eye {
  left: 68px;
  bottom: 78px;
  width: 13px;
  height: 15px;
  border-radius: 50%;
  background: #d9eef9;
  box-shadow:
    15px 0 0 #d9eef9,
    4px 5px 0 -3px #263845,
    19px 5px 0 -3px #263845;
}

.bird-beak {
  left: 96px;
  bottom: 74px;
  width: 32px;
  height: 20px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  background: linear-gradient(90deg, #f8dc47 0%, #f3c430 100%);
}

.bird-foot {
  bottom: 0;
  width: 28px;
  height: 16px;
  border: 6px solid #b96535;
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: transparent;
  transform-origin: right center;
}

.bird-foot.one {
  left: 57px;
  transform: rotate(9deg);
}

.bird-foot.two {
  left: 76px;
  transform: rotate(-9deg);
}

.bird-bow {
  right: 3px;
  bottom: 44px;
  width: 44px;
  height: 58px;
  border-right: 7px solid #5f6f78;
  border-radius: 0 44px 44px 0;
  transform: rotate(-18deg);
}

.bird-bow::after {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 38px;
  height: 32px;
  content: "";
  border-top: 7px solid #a9623d;
  border-radius: 50% 50% 0 0;
  transform: rotate(-16deg);
}

.bird-wing::before,
.bird-tail::before {
  position: absolute;
  width: 9px;
  height: 52px;
  content: "";
  border-radius: 999px;
  background: rgba(35, 54, 130, 0.72);
}

.bird-wing::before {
  right: 30px;
  bottom: 16px;
  transform: rotate(20deg);
  box-shadow: 19px -5px 0 rgba(35, 54, 130, 0.6);
}

.bird-tail::before {
  left: 26px;
  bottom: 16px;
  transform: rotate(-20deg);
  box-shadow: -18px -4px 0 rgba(35, 54, 130, 0.6);
}

.math-arrow {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 7;
  width: clamp(34px, 8%, 48px);
  aspect-ratio: 693 / 702;
  background: url("./assets/math-arrow-painted.png") center / contain no-repeat;
  opacity: 0;
  transform: translate(var(--arrow-start-x, 50%), var(--arrow-start-y, 75%)) rotate(var(--arrow-rotate, 0deg)) scale(0.82);
  transform-origin: center center;
  pointer-events: none;
}

.math-arrow.math-bullet-shot {
  width: clamp(30px, 6%, 42px);
  aspect-ratio: 240 / 202;
  background-image: url("./assets/math-bullet.png?v=20260708-cutout");
  filter: drop-shadow(0 4px 5px rgba(80, 54, 28, 0.2));
}

.math-bush {
  position: absolute;
  bottom: 16px;
  width: 68px;
  height: 24px;
  border-radius: 28px 28px 8px 8px;
  background: #6fb26f;
}

.math-bush::before,
.math-bush::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: #5a9f61;
}

.math-bush::before {
  left: 10px;
  top: -12px;
  width: 26px;
  height: 26px;
}

.math-bush::after {
  right: 8px;
  top: -8px;
  width: 22px;
  height: 22px;
}

.math-bush.one {
  left: 34px;
}

.math-bush.two {
  right: 44px;
  transform: scale(0.82);
  transform-origin: bottom center;
}

.math-arrow.shooting {
  animation: arrowShoot 0.48s ease-out;
}

.math-choice-grid {
  display: none;
}

.word-game-stage {
  width: 100%;
}

.word-game-scene {
  position: relative;
  isolation: isolate;
  min-height: clamp(400px, 58vw, 560px);
  overflow: hidden;
  border: 2px solid #c4dde6;
  border-radius: 8px;
  background-color: #54d332;
  background-image: url("./assets/english-shooter/background.png");
  background-position: 0% center;
  background-size: cover;
}

.word-game-scene.scene-1 {
  background-position: 33% center;
}

.word-game-scene.scene-2 {
  background-position: 66% center;
}

.word-game-scene.scene-3 {
  background-position: 100% center;
}

.word-game-ground {
  display: none;
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 22%;
  background:
    radial-gradient(ellipse at 18% 100%, rgba(75, 141, 86, 0.27) 0 58px, transparent 60px),
    radial-gradient(ellipse at 88% 100%, rgba(75, 141, 86, 0.23) 0 72px, transparent 74px),
    linear-gradient(180deg, rgba(219, 240, 205, 0.65), #b9dc9d);
}

.word-game-cloud {
  display: none;
  position: absolute;
  z-index: 1;
  width: 86px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.word-game-cloud::before,
.word-game-cloud::after {
  position: absolute;
  bottom: 7px;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.word-game-cloud::before {
  left: 20px;
  width: 30px;
  height: 30px;
}

.word-game-cloud::after {
  left: 43px;
  width: 25px;
  height: 25px;
}

.cloud-one {
  top: 14%;
  left: 7%;
}

.cloud-two {
  top: 27%;
  right: 10%;
  transform: scale(0.72);
}

.word-game-answer-zone {
  position: absolute;
  z-index: 6;
  top: 27%;
  left: 50%;
  display: grid;
  width: min(44%, 420px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.5vw, 14px);
  transform: translateX(-50%);
}

.word-game-option {
  display: grid;
  min-width: 0;
  min-height: 164px;
  place-items: center;
  gap: 7px;
  padding: 10px 6px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 253, 250, 0.96);
  box-shadow: 0 10px 22px rgba(39, 75, 99, 0.15);
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.25s ease, box-shadow 0.18s ease;
}

.word-game-option:hover,
.word-game-option:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(39, 75, 99, 0.22);
}

.word-game-option .visual {
  width: clamp(58px, 7vw, 78px);
  height: clamp(58px, 7vw, 78px);
}

.word-game-option-text {
  display: grid;
  gap: 2px;
  min-height: 24px;
  text-align: center;
}

.word-game-option-text strong {
  font-size: clamp(0.88rem, 1.6vw, 1.05rem);
  line-height: 1.05;
}

.word-game-option-text span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.word-game-option.wrong {
  border-color: var(--coral);
  background: var(--peach);
  opacity: 0.72;
}

.word-game-option.fade-out {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88);
}

.word-game-monster-zone {
  position: absolute;
  z-index: 4;
  top: 12%;
  right: 3%;
  display: flex;
  align-items: end;
  justify-content: end;
  gap: clamp(2px, 1vw, 12px);
  width: 28%;
  min-height: 45%;
}

.word-game-monster {
  position: relative;
  width: min(100%, 132px);
  transform-origin: bottom center;
  transition: opacity 0.22s ease, transform 0.42s ease;
  animation: wordGameMonsterBob 1.45s ease-in-out infinite;
}

.word-game-monster:nth-child(2) {
  margin-bottom: 30px;
  animation-delay: -0.36s;
}

.word-game-monster:nth-child(3) {
  margin-bottom: 8px;
  animation-delay: -0.72s;
}

.word-game-monster img {
  display: block;
  width: 100%;
  height: 158px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(35, 54, 69, 0.2));
}

.word-game-monster.boss {
  width: min(100%, 274px);
}

.word-game-monster.boss img {
  height: 360px;
  border-radius: 8px;
}

.word-game-scene.boss-battle .word-game-monster-zone {
  top: 15%;
  min-height: 56%;
}

.word-game-monster.boss.attacking {
  animation: wordGameBossAttack 0.75s ease-in-out both;
}

.word-game-monster.boss.hit {
  animation: wordGameBossHit 0.58s ease-out both;
}

.word-game-monster.charging {
  z-index: 10;
  animation: wordGameMonsterCharge 1.05s ease-in-out forwards;
}

.word-game-monster.defeated {
  opacity: 0;
  transform: translateY(-22px) scale(0.48) rotate(12deg);
}

.word-game-bird {
  position: absolute;
  z-index: 5;
  bottom: 3%;
  left: 7%;
  width: clamp(116px, 19%, 168px);
  filter: drop-shadow(0 8px 9px rgba(27, 70, 94, 0.18));
  animation: wordGameBirdBob 1.35s ease-in-out infinite;
}

.word-game-bird img {
  display: block;
  width: 100%;
  height: auto;
}

.word-game-scene.advance .word-game-bird {
  animation: wordGameBirdAdvance 0.7s ease-in forwards;
}

.word-game-arrows {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

.word-game-arrow {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(32px, 5%, 46px);
  aspect-ratio: 1 / 1.35;
  opacity: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  transform: translate(calc(var(--word-arrow-start-x, 0px) - 50%), calc(var(--word-arrow-start-y, 0px) - 50%)) rotate(var(--word-arrow-rotate, 0deg)) scale(0.78);
  transform-origin: center;
}

.word-game-arrow.shooting {
  animation: wordGameArrowShoot 0.48s ease-out forwards;
}

.word-game-arrow.boss-shot {
  width: clamp(38px, 6%, 56px);
}

.word-game-enemy-bullets {
  position: absolute;
  z-index: 11;
  inset: 0;
  pointer-events: none;
}

.word-game-enemy-bullet {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(27px, 4%, 40px);
  aspect-ratio: 1 / 1.45;
  opacity: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 4px 5px rgba(80, 54, 28, 0.22));
  transform: translate(calc(var(--enemy-bullet-start-x, 0px) - 50%), calc(var(--enemy-bullet-start-y, 0px) - 50%)) rotate(var(--enemy-bullet-rotate, 0deg)) scale(0.85);
  transform-origin: center;
}

.word-game-enemy-bullet.shooting {
  animation: wordGameEnemyBulletShoot 0.48s ease-in forwards;
}

.word-game-enemy-bullet.boss-bullet {
  width: clamp(42px, 7%, 66px);
  aspect-ratio: 1;
}

.word-game-enemy-bullet.boss-bullet.shooting {
  animation: wordGameBossBulletShoot 0.62s ease-in forwards;
}

.word-game-boss-health {
  position: absolute;
  z-index: 9;
  top: -20%;
  left: 50%;
  display: grid;
  width: 118%;
  aspect-ratio: 734 / 321;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  filter: drop-shadow(0 5px 8px rgba(33, 49, 60, 0.24));
  transform: translateX(-50%);
}

.word-game-boss-health span {
  background-image: url("./assets/english-shooter/boss-health.png");
  background-repeat: no-repeat;
  background-size: 500% 100%;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.word-game-boss-health span:nth-child(1) { background-position: 0% center; }
.word-game-boss-health span:nth-child(2) { background-position: 25% center; }
.word-game-boss-health span:nth-child(3) { background-position: 50% center; }
.word-game-boss-health span:nth-child(4) { background-position: 75% center; }
.word-game-boss-health span:nth-child(5) { background-position: 100% center; }

.word-game-boss-health span.active {
  opacity: 1;
}

.word-game-boss-health span.lost {
  opacity: 0;
  transform: translateY(-5px) scale(0.85);
}

.word-game-bird.hit {
  animation: wordGameBirdHit 0.48s ease-out both;
}

.word-game-center-panel {
  position: absolute;
  z-index: 12;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(82%, 410px);
  gap: 11px;
  place-items: center;
  padding: 24px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: 0 16px 36px rgba(33, 49, 60, 0.2);
  text-align: center;
  transform: translate(-50%, -50%);
}

.word-game-center-panel strong {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.word-game-center-panel span {
  color: var(--muted);
  font-weight: 800;
}

.word-game-center-button {
  width: min(100%, 240px);
}

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

@keyframes wordGameMonsterCharge {
  0%, 100% { transform: translate(0, 0) scale(1); }
  42%, 56% { transform: translate(var(--word-attack-x, -360px), var(--word-attack-y, 80px)) scale(1.12); }
  48% { filter: brightness(1.18) saturate(1.2); }
}

@keyframes wordGameEnemyBulletShoot {
  0% {
    opacity: 0;
    transform: translate(calc(var(--enemy-bullet-start-x, 0px) - 50%), calc(var(--enemy-bullet-start-y, 0px) - 50%)) rotate(var(--enemy-bullet-rotate, 0deg)) scale(0.7);
  }
  10% { opacity: 1; }
  82% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(var(--enemy-bullet-end-x, 0px) - 50%), calc(var(--enemy-bullet-end-y, 0px) - 50%)) rotate(var(--enemy-bullet-rotate, 0deg)) scale(1.05);
  }
}

@keyframes wordGameBossBulletShoot {
  0% {
    opacity: 0;
    transform: translate(calc(var(--enemy-bullet-start-x, 0px) - 50%), calc(var(--enemy-bullet-start-y, 0px) - 50%)) rotate(0deg) scale(0.55);
  }
  12% { opacity: 1; }
  84% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(var(--enemy-bullet-end-x, 0px) - 50%), calc(var(--enemy-bullet-end-y, 0px) - 50%)) rotate(720deg) scale(1.08);
  }
}

@keyframes wordGameBossAttack {
  0% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(-12deg) scale(1.08); }
  72% { transform: rotate(12deg) scale(1.08); }
  100% { transform: rotate(0deg) scale(1); }
}

@keyframes wordGameBossHit {
  0% { transform: translateX(0) scale(1); filter: brightness(1); }
  28% { transform: translateX(12px) scale(0.94); filter: brightness(1.55); }
  54% { transform: translateX(-9px) scale(0.98); }
  100% { transform: translateX(0) scale(1); filter: brightness(1); }
}

@keyframes wordGameBirdHit {
  0% { transform: translateX(0) rotate(0); }
  24% { transform: translateX(-15px) rotate(-9deg); }
  52% { transform: translateX(8px) rotate(5deg); }
  100% { transform: translateX(0) rotate(0); }
}

@keyframes wordGameMonsterAttack {
  0% { transform: translateX(0) scale(1); }
  72% { transform: translateX(-80px) scale(1.1); }
  100% { transform: translateX(0) scale(1); }
}

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

@keyframes wordGameBirdAdvance {
  0% { transform: translate(0, 0); }
  100% { transform: translate(78px, -10px); }
}

@keyframes wordGameArrowShoot {
  0% {
    opacity: 1;
    transform: translate(calc(var(--word-arrow-start-x) - 50%), calc(var(--word-arrow-start-y) - 50%)) rotate(var(--word-arrow-rotate)) scale(0.78);
  }
  84% {
    opacity: 1;
    transform: translate(calc(var(--word-arrow-end-x) - 50%), calc(var(--word-arrow-end-y) - 50%)) rotate(var(--word-arrow-rotate)) scale(0.92);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--word-arrow-end-x) - 50%), calc(var(--word-arrow-end-y) - 50%)) rotate(var(--word-arrow-rotate)) scale(1.04);
  }
}

.dot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
}

.dot-row.subtle {
  opacity: 0.42;
}

.number-dot {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.number-dot.take-away {
  background: var(--coral);
}

.math-problem {
  font-size: clamp(2.3rem, 9vw, 4.8rem);
  font-weight: 950;
  line-height: 1;
}

.math-start-button {
  width: min(100%, 240px);
  margin: 4px auto 0;
}

.math-answer {
  position: relative;
  min-height: 78px;
  color: #263845;
  border: 2px solid rgba(38, 56, 69, 0.18);
  background: linear-gradient(145deg, #ffe388 0%, #f7b84e 74%);
  font-size: 1.85rem;
  font-weight: 950;
  box-shadow: inset -10px -14px 0 rgba(137, 75, 30, 0.14), 0 14px 20px rgba(61, 90, 110, 0.18);
}

.math-balloon {
  width: 100%;
  max-width: 96px;
  justify-self: center;
  border-radius: 52% 52% 48% 48%;
  clip-path: none;
  animation: balloonFloat var(--drift, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.math-balloon::before {
  position: absolute;
  top: 16px;
  left: 18px;
  width: 18px;
  height: 26px;
  content: "";
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  transform: rotate(22deg);
}

.math-balloon::after {
  position: absolute;
  right: 50%;
  bottom: -28px;
  width: 2px;
  height: 28px;
  content: "";
  background: rgba(68, 84, 96, 0.35);
}

.math-balloon:nth-child(2) {
  background: linear-gradient(145deg, #a9e2ff 0%, #54a8d7 76%);
}

.math-balloon:nth-child(3) {
  background: linear-gradient(145deg, #ffc2d0 0%, #f06d91 78%);
}

.math-balloon:nth-child(4) {
  background: linear-gradient(145deg, #b9efad 0%, #62b96a 76%);
}

.math-enemy {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 128px;
  min-height: 126px;
  place-items: center;
  justify-self: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  animation: enemyFloat var(--drift, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.math-enemy-art {
  grid-area: 1 / 1;
  max-width: 116px;
  max-height: 108px;
  object-fit: contain;
  filter: drop-shadow(0 10px 8px rgba(38, 56, 69, 0.16));
  pointer-events: none;
  user-select: none;
}

.math-enemy-label {
  position: absolute;
  top: 0;
  right: 2px;
  z-index: 2;
  display: grid;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  color: white;
  background: rgba(38, 56, 69, 0.88);
  font-size: 1.55rem;
  font-weight: 950;
  box-shadow: 0 8px 14px rgba(38, 56, 69, 0.16);
  transform: translate(18%, -12%);
}

.math-game-stage.advanced {
  min-height: 0;
}

.math-answer:hover,
.math-answer:focus-visible {
  transform: translateY(-4px);
}

.math-answer.targeted {
  outline: 4px solid rgba(244, 197, 66, 0.72);
  outline-offset: 3px;
}

.math-answer.wrong {
  color: #46535c;
  border-color: rgba(231, 111, 81, 0.45);
  background: #d8e0e7;
  animation: balloonWrong 0.34s ease-in-out;
}

.math-answer.pop {
  color: transparent;
  background: transparent;
  box-shadow: none;
  animation: balloonPop 0.42s ease-out forwards;
}

.math-answer.pop::before {
  position: absolute;
  inset: -8px;
  content: "";
  border: 4px dashed #e76f51;
  transform: rotate(18deg);
}

.math-enemy.pop .math-enemy-art,
.math-enemy.pop .math-enemy-label {
  opacity: 0;
}

.math-center-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 9;
  display: grid;
  width: min(86%, 460px);
  gap: 12px;
  padding: 22px;
  border: 2px solid #c4dde6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 900;
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 18px 38px rgba(38, 56, 69, 0.12);
}

.math-center-panel strong {
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  line-height: 1;
}

.math-center-panel span {
  color: var(--muted);
}

.math-center-button {
  width: min(100%, 260px);
  margin: 0 auto;
}

.math-pause-panel strong {
  font-size: clamp(2rem, 6vw, 3.2rem);
}

#mathTimerLabel.urgent {
  color: var(--coral);
  animation: timerPulse 0.52s ease-in-out infinite;
}

.feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f7fbfa;
  color: var(--muted);
  font-weight: 800;
}

.score-badge {
  width: min(100%, 340px);
  margin: 14px auto 0;
  padding: 12px 16px;
  border: 2px solid var(--yellow);
  border-radius: 8px;
  background: #fff8d8;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 950;
  text-align: center;
  box-shadow: 0 10px 24px rgba(244, 197, 66, 0.2);
}

.firework-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}

.firework {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  animation: firework-pop 900ms ease-out forwards;
}

.firework::before,
.firework::after {
  position: absolute;
  inset: -16px;
  content: "";
  border-radius: 50%;
  border: 5px dotted var(--c);
}

.firework::after {
  inset: -28px;
  transform: rotate(25deg);
  opacity: 0.75;
}

@keyframes firework-pop {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: scale(3.8);
    opacity: 0;
  }
}

@keyframes balloonFloat {
  0%,
  100% {
    transform: translateX(0) translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateX(var(--xwiggle, 18px)) translateY(14px) rotate(3deg);
  }
}

@keyframes enemyFloat {
  0%,
  100% {
    transform: translateX(0) translateY(var(--enemy-lift, 0)) rotate(-2deg);
  }
  50% {
    transform: translateX(var(--xwiggle, 18px)) translateY(calc(var(--enemy-lift, 0) + 12px)) rotate(3deg);
  }
}

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

@keyframes balloonPop {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  70% {
    opacity: 1;
    transform: scale(1.38);
  }
  100% {
    opacity: 0;
    transform: scale(0.2);
  }
}

@keyframes arrowShoot {
  0% {
    opacity: 1;
    transform: translate(var(--arrow-start-x, 0), var(--arrow-start-y, 0)) rotate(var(--arrow-rotate, 0deg)) scale(0.78);
  }
  78% {
    opacity: 1;
    transform: translate(var(--arrow-end-x, 0), var(--arrow-end-y, -180px)) rotate(var(--arrow-rotate, 0deg)) scale(0.78);
  }
  100% {
    opacity: 0;
    transform: translate(var(--arrow-end-x, 0), var(--arrow-end-y, -180px)) rotate(var(--arrow-rotate, 0deg)) scale(0.78);
  }
}

@keyframes birdBob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-3px);
  }
}

@keyframes timerPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.lesson-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.lesson-actions:has(#nextButton[hidden]) {
  grid-template-columns: 1fr;
}

.primary-button,
.secondary-button {
  padding: 12px 16px;
  font-weight: 900;
}

.primary-button {
  color: white;
  background: var(--coral);
  box-shadow: 0 10px 22px rgba(231, 111, 81, 0.24);
}

.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
}

.secondary-button.compact {
  min-height: 42px;
  padding: 9px 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.word-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.word-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.word-card {
  display: grid;
  gap: 8px;
  min-height: 172px;
  padding: 12px;
  place-items: center;
  text-align: center;
  cursor: pointer;
}

.word-card.locked {
  opacity: 0.54;
}

.word-card strong {
  font-size: 1.18rem;
}

.word-card span {
  color: var(--muted);
}

.stat-card {
  padding: 18px;
  text-align: center;
}

.stat-card span {
  display: block;
  font-size: 2rem;
  font-weight: 950;
  color: var(--blue);
}

.stat-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.progress-note {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: #f7fbfa;
  color: var(--muted);
  line-height: 1.6;
}

.reset-button {
  width: 100%;
  margin-top: 14px;
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    padding: 14px;
  }

  .choice-grid,
  .lesson-actions,
  .stage-switch,
  .pinyin-switch,
  .pinyin-choice-grid {
    grid-template-columns: 1fr;
  }

  .math-game-stage {
    aspect-ratio: 1 / 0.9;
  }

  .math-sky {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 66%;
    gap: 14px;
    padding: 18px 16px 0;
  }

  .math-balloon {
    max-width: 96px;
  }

  .choice-card {
    min-height: 128px;
  }

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

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Layout refresh: the activity stays central, while navigation remains easy to reach. */
html {
  scroll-behavior: smooth;
}

body {
  background: #f4f7f4;
}

.app-shell {
  width: min(100%, 1240px);
  padding: clamp(12px, 2.4vw, 30px);
}

.topbar {
  min-height: 96px;
  padding: 18px clamp(16px, 2.5vw, 28px);
  box-shadow: 0 10px 30px rgba(33, 49, 60, 0.09);
}

.brand-block {
  min-width: 0;
}

.brand-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.daily-goal {
  display: grid;
  min-width: 138px;
  padding: 10px 14px;
  border: 1px solid #bde2cf;
  border-radius: 8px;
  background: #effaf4;
  color: #31765b;
  text-align: center;
}

.daily-goal span {
  font-size: 0.74rem;
  font-weight: 800;
}

.daily-goal strong {
  margin-top: 2px;
  font-size: 1rem;
}

.tabs {
  position: sticky;
  z-index: 20;
  top: 8px;
  margin: 14px 0 22px;
  padding: 6px;
  box-shadow: 0 8px 22px rgba(33, 49, 60, 0.08);
}

.tab {
  min-height: 58px;
  padding: 9px 12px;
}

.tab small {
  white-space: nowrap;
}

.view {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lesson-panel {
  padding: clamp(16px, 2.8vw, 30px);
  border: 1px solid rgba(219, 229, 229, 0.95);
  box-shadow: 0 12px 32px rgba(33, 49, 60, 0.08);
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.lesson-status {
  padding: 10px 12px;
  border: 1px solid #e2ece8;
  border-radius: 8px;
  background: #f7fbf9;
}

.progress-track {
  height: 10px;
  margin: 12px 0 16px;
}

.round-size-switch {
  margin: 0 0 14px;
  padding: 8px 0 0;
}

.round-size-button {
  min-height: 42px;
  min-width: 58px;
}

.stage-switch {
  margin: 0 0 22px;
}

.stage-button {
  min-height: 74px;
  padding: 12px 14px;
}

.stage-button strong {
  font-size: 1.04rem;
}

.prompt-area {
  min-height: 148px;
  padding: 18px 0 22px;
}

.choice-grid {
  gap: clamp(10px, 1.8vw, 18px);
}

.choice-card {
  min-height: clamp(138px, 18vw, 176px);
}

.visual {
  width: 92px;
  height: 92px;
}

.feedback {
  margin-top: 18px;
}

.lesson-actions {
  width: min(100%, 640px);
  margin: 16px auto 0;
}

.math-panel {
  padding: clamp(12px, 2vw, 22px) !important;
}

#mathView .lesson-status {
  margin-bottom: 10px;
}

.math-card {
  padding: clamp(8px, 1.5vw, 14px);
}

.math-game-stage {
  height: clamp(380px, 52vh, 560px);
  aspect-ratio: auto;
  max-width: 1120px;
  margin: 0 auto;
}

.pinyin-card,
.spell-card,
.repeat-card {
  max-width: 860px;
  margin-inline: auto;
}

.utility-view {
  padding: clamp(18px, 2.8vw, 30px);
  border: 1px solid rgba(219, 229, 229, 0.95);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 32px rgba(33, 49, 60, 0.08);
}

.word-grid {
  grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px 10px calc(24px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 0;
    gap: 10px;
    padding: 14px;
  }

  h1 {
    font-size: 1.45rem;
  }

  .brand-note {
    display: none;
  }

  .daily-goal {
    min-width: 104px;
    padding: 8px 10px;
  }

  .daily-goal strong {
    font-size: 0.84rem;
  }

  .icon-button {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    font-size: 1.3rem;
  }

  .voice-picker-button {
    min-width: 58px;
    min-height: 48px;
    padding: 0 8px;
    font-size: 0.82rem;
  }

  .voice-picker {
    padding: 14px;
  }

  .voice-picker-panel {
    padding: 26px 18px;
  }

  .voice-option-grid {
    gap: 10px;
  }

  .voice-option {
    min-height: 152px;
    padding: 14px 8px;
  }

  .word-game-scene {
    min-height: 500px;
  }

  .word-game-answer-zone {
    top: 23%;
    left: 5%;
    width: 62%;
    transform: none;
  }

  .word-game-option {
    min-height: 144px;
    padding: 8px 4px;
  }

  .word-game-option .visual {
    width: 58px;
    height: 58px;
  }

  .word-game-monster-zone {
    top: 8%;
    right: 3%;
    flex-direction: column;
    align-items: center;
    width: 27%;
    min-height: 72%;
    gap: 2px;
  }

  .word-game-monster {
    width: min(100%, 74px);
  }

  .word-game-monster img {
    height: 98px;
  }

  .word-game-monster.boss {
    width: min(120%, 150px);
  }

  .word-game-monster.boss img {
    height: 224px;
  }

  .word-game-scene.boss-battle .word-game-monster-zone {
    top: 16%;
    min-height: 62%;
  }

  .word-game-boss-health {
    top: -18%;
    left: 50%;
    width: 122%;
  }

  .word-game-monster:nth-child(2),
  .word-game-monster:nth-child(3) {
    margin-bottom: 0;
  }

  .word-game-bird {
    bottom: 4%;
    left: 5%;
    width: 108px;
  }

  .tabs {
    display: flex;
    gap: 7px;
    width: calc(100% + 20px);
    margin: 10px -10px 16px;
    padding: 7px 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 132px;
    scroll-snap-align: start;
  }

  .tab small {
    font-size: 0.68rem;
  }

  .lesson-panel,
  .utility-view {
    padding: 16px 12px;
  }

  .section-heading {
    align-items: center;
    flex-direction: row;
    margin-bottom: 14px;
  }

  .section-heading h2 {
    font-size: 1.42rem;
  }

  .lesson-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    padding: 9px 10px;
    font-size: 0.9rem;
  }

  #mathView .lesson-status {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  #mathView .lesson-status span:first-child,
  #mathView .lesson-status span:last-child {
    text-align: left;
  }

  #mathView .lesson-status span:last-child {
    grid-column: 1 / -1;
  }

  .stage-switch,
  .pinyin-switch {
    display: flex;
    gap: 8px;
    margin-right: -12px;
    padding-right: 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .stage-button {
    flex: 0 0 146px;
    min-height: 70px;
    scroll-snap-align: start;
  }

  .pinyin-switch .stage-button {
    flex-basis: 136px;
  }

  .prompt-area {
    min-height: 132px;
    padding: 12px 0 18px;
  }

  .speak-card {
    width: 100%;
    min-height: 76px;
  }

  #spokenWord {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

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

  .choice-card {
    min-height: 136px;
    padding: 10px;
  }

  .letter-bank {
    width: 100%;
    gap: 5px;
  }

  .letter-button {
    min-height: 46px;
    padding: 6px 2px;
    font-size: 1.2rem;
  }

  .visual {
    width: 78px;
    height: 78px;
    font-size: 3rem;
  }

  .pinyin-card,
  .spell-card,
  .repeat-card {
    padding: 14px 10px;
  }

  .pinyin-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .math-game-stage {
    height: auto;
    aspect-ratio: 1 / 1.08;
  }

  .math-sky {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .math-game-stage.advanced .math-sky {
    gap: 8px;
    min-height: 70%;
    padding: 16px 12px 0;
  }

  .math-game-stage.advanced .math-enemy {
    max-width: 80px;
    min-height: 82px;
  }

  .math-game-stage.advanced .math-enemy-art {
    max-width: 72px;
    max-height: 70px;
  }

  .math-game-stage.advanced .math-enemy-label {
    min-width: 30px;
    height: 30px;
    font-size: 1rem;
    border-width: 2px;
    transform: translate(12%, -8%);
  }

  .math-choice-grid {
    width: 100%;
  }

  .lesson-actions {
    width: 100%;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 14px 8px;
  }

  .stat-card span {
    font-size: 1.65rem;
  }

  .stat-card p {
    font-size: 0.78rem;
  }
}

/* Flat cartoon learning shell */
:root {
  --ink: #253744;
  --muted: #687985;
  --paper: #ffffff;
  --line: #d7e6e5;
  --green: #2f9b72;
  --blue: #3b82c4;
  --coral: #e96f55;
  --yellow: #f3c441;
  --mint: #dff4e9;
  --sky: #e4f2fb;
  --peach: #ffebe3;
  --shadow: 0 10px 28px rgba(37, 55, 68, 0.08);
}

body {
  background: #f2f7f5;
}

.app-shell {
  width: min(100%, 1380px);
  padding: 16px clamp(14px, 2vw, 28px) 32px;
}

.topbar {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  min-height: 112px;
  gap: 16px;
  padding: 16px 20px;
  border: 0;
  border-bottom: 3px solid #cfe9df;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.brand-mascot {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  overflow: hidden;
  border: 2px solid #cbe8da;
  border-radius: 8px;
  background: #e9f8f0;
}

.brand-mascot img {
  width: 94%;
  height: 94%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.brand-block {
  align-self: center;
}

.brand-block h1 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.brand-note {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.daily-goal {
  min-width: 128px;
  padding: 10px 14px;
  border: 1px solid #bfe2d2;
  border-radius: 8px;
  color: #27785c;
  background: #edf9f3;
  text-align: center;
}

.daily-goal span,
.daily-goal strong {
  display: block;
}

.daily-goal span {
  font-size: 0.72rem;
  font-weight: 800;
}

.daily-goal strong {
  margin-top: 2px;
  font-size: 1rem;
}

.voice-picker-button,
.icon-button {
  box-shadow: none;
}

.icon-button {
  width: 50px;
  height: 50px;
  flex-basis: 50px;
  border: 2px solid #c9dfef;
  color: #28699f;
  background: #eaf4fb;
}

.tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.tab {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-height: 90px;
  gap: 2px 12px;
  padding: 10px 14px;
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  box-shadow: none;
}

.tab .tab-art {
  display: grid;
  grid-row: 1 / 3;
  width: 68px;
  height: 68px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #edf5f2;
}

.tab .tab-art img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.tab .math-art img {
  width: 58%;
  height: 78%;
}

.tab strong {
  align-self: end;
  font-size: 1.08rem;
}

.tab small {
  align-self: start;
  font-size: 0.76rem;
}

.tab:nth-child(1) .tab-art { background: #e6f6ed; }
.tab:nth-child(2) .tab-art { background: #e6f2fb; }
.tab:nth-child(3) .tab-art { background: #fff0e8; }
.tab:nth-child(4) .tab-art { background: #fff7d9; }

.tab:nth-child(1).active {
  border-color: #75c5a5;
  background: #eaf8f1;
}

.tab:nth-child(2).active {
  border-color: #86bce5;
  background: #edf6fd;
}

.tab:nth-child(3).active {
  border-color: #efa083;
  background: #fff1eb;
}

.tab:nth-child(4).active {
  border-color: #e7c24d;
  background: #fff9df;
}

.tab.active strong,
.tab.active small {
  color: var(--ink);
}

.english-activity-tabs {
  gap: 0;
  margin: 10px 0 12px;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.english-activity-button {
  min-height: 66px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
}

.english-activity-button:hover,
.english-activity-button:focus-visible {
  border-color: #9bd0bb;
  background: #f5fbf8;
  transform: none;
}

.english-activity-button.active {
  border-color: var(--green);
  background: #f1faf6;
}

.english-activity-button > .activity-art {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
}

.activity-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.view {
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.lesson-panel,
.utility-view {
  padding: clamp(16px, 2vw, 24px);
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.section-heading {
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
}

.lesson-status {
  padding: 7px 0;
  border: 0;
  background: transparent;
}

.progress-track {
  height: 9px;
  margin: 4px 0 12px;
  background: #e8f0ed;
}

.round-size-switch {
  width: max-content;
  max-width: 100%;
  gap: 3px;
  margin: 0 0 10px;
  padding: 4px;
  border-radius: 8px;
  background: #eef4f2;
}

.round-size-switch > span {
  padding: 0 8px;
  font-size: 0.82rem;
}

.round-size-button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.round-size-button.active {
  color: #1f6a52;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(37, 55, 68, 0.1);
}

.stage-switch {
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 8px;
  background: #eef4f2;
}

.stage-button {
  min-height: 50px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.stage-button span {
  display: none;
}

.stage-button.active {
  border: 0;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 55, 68, 0.1);
}

.prompt-area,
.pinyin-card,
.math-card {
  border-color: #d9e9e6;
  background: #f8fbfa;
  box-shadow: none;
}

.speak-card,
.primary-button {
  box-shadow: none;
}

.choice-card,
.word-card,
.stat-card {
  border: 2px solid #d9e8e5;
  box-shadow: none;
}

.choice-card:hover,
.choice-card:focus-visible {
  border-color: #72bfa1;
  box-shadow: 0 6px 16px rgba(37, 55, 68, 0.08);
}

.feedback {
  min-height: 46px;
  padding: 9px 12px;
  border: 0;
  border-left: 4px solid #9bd0bb;
  border-radius: 0;
  background: #f3f9f6;
}

.score-badge {
  border-radius: 6px;
  box-shadow: none;
}

.secondary-button {
  border: 2px solid #d7e4e3;
  box-shadow: none;
  background: #ffffff;
}

@media (max-width: 760px) {
  body {
    background: #f5f8f6;
  }

  .app-shell {
    padding: 8px 8px calc(92px + env(safe-area-inset-bottom));
  }

  .topbar {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    min-height: 68px;
    gap: 8px;
    padding: 8px;
  }

  .brand-mascot {
    display: grid;
    width: 48px;
    height: 48px;
  }

  .brand-block h1 {
    font-size: clamp(1.05rem, 4.8vw, 1.32rem);
  }

  .brand-note,
  .brand-block .eyebrow,
  .daily-goal {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .voice-picker-button {
    min-width: 48px;
    min-height: 42px;
    padding: 0 8px;
  }

  .voice-picker-button > span:first-child {
    display: none;
  }

  .icon-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    flex-basis: 42px;
    font-size: 1.2rem;
  }

  .tabs {
    position: fixed;
    z-index: 24;
    top: auto;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    margin: 0;
    padding: 5px;
    border: 1px solid #d6e4e1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(37, 55, 68, 0.16);
  }

  .tab {
    grid-template-columns: 1fr;
    grid-template-rows: 34px auto;
    min-height: 64px;
    gap: 2px;
    padding: 4px 2px;
    place-items: center;
    border-width: 1px;
    text-align: center;
  }

  .tab .tab-art {
    display: grid;
    grid-row: 1;
    width: 34px;
    height: 34px;
  }

  .tab strong {
    grid-row: 2;
    align-self: center;
    font-size: clamp(0.72rem, 3vw, 0.86rem);
  }

  .tab small {
    display: none;
  }

  .english-activity-tabs {
    position: sticky;
    z-index: 18;
    top: 0;
    gap: 0;
    margin: 7px 0;
    padding: 0 2px;
  }

  .english-activity-button {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: 1fr;
    min-height: 50px;
    gap: 4px;
    padding: 5px 4px;
    text-align: left;
  }

  .english-activity-button > .activity-art {
    display: grid;
    grid-row: 1;
    width: 30px;
    height: 30px;
  }

  .english-activity-button strong {
    font-size: clamp(0.72rem, 3.1vw, 0.88rem);
  }

  .lesson-panel,
  .utility-view {
    padding: 11px 8px;
  }

  .round-size-switch {
    width: 100%;
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
  }

  .round-size-switch > span {
    align-self: center;
    padding: 0 5px;
  }

  .round-size-button {
    min-width: 0;
    padding-inline: 5px;
  }

  .stage-switch,
  .pinyin-switch {
    gap: 3px;
    padding: 3px;
  }

  .stage-button {
    min-width: 0;
    min-height: 46px;
    padding: 6px 4px;
  }

  .stage-button strong {
    font-size: clamp(0.76rem, 3.2vw, 0.9rem);
  }

  .pinyin-switch .stage-button strong {
    font-size: clamp(0.68rem, 2.8vw, 0.82rem);
  }

  .section-heading .eyebrow {
    display: none;
  }

  .section-heading h2 {
    font-size: 1.24rem;
  }
}

@media (min-width: 761px) and (max-width: 1020px) {
  .app-shell {
    padding: 20px;
  }

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

  .tab {
    padding: 9px 8px;
  }

  .tab small {
    display: none;
  }
}

/* Learning hierarchy and activity-focused layout */
.app-shell {
  width: min(100%, 1320px);
}

.topbar {
  min-height: 82px;
  padding-block: 14px;
}

.topbar h1 {
  font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.brand-note {
  margin-top: 4px;
}

.tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.tab {
  min-height: 62px;
  padding: 9px 14px;
}

.english-activity-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 8px;
  border: 1px solid rgba(219, 229, 229, 0.96);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.9);
  box-shadow: 0 8px 22px rgba(33, 49, 60, 0.07);
}

.english-activity-tabs[hidden] {
  display: none;
}

.english-activity-button {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 0;
  min-height: 64px;
  column-gap: 10px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.english-activity-button > span {
  display: grid;
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #edf5f2;
  font-size: 1.15rem;
}

.english-activity-button strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.15;
}

.english-activity-button small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.english-activity-button:hover,
.english-activity-button:focus-visible {
  border-color: #cce4da;
  background: #f6fbf8;
  transform: translateY(-1px);
}

.english-activity-button.active {
  border-color: #acd9c6;
  background: var(--mint);
}

.english-activity-button.active > span {
  background: #ffffff;
}

.lesson-panel {
  padding: clamp(16px, 2.2vw, 26px);
}

.section-heading {
  margin-bottom: 12px;
}

.lesson-status {
  padding: 8px 12px;
}

.progress-track {
  margin: 9px 0 12px;
}

.round-size-switch {
  margin-bottom: 10px;
  padding-top: 0;
}

.round-size-button {
  min-height: 38px;
  padding: 7px 13px;
}

.stage-switch {
  gap: 8px;
  margin-bottom: 12px;
}

.stage-button {
  min-height: 64px;
  padding: 10px 13px;
}

#learnView .prompt-area {
  min-height: 0;
  gap: 7px;
  padding: 6px 0 12px;
}

#learnView .speak-card {
  min-height: 64px;
  padding: 11px 18px;
}

#learnView .speaker-mark {
  width: 32px;
  height: 32px;
}

#learnView #spokenWord {
  font-size: clamp(1.45rem, 3vw, 1.85rem);
}

#learnView .choice-grid:not(.spelling-mode) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
}

#learnView .choice-card {
  min-height: clamp(205px, 20vw, 248px);
  align-content: center;
  gap: 8px;
  padding: clamp(10px, 1.4vw, 16px);
}

#learnView .choice-card .visual {
  width: clamp(128px, 12vw, 166px);
  height: clamp(128px, 12vw, 166px);
  border-radius: 8px;
}

#learnView .choice-card .image-visual {
  padding: 4px;
}

#learnView .choice-card .word-image {
  object-fit: contain;
}

#learnView .choice-name {
  gap: 1px;
  margin-top: 2px;
}

#learnView .choice-name strong {
  font-size: clamp(1rem, 1.7vw, 1.18rem);
}

#learnView .choice-name small {
  font-size: 0.82rem;
}

#learnView .feedback {
  margin-top: 12px;
}

#learnView .lesson-actions {
  margin-top: 10px;
}

.word-game-panel,
.math-panel {
  width: 100%;
}

.utility-view {
  padding: clamp(16px, 2.2vw, 26px);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 8px 8px calc(20px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 0;
    gap: 8px;
    padding: 11px 10px;
  }

  .topbar .eyebrow,
  .daily-goal {
    display: none;
  }

  .topbar h1 {
    overflow: hidden;
    font-size: clamp(1.12rem, 5.3vw, 1.42rem);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .voice-picker-button {
    min-width: 54px;
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    flex-basis: 44px;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
    margin: 8px 0;
    padding: 5px;
    overflow: visible;
    border: 1px solid rgba(219, 229, 229, 0.96);
    border-radius: 8px;
  }

  .tab {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-width: 0;
    min-height: 55px;
    padding: 7px 3px;
    place-items: center;
    text-align: center;
  }

  .tab span {
    display: none;
  }

  .tab strong {
    grid-column: 1;
    grid-row: 1;
    font-size: clamp(0.78rem, 3.3vw, 0.94rem);
  }

  .tab small {
    display: none;
  }

  .english-activity-tabs {
    gap: 5px;
    margin-bottom: 9px;
    padding: 5px;
  }

  .english-activity-button {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: 68px;
    gap: 3px;
    padding: 6px 3px;
    place-items: center;
    text-align: center;
  }

  .english-activity-button > span {
    grid-row: auto;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .english-activity-button strong {
    font-size: clamp(0.75rem, 3.2vw, 0.9rem);
  }

  .english-activity-button small {
    display: none;
  }

  .lesson-panel,
  .utility-view {
    padding: 12px 9px;
  }

  .section-heading {
    margin-bottom: 9px;
  }

  .section-heading .eyebrow {
    margin-bottom: 2px;
  }

  .section-heading h2 {
    font-size: 1.28rem;
  }

  .lesson-status {
    padding: 7px 9px;
    font-size: 0.84rem;
  }

  .progress-track {
    height: 8px;
    margin: 7px 0 9px;
  }

  .round-size-switch {
    gap: 5px;
    margin-bottom: 8px;
    font-size: 0.84rem;
  }

  .round-size-button {
    min-width: 52px;
    min-height: 34px;
    padding: 5px 9px;
    font-size: 0.84rem;
  }

  .stage-switch,
  .pinyin-switch {
    gap: 6px;
    margin-bottom: 8px;
  }

  .stage-button {
    flex-basis: 126px;
    min-height: 58px;
    padding: 8px 10px;
  }

  .stage-button strong {
    font-size: 0.94rem;
  }

  #learnView .prompt-area {
    gap: 5px;
    padding: 3px 0 8px;
  }

  #learnView .prompt-kicker,
  #learnView .hint {
    font-size: 0.82rem;
  }

  #learnView .speak-card {
    min-height: 56px;
    padding: 8px 12px;
  }

  #learnView .speaker-mark {
    width: 28px;
    height: 28px;
  }

  #learnView .choice-grid:not(.spelling-mode) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #learnView .choice-card {
    min-height: 174px;
    gap: 5px;
    padding: 8px 5px;
  }

  #learnView .choice-card .visual {
    width: min(30vw, 122px);
    height: min(30vw, 122px);
  }

  #learnView .choice-name strong {
    font-size: 0.98rem;
  }

  #learnView .choice-name small {
    font-size: 0.75rem;
  }

  #learnView .feedback {
    margin-top: 9px;
  }

  #learnView .lesson-actions {
    margin-top: 8px;
  }
}

/* Keep the simplified shell authoritative over earlier layout revisions. */
body {
  background: #f2f7f5;
}

.app-shell {
  width: min(100%, 1380px);
  padding: 16px clamp(14px, 2vw, 28px) 32px;
}

.topbar {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  min-height: 112px;
  gap: 16px;
  padding: 16px 20px;
  border: 0;
  border-bottom: 3px solid #cfe9df;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.brand-mascot {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  overflow: hidden;
  border: 2px solid #cbe8da;
  border-radius: 8px;
  background: #e9f8f0;
}

.brand-mascot img {
  width: 94%;
  height: 94%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.brand-block h1 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.brand-note {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: auto;
  margin: 12px 0 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.tab {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-width: 0;
  min-height: 90px;
  gap: 2px 12px;
  padding: 10px 14px;
  place-items: initial;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  text-align: left;
}

.tab .tab-art {
  display: grid;
  grid-row: 1 / 3;
  width: 68px;
  height: 68px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
}

.tab .tab-art img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.tab .math-art img {
  width: 58%;
  height: 78%;
}

.tab strong {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: 1.08rem;
}

.tab small {
  display: block;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  font-size: 0.76rem;
}

.english-activity-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 10px 0 12px;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.english-activity-button {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  min-height: 66px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.english-activity-button.active {
  border-color: var(--green);
  background: #f1faf6;
}

.english-activity-button > .activity-art {
  display: grid;
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
}

.view {
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.lesson-panel,
.utility-view {
  padding: clamp(16px, 2vw, 24px);
  border: 0;
  background: transparent;
}

.round-size-switch {
  width: max-content;
  max-width: 100%;
  gap: 3px;
  margin: 0 0 10px;
  padding: 4px;
  border-radius: 8px;
  background: #eef4f2;
}

.round-size-button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.round-size-button.active {
  border: 0;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(37, 55, 68, 0.1);
}

.stage-switch,
.pinyin-switch {
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 8px;
  background: #eef4f2;
}

.stage-button {
  min-height: 50px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.stage-button span {
  display: none;
}

.stage-button.active {
  border: 0;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 55, 68, 0.1);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 8px 8px calc(92px + env(safe-area-inset-bottom));
  }

  .topbar {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    min-height: 68px;
    gap: 8px;
    padding: 8px;
  }

  .brand-mascot {
    display: grid;
    width: 48px;
    height: 48px;
  }

  .brand-block .eyebrow,
  .brand-note,
  .daily-goal {
    display: none;
  }

  .brand-block h1 {
    overflow: hidden;
    font-size: clamp(1.05rem, 4.8vw, 1.32rem);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 5px;
  }

  .tabs {
    position: fixed;
    z-index: 24;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    top: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    width: auto;
    margin: 0;
    padding: 5px;
    border: 1px solid #d6e4e1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(37, 55, 68, 0.16);
  }

  .tab {
    grid-template-columns: 1fr;
    grid-template-rows: 34px auto;
    min-height: 64px;
    gap: 2px;
    padding: 4px 2px;
    place-items: center;
    border-width: 1px;
    text-align: center;
  }

  .tab .tab-art {
    display: grid;
    grid-column: 1;
    grid-row: 1;
    width: 34px;
    height: 34px;
  }

  .tab strong {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    font-size: clamp(0.72rem, 3vw, 0.86rem);
  }

  .tab small {
    display: none;
  }

  .english-activity-tabs {
    position: sticky;
    z-index: 18;
    top: 0;
    gap: 0;
    margin: 7px 0;
    padding: 0 2px;
  }

  .english-activity-button {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: 1fr;
    min-height: 50px;
    gap: 4px;
    padding: 5px 4px;
    place-items: center start;
    text-align: left;
  }

  .english-activity-button > .activity-art {
    grid-column: 1;
    grid-row: 1;
    width: 30px;
    height: 30px;
  }

  .english-activity-button strong {
    grid-column: 2;
    grid-row: 1;
    font-size: clamp(0.72rem, 3.1vw, 0.88rem);
  }

  .english-activity-button small {
    display: none;
  }

  .lesson-panel,
  .utility-view {
    padding: 11px 8px;
  }

  .round-size-switch {
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .round-size-button {
    min-width: 0;
  }

  .stage-switch,
  .pinyin-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    overflow: visible;
  }

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

  .stage-button {
    min-width: 0;
    min-height: 46px;
    padding: 6px 4px;
  }

  .section-heading .eyebrow {
    display: none;
  }
}

/*
 * Adventure theme preview
 * Remove `adventure-preview` from <body> to restore the previous design.
 */
.adventure-preview {
  --ink: #263648;
  --muted: #6e7585;
  --paper: #fffdf6;
  --line: #d7eadf;
  --green: #39a875;
  --blue: #4f91d9;
  --coral: #f17b62;
  --yellow: #f6c84c;
  --mint: #ddf5e9;
  --sky: #e4f3ff;
  --peach: #ffe5d8;
  --purple: #8b72d6;
  --cream: #fff8e8;
  --shadow: 0 16px 0 rgba(73, 111, 91, 0.07), 0 24px 52px rgba(50, 86, 72, 0.13);
  background:
    radial-gradient(circle at 9% 8%, rgba(246, 200, 76, 0.34) 0 86px, transparent 88px),
    radial-gradient(circle at 92% 15%, rgba(79, 145, 217, 0.2) 0 110px, transparent 112px),
    radial-gradient(circle at 18% 88%, rgba(139, 114, 214, 0.12) 0 100px, transparent 102px),
    linear-gradient(180deg, #fff7d8 0%, #eef9ec 36%, #e8f5ff 100%);
  background-attachment: fixed;
}

.adventure-preview button {
  -webkit-tap-highlight-color: transparent;
}

.adventure-preview .app-shell {
  width: min(100%, 1120px);
  padding: 26px;
}

.adventure-preview .topbar {
  position: relative;
  isolation: isolate;
  min-height: 148px;
  gap: 22px;
  overflow: hidden;
  padding: 22px 26px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 30px;
  background:
    radial-gradient(ellipse at 73% 18%, rgba(255, 255, 255, 0.9) 0 46px, transparent 48px),
    radial-gradient(ellipse at 82% 22%, rgba(255, 255, 255, 0.72) 0 32px, transparent 34px),
    linear-gradient(135deg, #dff4ff 0%, #eef9e7 54%, #fff0bd 100%);
  box-shadow: var(--shadow);
}

.adventure-preview .topbar::before {
  position: absolute;
  z-index: -1;
  right: -4%;
  bottom: -74px;
  left: 38%;
  height: 132px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, rgba(112, 190, 111, 0.38), rgba(74, 166, 103, 0.18));
  content: "";
}

.adventure-preview .brand-mascot {
  width: 104px;
  height: 104px;
  flex: 0 0 104px;
  padding: 7px;
  border: 4px solid #ffffff;
  border-radius: 34px 42px 32px 40px;
  background: linear-gradient(145deg, #fff4a9, #ddf7e9);
  box-shadow: 0 12px 24px rgba(54, 112, 87, 0.16);
  transform: rotate(-3deg);
}

.adventure-preview .brand-mascot img {
  filter: drop-shadow(0 7px 5px rgba(53, 73, 85, 0.18));
}

.adventure-preview .brand-block {
  position: relative;
  z-index: 1;
}

.adventure-preview .brand-block .eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  color: #247b57;
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
}

.adventure-preview .brand-block h1 {
  color: #29445b;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 950;
  letter-spacing: 0.02em;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.92);
}

.adventure-preview .brand-note {
  margin-top: 8px;
  color: #536a78;
  font-size: 1.05rem;
  font-weight: 800;
}

.adventure-preview .daily-goal {
  border: 2px solid rgba(57, 168, 117, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(54, 112, 87, 0.08);
}

.adventure-preview .daily-goal strong::before {
  content: "⭐ ";
}

.adventure-preview .voice-picker-button,
.adventure-preview .icon-button {
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 9px 0 rgba(78, 91, 103, 0.1), 0 14px 24px rgba(45, 75, 93, 0.13);
}

.adventure-preview .tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.adventure-preview .tab {
  min-height: 92px;
  padding: 12px 14px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 9px 0 rgba(59, 92, 76, 0.08), 0 13px 24px rgba(43, 83, 64, 0.09);
}

.adventure-preview .tab:nth-child(1) { background: #e7f8ef; }
.adventure-preview .tab:nth-child(2) { background: #e8f4ff; }
.adventure-preview .tab:nth-child(3) { background: #fff0e4; }
.adventure-preview .tab:nth-child(4) { background: #fff7d4; }

.adventure-preview .tab .tab-art {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
}

.adventure-preview .tab strong {
  font-size: 1.08rem;
}

.adventure-preview .tab.active {
  border-color: #f6c84c;
  color: var(--ink);
  background: #fffdf5;
  box-shadow: 0 9px 0 #eec75d, 0 15px 28px rgba(78, 102, 66, 0.15);
  transform: translateY(-3px) rotate(-0.5deg);
}

.adventure-preview .tab.active strong,
.adventure-preview .tab.active small {
  color: var(--ink);
}

.adventure-preview .english-activity-tabs {
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 24px rgba(55, 91, 73, 0.08);
}

.adventure-preview .english-activity-button {
  min-height: 72px;
  padding: 9px 12px;
  border: 2px solid transparent;
  border-radius: 18px;
}

.adventure-preview .english-activity-button.active {
  border-color: #56b889;
  background: #eaf9f0;
  box-shadow: 0 6px 0 rgba(57, 168, 117, 0.22);
}

.adventure-preview .view {
  padding: 20px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 30px;
  background: rgba(255, 253, 246, 0.9);
  box-shadow: var(--shadow);
}

.adventure-preview .lesson-panel,
.adventure-preview .utility-view {
  background: transparent;
}

.adventure-preview .section-heading h2 {
  color: #29445b;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 950;
}

.adventure-preview .lesson-status span {
  padding: 7px 12px;
  border-radius: 999px;
  background: #f3f6f2;
}

.adventure-preview .progress-track {
  height: 15px;
  border: 3px solid #ffffff;
  background: #e8efe8;
  box-shadow: inset 0 2px 5px rgba(54, 91, 73, 0.08);
}

.adventure-preview .progress-fill {
  background: linear-gradient(90deg, #55bf82, #f6c84c 72%, #ff9b72);
}

.adventure-preview .round-size-switch,
.adventure-preview .stage-switch,
.adventure-preview .pinyin-switch {
  border: 2px solid #ffffff;
  border-radius: 18px;
  background: #edf5f0;
  box-shadow: inset 0 2px 5px rgba(54, 91, 73, 0.06);
}

.adventure-preview .round-size-button,
.adventure-preview .stage-button {
  border-radius: 14px;
}

.adventure-preview .round-size-button.active,
.adventure-preview .stage-button.active {
  background: #ffffff;
  box-shadow: 0 5px 0 rgba(66, 116, 91, 0.12), 0 7px 14px rgba(50, 86, 72, 0.08);
}

.adventure-preview .prompt-area {
  position: relative;
  margin: 6px 0 14px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(145deg, #eef8ff, #f4faed);
}

.adventure-preview .speak-card {
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  background: linear-gradient(135deg, #5a9fe5, #707edb);
  box-shadow: 0 9px 0 #3c73b6, 0 15px 28px rgba(60, 115, 182, 0.2);
}

.adventure-preview .pinyin-speak {
  background: linear-gradient(135deg, #4bb884, #31a87e);
  box-shadow: 0 9px 0 #25845f, 0 15px 28px rgba(37, 132, 95, 0.2);
}

.adventure-preview .choice-grid {
  gap: 16px;
}

.adventure-preview .choice-card,
.adventure-preview .spell-card,
.adventure-preview .repeat-card,
.adventure-preview .pinyin-card,
.adventure-preview .math-card {
  border: 3px solid #dcebe3;
  border-radius: 24px;
  background: #fffefa;
  box-shadow: 0 8px 0 rgba(70, 111, 89, 0.08), 0 12px 22px rgba(56, 91, 74, 0.07);
}

.adventure-preview .choice-card:hover,
.adventure-preview .choice-card:focus-visible {
  border-color: #f0bd49;
  box-shadow: 0 9px 0 rgba(240, 189, 73, 0.28), 0 15px 24px rgba(70, 93, 62, 0.12);
  transform: translateY(-4px) rotate(-0.5deg);
}

.adventure-preview .visual {
  border: 3px solid #ffffff;
  border-radius: 22px;
  box-shadow: 0 7px 14px rgba(57, 81, 67, 0.1);
}

.adventure-preview .feedback {
  border: 2px dashed #b8dcca;
  border-radius: 20px;
  background: #f2fbf6;
}

.adventure-preview .score-badge {
  border: 3px solid #efc34f;
  border-radius: 18px;
  background: #fff5bd;
  box-shadow: 0 7px 0 rgba(222, 174, 46, 0.2);
}

.adventure-preview .primary-button,
.adventure-preview .secondary-button {
  border-radius: 17px;
}

.adventure-preview .primary-button {
  border: 3px solid rgba(255, 255, 255, 0.8);
  background: linear-gradient(135deg, #f28968, #e66d57);
  box-shadow: 0 8px 0 #bd5543, 0 13px 20px rgba(189, 85, 67, 0.18);
}

.adventure-preview .secondary-button {
  border: 2px solid #cee4d9;
  background: #ffffff;
  box-shadow: 0 5px 0 rgba(64, 104, 83, 0.1);
}

.adventure-preview .math-game-stage,
.adventure-preview .word-game-scene {
  border: 4px solid #ffffff;
  border-radius: 26px;
  box-shadow: 0 0 0 3px #cfe5db, 0 14px 30px rgba(44, 79, 62, 0.12);
}

.adventure-preview .math-center-panel,
.adventure-preview .word-game-center-panel {
  border: 4px solid #ffffff;
  border-radius: 24px;
  background: rgba(255, 253, 244, 0.96);
  box-shadow: 0 10px 0 rgba(57, 91, 73, 0.11), 0 18px 36px rgba(39, 75, 99, 0.16);
}

.adventure-preview .pinyin-option,
.adventure-preview .math-answer {
  border-width: 3px;
  border-radius: 20px;
}

.adventure-preview .stats-grid {
  gap: 16px;
}

.adventure-preview .stat-card {
  position: relative;
  overflow: hidden;
  padding: 26px 16px;
  border: 3px solid #ffffff;
  border-radius: 24px;
  box-shadow: 0 8px 0 rgba(65, 100, 82, 0.09), 0 13px 25px rgba(54, 86, 70, 0.08);
}

.adventure-preview .stat-card:nth-child(1) { background: #e8f5ff; }
.adventure-preview .stat-card:nth-child(2) { background: #e7f8ee; }
.adventure-preview .stat-card:nth-child(3) { background: #fff3c9; }

.adventure-preview .stat-card span {
  color: #4d79bd;
  font-weight: 950;
}

.adventure-preview .progress-note {
  border: 2px dashed #b9dccb;
  border-radius: 20px;
  background: #f5fcf7;
}

.adventure-preview .voice-picker-panel,
.adventure-preview .voice-option {
  border-radius: 26px;
}

@media (max-width: 760px) {
  .adventure-preview .app-shell {
    padding: 8px 8px calc(98px + env(safe-area-inset-bottom));
  }

  .adventure-preview .topbar {
    min-height: 72px;
    padding: 8px 9px;
    border-width: 2px;
    border-radius: 22px;
    background: linear-gradient(135deg, #e6f6ff, #eff9e9 62%, #fff2bf);
    box-shadow: 0 7px 0 rgba(73, 111, 91, 0.08), 0 12px 24px rgba(50, 86, 72, 0.1);
  }

  .adventure-preview .topbar::before {
    display: none;
  }

  .adventure-preview .brand-mascot {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    padding: 3px;
    border-width: 2px;
    border-radius: 17px 21px 16px 20px;
  }

  .adventure-preview .brand-block h1 {
    font-size: clamp(1.02rem, 4.7vw, 1.28rem);
  }

  .adventure-preview .voice-picker-button,
  .adventure-preview .icon-button {
    border-width: 2px;
    border-radius: 14px;
    box-shadow: 0 5px 0 rgba(78, 91, 103, 0.1);
  }

  .adventure-preview .tabs {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    gap: 4px;
    padding: 6px;
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    background: rgba(255, 253, 246, 0.96);
    box-shadow: 0 8px 0 rgba(51, 87, 70, 0.12), 0 16px 32px rgba(45, 74, 61, 0.18);
  }

  .adventure-preview .tab {
    min-height: 66px;
    padding: 4px 2px;
    border: 2px solid transparent;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
  }

  .adventure-preview .tab .tab-art {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .adventure-preview .tab.active {
    border-color: #f0c452;
    background: #fff7cf;
    box-shadow: 0 4px 0 rgba(222, 174, 46, 0.23);
    transform: translateY(-1px);
  }

  .adventure-preview .english-activity-tabs {
    top: 5px;
    gap: 4px;
    margin: 8px 0;
    padding: 5px;
    border-width: 2px;
    border-radius: 19px;
    background: rgba(255, 253, 246, 0.95);
  }

  .adventure-preview .english-activity-button {
    min-height: 50px;
    padding: 4px;
    border-radius: 14px;
  }

  .adventure-preview .english-activity-button.active {
    box-shadow: 0 4px 0 rgba(57, 168, 117, 0.18);
  }

  .adventure-preview .view {
    padding: 8px;
    border-width: 2px;
    border-radius: 22px;
    box-shadow: 0 8px 0 rgba(73, 111, 91, 0.06), 0 14px 28px rgba(50, 86, 72, 0.09);
  }

  .adventure-preview .lesson-panel,
  .adventure-preview .utility-view {
    padding: 10px 7px;
  }

  .adventure-preview .section-heading h2 {
    font-size: 1.42rem;
  }

  .adventure-preview .lesson-status span {
    padding: 5px 8px;
  }

  .adventure-preview .round-size-switch,
  .adventure-preview .stage-switch,
  .adventure-preview .pinyin-switch {
    border-radius: 15px;
  }

  .adventure-preview .prompt-area {
    padding: 12px 8px;
    border-radius: 18px;
  }

  .adventure-preview .speak-card {
    border-radius: 18px;
    box-shadow: 0 6px 0 #3c73b6, 0 10px 18px rgba(60, 115, 182, 0.16);
  }

  .adventure-preview .choice-grid {
    gap: 10px;
  }

  .adventure-preview .choice-card,
  .adventure-preview .spell-card,
  .adventure-preview .repeat-card,
  .adventure-preview .pinyin-card,
  .adventure-preview .math-card {
    border-width: 2px;
    border-radius: 18px;
    box-shadow: 0 5px 0 rgba(70, 111, 89, 0.08);
  }

  .adventure-preview .feedback,
  .adventure-preview .score-badge {
    border-radius: 16px;
  }

  .adventure-preview .math-game-stage,
  .adventure-preview .word-game-scene {
    border-width: 3px;
    border-radius: 20px;
    box-shadow: 0 0 0 2px #cfe5db, 0 10px 22px rgba(44, 79, 62, 0.1);
  }

  .adventure-preview .stat-card {
    border-radius: 18px;
  }
}

/* Practice clarity and balanced math artwork */
.adventure-preview .stage-button {
  justify-items: center;
  text-align: center;
}

.adventure-preview .tab .math-art img {
  width: 92%;
  height: 92%;
  filter: saturate(0.88) contrast(1.04) brightness(1.02);
}

.adventure-preview #learnView .prompt-area {
  min-height: 0;
  margin-bottom: 12px;
  padding-block: 13px;
}

.adventure-preview .repeat-card {
  display: grid;
  grid-template-columns: 142px minmax(300px, 440px);
  grid-template-rows: auto auto;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  gap: 6px 22px;
  align-items: center;
  justify-items: stretch;
  justify-self: center;
  padding: 20px 24px;
  text-align: center;
}

.adventure-preview .repeat-visual {
  grid-column: 1;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
}

.adventure-preview .repeat-card .visual {
  width: 142px;
  height: 142px;
  margin: 0;
}

.adventure-preview .repeat-copy {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 0;
}

.adventure-preview .repeat-target {
  width: 100%;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  overflow-wrap: anywhere;
  text-align: center;
}

.adventure-preview .repeat-meaning {
  font-size: 1rem;
}

.adventure-preview .repeat-card .mic-button {
  min-width: 168px;
  min-height: 54px;
  margin-top: 4px;
}

.adventure-preview .repeat-result {
  grid-column: 2;
  grid-row: 2;
  padding-top: 2px;
  border-top: 0;
  font-size: 0.9rem;
  text-align: center;
}

.adventure-preview .spell-card {
  width: min(100%, 860px);
  min-height: 0;
  gap: 20px;
  padding: 24px 28px;
}

.adventure-preview .spell-focus {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  width: min(100%, 720px);
  gap: 24px;
}

.adventure-preview .spell-card .visual {
  width: 146px;
  height: 146px;
  margin: 0;
}

.adventure-preview .spell-word {
  gap: 10px;
  justify-content: flex-start;
}

.adventure-preview .letter-slot {
  width: 54px;
  height: 64px;
  border-radius: 12px;
  font-size: 2rem;
}

.adventure-preview .letter-slot.blank.current {
  border-color: #f0b82f;
  background: #fff8d9;
  box-shadow: 0 0 0 4px rgba(240, 184, 47, 0.17);
}

.adventure-preview .letter-bank {
  width: min(100%, 680px);
  gap: 10px;
}

.adventure-preview .letter-button {
  min-height: 62px;
  border-width: 3px;
  border-radius: 14px;
  font-size: 1.65rem;
}

.adventure-preview .math-bird-art {
  filter: saturate(1.28) contrast(1.08) brightness(1.02);
}

.adventure-preview .math-cannon-art {
  filter: saturate(1.34) contrast(1.1) brightness(1.02);
}

.adventure-preview .math-enemy-art {
  filter: saturate(1.32) contrast(1.1) brightness(1.02) drop-shadow(0 10px 8px rgba(38, 56, 69, 0.16));
}

.adventure-preview .math-balloon {
  filter: saturate(1.24) contrast(1.07) brightness(1.01);
}

.adventure-preview .math-arrow {
  filter: saturate(1.3) contrast(1.1) brightness(1.02) drop-shadow(0 4px 5px rgba(80, 54, 28, 0.18));
}

.adventure-preview .math-arrow.math-bullet-shot {
  filter: saturate(1.36) contrast(1.12) brightness(1.02) drop-shadow(0 4px 5px rgba(80, 54, 28, 0.18));
}

@media (max-width: 760px) {
  .adventure-preview #learnView .prompt-area {
    margin-bottom: 9px;
    padding-block: 10px;
  }

  .adventure-preview .repeat-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px 12px;
    padding: 14px 12px;
  }

  .adventure-preview .repeat-card .visual {
    width: 92px;
    height: 92px;
  }

  .adventure-preview .repeat-copy {
    gap: 4px;
  }

  .adventure-preview .repeat-target {
    font-size: clamp(1.4rem, 7vw, 2rem);
  }

  .adventure-preview .repeat-meaning {
    font-size: 0.84rem;
  }

  .adventure-preview .repeat-card .mic-button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 8px 10px;
  }

  .adventure-preview .repeat-result {
    font-size: 0.78rem;
  }

  .adventure-preview .spell-card {
    gap: 15px;
    padding: 15px 12px;
  }

  .adventure-preview .spell-focus {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
  }

  .adventure-preview .spell-card .visual {
    width: 90px;
    height: 90px;
  }

  .adventure-preview .spell-word {
    gap: 5px;
    justify-content: flex-start;
  }

  .adventure-preview .letter-slot {
    width: clamp(34px, 10vw, 42px);
    height: 50px;
    border-radius: 9px;
    font-size: 1.45rem;
  }

  .adventure-preview .letter-bank {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .adventure-preview .letter-button {
    min-height: 56px;
    font-size: 1.45rem;
  }
}

/* Cartoon controls: stronger hierarchy and child-friendly touch targets */
.adventure-preview {
  --cartoon-ink: #29475b;
  --cartoon-line: #a9d5c4;
  --cartoon-yellow: #ffd45f;
  --cartoon-yellow-dark: #dcae36;
  --cartoon-green: #42b984;
  --cartoon-green-dark: #218661;
  --cartoon-blue: #5ca7ec;
  --cartoon-coral: #f47e63;
}

.adventure-preview button {
  min-height: 44px;
  color: var(--cartoon-ink);
  font-weight: 900;
  touch-action: manipulation;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.adventure-preview button:focus-visible {
  outline: 5px solid rgba(255, 204, 64, 0.52);
  outline-offset: 4px;
}

.adventure-preview button:active:not(:disabled) {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 2px 0 rgba(50, 76, 66, 0.2);
}

.adventure-preview .topbar {
  border-color: #ffffff;
  box-shadow: 0 9px 0 rgba(57, 126, 94, 0.14), 0 19px 40px rgba(50, 86, 72, 0.14);
}

.adventure-preview .brand-mascot {
  border-color: #ffffff;
  background: #fff3a9;
  box-shadow: 0 8px 0 rgba(65, 141, 105, 0.2), 0 15px 25px rgba(54, 112, 87, 0.14);
}

.adventure-preview .tabs {
  align-items: stretch;
}

.adventure-preview .tab {
  position: relative;
  min-height: 102px;
  border-color: rgba(151, 197, 179, 0.74);
  box-shadow: 0 7px 0 rgba(73, 124, 100, 0.16), 0 13px 22px rgba(43, 83, 64, 0.1);
}

.adventure-preview .tab::after {
  position: absolute;
  top: 5px;
  right: 9px;
  color: transparent;
  font-size: 1.15rem;
  line-height: 1;
  content: "★";
  transform: rotate(10deg);
}

.adventure-preview .tab.active::after {
  color: #f1b82d;
  text-shadow: 0 2px 0 #ffffff;
}

.adventure-preview .tab .tab-art {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 0 rgba(75, 116, 97, 0.12);
}

.adventure-preview .tab:hover .tab-art,
.adventure-preview .tab:focus-visible .tab-art {
  transform: rotate(-4deg) scale(1.06);
}

.adventure-preview .tab.active {
  border-color: #f0bd3f;
  background: #fffdf2;
  box-shadow: 0 9px 0 var(--cartoon-yellow-dark), 0 16px 28px rgba(91, 102, 55, 0.16);
}

.adventure-preview .tab strong {
  color: var(--cartoon-ink);
  font-size: 1.18rem;
}

.adventure-preview .english-activity-tabs {
  border-color: #ffffff;
  background: #f8fcf8;
  box-shadow: 0 7px 0 rgba(64, 119, 91, 0.13), 0 13px 24px rgba(55, 91, 73, 0.08);
}

.adventure-preview .english-activity-button {
  min-height: 78px;
  border: 3px solid transparent;
}

.adventure-preview .english-activity-button > .activity-art {
  width: 54px;
  height: 54px;
  border: 3px solid #ffffff;
  background: #eef8f2;
  box-shadow: 0 5px 0 rgba(67, 112, 91, 0.12);
}

.adventure-preview .english-activity-button.active {
  border-color: #42ae7b;
  background: #e5f8ed;
  box-shadow: 0 6px 0 #a4ddc0;
}

.adventure-preview .round-size-switch {
  min-height: 60px;
  padding: 6px;
  border: 3px solid #ffffff;
  background: #edf7f1;
}

.adventure-preview .round-size-switch > span {
  padding-inline: 10px;
  color: #567063;
  font-weight: 950;
}

.adventure-preview .round-size-button {
  min-width: 76px;
  min-height: 48px;
  border: 2px solid transparent;
  font-size: 1rem;
}

.adventure-preview .round-size-button.active {
  border-color: #e2b43c;
  color: #5e4918;
  background: #ffef9d;
  box-shadow: 0 5px 0 #e0ba50;
}

.adventure-preview .stage-switch,
.adventure-preview .pinyin-switch {
  gap: 8px;
  padding: 7px;
  border: 3px solid #ffffff;
  background: #edf7f2;
}

.adventure-preview .stage-button {
  min-height: 78px;
  padding: 10px 12px;
  border: 3px solid #cfe4da;
  background: #fffefa;
  box-shadow: 0 5px 0 rgba(76, 123, 101, 0.12);
}

.adventure-preview .stage-button:nth-child(1) { background: #eaf6ff; }
.adventure-preview .stage-button:nth-child(2) { background: #fff0e7; }
.adventure-preview .stage-button:nth-child(3) { background: #fff7cd; }
.adventure-preview .pinyin-switch .stage-button:nth-child(4) { background: #eee9ff; }

.adventure-preview .stage-button span {
  color: #667a70;
  font-size: 0.78rem;
  font-weight: 850;
}

.adventure-preview .stage-button strong {
  color: var(--cartoon-ink);
  font-size: 1.08rem;
}

.adventure-preview .stage-button.active {
  border-color: var(--cartoon-green);
  background: #ffffff;
  box-shadow: 0 7px 0 #9eddbd, 0 12px 19px rgba(48, 126, 91, 0.12);
  transform: translateY(-2px);
}

.adventure-preview .prompt-area {
  border: 3px dashed #b9dcca;
  background: linear-gradient(135deg, #eaf6ff, #f4fae9);
}

.adventure-preview .prompt-kicker {
  color: #516b78;
  font-weight: 950;
}

.adventure-preview .speak-card {
  min-height: 88px;
  border-width: 4px;
  font-weight: 950;
}

.adventure-preview .speaker-mark {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  color: #4d86d6;
  background: #ffffff;
  box-shadow: 0 5px 0 rgba(38, 82, 141, 0.2);
}

.adventure-preview .choice-card,
.adventure-preview .pinyin-option,
.adventure-preview .letter-button,
.adventure-preview .math-answer {
  border-color: #bcded0;
  box-shadow: 0 7px 0 rgba(68, 128, 100, 0.14), 0 12px 18px rgba(56, 91, 74, 0.07);
}

.adventure-preview .choice-card:active:not(:disabled),
.adventure-preview .pinyin-option:active:not(:disabled),
.adventure-preview .letter-button:active:not(:disabled),
.adventure-preview .math-answer:active:not(:disabled) {
  transform: translateY(5px) scale(0.98);
}

/* Pinyin reading cards */
#pinyinView .learning-panel {
  overflow: hidden;
}

.pinyin-reading-status span:last-child {
  text-align: right;
}

.pinyin-reading-card {
  position: relative;
  display: grid;
  width: min(100%, 860px);
  min-height: 390px;
  margin: 24px auto 18px;
  padding: 34px 42px;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "group speaker"
    "formula character";
  align-items: center;
  gap: 20px 36px;
  color: #20324c;
  border: 4px solid #ffffff;
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 222, 99, 0.5) 0 42px, transparent 44px),
    linear-gradient(145deg, #e9f7ff 0%, #fffdf2 52%, #e9f8ed 100%);
  box-shadow: 0 9px 0 #b9ddd1, 0 18px 34px rgba(48, 92, 76, 0.16);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pinyin-reading-card:hover,
.pinyin-reading-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 0 #acd5c7, 0 22px 38px rgba(48, 92, 76, 0.18);
}

.pinyin-reading-card:active {
  transform: translateY(5px);
  box-shadow: 0 4px 0 #acd5c7, 0 10px 20px rgba(48, 92, 76, 0.14);
}

.pinyin-reading-card.playing {
  border-color: #77cda6;
  background: linear-gradient(145deg, #e5f8ff 0%, #fff3bd 52%, #dff6e7 100%);
}

.pinyin-reading-group {
  grid-area: group;
  justify-self: start;
  padding: 9px 16px;
  color: #267656;
  border: 2px solid #a8dcc6;
  border-radius: 999px;
  background: #ffffff;
  font-size: 1rem;
  font-weight: 950;
}

.pinyin-speaker-badge {
  display: grid;
  width: 58px;
  height: 58px;
  grid-area: speaker;
  justify-self: end;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #5c93de;
  box-shadow: 0 6px 0 #316cb9;
  font-size: 1.55rem;
}

.pinyin-reading-formula {
  display: flex;
  min-width: 0;
  grid-area: formula;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  font-family: Arial, sans-serif;
  font-size: 3.4rem;
  font-weight: 900;
  white-space: nowrap;
}

.pinyin-reading-formula strong {
  color: #e45642;
  font-size: 4.9rem;
}

.pinyin-formula-symbol {
  color: #72909e;
  font-size: 2.2rem;
}

.pinyin-reading-character {
  display: grid;
  min-width: 220px;
  min-height: 230px;
  grid-area: character;
  place-items: center;
  color: #263852;
  border: 4px solid #ffffff;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 22px rgba(54, 89, 78, 0.12);
  font-size: 9rem;
  font-weight: 950;
  line-height: 1;
}

.pinyin-reading-card.complete .pinyin-reading-formula > span,
.pinyin-reading-card.complete .pinyin-formula-symbol {
  display: none;
}

.pinyin-reading-card.complete .pinyin-reading-formula strong {
  color: #2f9b72;
  font-size: 4rem;
}

.pinyin-reading-card.complete .pinyin-reading-character {
  color: #b15d1c;
  background: #fff4bd;
  font-size: 4.2rem;
}

.pinyin-page-controls {
  display: grid;
  width: min(100%, 760px);
  margin: 10px auto 2px;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 14px;
}

.pinyin-page-controls button {
  min-width: 0;
  min-height: 60px;
}

.pinyin-read-button {
  background: #ee7559;
}

.pinyin-page-button:disabled {
  opacity: 0.38;
  transform: none;
  box-shadow: none;
}

@media (max-width: 680px) {
  #pinyinView .learning-panel {
    padding-inline: 12px;
  }

  .pinyin-reading-status {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .pinyin-reading-status span:last-child {
    text-align: left;
    font-size: 0.82rem;
  }

  .pinyin-reading-card {
    min-height: 430px;
    margin: 16px auto 14px;
    padding: 20px 18px 24px;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "group speaker"
      "formula formula"
      "character character";
    gap: 14px;
    border-radius: 22px;
  }

  .pinyin-reading-group {
    padding: 7px 12px;
    font-size: 0.85rem;
  }

  .pinyin-speaker-badge {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .pinyin-reading-formula {
    gap: 10px;
    font-size: 2.35rem;
  }

  .pinyin-reading-formula strong {
    font-size: 3.45rem;
  }

  .pinyin-formula-symbol {
    font-size: 1.55rem;
  }

  .pinyin-reading-character {
    width: 100%;
    min-width: 0;
    min-height: 230px;
    font-size: 7.8rem;
  }

  .pinyin-reading-card.complete .pinyin-reading-formula strong,
  .pinyin-reading-card.complete .pinyin-reading-character {
    font-size: 3.2rem;
  }

  .pinyin-page-controls {
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 7px;
  }

  .pinyin-page-controls button {
    min-height: 56px;
    padding-inline: 8px;
    font-size: 0.9rem;
  }
}

.adventure-preview .feedback {
  min-height: 62px;
  border-width: 3px;
  background: #f0fbf5;
  font-weight: 900;
}

.adventure-preview .feedback > span:first-child {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(69, 124, 98, 0.13);
}

.adventure-preview .score-badge {
  min-height: 58px;
  color: #674f17;
  font-weight: 950;
  background: #fff1a9;
}

.adventure-preview .primary-button,
.adventure-preview .secondary-button,
.adventure-preview .mic-button {
  min-height: 56px;
  padding-inline: 24px;
  font-size: 1.05rem;
}

.adventure-preview .primary-button {
  border-width: 4px;
  box-shadow: 0 8px 0 #bd5543, 0 14px 22px rgba(189, 85, 67, 0.2);
}

.adventure-preview .secondary-button {
  border-width: 3px;
  box-shadow: 0 6px 0 rgba(64, 104, 83, 0.14);
}

@media (max-width: 760px) {
  .adventure-preview .tab {
    min-height: 70px;
  }

  .adventure-preview .tab::after {
    top: 3px;
    right: 5px;
    font-size: 0.8rem;
  }

  .adventure-preview .tab .tab-art {
    width: 39px;
    height: 39px;
    border-width: 2px;
  }

  .adventure-preview .tab strong {
    font-size: 0.82rem;
  }

  .adventure-preview .english-activity-button {
    min-height: 58px;
    border-width: 2px;
  }

  .adventure-preview .english-activity-button > .activity-art {
    width: 40px;
    height: 40px;
    border-width: 2px;
  }

  .adventure-preview .round-size-switch {
    min-height: 54px;
    padding: 4px;
  }

  .adventure-preview .round-size-button {
    min-width: 0;
    min-height: 46px;
    padding-inline: 10px;
  }

  .adventure-preview .stage-switch,
  .adventure-preview .pinyin-switch {
    gap: 5px;
    padding: 5px;
    border-width: 2px;
  }

  .adventure-preview .stage-button {
    min-height: 66px;
    padding: 7px 4px;
    border-width: 2px;
  }

  .adventure-preview .stage-button strong {
    font-size: 0.86rem;
  }

  .adventure-preview .stage-button span {
    font-size: 0.67rem;
  }

  .adventure-preview .prompt-area {
    border-width: 2px;
  }

  .adventure-preview .speak-card {
    min-height: 72px;
    border-width: 3px;
  }

  .adventure-preview .speaker-mark {
    width: 42px;
    height: 42px;
  }

  .adventure-preview .primary-button,
  .adventure-preview .secondary-button,
  .adventure-preview .mic-button {
    min-height: 52px;
    padding-inline: 16px;
  }
}
