:root {
  --primary: #3b6ef6;
  --primary-dark: #2b54c8;
  --ok: #2fb36a;
  --no: #e0533d;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #8a90a0;
  --line: #e6e9f0;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-title { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.stat-strip { display: flex; gap: 14px; font-size: 13px; opacity: .95; }

.tabbar {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 9;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  padding: 13px 0;
  font-size: 15px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

main { padding: 14px; max-width: 640px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field select {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.btn {
  display: inline-block;
  padding: 13px 18px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  margin: 4px 0;
}
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); width: 100%; font-weight: 600; }
.btn.primary:active { background: var(--primary-dark); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.no { background: var(--no); color: #fff; border-color: var(--no); }

.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.section-label { font-size: 14px; color: var(--muted); margin: 0 0 12px; }

.progress-line { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 10px; }

.card { text-align: center; padding: 24px 10px; }
.word-line { display: flex; align-items: center; justify-content: center; gap: 10px; }
.word { font-size: 34px; font-weight: 700; letter-spacing: .5px; }
.speak-btn { border: none; background: none; font-size: 24px; cursor: pointer; }
.phonetic { color: var(--muted); font-size: 17px; margin-top: 6px; min-height: 22px; }
.meaning { font-size: 22px; margin-top: 18px; color: var(--primary-dark); }

.choice-area { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.choice-area .btn { width: 100%; text-align: left; }
.choice-area .btn.correct { background: var(--ok); color: #fff; border-color: var(--ok); }
.choice-area .btn.wrong { background: var(--no); color: #fff; border-color: var(--no); }

.spell-area { margin-top: 18px; }
.spell-meaning { font-size: 20px; margin-bottom: 14px; color: var(--primary-dark); }
.spell-area input {
  width: 100%;
  padding: 13px;
  font-size: 18px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1; }

.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.topic-btn {
  padding: 18px 0;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.topic-btn:active { background: var(--bg); }

.passage {
  font-size: 17px;
  line-height: 1.7;
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 16px;
}
.q-block { margin-bottom: 18px; }
.q-title { font-weight: 600; margin: 0 0 8px; }
.q-option { display: block; padding: 9px 6px; font-size: 15px; }

.review-item { padding: 12px; border-radius: 10px; margin-bottom: 10px; font-size: 14px; }
.review-item.ok { background: #eaf7f0; }
.review-item.no { background: #fdeeeb; }
.review-item .expl { color: var(--muted); margin-top: 6px; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 10px auto 16px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.big-stats { display: flex; justify-content: space-around; text-align: center; }
.big-stat b { display: block; font-size: 30px; color: var(--primary); }
.big-stat span { font-size: 13px; color: var(--muted); }

.wrong-list { margin: 10px 0; }
.wrong-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.wrong-row span { color: var(--muted); }
