/* 中级经济师刷题 - 全站样式 */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #8a93a6;
  --line: #e6eaf2;
  --accent: #4263eb;
  --accent-weak: #edf1ff;
  --ok: #2f9e44;
  --ok-weak: #e6f6e9;
  --bad: #e03131;
  --bad-weak: #fdecec;
  --part: #e8890c;
  --part-weak: #fff4e0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 42, 68, .06);
}
body.theme-hr {
  --accent: #0ca678;
  --accent-weak: #e3f7ef;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }
button { font-family: inherit; cursor: pointer; }

/* ===== 首页 ===== */
.hero {
  padding: 34px 6px 20px;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.subject-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-top: 14px;
  text-align: left;
  transition: transform .08s ease;
}
.subject-card:active { transform: scale(.985); }
.subject-card .icon {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 13px;
  background: var(--accent-weak);
  display: flex; align-items: center; justify-content: center;
  font-size: 27px;
}
.subject-card .info { flex: 1; min-width: 0; }
.subject-card .name { font-size: 17px; font-weight: 700; }
.subject-card .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.subject-card .arrow { color: #c4cbd9; font-size: 20px; }
.footnote { color: var(--muted); font-size: 12px; margin-top: 26px; text-align: center; line-height: 1.8; }

/* 开始考试面板 */
.start-panel { display: none; }
.start-panel.show { display: block; }
.back-link {
  display: inline-block;
  background: none; border: none;
  color: var(--muted); font-size: 14px;
  padding: 14px 0 4px;
}
.back-link::before { content: "‹ "; }
.paper-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  margin-top: 10px;
}
.paper-card h2 { margin: 0 0 4px; font-size: 20px; }
.paper-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.rule-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.rule-row:last-of-type { border-bottom: none; }
.rule-row .k { color: var(--muted); }
.rule-row .v { font-weight: 600; }
.tip {
  background: var(--accent-weak);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.7;
  white-space: pre-line;
}
.btn-primary {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  padding: 14px;
  margin-top: 18px;
}
.btn-primary:active { opacity: .85; }
.btn-ghost {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  padding: 12px;
  margin-top: 10px;
}
.history { margin-top: 22px; }
.history h3 { font-size: 15px; margin: 0 0 8px; }
.history .empty { color: var(--muted); font-size: 13px; }
.attempt {
  display: flex; align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 14px;
}
.attempt .date { color: var(--muted); flex: 1; }
.attempt .score { font-weight: 700; margin-right: 10px; }
.attempt .score.pass { color: var(--ok); }
.attempt .score.fail { color: var(--bad); }
.clear-history {
  background: none; border: none;
  color: var(--muted); font-size: 12px;
  padding: 10px 0 0;
  text-decoration: underline;
}

/* ===== 做题页 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 10px 12px;
  gap: 8px;
}
.topbar .quit, .topbar .card-btn, .topbar .submit-btn {
  border: none; background: none;
  font-size: 14px; color: var(--muted);
  padding: 6px 8px;
  border-radius: 8px;
  flex: none;
}
.topbar .submit-btn { color: var(--accent); font-weight: 700; }
.topbar .progress { flex: 1; text-align: center; font-size: 15px; font-weight: 700; }
.topbar .progress small { color: var(--muted); font-weight: 400; }
.topbar .timer { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.topbar .timer.warn { color: var(--bad); font-weight: 700; }
.progress-track { height: 3px; background: var(--line); }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.q-area { padding-top: 16px; touch-action: pan-y; }
.q-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}
.q-tags { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tag {
  font-size: 12px;
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 700;
}
.tag.plain { background: #f1f3f8; color: var(--muted); font-weight: 400; }
.q-stem { font-size: 16.5px; line-height: 1.75; white-space: pre-wrap; }
.opts { margin-top: 16px; }
.opt {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%;
  background: #fafbfe;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  margin-top: 10px;
  text-align: left;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  transition: border-color .12s, background .12s;
}
.opt .letter {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid #cfd6e4;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: #fff;
}
.opt.selected { border-color: var(--accent); background: var(--accent-weak); }
.opt.selected .letter { border-color: var(--accent); color: var(--accent); }
.opt.correct { border-color: var(--ok); background: var(--ok-weak); }
.opt.correct .letter { border-color: var(--ok); background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-weak); }
.opt.wrong .letter { border-color: var(--bad); background: var(--bad); color: #fff; }
.opt.dim { opacity: .55; }
.opt:disabled { cursor: default; }
.opt:disabled:not(.correct):not(.wrong):not(.selected) { opacity: .75; }

.confirm-btn {
  display: block; width: 100%;
  border: none; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700;
  padding: 13px; margin-top: 16px;
}
.confirm-btn:disabled { background: #ccd3e0; color: #fff; }

.feedback { margin-top: 14px; }
.fb-banner {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 15px;
  display: flex; justify-content: space-between; align-items: center;
}
.fb-banner.ok { background: var(--ok-weak); color: var(--ok); }
.fb-banner.part { background: var(--part-weak); color: var(--part); }
.fb-banner.bad { background: var(--bad-weak); color: var(--bad); }
.fb-answer { font-size: 14px; margin-top: 10px; color: var(--text); }
.fb-answer b { color: var(--ok); }
.fb-analysis {
  background: #f7f9fc;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
  font-size: 14px;
  color: #3c4356;
  margin-top: 10px;
  line-height: 1.75;
  white-space: pre-wrap;
}
.fb-point { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.fb-next {
  display: block; width: 100%;
  border: none; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700;
  padding: 13px; margin-top: 14px;
}
.fb-next.finish { background: var(--text); }

.bottom-nav {
  display: flex; gap: 10px;
  max-width: 560px; margin: 16px auto 30px;
  padding: 0 16px;
  margin-bottom: calc(30px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  padding: 12px;
}
.bottom-nav button:disabled { color: #c4cbd9; }
.bottom-nav button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* 答题卡 */
.sheet-mask {
  position: fixed; inset: 0;
  background: rgba(20, 26, 40, .45);
  z-index: 30;
  display: none;
}
.sheet-mask.show { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 31;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  max-height: 72vh;
  overflow-y: auto;
  padding: 18px 16px 26px;
  display: none;
}
.sheet.show { display: block; }
.sheet h3 { margin: 0 0 12px; font-size: 16px; }
.sheet-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.cell {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fafbfe;
  font-size: 14px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.cell.done { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.cell.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet-legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.sheet-legend i {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 4px; margin-right: 4px; vertical-align: -1px;
  border: 1px solid var(--line); background: #fafbfe;
}
.sheet-legend .l-done i { background: var(--accent-weak); border-color: var(--accent); }
.sheet-close {
  display: block; width: 100%;
  margin-top: 18px;
  border: none; border-radius: 12px;
  background: #f1f3f8; color: var(--text);
  font-size: 15px; padding: 12px;
}

/* ===== 成绩页 ===== */
.score-hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  padding: 30px 16px 24px;
  margin-top: 18px;
}
.score-num { font-size: 58px; font-weight: 800; line-height: 1.1; color: var(--accent); }
.score-num .full { font-size: 20px; color: var(--muted); font-weight: 500; }
.verdict {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px; font-weight: 700;
  border-radius: 999px;
  padding: 4px 16px;
}
.verdict.pass { background: var(--ok-weak); color: var(--ok); }
.verdict.fail { background: var(--bad-weak); color: var(--bad); }
.score-bar {
  height: 8px; border-radius: 999px;
  background: var(--line);
  margin: 20px 10px 6px;
  position: relative;
}
.score-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent); }
.score-bar .passmark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--bad); }
.bar-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 0 10px; }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-top: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 4px;
  text-align: center;
}
.stat .n { font-size: 20px; font-weight: 800; }
.stat .t { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.ok .n { color: var(--ok); }
.stat.part .n { color: var(--part); }
.stat.bad .n { color: var(--bad); }

.review { margin-top: 26px; }
.review h2 { font-size: 18px; margin: 0 0 4px; }
.review .sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.review-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.ri-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.ri-stem { font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
.ri-detail { margin-top: 10px; font-size: 14px; }
.ri-detail .your b { color: var(--bad); }
.ri-detail .your b.ok { color: var(--ok); }
.ri-detail .corr { margin-top: 4px; }
.ri-detail .corr b { color: var(--ok); }
.result-actions { margin-top: 26px; }

@media (min-width: 700px) {
  body { font-size: 17px; }
  .hero { padding-top: 48px; }
}

/* 案例材料卡 */
.case-card {
  background: var(--accent-weak);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.case-label { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.case-text { font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; }
.ri-material {
  background: #f7f9fc;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #4a5265;
  margin-bottom: 8px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ===== 备考资料 ===== */
.md-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px 24px;
  margin-top: 12px;
}
.md-body h1 { font-size: 20px; margin: 22px 0 10px; }
.md-body h2 {
  font-size: 18px;
  margin: 26px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-weak);
}
.md-body h2.mat-ch, .md-body h3.mat-ch {
  scroll-margin-top: 96px;
  background: var(--accent-weak);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--accent);
}
.md-body h3 { font-size: 16px; margin: 18px 0 8px; color: var(--accent); }
.md-body h4, .md-body h5 { font-size: 14.5px; margin: 14px 0 6px; }
.md-body p { margin: 8px 0; line-height: 1.85; font-size: 14.5px; }
.md-body ul { margin: 8px 0; padding-left: 20px; }
.md-body li { margin: 4px 0; line-height: 1.7; font-size: 14.5px; }
.md-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12.5px;
  display: block;
  overflow-x: auto;
}
.md-body th, .md-body td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  line-height: 1.55;
  white-space: nowrap;
}
.md-body th { background: var(--accent-weak); font-weight: 700; }
.mat-callout {
  background: var(--accent-weak);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  margin: 10px 0;
  font-size: 13.5px;
  line-height: 1.7;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: none;
  border: 1px solid var(--line);
  background: #fafbfe;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text);
}
.chip.cur { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.md-body .mat-ch { scroll-margin-top: 100px; }

/* ===== 章节练习 ===== */
.mode-tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.mode-tab {
  flex: 1;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}
.mode-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-weak);
}
.chapter-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  text-align: left;
}
.chapter-item:active { transform: scale(.99); }
.chapter-item .no {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.chapter-item .cname { flex: 1; font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.chapter-item .cmeta { color: var(--muted); font-size: 12px; font-weight: 400; }
#chapter-list { max-height: 58vh; overflow-y: auto; padding-bottom: 4px; }
.verdict.part { background: var(--part-weak); color: var(--part); }
