:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #8a93a6;
  --brand: #4c6ef5;
  --brand-d: #3b5bdb;
  --ok: #2f9e44;
  --bad: #e03131;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}
.app { max-width: 1100px; margin: 0 auto; padding: 16px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.brand { font-size: 22px; font-weight: 800; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grade-label { font-size: 14px; color: var(--muted); }
select {
  font-size: 16px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid #d6dbe6; background: #fff; color: var(--ink);
}
.score { font-size: 16px; font-weight: 700; color: var(--brand); min-width: 70px; text-align: right; }

.btn {
  font-size: 17px; font-weight: 700; padding: 12px 18px; border-radius: 14px;
  border: 1px solid #d6dbe6; background: #fff; color: var(--ink); cursor: pointer;
  transition: transform .05s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-d); }

.main { display: flex; flex-direction: column; gap: 16px; }
.prompt-col, .answer-col {
  background: var(--card); border-radius: var(--radius); padding: 22px;
  box-shadow: 0 6px 24px rgba(31,36,48,.06);
}
.prompt-col { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.illus { font-size: 96px; line-height: 1; }
.zh { font-size: 30px; font-weight: 800; }
.sound {
  font-size: 16px; padding: 10px 16px; border-radius: 12px; border: none;
  background: #eef2ff; color: var(--brand-d); font-weight: 700; cursor: pointer;
}
.subject-toggle { display: flex; gap: 8px; }
.mode-toggle { display: flex; gap: 8px; }
.py {
  font-size: 40px; font-weight: 800; color: var(--brand-d);
  letter-spacing: 1px; line-height: 1.1;
}
.seg {
  font-size: 16px; font-weight: 700; padding: 10px 16px; border-radius: 12px;
  border: 1px solid #d6dbe6; background: #fff; color: var(--muted); cursor: pointer;
}
.seg.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.progress { font-size: 14px; color: var(--muted); }

.answer-col { display: flex; flex-direction: column; gap: 14px; }
.pane { display: flex; flex-direction: column; gap: 12px; }
.answer-input {
  font-size: 24px; padding: 14px 16px; border-radius: 14px; border: 2px solid #d6dbe6;
  width: 100%; text-align: center; letter-spacing: 2px; color: var(--ink);
}
.answer-input:focus { outline: none; border-color: var(--brand); }

.pad {
  width: 100%; height: 340px; background: #fff; border: 2px dashed #c3cad9;
  border-radius: 14px; touch-action: none; display: block;
}
.pen-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.pen-hint { font-size: 13px; color: var(--muted); text-align: center; }

.feedback { font-size: 20px; font-weight: 800; min-height: 28px; text-align: center; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

.result { background: var(--card); border-radius: var(--radius); padding: 28px; text-align: center; box-shadow: 0 6px 24px rgba(31,36,48,.06); }
.result h2 { margin: 0 0 10px; font-size: 28px; }
.result-score { font-size: 22px; font-weight: 800; color: var(--brand); margin-bottom: 16px; }
.wrong-wrap { text-align: left; margin: 12px 0; }
.wrong-wrap h3 { font-size: 18px; margin: 8px 0; }
.wrong-list { display: flex; flex-wrap: wrap; gap: 10px; }
.wrong-item { background: #fff0f0; border: 1px solid #ffc9c9; border-radius: 12px; padding: 8px 12px; font-size: 16px; }
.wrong-item b { color: var(--bad); }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }

.hidden { display: none !important; }

/* iPad / 桌面双栏 */
@media (min-width: 760px) {
  .main { flex-direction: row; align-items: stretch; }
  .prompt-col { flex: 0 0 320px; }
  .answer-col { flex: 1; }
  .pad { height: 460px; }
  .illus { font-size: 120px; }
}
