/* HSE 换证题库练习 — 纯静态，无依赖 */
:root {
  --bg: #f2f5f9;
  --card: #ffffff;
  --ink: #17233a;
  --muted: #66738a;
  --primary: #2563eb;
  --primary-dark: #1d3a6e;
  --primary-soft: #e8effd;
  --ok: #158a3f;
  --ok-bg: #e9f7ee;
  --ok-line: #b5e2c5;
  --bad: #d63326;
  --bad-bg: #fdeeed;
  --bad-line: #f3c1bc;
  --line: #e3e9f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 35, 58, .05), 0 8px 24px rgba(23, 35, 58, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}
#app { max-width: 680px; margin: 0 auto; padding: 0 16px 48px; }
body.browse #app { max-width: 820px; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ---------- 顶部安全条纹 ---------- */
.safety-stripe {
  height: 6px;
  background: repeating-linear-gradient(-45deg, #f5b301 0 14px, #1b1b1b 14px 28px);
}

/* ---------- 首页 ---------- */
.hero {
  margin: 20px 0 18px;
  background: linear-gradient(135deg, var(--primary-dark), #2a63d8 70%, #3b7aee);
  border-radius: var(--radius);
  color: #fff;
  padding: 26px 22px 22px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 22px; letter-spacing: .5px; }
.hero .sub { margin-top: 6px; font-size: 13px; opacity: .82; }
.hero .tags { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero .tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25);
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--card); border-radius: 12px; padding: 12px 10px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.stat .num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent .num { color: var(--primary); }
.stat.warn .num { color: var(--bad); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h2 .ico { font-size: 20px; }
.card .desc { font-size: 13px; color: var(--muted); margin-top: 2px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: #fafbfe; color: var(--ink);
  border-radius: 999px; padding: 8px 15px; font-size: 14px; transition: all .15s;
  min-height: 38px; display: inline-flex; align-items: center;
}
.chip .cnt { color: var(--muted); font-size: 12px; margin-left: 2px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.on .cnt { color: rgba(255, 255, 255, .8); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px; padding: 12px 22px; font-size: 16px; font-weight: 600;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .28); }
.btn-primary:disabled { background: #b9c6da; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-danger-ghost { background: transparent; border: 1px solid var(--bad-line); color: var(--bad); }
.btn-block { width: 100%; margin-top: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

.home-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 22px; line-height: 1.9; }

/* ---------- 练习页 ---------- */
.quiz-top {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--primary-dark), #2a63d8);
  color: #fff; margin: 0 -16px; padding: 10px 16px 12px;
}
.quiz-top .row1 { display: flex; align-items: center; gap: 10px; }
.quiz-back {
  background: rgba(255,255,255,.14); border: none; color: #fff; border-radius: 10px;
  width: 34px; height: 34px; font-size: 17px; flex: none;
}
.quiz-mid { flex: 1; min-width: 0; }
.quiz-pos { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.quiz-sub { font-size: 11.5px; opacity: .78; margin-top: 1px; }
.quiz-score { font-size: 12px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pbar { height: 5px; background: rgba(255,255,255,.22); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.pbar > div { height: 100%; background: #7ee0a0; border-radius: 99px; transition: width .25s; }

.resume-tip {
  margin-top: 12px; font-size: 13px; background: #fff7e0; border: 1px solid #f0dfae;
  color: #7a5b00; border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; gap: 8px;
}
.resume-tip a { margin-left: auto; color: #7a5b00; text-decoration: underline; flex: none; }

.q-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 18px; margin-top: 14px; }
.q-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.badge {
  font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px;
  background: var(--primary-soft); color: var(--primary);
}
.badge.judge { background: #f3ecfd; color: #7c3aed; }
.badge.multi { background: #fdf1e4; color: #c2620a; }
.q-no { font-size: 12px; color: var(--muted); }
.q-text { font-size: 17.5px; font-weight: 600; line-height: 1.75; word-break: break-word; }

.opts { margin-top: 16px; display: grid; gap: 10px; }
body.judge-opts .opts { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  background: #fafbfe; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 15.5px; line-height: 1.6; transition: border-color .12s, background .12s;
}
.opt:not(:disabled):hover { border-color: #b9c8e4; }
.opt .key {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eef2f8; color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 1px;
}
body.judge-opts .opt { justify-content: center; font-size: 17px; font-weight: 600; padding: 16px 10px; }
body.judge-opts .opt .key { display: none; }
.opt.picked { border-color: var(--primary); background: var(--primary-soft); }
.opt.picked .key { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--ok-line); background: var(--ok-bg); }
.opt.right .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad-line); background: var(--bad-bg); animation: shake .3s; }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; opacity: .92; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.feedback { margin-top: 14px; border-radius: 10px; padding: 10px 14px; font-size: 14px; display: none; }
.feedback.show { display: block; }
.feedback.good { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }
.feedback b { font-weight: 700; }

.quiz-actions { margin-top: 16px; display: none; }
.quiz-actions.show { display: block; }
.multi-submit { margin-top: 16px; display: none; }
.multi-submit.show { display: block; }

.setting-row {
  margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
}
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 2; margin: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #cdd6e4; border-radius: 99px; transition: background .15s;
}
.switch .slider::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { left: 21px; }

/* ---------- 结果页 ---------- */
.result { text-align: center; padding: 34px 18px 26px; }
.result .ring {
  width: 130px; height: 130px; margin: 0 auto; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--ok) var(--p, 0%), #e8edf5 0);
  position: relative;
}
.result .ring::before { content: ""; position: absolute; inset: 10px; background: var(--card); border-radius: 50%; }
.result .ring .val { position: relative; font-size: 30px; font-weight: 800; color: var(--ok); }
.result .ring .pct { position: relative; font-size: 12px; color: var(--muted); }
.result h2 { margin-top: 16px; font-size: 19px; }
.result .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.result .nums { display: flex; justify-content: center; gap: 26px; margin-top: 18px; }
.result .nums .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result .nums .l { font-size: 12px; color: var(--muted); }

/* ---------- 模拟考试 ---------- */
.exam-clock {
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.14); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.exam-clock.warn { background: #d63326; color: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.exam-actions { display: flex; gap: 10px; margin-top: 18px; }
.exam-actions .btn { flex: 1; padding: 11px 10px; }
.exam-actions .btn:disabled { opacity: .4; cursor: not-allowed; }
.exam-bar { display: flex; gap: 10px; margin-top: 10px; }
.exam-bar .btn { flex: 1; padding: 10px; font-size: 14.5px; }
.palette-wrap { margin-top: 14px; display: none; border-top: 1px dashed var(--line); padding-top: 12px; }
.palette-wrap.show { display: block; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.pal {
  border: 1px solid var(--line); background: #fafbfe; border-radius: 8px; height: 34px;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center;
}
.pal.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pal.cur { outline: 2.5px solid var(--primary); outline-offset: 1px; }
.breakdown { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.bd { background: #f6f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px; font-size: 13.5px; color: var(--muted); }
.bd b { font-size: 16px; color: var(--ink); margin-right: 2px; }
.b-opt.is-mine-wrong { color: var(--bad); }

/* ---------- 浏览 / 错题本 ---------- */
.list-bar { position: sticky; top: 0; z-index: 20; background: var(--bg); margin: 16px -4px 12px; padding: 8px 4px; }
.list-bar .search {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 11px 14px; font-size: 15px; outline: none;
}
.list-bar .search:focus { border-color: var(--primary); }
.b-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px;
}
.b-item .q { font-weight: 600; font-size: 15.5px; line-height: 1.7; }
.b-item .b-opts { margin-top: 10px; display: grid; gap: 6px; }
.b-opt { font-size: 14px; color: var(--muted); display: flex; gap: 8px; }
.b-opt.is-right { color: var(--ok); font-weight: 600; }
.b-opt .k { flex: none; font-weight: 700; }
.b-ans { margin-top: 10px; font-size: 13px; color: var(--ok); font-weight: 600; }
.empty {
  text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px; line-height: 2;
}
.empty .big { font-size: 40px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; }
.pager button {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 8px 16px; font-size: 14px;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .pageinfo { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.list-head { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.list-head h1 { font-size: 19px; flex: 1; }
