:root {
  --ink: #2d2630;
  --muted: #6f6572;
  --paper: #fffaf7;
  --panel: #ffffff;
  --pink: #ff8fb8;
  --pink-soft: #ffe2ed;
  --mint: #8edec4;
  --blue: #8cc7ff;
  --yellow: #ffd86f;
  --violet: #b9a4ff;
  --green: #69bd91;
  --line: #f0d9df;
  --shadow: 0 18px 40px rgba(84, 52, 72, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 143, 184, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(140, 199, 255, 0.10) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar,
.hero,
.view,
.tabbar,
.encouragement-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border-radius: 8px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--violet));
}

.eyebrow {
  margin: 0 0 4px;
  color: #9c5676;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 22px;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.version-switch,
.tabbar,
.today-strip,
.stamp-row,
.question-meta,
.tag-row,
.lesson-actions,
.level-topline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-switch,
.tag-row {
  flex-wrap: wrap;
}

.version-switch {
  justify-content: flex-end;
}

.version-chip,
.tab-button,
.soft-button,
.ghost-button,
.install-button,
.option-button,
.letter-button,
.memory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.version-chip,
.tab-button,
.soft-button,
.ghost-button,
.install-button {
  padding: 10px 14px;
  font-weight: 800;
}

.version-chip.active,
.tab-button.active,
.soft-button,
.install-button {
  border-color: #f4a6c1;
  background: var(--pink-soft);
}

.ghost-button {
  background: #fff;
}

.version-chip:hover,
.tab-button:hover,
.soft-button:hover,
.ghost-button:hover,
.install-button:hover,
.option-button:hover,
.letter-button:hover,
.memory-card:hover,
.level-card:hover {
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 24px;
  margin-top: 18px;
  padding: 28px;
  border-radius: 8px;
}

.hero-text {
  max-width: 650px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.today-strip {
  flex-wrap: wrap;
  margin-top: 22px;
}

.install-button {
  display: none;
  margin-top: 16px;
}

.can-install-app .install-button {
  display: inline-flex;
}

.today-strip > div {
  min-width: 126px;
  padding: 14px;
  border: 1px dashed #efacc5;
  border-radius: 8px;
  background: #fff7fa;
}

.stat-value,
.stat-label {
  display: block;
}

.stat-value {
  font-size: 27px;
  font-weight: 900;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.mascot-panel {
  position: relative;
  min-height: 320px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #f4d5df;
  background: linear-gradient(180deg, #fff9fb, #eafaf4);
}

.mascot-panel img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.speech {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #f0c8d6;
}

.speech strong,
.speech span {
  display: block;
}

.speech span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.55;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 2;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0;
  padding: 10px;
  border-radius: 8px;
}

.view {
  display: none;
  padding: 24px;
  border-radius: 8px;
}

.view.active {
  display: block;
}

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

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

.level-card,
.report-card,
.rule-panel,
.question-panel,
.word-game,
.spelling-game,
.word-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.level-card {
  min-height: 226px;
  padding: 16px;
  cursor: pointer;
}

.level-card.selected {
  border-color: #e780aa;
  background: #fff8fb;
}

.level-topline {
  justify-content: space-between;
}

.level-topline strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
}

.level-topline span,
.tag-row span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #7a4a60;
  font-size: 12px;
  font-weight: 800;
  background: #fff0f6;
}

.level-card h3 {
  margin-top: 14px;
}

.level-card p {
  color: var(--muted);
  line-height: 1.55;
}

.stars {
  display: flex;
  gap: 3px;
  margin-top: 14px;
  color: #d69b16;
  font-weight: 900;
}

.lesson-layout,
.word-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.rule-panel,
.question-panel,
.word-game,
.spelling-game {
  padding: 18px;
}

.rule-panel {
  background: #f7fff9;
}

.rule-panel p,
.game-note,
.word-example,
.word-card p,
.report-card p,
.encouragement-card p {
  color: var(--muted);
  line-height: 1.65;
}

.stamp-row,
.question-meta {
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: #fff8df;
  color: #7a5a12;
}

.stamp-row {
  margin-top: 14px;
}

.question-meta {
  margin-bottom: 16px;
  background: #f3f0ff;
  color: #5b4f8e;
}

.progress-shell {
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffe7f0;
}

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

#questionPrompt {
  font-size: clamp(23px, 3vw, 34px);
}

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

.option-button {
  min-height: 64px;
  padding: 14px;
  font-size: 20px;
  font-weight: 900;
}

.option-button.correct {
  border-color: var(--green);
  background: #e8fff2;
}

.option-button.wrong {
  border-color: #ef8b9f;
  background: #fff1f4;
}

.feedback {
  min-height: 94px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #f1cbd7;
  background: #fff9fb;
}

.feedback p {
  margin-bottom: 0;
}

.lesson-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 14px;
}

.word-layout {
  align-items: start;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.memory-card {
  min-height: 84px;
  padding: 10px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff, #fff4f8);
}

.memory-card.matched {
  border-color: var(--mint);
  background: #eafff7;
}

.letter-bank,
.spell-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 52px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed #e8b4c8;
  background: #fff8fb;
}

.letter-button {
  min-width: 42px;
  height: 42px;
  font-size: 18px;
  font-weight: 900;
}

.spell-answer {
  margin-bottom: 14px;
  background: #f5fbff;
  font-size: 20px;
  font-weight: 900;
}

.word-bank {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.word-card {
  padding: 14px;
}

.word-card strong,
.word-card span {
  display: block;
}

.word-card strong {
  font-size: 18px;
}

.word-card span {
  margin: 3px 0 8px;
  color: #9c5676;
  font-weight: 800;
}

.word-card p {
  margin-bottom: 0;
  font-size: 13px;
}

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

.report-card {
  padding: 18px;
}

.report-number {
  display: block;
  color: #c05784;
  font-size: 36px;
  font-weight: 900;
}

.encouragement-card {
  margin-top: 16px;
  padding: 20px;
  border-radius: 8px;
  background: #fffdf6;
}

.data-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 960px) {
  .level-grid,
  .word-bank {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .version-switch {
    justify-content: flex-start;
  }

  .hero,
  .lesson-layout,
  .word-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero,
  .view {
    padding: 16px;
  }

  .level-grid,
  .report-grid,
  .option-grid,
  .memory-grid,
  .word-bank {
    grid-template-columns: 1fr;
  }

  .today-strip > div {
    flex: 1 1 100%;
  }
}
