:root {
  --green: #58cc02;
  --green-d: #46a302;
  --blue: #1cb0f6;
  --red: #ff4b4b;
  --yellow: #ffc800;
  --purple: #ce82ff;
  --ink: #3c3c3c;
  --muted: #777;
  --bg: #f7f9fb;
  --card: #ffffff;
  --line: #e5e5e5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding: 0 16px 28px;
  position: relative;
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0 10px;
  font-weight: 800;
  font-size: 15px;
}
.topbar .stat { display: flex; align-items: center; gap: 4px; }
.topbar .spacer { flex: 1; }
.topbar .hearts { color: var(--red); }
.topbar .streak { color: var(--orange, #ff9600); }
.topbar .xp { color: var(--green); }
.topbar .coins { color: var(--yellow); }
.iconbtn {
  border: none; background: #e9eef3; color: var(--ink);
  border-radius: 10px; padding: 8px 10px; font-weight: 800; font-size: 14px;
}

h1.title { font-size: 24px; font-weight: 900; margin: 8px 0 4px; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* 卡片 / 关卡 */
.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 0 var(--line);
}
.unit-card { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.unit-card.locked { opacity: .55; cursor: not-allowed; }
.unit-emoji { font-size: 34px; }
.unit-meta { flex: 1; }
.unit-name { font-weight: 800; font-size: 17px; }
.unit-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.unit-stars { color: var(--yellow); font-weight: 800; font-size: 14px; }

.level-row { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.level {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--line); border-radius: 14px; padding: 14px;
  background: var(--card); cursor: pointer; box-shadow: 0 2px 0 var(--line);
}
.level.locked { opacity: .5; cursor: not-allowed; }
.level-dot {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; flex-shrink: 0;
}
.level.locked .level-dot { background: #c8c8c8; }
.level-info { flex: 1; }
.level-name { font-weight: 800; }
.level-stars { color: var(--yellow); font-size: 14px; margin-top: 2px; letter-spacing: 2px; }

/* 按钮 */
.btn {
  display: block; width: 100%; border: none; border-radius: 14px;
  padding: 14px; font-size: 17px; font-weight: 900; cursor: pointer;
  background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-d);
  transition: transform .05s; margin-top: 10px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-d); }
.btn.blue { background: var(--blue); box-shadow: 0 4px 0 #1490cc; }
.btn.ok-btn { background: var(--green); box-shadow: 0 4px 0 var(--green-d); }
.btn.no-btn { background: var(--red); box-shadow: 0 4px 0 #c0392b; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn:disabled { opacity: .5; }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; margin-top: 8px; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 12px; background: #fff; border: 2px solid var(--line); font-weight: 800; cursor: pointer; }
.tab.active { background: var(--green); color: #fff; border-color: var(--green); }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 800; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.field input {
  width: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 12px;
  font-size: 16px; background: #fff; outline: none;
}
.field input:focus { border-color: var(--blue); }

.hint { font-size: 13px; color: var(--muted); text-align: center; margin-top: 12px; }
.error { color: var(--red); font-size: 14px; text-align: center; margin-top: 8px; min-height: 18px; }

/* 题目 */
.quiz-progress { height: 14px; background: #e9eef3; border-radius: 8px; overflow: hidden; margin: 6px 0 18px; }
.quiz-progress > div { height: 100%; background: var(--green); transition: width .2s; }

.q-prompt { font-size: 22px; font-weight: 900; margin: 14px 0 6px; }
.q-sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.speaker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; background: var(--blue); color: #fff;
  font-size: 26px; border: none; cursor: pointer; box-shadow: 0 3px 0 #1490cc; margin-bottom: 12px;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  border: 2px solid var(--line); border-radius: 14px; padding: 14px;
  font-size: 16px; font-weight: 800; background: #fff; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
}
.opt-zh { font-size: 12px; font-weight: 400; color: var(--muted); }
.opt.correct { background: #d7ffb8; border-color: var(--green); color: var(--green-d); }
.opt.wrong { background: #ffd6d6; border-color: var(--red); color: var(--red); }
.opt:disabled { cursor: default; }

.spell-input { width: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 12px; font-size: 18px; margin-bottom: 12px; outline: none; text-align: center; }
.feedback { text-align: center; font-weight: 800; min-height: 22px; margin-top: 10px; }
.feedback.ok { color: var(--green-d); }
.feedback.no { color: var(--red); }

/* 结果 */
.result-stars { font-size: 52px; text-align: center; letter-spacing: 8px; margin: 12px 0; }
.result-line { display: flex; justify-content: space-around; margin: 16px 0; }
.result-line .b { text-align: center; }
.result-line .v { font-size: 24px; font-weight: 900; }
.result-line .l { color: var(--muted); font-size: 13px; }

.offline-badge { background: #fff4d6; color: #9a6b00; font-size: 12px; padding: 6px 10px; border-radius: 10px; text-align: center; margin-bottom: 10px; }

.center { text-align: center; }
.mt { margin-top: 18px; }

/* 音标提示 */
.q-ph { color: var(--muted); font-size: 14px; font-style: italic; margin: 4px 0 2px; }
/* 自然拼读发音展示 */
.q-prompt.sound { font-size: 46px; color: var(--purple); font-weight: 900; letter-spacing: 2px; }
/* 考点卡片 */
.notes-card { background: #f3f0ff; border: 1px solid #e0d8ff; }
.notes-title { font-weight: 800; color: var(--purple); margin-bottom: 8px; }
.notes-item { font-size: 13px; color: #4a4a55; line-height: 1.7; }
.notes-sub { font-size: 12px; color: var(--muted); margin: 2px 0 10px 0; padding-left: 2px; }

/* 待复习提醒条 */
.reminder { background: #fff1e6; color: #c2570a; font-size: 13px; font-weight: 700; padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }

/* 错题本卡片（首页入口） */
.mistakes-card { background: #fff7e6; border: 1px solid #ffe2b0; }

/* 错题本页：单条错题 */
.mistake-row { padding: 10px 4px; border-bottom: 1px solid #eee; }
.mistake-row:last-child { border-bottom: none; }
.mistake-row:active { background: #faf7ff; }
.mr-main { font-size: 15px; font-weight: 700; color: #2b2b33; }
.mr-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mr-toggle { float: right; color: var(--muted); font-size: 12px; }
.mr-detail { margin-top: 8px; padding: 10px; background: #f6f7fb; border-radius: 10px; }
.mr-line { font-size: 13px; color: #4a4a55; line-height: 1.7; }

/* 答题/错题讲解卡 */
.q-tip { margin-top: 10px; padding: 10px 12px; background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 10px; font-size: 13px; color: #8a5a00; line-height: 1.6; }
.mt { margin-top: 16px; }
.center { text-align: center; }

/* 拼写错误：对照书写 + 抄写框 */
.copy-ref { font-size: 16px; color: #2b2b33; margin: 10px 0 6px; }
.copy-ref b { color: var(--green); font-size: 20px; letter-spacing: 1px; }
.copy-ph { color: var(--muted); font-size: 13px; margin-left: 6px; }
.spell-input { width: 100%; box-sizing: border-box; padding: 14px 14px; font-size: 18px; border: 2px solid #e2e2ea; border-radius: 14px; margin: 10px 0; text-align: center; outline: none; }
.spell-input:focus { border-color: var(--green); }

/* 连词成句 */
.answer-line { min-height: 46px; padding: 10px 12px; background: #f3f6ff; border: 2px dashed #b9c7ee; border-radius: 12px; margin: 10px 0; font-size: 16px; font-weight: 700; color: #2b2b33; line-height: 1.8; }
.answer-line .ph { color: var(--muted); font-weight: 400; font-size: 13px; }
.answer-line .pick { display: inline-block; background: var(--green); color: #fff; border-radius: 8px; padding: 2px 9px; margin: 0 4px 4px 0; cursor: pointer; }
.answer-line .pick b { opacity: .8; }
.word-pool { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.wbtn { border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 15px; font-weight: 800; background: #fff; cursor: pointer; }
.wbtn:active { transform: translateY(2px); }

