/* ============ 留置看护辅警备考刷题 · 设计系统 ============ */
:root {
  --navy-900: #0d1f45;
  --navy-700: #16306b;
  --navy-600: #1e3f8a;
  --navy-100: #e8eef9;
  --gold: #d4a53f;
  --gold-dark: #b8892a;
  --bg: #f2f5fa;
  --card: #ffffff;
  --text: #1b2437;
  --text-2: #5b6677;
  --text-3: #8a94a6;
  --line: #e3e9f2;
  --ok: #16934c;
  --ok-bg: #e7f6ec;
  --bad: #d0342c;
  --bad-bg: #fdeceb;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(13, 31, 69, .06);
  --shadow-lg: 0 6px 24px rgba(13, 31, 69, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  position: sticky; top: 0; z-index: 95; /* 高于弹窗(90)、低于密码门(100)：封锁弹窗下也能点「切换」登录管理员 */
  box-shadow: 0 2px 12px rgba(13, 31, 69, .25);
}
.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.btn-back {
  background: rgba(255,255,255,.12); color: #fff; border: none;
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px;
  cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.btn-back:hover { background: rgba(255,255,255,.22); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-icon { font-size: 28px; line-height: 1; }
.brand-text h1 { font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand-text p { font-size: 11.5px; color: rgba(255,255,255,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.mini-chip {
  background: rgba(255,255,255,.14); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; color: #fff;
}

/* ---------- 布局 ---------- */
.container { max-width: 760px; margin: 0 auto; width: 100%; padding: 18px 14px 40px; flex: 1; }
.footer { text-align: center; color: var(--text-3); font-size: 12px; padding: 14px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 14px;
}
.card-title { font-size: 16.5px; font-weight: 700; margin-bottom: 4px; color: var(--navy-900); }
.card-sub { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin: 14px 0 8px; }

/* ---------- 统计条 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 6px; text-align: center;
}
.stat-item b { display: block; font-size: 21px; color: var(--navy-700); font-variant-numeric: tabular-nums; }
.stat-item span { font-size: 12px; color: var(--text-2); }

/* ---------- 模式选择 ---------- */
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.mode-card {
  background: var(--navy-100); border: 2px solid transparent; border-radius: 14px;
  padding: 14px 8px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 4px; text-align: center; transition: all .15s;
  font-family: inherit;
}
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mode-card.active { border-color: var(--navy-600); background: #fff; }
.mode-emoji { font-size: 26px; line-height: 1.2; }
.mode-name { font-size: 15px; font-weight: 700; color: var(--navy-900); }
.mode-desc { font-size: 11px; color: var(--text-2); line-height: 1.4; }

/* ---------- 分类网格 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cat-chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 10px; font-size: 13.5px; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 6px; transition: all .12s; font-family: inherit;
  color: var(--text);
}
.cat-chip:hover { border-color: var(--navy-600); }
.cat-chip.active { border-color: var(--navy-600); background: var(--navy-100); font-weight: 600; }
.cat-chip .cat-emoji { font-size: 16px; }
.cat-chip .cat-count { margin-left: auto; color: var(--text-3); font-size: 11px; font-weight: 400; }

/* ---------- chips（题量选择） ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 18px; font-size: 14px; cursor: pointer; transition: all .12s;
  font-family: inherit; color: var(--text);
}
.chip:hover { border-color: var(--navy-600); }
.chip.active { background: var(--navy-600); border-color: var(--navy-600); color: #fff; font-weight: 600; }
.seq-hint { font-size: 12.5px; color: var(--text-2); background: var(--navy-100); border-radius: 10px; padding: 9px 12px; margin-top: 10px; }
.seq-hint b { color: var(--navy-700); }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 12px; padding: 12px 20px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: all .15s; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy-600); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-primary:disabled { background: #b9c4d8; cursor: not-allowed; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; }
.btn-gold:hover { filter: brightness(1.06); }
.btn-outline { background: #fff; color: var(--navy-700); border: 1.5px solid var(--navy-600); }
.btn-outline:hover { background: var(--navy-100); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--navy-700); background: var(--navy-100); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; min-width: 110px; }

/* ---------- 答题页 ---------- */
.quiz-top { margin-bottom: 12px; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.quiz-progress-text { font-size: 15px; font-weight: 700; color: var(--navy-900); }
.quiz-mode-tag {
  font-size: 11.5px; background: var(--navy-100); color: var(--navy-700);
  padding: 3px 10px; border-radius: 999px;
}
.progress-track { height: 8px; background: #e2e8f3; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #e5c373); border-radius: 999px; transition: width .25s; }
.quiz-score-chips { display: flex; gap: 8px; margin-top: 8px; }
.chip-score { font-size: 12.5px; padding: 4px 12px; border-radius: 999px; font-weight: 600; }
.chip-score b { font-variant-numeric: tabular-nums; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }

.q-card { padding: 20px 16px; }
.q-cat {
  display: inline-block; font-size: 12px; color: var(--gold-dark);
  background: #faf3e0; border-radius: 999px; padding: 3px 10px; margin-bottom: 10px;
}
.q-stars { color: #e6a817; margin-left: 6px; font-size: 12px; letter-spacing: 1px; }
.q-multi-badge { display: inline-block; margin-left: 6px; background: #e74c3c; color: #fff; font-size: 11px; border-radius: 4px; padding: 1px 6px; vertical-align: 1px; }
.review-stars { color: #e6a817; font-size: 11px; letter-spacing: 1px; flex-shrink: 0; white-space: nowrap; }
.star-chip { font-size: 12.5px; letter-spacing: .5px; }
.q-stem { font-size: 17px; font-weight: 600; line-height: 1.7; margin-bottom: 16px; word-break: break-word; }

.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-opt {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 13px;
  background: #fff; cursor: pointer; transition: all .12s; font-size: 15px;
  font-family: inherit; color: var(--text); line-height: 1.55; width: 100%;
}
.q-opt:hover { border-color: var(--navy-600); }
.q-opt .opt-letter {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy-100); color: var(--navy-700); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.q-opt .opt-text { flex: 1; word-break: break-word; }
.q-opt.selected { border-color: var(--navy-600); background: var(--navy-100); }
.q-opt.selected .opt-letter { background: var(--navy-600); color: #fff; }
.q-opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.q-opt.correct .opt-letter { background: var(--ok); color: #fff; }
.q-opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.q-opt.wrong .opt-letter { background: var(--bad); color: #fff; }
.q-opt.dim { opacity: .55; }
.q-opt:disabled { cursor: default; }

.q-feedback {
  margin-top: 16px; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; font-weight: 600;
}
.q-feedback.ok { background: var(--ok-bg); color: var(--ok); }
.q-feedback.bad { background: var(--bad-bg); color: var(--bad); }
.q-feedback .fb-sub { display: block; font-weight: 400; font-size: 13.5px; margin-top: 2px; color: var(--text-2); }

.q-note {
  margin-top: 12px; border: 1.5px dashed var(--gold); background: #fdf8ec;
  border-radius: 12px; padding: 13px 14px; font-size: 14px;
  animation: noteIn .2s ease;
}
@keyframes noteIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.q-note .note-h { font-weight: 700; color: var(--gold-dark); margin-bottom: 6px; }
.q-note .note-block { margin-bottom: 8px; }
.q-note .note-block:last-child { margin-bottom: 0; }
.q-note .note-block b { color: var(--navy-900); }
.q-note .note-block p { color: var(--text); line-height: 1.7; }

.q-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ---------- 成绩页 ---------- */
.result-card { text-align: center; padding: 24px 16px; }
.ring-wrap { position: relative; width: 150px; height: 150px; margin: 4px auto 12px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #e7ecf5; stroke-width: 12; }
.ring-fg {
  fill: none; stroke: var(--gold); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 377; stroke-dashoffset: 377; transition: stroke-dashoffset .8s ease;
}
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-center b { font-size: 30px; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.ring-center span { font-size: 12px; color: var(--text-2); }
.result-msg { font-size: 16.5px; font-weight: 700; color: var(--navy-900); margin-bottom: 12px; }
.result-counts { display: flex; justify-content: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rc-item {
  min-width: 92px; border-radius: 12px; padding: 10px 14px;
  display: flex; flex-direction: column; align-items: center;
}
.rc-item b { font-size: 22px; font-variant-numeric: tabular-nums; }
.rc-item span { font-size: 12px; }
.rc-ok { background: var(--ok-bg); color: var(--ok); }
.rc-bad { background: var(--bad-bg); color: var(--bad); }
.rc-all { background: var(--navy-100); color: var(--navy-700); }

/* ---------- 回顾/错题列表 ---------- */
.review-item {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 13px; margin-bottom: 10px;
}
.review-item.ok { border-left: 4px solid var(--ok); }
.review-item.bad { border-left: 4px solid var(--bad); }
.review-head { display: flex; gap: 8px; align-items: flex-start; }
.review-mark { flex-shrink: 0; font-weight: 700; font-size: 13px; border-radius: 6px; padding: 2px 8px; }
.review-mark.ok { background: var(--ok-bg); color: var(--ok); }
.review-mark.bad { background: var(--bad-bg); color: var(--bad); }
.review-stem { flex: 1; font-size: 14px; line-height: 1.6; word-break: break-word; }
.review-ans { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.review-ans b { color: var(--navy-900); }
.review-ans .ans-ok { color: var(--ok); font-weight: 700; }
.review-ans .ans-bad { color: var(--bad); font-weight: 700; }
.review-note-toggle {
  margin-top: 8px; font-size: 12.5px; color: var(--navy-700); background: none; border: none;
  cursor: pointer; font-family: inherit; padding: 0; text-decoration: underline dotted;
}
.review-note { display: none; margin-top: 8px; }
.review-note.open { display: block; }
.review-remove {
  margin-left: auto; background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 12px; font-family: inherit; flex-shrink: 0; padding: 2px 4px;
}
.review-remove:hover { color: var(--bad); }
.empty-tip { text-align: center; color: var(--text-3); padding: 26px 10px; font-size: 14px; }
.empty-tip .big { font-size: 34px; display: block; margin-bottom: 8px; }

.footnote { font-size: 12px; color: var(--text-3); line-height: 1.7; padding: 4px 6px 10px; }

/* ---------- 密码门 ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(150deg, var(--navy-900), var(--navy-600));
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate-card {
  background: #fff; border-radius: 20px; padding: 32px 26px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: gateIn .35s ease;
}
@keyframes gateIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.gate-icon { font-size: 46px; line-height: 1; margin-bottom: 10px; }
.gate-card h2 { font-size: 19px; color: var(--navy-900); margin-bottom: 4px; }
.gate-sub { font-size: 13.5px; color: var(--text-2); margin-bottom: 16px; }
.gate-input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; text-align: center; letter-spacing: 2px; margin-bottom: 10px; font-family: inherit;
}
.gate-input:focus { outline: none; border-color: var(--navy-600); }
.gate-err { color: var(--bad); font-size: 13px; margin-bottom: 8px; }
.gate-hint { margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.gate-hint b { color: var(--navy-700); }

/* ---------- 顶栏身份 ---------- */
.mini-chip-admin { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); font-weight: 600; }
.mini-chip-link { cursor: pointer; }
.mini-chip-link:hover { background: rgba(255,255,255,.3); }
.brand-text { flex: 1; min-width: 0; }
.brand-text h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-note { font-size: 13px; color: var(--text-2); background: var(--navy-100); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.7; }
.mode-note b { color: var(--navy-700); }
#config-body .btn-block { margin-bottom: 10px; }
#config-body .btn-block:last-child { margin-bottom: 0; }
#config-body .chips { margin-bottom: 12px; }
#config-body .cat-grid { margin-bottom: 4px; }
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--navy-700); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(9, 18, 38, .62);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 20px; padding: 26px 22px; width: 100%; max-width: 400px;
  text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.4);
  animation: gateIn .3s ease; max-height: 88vh; overflow-y: auto;
}
.modal-emoji { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.modal-title { font-size: 16.5px; color: var(--navy-900); line-height: 1.6; margin-bottom: 8px; }
.modal-sub { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.modal-hint { font-size: 11.5px; color: var(--text-3); margin-top: 12px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.btn-pay-alipay { background: linear-gradient(135deg, #1677ff, #0958d9); color: #fff; }
.btn-pay-alipay:hover { filter: brightness(1.08); }
.btn-pay-wechat { background: linear-gradient(135deg, #07c160, #06a34f); color: #fff; }
.btn-pay-wechat:hover { filter: brightness(1.08); }
.payqr-img { width: 230px; height: 230px; border: 1.5px solid var(--line); border-radius: 14px; margin: 6px auto 10px; display: block; }
.payqr-status { font-size: 13.5px; color: var(--navy-700); font-weight: 600; margin-bottom: 10px; min-height: 20px; }

/* ---------- 历史记录 ---------- */
.history-item { padding: 14px 16px; }
.history-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.history-idx {
  background: var(--navy-100); color: var(--navy-700); font-size: 12px; font-weight: 700;
  border-radius: 6px; padding: 2px 8px;
}
.history-mode { font-size: 14px; font-weight: 600; color: var(--navy-900); flex: 1; }
.history-time { font-size: 12px; color: var(--text-3); }
.history-body { display: flex; flex-wrap: wrap; gap: 6px; }
.history-body span {
  font-size: 12.5px; border-radius: 999px; padding: 3px 12px; font-weight: 600;
}
.h-ok { background: var(--ok-bg); color: var(--ok); }
.h-bad { background: var(--bad-bg); color: var(--bad); }
.h-all { background: var(--navy-100); color: var(--navy-700); }
.h-acc { background: #faf3e0; color: var(--gold-dark); }
.h-acc b { font-size: 14px; }

@media (max-width: 480px) {
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 12px 14px; text-align: left; }
  .mode-emoji { font-size: 24px; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .brand-text p { display: none; }
  .brand-text h1 { font-size: 15px; }
  .topbar-inner { gap: 8px; padding: 12px 12px; }
  .mini-chip-uid { display: none; }
  .mini-chip { padding: 3px 8px; font-size: 11.5px; }
  .q-stem { font-size: 16px; }
}
