:root {
  --primary: #1677ff;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a919c;
  --border: #e5e8ee;
  --correct: #1a9e54;
  --correct-bg: #e9f9ef;
  --wrong: #d84a4a;
  --wrong-bg: #fdeeee;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.topbar { background: var(--primary); color: #fff; padding: 18px 16px 14px; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar .subtitle { margin: 4px 0 0; font-size: 13px; opacity: .85; }
.container { max-width: 720px; margin: 0 auto; padding: 16px 16px 156px; }
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 12px 0 8px; font-size: 15px; }
p { line-height: 1.7; }
.muted { color: var(--muted); font-size: 13px; }
.btn {
  display: inline-block; border: none; border-radius: 10px;
  padding: 12px 20px; font-size: 16px; cursor: pointer;
  text-decoration: none; text-align: center; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-ghost { background: #eef2f7; color: var(--text); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-card { text-decoration: none; color: inherit; display: block; }
.cat-name { font-weight: 600; margin-bottom: 6px; }
.cat-meta { font-size: 13px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 8px; text-align: center; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.progress { height: 8px; background: #e7ebf1; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.quiz-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.tag { background: #eef2f7; border-radius: 20px; padding: 4px 12px; font-size: 13px; color: #4a5568; }
.tag.good { background: var(--correct-bg); color: var(--correct); }
.tag.bad { background: var(--wrong-bg); color: var(--wrong); }
.tag.warn { background: #fff3d6; color: #8a6d1a; }
/* 案例缺失信息提示条 */
.issue-note {
  margin: 0 4px 12px;
  padding: 10px 12px;
  background: #fff8e6;
  border: 1px solid #f0d98c;
  border-left: 4px solid #d9a821;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #6b5518;
}
.stem { font-size: 17px; line-height: 1.7; margin: 0 0 14px; }
.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.option {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  text-align: left; background: #fff; border: 1.5px solid var(--border);
  border-radius: 10px; padding: 13px 14px; font-size: 15px;
  cursor: pointer; line-height: 1.6; color: var(--text);
}
.option:active { background: #f2f6fc; }
.option.selected { border-color: var(--primary); background: #eef5ff; }
.option.correct { border-color: var(--correct); background: var(--correct-bg); }
.option.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.option:disabled { cursor: default; }
.opt-mark { color: var(--muted); flex: none; }
.opt-key { font-weight: 700; flex: none; }
.explain { background: #fbfdff; border: 1px dashed var(--border); }
.explain p { margin: 8px 0; font-size: 14px; }
.quiz-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.quiz-actions .btn { flex: 1; min-width: 100px; }
.qitem {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 4px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.qitem:last-child { border-bottom: none; }
.qitem .stem-mini { font-size: 15px; flex: 1; }
.status { font-size: 13px; flex: none; }
.status.ok { color: var(--correct); }
.status.no { color: var(--wrong); }
.status.todo { color: var(--muted); }
.bar-row { margin-bottom: 12px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.tabbar {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px; display: flex;
  background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); z-index: 2147483647;
}
.tabbar a { flex: 1; text-align: center; padding: 12px 0; text-decoration: none; color: var(--muted); font-size: 14px; }
.tabbar a.active { color: var(--primary); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.finish { text-align: center; padding: 30px 0; }
.finish .big { font-size: 40px; font-weight: 800; color: var(--primary); margin: 10px 0; }
@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
/* 案例自测：考点竖排卡片，点开展开自评 */
.topic { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; border: 2px solid var(--border); }
.topic .idx { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.topic .text { font-size: 15px; line-height: 1.6; white-space: pre-wrap; }
.topic .state { margin-top: 10px; font-size: 13px; font-weight: 600; }
.topic.s0 .state { color: var(--muted); }
.topic.s1 { border-color: #16a34a; background: #f0fdf4; }
.topic.s1 .state { color: #16a34a; }
.topic.s2 { border-color: #ea580c; background: #fff7ed; }
.topic.s2 .state { color: #ea580c; }
.rate-row { display: flex; gap: 10px; margin-top: 12px; }
.rate-row .btn { flex: 1; }
.topic .answer { margin-top: 10px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
/* S 盒表：16 列，手机上横向滚动 */
.sbox-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.sbox { border-collapse: collapse; font-size: 11px; }
.sbox th, .sbox td { border: 1px solid var(--border); padding: 3px 4px; text-align: center; min-width: 24px; }
.sbox th { background: #f8fafc; white-space: nowrap; }

/* ============ 模拟考试 ============ */
.mock-rules { display: flex; gap: 10px; margin: 4px 0 6px; }
.mock-rules > div { flex: 1; background: #f2f6fc; border-radius: var(--radius); padding: 12px 8px; text-align: center; }
.mock-rules strong { display: block; font-size: 26px; color: var(--primary); }
.mock-rules span { font-size: 13px; color: var(--muted); }
.mock-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mock-timer { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); background: #eef5ff; border-radius: 8px; padding: 4px 12px; }
.mock-timer.urgent { color: var(--wrong); background: var(--wrong-bg); }
.btn-sm { width: auto !important; padding: 8px 12px; font-size: 14px; flex: none !important; min-width: 0 !important; }
.ac-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ac-num { display: block; text-align: center; padding: 10px 0; border-radius: 8px; background: #eef2f7; color: var(--text); text-decoration: none; font-size: 15px; border: 1.5px solid transparent; }
.ac-num.done { background: #e9f9ef; border-color: var(--correct); color: var(--correct); }
.ac-num.marked { position: relative; }
.ac-num.marked::after { content: "!"; position: absolute; top: 2px; right: 6px; font-size: 12px; font-weight: 700; color: #d9a821; }
.ac-num.current { border-color: var(--primary); }
.ac-legend { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; }
.ac-legend.done { background: #e9f9ef; border: 1.5px solid var(--correct); }
.ac-legend.marked { background: #eef2f7; border: 1.5px solid #d9a821; }
.ac-legend.current { background: #eef2f7; border: 1.5px solid var(--primary); }
.score-big { font-size: 56px; font-weight: 800; color: var(--text); line-height: 1.2; }
.score-big .muted { font-size: 24px; font-weight: 400; }
.cat-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.cat-row .cat-name { flex: none; width: 110px; font-size: 14px; }
/* 模拟题徽标（紫色，与审题页一致） */
.tag.sim { background: #f1eaff; color: #7c3aed; }
/* 问答题答案状态徽标（与审题页一致：蓝=推导，红=暂缺） */
.tag.derived { background: #e8f0fe; color: #1a56db; }
.tag.missing { background: #fde8e8; color: #c81e1e; }
/* 问答题背景：保留换行（如 /etc/passwd 多行内容），等宽字体 */
.essay-bg { margin: 0 4px 12px; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
/* 问答案例原题配图 */
.essay-fig { margin: 8px 4px 12px; }
.essay-fig figcaption { font-size: 13px; color: #666; margin-bottom: 4px; }
.essay-fig img { max-width: 100%; border: 1px solid #ddd; border-radius: 6px; display: block; background: #fff; }
/* 配图灯箱：点开放大 */
.essay-fig img { cursor: zoom-in; }
.essay-fig .zoom-hint { font-size: 12px; color: #999; }
.lightbox { position: fixed; inset: 0; z-index: 2147483646; background: rgba(0, 0, 0, 0.92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lightbox-hint { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; color: #999; font-size: 13px; pointer-events: none; }
/* 搜索 */
.search-entry { display: block; padding: 10px 14px; margin: 0 0 12px; background: #f5f5f5; border-radius: 20px; color: #999; font-size: 14px; text-decoration: none; }
.search-entry:active { background: #eee; }
.search-input { width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; }
.search-input:focus { outline: none; border-color: var(--primary); }
.search-bar { display: flex; align-items: center; justify-content: space-between; margin: 12px 4px; }
.search-item { display: block; text-decoration: none; color: inherit; margin-bottom: 8px; }
.search-stem { font-size: 14px; margin-top: 4px; line-height: 1.5; }
