:root {
  --bg: #f3f7ef;
  --panel: #ffffff;
  --ink: #21312b;
  --muted: #617069;
  --green: #207a5a;
  --green-dark: #12583f;
  --yellow: #ffd166;
  --blue: #2f80ed;
  --red: #d84848;
  --border: #d8e2d9;
  --shadow: 0 18px 40px rgba(30, 64, 52, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 209, 102, 0.34), transparent 26rem),
    linear-gradient(135deg, #edf7f2 0%, #f7fbff 58%, #fff8e6 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hero {
  min-height: 48vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
}

.island-mark {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 32px;
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 54px;
}

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

h1 {
  font-size: clamp(2.1rem, 7vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  color: var(--muted);
  font-size: clamp(1rem, 3vw, 1.28rem);
}

.hero .encourage {
  max-width: 720px;
  padding: 0 10px;
  color: var(--green-dark);
  font-size: clamp(1.02rem, 2.6vw, 1.22rem);
  line-height: 1.6;
  font-weight: 700;
}

.primary-btn,
.secondary-btn,
.unit-btn,
.listen-btn,
.icon-text-btn,
.option-btn,
.word-chip {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-btn {
  padding: 14px 28px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(32, 122, 90, 0.25);
}

.primary-btn:hover,
.unit-btn:hover,
.option-btn:hover,
.word-chip:hover,
.listen-btn:hover,
.secondary-btn:hover,
.icon-text-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:active,
.unit-btn:active,
.option-btn:active,
.word-chip:active,
.listen-btn:active,
.secondary-btn:active,
.icon-text-btn:active {
  transform: translateY(1px);
}

.unit-panel,
.stage-panel,
.question-card,
.result-card {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.unit-panel {
  padding: 22px;
}

.stage-panel {
  margin-top: 16px;
  padding: 22px;
}

.unit-panel h2,
.stage-panel h2 {
  margin-bottom: 14px;
}

.stage-panel p {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.unit-grid,
.stage-grid {
  display: grid;
  gap: 14px;
}

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

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

.unit-btn,
.stage-btn {
  display: grid;
  gap: 6px;
  padding: 18px 12px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--border);
  text-align: center;
}

.unit-btn span,
.stage-btn span {
  font-size: 1.35rem;
  font-weight: 800;
}

.stage-btn span {
  font-size: 1.05rem;
}

.unit-btn small,
.stage-btn small {
  color: var(--muted);
}

.game-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}

.game-top > div:nth-child(2) {
  display: grid;
  justify-items: center;
  gap: 4px;
}

#unit-title {
  font-size: 1.15rem;
}

#progress-text {
  color: var(--muted);
}

.icon-text-btn,
.secondary-btn {
  padding: 12px 16px;
  color: var(--green-dark);
  background: #fff;
  border: 2px solid var(--border);
  font-weight: 700;
}

.score-box {
  min-width: 76px;
  padding: 8px 10px;
  display: grid;
  justify-items: center;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--border);
}

.score-box span,
.result-stats span {
  color: var(--muted);
  font-size: 0.88rem;
}

.score-box strong {
  font-size: 1.3rem;
  color: var(--green);
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8df;
  margin-bottom: 14px;
}

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

.question-card {
  padding: clamp(18px, 4vw, 34px);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.question-image {
  min-height: 112px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  font-size: clamp(4rem, 16vw, 7.5rem);
}

.question-image img {
  max-width: min(240px, 80%);
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
}

.question-text {
  min-height: 58px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(1.18rem, 4vw, 1.7rem);
  line-height: 1.45;
  font-weight: 700;
}

.listen-btn {
  width: 100%;
  margin: 14px 0;
  color: #163a6b;
  background: #eaf2ff;
  border: 2px solid #cfe0fb;
  font-weight: 800;
}

.answer-area {
  display: grid;
  gap: 12px;
}

.option-btn {
  width: 100%;
  padding: 14px 16px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--border);
  text-align: left;
  font-weight: 700;
  line-height: 1.35;
}

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

.option-btn.wrong {
  border-color: var(--red);
  background: #fff0f0;
}

.fill-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.fill-input {
  min-height: 56px;
  width: 100%;
  padding: 0 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 1.1rem;
}

.word-bank,
.sentence-build {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.word-chip {
  padding: 12px 16px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--border);
  font-weight: 800;
}

.word-chip.used {
  opacity: 0.45;
}

.sentence-build {
  min-height: 64px;
  padding: 10px;
  align-items: center;
  border-radius: 8px;
  background: #f5faf7;
  border: 2px dashed #bdd6c8;
}

.feedback {
  min-height: 54px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.45;
  background: #f4f7f5;
  color: var(--muted);
}

.feedback.good {
  color: var(--green-dark);
  background: #e9f8ef;
}

.feedback.bad {
  color: #8a2d2d;
  background: #fff0f0;
}

.next-btn {
  width: 100%;
  margin-top: 14px;
}

.hidden {
  display: none;
}

.result-card {
  margin-top: 28px;
  padding: clamp(18px, 4vw, 34px);
}

.result-card h2 {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

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

.result-stats div {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  border-radius: 8px;
  background: #f5faf7;
  border: 1px solid var(--border);
}

.result-stats strong {
  color: var(--green);
  font-size: 2rem;
}

.mistake-section h3 {
  margin-bottom: 12px;
}

.mistake-list {
  display: grid;
  gap: 12px;
}

.mistake-item {
  padding: 14px;
  border-radius: 8px;
  background: #fffaf0;
  border: 1px solid #f2d38b;
  line-height: 1.5;
}

.mistake-item strong {
  display: block;
  margin-bottom: 4px;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}

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

  .hero {
    min-height: 42vh;
  }

  .unit-grid,
  .stage-grid,
  .result-stats,
  .result-actions {
    grid-template-columns: 1fr;
  }

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

  .game-top > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .icon-text-btn {
    justify-self: start;
  }

  .fill-row {
    grid-template-columns: 1fr;
  }
}
