:root {
  --ink: #22303d;
  --muted: #6b7c8c;
  --line: #d8e2ea;
  --paper: #fbfcfe;
  --brand: #2f7fd1;
  --good: #2e9e5b;
  --bad: #d2503a;
  --warm: #ffd166;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}

#app {
  max-width: 780px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- 通用 ---------- */
.top { margin-bottom: 18px; }
.top h1 { font-size: 26px; letter-spacing: 1px; }
.top .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

.back {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 14px;
  margin-bottom: 14px;
}

.primary {
  display: inline-block;
  border: none;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  padding: 13px 30px;
  box-shadow: 0 4px 0 #23629f;
}
.primary:active { transform: translateY(3px); box-shadow: none; }
.primary.ghost { background: #fff; color: var(--brand); border: 2px solid var(--brand); box-shadow: none; }

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

/* ---------- 单元列表 ---------- */
.units { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.unitBtn {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 92px;
  transition: transform .08s, border-color .08s;
}
.unitBtn:hover { transform: translateY(-2px); border-color: var(--brand); }
.unitBtn .uid { font-size: 22px; font-weight: 800; color: var(--brand); letter-spacing: 1px; }
.unitBtn .utitle { font-size: 14px; color: var(--ink); line-height: 1.35; }
.unitBtn .ucount { font-size: 12px; color: var(--muted); margin-top: 2px; }
.unitBtn.empty { opacity: .72; }

/* ---------- 篇目列表 ---------- */
.unitHead { margin-bottom: 14px; }
.unitHead h2 { font-size: 22px; }
.unitHead .utitle { color: var(--muted); font-size: 14px; margin-top: 5px; }

.plist { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.pitem {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pitem:hover { border-color: var(--brand); }

.pbadge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 9px;
  background: #eaf3fd;
  color: var(--brand);
  white-space: nowrap;
}
.pbadge.orig { background: #fdf1e3; color: #b57b21; }

.pitem .ptitle { font-size: 17px; font-weight: 600; }
.pitem .pmeta { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.pitem .pmeta .wrong { color: var(--bad); }

.note {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* 讲解里的反引号对：浅灰小框 */
code {
  font-family: Consolas, "Courier New", monospace;
  font-size: .92em;
  background: #eef2f6;
  color: #2b3945;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}

/* ---------- 阅读 ---------- */
.readTop, .qTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.clock { font-variant-numeric: tabular-nums; }
.clock.low { color: var(--bad); font-weight: 700; }

.figures { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.figures img {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.text { font-size: 21px; line-height: 1.9; }
.sent {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  padding: 2px 6px;
  border-radius: 8px;
}
.sent:hover { background: #eef4fa; }
.sent.marked { background: #fff3cd; box-shadow: inset 0 -2px 0 var(--warm); }

.hint { font-size: 14px; color: var(--muted); margin-top: 16px; }

/* ---------- 做题 ---------- */
.qcard { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 20px; }
.qprompt { font-size: 20px; line-height: 1.6; margin-bottom: 18px; }
.qtype { font-size: 12px; color: var(--muted); margin-bottom: 8px; letter-spacing: .5px; }

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 18px;
  text-align: left;
}
.opt:hover { border-color: var(--brand); }
.opt.picked { border-color: var(--brand); background: #eaf3fd; }

.tfRow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tfRow .opt { text-align: center; font-weight: 700; letter-spacing: 1px; }

#writeIn {
  width: 100%;
  font-size: 20px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
}
#writeIn:focus { outline: none; border-color: var(--brand); }

.qnav { margin-top: 20px; display: flex; gap: 10px; align-items: center; }

.banner {
  background: #fff3cd;
  border: 1px solid var(--warm);
  color: #7a5b00;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---------- 做题：看原文 ---------- */
.textWrap { position: relative; margin-bottom: 12px; }

.textToggle {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 14px;
}
.textToggle:hover { border-color: var(--brand); color: var(--brand); }
.textToggle.on { border-color: var(--brand); color: var(--brand); }

.textPanel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(34,48,61,.16);
  padding: 16px 18px;
  max-height: 62vh;
  overflow: auto;
}
.textPanel[hidden] { display: none; }
.textPanel .tTitle { font-size: 15px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.textPanel .tSent { padding-left: 22px; font-size: 19px; line-height: 1.8; }

/* ---------- 结果 ---------- */
.score { text-align: center; margin-bottom: 20px; }
.score .num { font-size: 44px; font-weight: 800; color: var(--brand); }
.score .txt { color: var(--muted); font-size: 14px; margin-top: 4px; }

.block { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.block h3 { font-size: 16px; margin-bottom: 10px; }

.ritem { border-left: 4px solid var(--line); padding-left: 12px; margin-bottom: 16px; }
.ritem.ok { border-color: var(--good); }
.ritem.ng { border-color: var(--bad); }

.ritem .rq { font-size: 16px; }
.ritem.ng .rq::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.ritem .ra { font-size: 14px; color: var(--muted); margin: 6px 0; }
.ritem .ra b { color: var(--ink); }
.ritem .exp { font-size: 14px; line-height: 1.8; }
.ritem .exp .w { color: var(--bad); }
.ritem .exp .y { color: var(--good); }
.ritem .exp p { margin-top: 4px; }

.markedSent { font-size: 15px; line-height: 1.9; }
.markedSent .en { font-weight: 600; }
.markedSent .zh { color: var(--muted); }
.markedSent .note { font-size: 14px; color: #33424f; }

.trans { font-size: 15px; line-height: 2; color: #33424f; }

.done { color: var(--muted); font-size: 13px; text-align: center; margin-top: 10px; }

/* ---------- 家长页 ---------- */
.parentBar { margin-top: 16px; text-align: center; }

.parentEntry {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 14px;
}
.parentEntry:hover { border-color: var(--brand); color: var(--brand); }

.recList, .sumList, .recWrong { list-style: none; }
.recList { display: flex; flex-direction: column; gap: 10px; }

.recRow { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.recHead { display: flex; align-items: baseline; gap: 10px; }
.recId { font-size: 13px; font-weight: 800; color: var(--brand); white-space: nowrap; }
.recTitle { font-size: 15px; font-weight: 600; }
.recDate { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

.recWrong { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.recWrong li { border-left: 3px solid var(--bad); padding-left: 10px; }
.recQ, .recYour, .recAnswer { display: block; font-size: 14px; line-height: 1.6; }
.recYour { color: var(--bad); }
.recAnswer { color: var(--good); }
.recOk { margin-top: 8px; font-size: 14px; color: var(--good); }

.sumCount { font-size: 15px; margin-bottom: 10px; }
.sumCount b { color: var(--brand); }
.sumList { display: flex; flex-direction: column; gap: 8px; }
.sumRow { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.sumQ { font-weight: 600; white-space: nowrap; }
.sumPrompt { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sumTimes { margin-left: auto; color: var(--bad); white-space: nowrap; }
.sumNote, .sumMore { font-size: 12px; color: var(--muted); margin-top: 10px; }

.primary.ghost.danger { color: var(--bad); border-color: var(--bad); }
.clearMsg { color: var(--bad); font-size: 13px; margin-bottom: 10px; }
