:root {
  --bg: #f7f3ea;
  --ink: #24312f;
  --muted: #6e7b78;
  --primary: #2f7d6b;
  --primary-dark: #1d5d50;
  --card: #fffdf7;
  --line: #e8dfcf;
  --danger: #b84a4a;
  --success: #247a45;
  font-family: Inter, "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top left, #d9f1e8, transparent 34%), var(--bg); color: var(--ink); }
.app { width: min(980px, calc(100% - 28px)); margin: 32px auto; }
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: stretch; margin-bottom: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 0; font-size: clamp(30px, 6vw, 56px); line-height: 1; }
.sub { color: var(--muted); font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); min-width: 330px; gap: 10px; }
.stats div { background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: 0 12px 30px rgba(45,60,55,.08); }
.stats strong { display: block; font-size: 32px; }
.stats span { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 8px; margin: 18px 0; }
button, input { font: inherit; }
button { border: 0; border-radius: 999px; padding: 12px 18px; color: white; background: var(--primary); cursor: pointer; font-weight: 800; box-shadow: 0 10px 22px rgba(47,125,107,.18); }
button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.secondary { background: #6c756f; }
.success { background: var(--success); }
.danger { background: var(--danger); }
.tab { background: #e8dfcf; color: var(--ink); box-shadow: none; }
.tab.active { background: var(--primary); color: white; }
.panel { display: none; }
.panel.active { display: block; }
.card, .quiz-box, .word-list, .add-form, .toolbar, .mistake-head { background: rgba(255,253,247,.88); border: 1px solid var(--line); border-radius: 28px; padding: 24px; box-shadow: 0 18px 50px rgba(45,60,55,.11); }
.flashcard { min-height: 330px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; transition: .2s ease; }
.flashcard:hover { transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
#frontText, #quizWord { font-size: clamp(42px, 9vw, 82px); line-height: 1; margin: 32px 0 16px; }
#hintText { color: var(--muted); }
.reading { color: var(--primary); font-weight: 900; margin: -6px 0 14px; }
.word-reading { color: var(--primary); font-weight: 800; }
.answer { border-top: 1px dashed var(--line); margin-top: 24px; padding-top: 18px; }
.hidden { display: none; }
.meaning { font-size: 28px; font-weight: 900; margin: 0 0 10px; }
.example { color: var(--muted); font-style: italic; margin: 0; }
.example-cn { color: var(--ink); margin: 8px 0 0; font-weight: 700; }
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.quiz-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.quiz-mode, .quiz-type { background: #e8dfcf; color: var(--ink); box-shadow: none; padding: 9px 14px; }
.quiz-mode.active, .quiz-type.active { background: var(--primary); color: white; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.choice { border-radius: 18px; background: white; color: var(--ink); border: 1px solid var(--line); box-shadow: none; text-align: left; }
.choice.correct { background: #dff5e7; border-color: #73bd8b; }
.choice.wrong { background: #f8dddd; border-color: #d28b8b; }
.quiz-answer-area { display: grid; gap: 12px; margin: 16px 0; }
.quiz-input { width: 100%; border: 1px solid var(--line); background: white; border-radius: 18px; padding: 14px 16px; font: inherit; }
.feedback { min-height: 26px; font-weight: 800; }
.mode-text { text-align: center; color: var(--primary); font-weight: 900; min-height: 24px; }
.mistake-head { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 12px; }
.mistake-head h2 { margin: 0 0 8px; font-size: 34px; }
.compact-actions { justify-content: flex-end; margin-top: 0; }
.mistake-meta { color: var(--danger); font-weight: 900; }
.empty-state { color: var(--muted); text-align: center; padding: 22px; }
.toolbar, .add-form { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
input { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 12px 16px; min-width: 170px; flex: 1; }
.word-list { display: grid; gap: 10px; }
.word-row { display: grid; grid-template-columns: 1.2fr 1fr .8fr auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 10px 0; }
.word-row:last-child { border-bottom: 0; }
.word-row strong { font-size: 20px; }
.badge { display: inline-block; color: var(--primary); background: #e4f3ee; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; }
.small { padding: 8px 12px; font-size: 13px; }
@media (max-width: 760px) {
  .hero, .stats, .mistake-head { display: block; min-width: 0; }
  .stats { display: grid; margin-top: 16px; }
  .choices { grid-template-columns: 1fr; }
  .word-row { grid-template-columns: 1fr; }
}
