:root {
  --green: #3db86e;
  --green-dark: #2a9d57;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --orange: #f59e0b;
  --pink: #fb7185;
  --ink: #1f2937;
  --muted: #6b7280;
  --paper: #fffdf8;
  --card: #ffffff;
  --line: #f3e7d3;
  --shadow: 0 10px 28px rgba(47, 79, 47, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, #fff7d6 0, transparent 28%),
    radial-gradient(circle at 92% 0%, #d8f5e3 0, transparent 32%),
    radial-gradient(circle at 80% 90%, #dbeafe 0, transparent 30%),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

button, input {
  font-family: inherit;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

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

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

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #67e29a, #22c55e);
  display: grid;
  place-items: center;
  font-size: 26px;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.5px;
}

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

.stats {
  display: flex;
  gap: 8px;
}

.stat {
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 14px;
}

.back {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
  cursor: pointer;
}

.hero {
  background: linear-gradient(135deg, #34d399, #059669);
  color: white;
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.hero h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.hero p { margin: 0; opacity: 0.92; }
.planet {
  position: absolute;
  right: 18px;
  top: 10px;
  font-size: 72px;
  opacity: 0.35;
}

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

.card, .unit, .word, .choice, .panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.grade {
  border: 0;
  text-align: left;
  padding: 18px;
  cursor: pointer;
  min-height: 120px;
  color: white;
  position: relative;
  overflow: hidden;
}

.grade h3 { margin: 0 0 6px; font-size: 22px; }
.grade p { margin: 0; opacity: 0.92; }
.grade .count {
  margin-top: 12px;
  font-weight: 800;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.btn {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn-green { background: var(--green); color: white; }
.btn-blue { background: var(--blue); color: white; }
.btn-purple { background: var(--purple); color: white; }
.btn-orange { background: var(--orange); color: white; }
.btn-pink { background: var(--pink); color: white; }
.btn-ghost { background: #fff; color: var(--ink); }
.btn-wide { grid-column: 1 / -1; }

.unit {
  padding: 16px;
  border: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
}

.unit h3 { margin: 0 0 4px; }
.unit p { margin: 0; color: var(--muted); }
.progress-row {
  margin-top: 10px;
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.progress-row span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #34d399, #22c55e);
}

.word {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.word .en {
  font-size: 22px;
  font-weight: 800;
}
.word .zh { color: var(--muted); }
.speak {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: #ecfdf5;
  cursor: pointer;
  font-size: 20px;
}

.flash {
  min-height: 280px;
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flash .en {
  font-size: 48px;
  font-weight: 900;
  margin: 8px 0 4px;
}
.flash .phonetic { color: var(--muted); margin-bottom: 12px; }
.flash .zh { font-size: 28px; font-weight: 800; }
.example { margin-top: 16px; color: #334155; }

.quiz-word {
  text-align: center;
  padding: 18px;
}
.quiz-word .hint {
  font-size: 18px;
  color: var(--muted);
}

.choices {
  display: grid;
  gap: 12px;
}

.choice {
  min-height: 56px;
  border: 3px solid transparent;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.choice.correct { border-color: var(--green); background: #ecfdf5; }
.choice.wrong { border-color: #ef4444; background: #fef2f2; }

.spell-box {
  min-height: 64px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 4px;
  margin: 12px 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.keys {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.key {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
}

.feedback {
  margin: 12px 0;
  font-weight: 800;
  text-align: center;
  min-height: 24px;
}

.ok { color: var(--green-dark); }
.bad { color: #dc2626; }

.meter {
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 16px;
}
.meter span {
  display: block;
  height: 100%;
  background: #22c55e;
}

.empty, .done {
  text-align: center;
  padding: 40px 16px;
}

.badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .flash .en { font-size: 36px; }
  .keys { grid-template-columns: repeat(6, 1fr); }
  .hero h2 { font-size: 24px; }
}
