/* ===========================================================
   题库刷题系统 · 样式表
   =========================================================== */

:root {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --card: #ffffff;
  --card-2: #fafbfe;
  --text: #16181d;
  --text-2: #4b5563;
  --muted: #8b93a3;
  --line: #e6e9f2;
  --line-2: #eef1f7;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --green: #10b981;
  --green-soft: #e7f8f2;
  --red: #ef4444;
  --red-soft: #fdeced;
  --amber: #f59e0b;
  --amber-soft: #fef5e6;
  --blue: #3b82f6;
  --blue-soft: #eaf2ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .05), 0 10px 30px -12px rgba(16, 24, 40, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --qscale: 1;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

[data-theme="dark"] {
  --bg: #0d0f14;
  --bg-2: #12151c;
  --card: #171a22;
  --card-2: #1c202a;
  --text: #e9ecf3;
  --text-2: #b9c0cf;
  --muted: #7e8798;
  --line: #252a36;
  --line-2: #1f2430;
  --primary: #818cf8;
  --primary-2: #a5b4fc;
  --primary-soft: #1e2130;
  --green: #34d399;
  --green-soft: #102a23;
  --red: #f87171;
  --red-soft: #2c1517;
  --amber: #fbbf24;
  --amber-soft: #2b2213;
  --blue: #60a5fa;
  --blue-soft: #14203a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 12px 30px -14px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.3; }
h2 { font-size: 17px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; color: var(--text-2); }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 6px; font-size: 12px; background: var(--card-2);
}
code { background: var(--primary-soft); color: var(--primary); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.link { color: var(--primary); background: none; border: 0; cursor: pointer; font-size: 13px; padding: 0 2px; }

/* ---------------- 布局 ---------------- */
.app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  height: 60px; padding: 0 22px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--card); }
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15.5px; white-space: nowrap; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; font-size: 15px; font-weight: 700;
}
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a {
  padding: 7px 12px; border-radius: 9px; color: var(--text-2); font-size: 14px; transition: .15s;
}
.nav a:hover { background: var(--bg-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: 6px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); display: grid; place-items: center;
  cursor: pointer; font-size: 16px; transition: .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.icon-btn.on { color: var(--amber); }

.view { flex: 1; outline: none; }
.page {
  max-width: 1080px; margin: 0 auto; padding: 26px 22px 60px;
  display: flex; flex-direction: column; gap: 18px;
}
.page-head h1 { margin-bottom: 4px; }

.tabbar { display: none; }

/* ---------------- 通用 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 11px; border: 1px solid transparent;
  background: var(--bg-2); color: var(--text); font-size: 14px; font-weight: 550;
  cursor: pointer; transition: .16s; white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-text { background: transparent; color: var(--text-2); }
.btn-text:hover { color: var(--primary); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-soft { background: var(--red-soft); color: var(--red); }
.btn-success { background: var(--green-soft); color: var(--green); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-xs { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 11px 22px; font-size: 15px; border-radius: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--bg-2); color: var(--text-2); white-space: nowrap;
}
.chip i { font-style: normal; opacity: .55; font-weight: 400; }
.t-single { background: var(--blue-soft); color: var(--blue); }
.t-multi { background: var(--amber-soft); color: var(--amber); }
.t-judge { background: var(--green-soft); color: var(--green); }
.t-essay { background: var(--primary-soft); color: var(--primary); }
.chip-btn { cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--text-2); transition: .15s; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.chip-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-btn.on i { opacity: .8; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 7px;
  font-size: 12px; background: var(--bg-2); color: var(--muted); white-space: nowrap;
}
.tag-warn { background: var(--amber-soft); color: var(--amber); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }

.bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; width: 100%; min-width: 0; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #8b5cf6); transition: width .5s ease; }

.empty { text-align: center; padding: 56px 16px; color: var(--text-2); }
.empty-ico { font-size: 34px; color: var(--primary); opacity: .5; }
.empty h3 { margin: 10px 0 6px; }
.empty p { color: var(--muted); margin-bottom: 16px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 10px; }
.alert-ok { background: var(--green-soft); color: var(--green); }
.alert-warn { background: var(--amber-soft); color: var(--amber); }

/* ---------------- 首页 ---------------- */
.hero {
  display: flex; align-items: center; gap: 26px;
  background: linear-gradient(135deg, var(--card), var(--card-2));
  border: 1px solid var(--line); border-radius: 22px; padding: 30px 32px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -120px; width: 320px; height: 320px;
  background: radial-gradient(circle, var(--primary-soft), transparent 70%); pointer-events: none;
}
.hero-main { flex: 1; min-width: 0; }
.hero-kicker { font-size: 12.5px; color: var(--primary); font-weight: 700; letter-spacing: .04em; margin-bottom: 6px; }
.hero h1 { font-size: 29px; margin-bottom: 8px; }
.hero-desc { color: var(--muted); font-size: 14px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-ring { width: 132px; height: 132px; position: relative; flex-shrink: 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fg { fill: none; stroke: url(#g); stroke: var(--primary); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-size: 24px; display: block; line-height: 1.1; }
.ring-label span { font-size: 11.5px; color: var(--muted); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat-value .unit { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tone-blue .stat-value { color: var(--blue); }
.tone-red .stat-value { color: var(--red); }
.tone-amber .stat-value { color: var(--amber); }

.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-row { display: grid; grid-template-columns: 128px 1fr 42px 54px; align-items: center; gap: 10px; }
.cr-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-num { font-size: 12.5px; color: var(--muted); text-align: right; }
.cr-act { text-align: right; }

.chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; border-bottom: 1px solid var(--line-2); }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; max-width: 34px; margin: 0 auto; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--primary), #8b5cf6); transition: height .5s ease; }
.chart-col.zero .chart-bar { background: var(--line-2); }
.chart-x { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-v { font-size: 11px; color: var(--muted); height: 14px; }
.chart-wide { height: 170px; gap: 3px; }
.chart-wide .chart-bar { max-width: 20px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--card-2); transition: .16s;
}
.quick:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick b { font-size: 14px; }
.quick span { font-size: 12.5px; color: var(--muted); }

/* ---------------- 刷题 ---------------- */
.practice-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pt-left, .pt-right { display: flex; align-items: center; gap: 10px; }
.practice-top + .bar { margin-top: -4px; }

.qcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 26px 20px;
}
.qmeta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.qcount { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.fav-btn { font-size: 18px; }

.qstem {
  font-size: calc(18px * var(--qscale)); line-height: 1.75; font-weight: 550;
  margin-bottom: 20px; word-break: break-word;
}
.qstem .blank {
  display: inline-block; width: 2.6em; height: 1em; margin: 0 1px; vertical-align: -3px;
  border-bottom: 1.5px solid currentColor; opacity: .38;
}

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 13px;
  background: var(--card); cursor: pointer; transition: .14s; font-size: calc(15px * var(--qscale));
  line-height: 1.6;
}
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.ok {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); color: var(--text-2); font-size: 12.5px; font-weight: 700; margin-top: 1px;
}
.otxt { flex: 1; }
.opt.picked { border-color: var(--primary); background: var(--primary-soft); }
.opt.picked .ok { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.right .ok { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .ok { background: var(--red); color: #fff; }
.opt .mark { color: var(--green); font-weight: 700; margin-left: auto; }

.opts-judge { flex-direction: row; gap: 12px; }
.opts-judge .opt { justify-content: center; align-items: center; gap: 8px; font-weight: 600; }
.jicon { font-size: 17px; }
.judge-yes .jicon { color: var(--green); }
.judge-no .jicon { color: var(--red); }

.multi-tip { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

.feedback { margin-top: 18px; padding: 14px 16px; border-radius: 13px; font-size: 14px; }
.feedback.ok { background: var(--green-soft); }
.feedback.bad { background: var(--red-soft); }
.fb-title { font-weight: 700; margin-bottom: 6px; }
.feedback.ok .fb-title { color: var(--green); }
.feedback.bad .fb-title { color: var(--red); }
.fb-answer { color: var(--text-2); font-size: 13.5px; line-height: 1.7; }

.essay-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

.qfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.qfoot-mid { flex: 1; display: flex; justify-content: center; }

.done-card { text-align: center; padding: 44px 24px; }
.done-ico { font-size: 42px; color: var(--green); }
.done-card h2 { margin: 8px 0 20px; }
.done-stats { display: flex; justify-content: center; gap: 34px; margin-bottom: 24px; flex-wrap: wrap; }
.done-stats div { display: flex; flex-direction: column; gap: 2px; }
.done-stats b { font-size: 22px; }
.done-stats span { font-size: 12.5px; color: var(--muted); }
.done-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ---------------- 考试 ---------------- */
.exam-config { display: flex; flex-direction: column; gap: 20px; }
.cfg-sec h4 { margin-bottom: 10px; }
.cfg-types { display: flex; flex-direction: column; gap: 8px; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cfg-name i { font-style: normal; font-weight: 400; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 34px; height: 34px; border: 0; background: var(--card); cursor: pointer; font-size: 16px; color: var(--text-2); }
.stepper button:hover { background: var(--bg-2); }
.stepper input { width: 54px; height: 34px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; background: var(--card); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.exam-start { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 4px 0; }
.exam-start-actions { display: flex; gap: 10px; }

.exam-bar {
  display: flex; align-items: center; gap: 16px; padding: 12px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  position: sticky; top: 66px; z-index: 20;
}
.exam-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; color: var(--primary); }
.exam-timer.warn { color: var(--red); }
.exam-progress { flex: 1; font-size: 13.5px; color: var(--muted); }
.exam-layout { display: grid; grid-template-columns: 1fr 232px; gap: 18px; align-items: start; }
.exam-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 146px; }
.side-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text-2); }
.sheet { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; max-height: 330px; overflow: auto; }
.sheet-item {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2);
  font-size: 12.5px; cursor: pointer; color: var(--text-2); transition: .12s;
}
.sheet-item.done { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.sheet-item.cur { outline: 2px solid var(--primary); outline-offset: 1px; }
.side-legend { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--line); margin-right: 4px; }
.dot.done { background: var(--primary); }

.result-hero {
  display: flex; align-items: center; gap: 22px; padding: 26px 28px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); flex-wrap: wrap;
}
.result-score { display: flex; align-items: baseline; gap: 4px; color: var(--primary); }
.result-score b { font-size: 46px; line-height: 1; letter-spacing: -.03em; }
.result-score span { font-size: 14px; color: var(--muted); }
.result-hero.pass { background: linear-gradient(135deg, var(--card), var(--green-soft)); }
.result-hero.fail { background: linear-gradient(135deg, var(--card), var(--amber-soft)); }
.result-info { flex: 1; }
.result-info h2 { margin-bottom: 4px; }
.result-info p { color: var(--muted); font-size: 13.5px; }
.result-actions { display: flex; gap: 10px; }

.review-item { border-top: 1px solid var(--line-2); padding: 18px 0; }
.review-item:first-child { border-top: 0; }
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.review-no { width: 24px; height: 24px; border-radius: 7px; background: var(--bg-2); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; }
.review-mark { margin-left: auto; font-size: 12.5px; font-weight: 600; }
.review-item.ok .review-mark { color: var(--green); }
.review-item.bad .review-mark { color: var(--red); }
.review-item.skip .review-mark { color: var(--muted); }
.review-ans { font-size: 13.5px; color: var(--text-2); margin-top: 10px; }
.review-expl { font-size: 13.5px; color: var(--text-2); margin-top: 6px; background: var(--card-2); padding: 10px 14px; border-radius: 10px; }
.review-item .opts { pointer-events: none; }
.review-item .qstem { font-size: 15px; margin-bottom: 12px; }

/* ---------------- 题库 / 列表 ---------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; }
.input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  outline: none; transition: .15s; min-width: 0;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.toolbar .input[type="search"] { flex: 1; min-width: 180px; }
.textarea { width: 100%; resize: vertical; line-height: 1.7; }
.result-line { margin-top: -6px; }
.list-card { padding: 6px 20px; }
.qrow {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line-2);
  cursor: pointer; transition: .12s;
}
.qrow:last-child { border-bottom: 0; }
.qrow:hover { background: var(--card-2); }
.qrow-no { width: 26px; color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.qrow-main { flex: 1; min-width: 0; }
.qrow-stem { font-size: 14.5px; line-height: 1.6; margin-bottom: 6px; }
.qrow-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.qrow-act { flex-shrink: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 0 20px; }

.filter-panel { display: flex; flex-direction: column; gap: 18px; }
.fp-group .fp-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 9px; display: flex; align-items: center; gap: 10px; }
.chapter-picker { display: flex; flex-wrap: wrap; gap: 8px; max-height: 190px; overflow: auto; padding: 2px; }
.pick {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px;
  border: 1px solid var(--line); cursor: pointer; font-size: 13px; transition: .14s; background: var(--card);
}
.pick input { display: none; }
.pick.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 550; }
.fp-summary { font-size: 13.5px; color: var(--text-2); padding-top: 4px; border-top: 1px solid var(--line-2); }
.fp-summary b { color: var(--primary); font-size: 16px; }

/* ---------------- 导入导出 ---------------- */
.import-box { display: flex; flex-direction: column; gap: 14px; }
.dropzone {
  border: 2px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center;
  cursor: pointer; transition: .16s; background: var(--card-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dz-ico { font-size: 26px; color: var(--primary); margin-bottom: 6px; }
.or { text-align: center; font-size: 12.5px; color: var(--muted); position: relative; }
.import-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.import-tip { line-height: 1.7; }
.preview-chips { margin-bottom: 10px; }
.preview-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; }
.preview-item { padding: 9px 12px; background: var(--card-2); border-radius: 10px; font-size: 13px; }
.export-list { display: flex; flex-direction: column; gap: 10px; }
.export-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; transition: .15s;
}
.export-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.export-item span { font-size: 12.5px; color: var(--muted); }

/* ---------------- 统计 ---------------- */
.type-stats { display: flex; flex-direction: column; gap: 12px; }
.ts-row { display: grid; grid-template-columns: 74px 1fr 48px 52px; align-items: center; gap: 10px; }
.ts-bar { display: flex; }
.ts-num { text-align: right; font-size: 13px; font-weight: 600; }
.history-list { display: flex; flex-direction: column; gap: 9px; }
.h-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.h-type { padding: 1px 8px; border-radius: 6px; font-size: 11.5px; background: var(--bg-2); color: var(--muted); }
.h-type.exam { background: var(--amber-soft); color: var(--amber); }
.h-name { flex: 1; }
.h-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.chapter-table { display: flex; flex-direction: column; gap: 9px; }
.ct-row { display: grid; grid-template-columns: 190px 1fr 42px 52px 52px; align-items: center; gap: 10px; font-size: 13.5px; }
.ct-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-num { text-align: right; color: var(--muted); font-size: 12.5px; }
.ct-sub { text-align: right; }
.ct-acc { text-align: right; font-weight: 600; font-size: 13px; }
.ct-acc.good { color: var(--green); }
.ct-acc.mid { color: var(--amber); }
.ct-acc.low { color: var(--red); }

/* ---------------- 设置 ---------------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: 0; }
.set-row.flat { padding: 0; border-bottom: 0; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch-row.slim { padding: 0 4px; }
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; }
.switch i::after {
  content: ""; position: absolute; width: 19px; height: 19px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(19px); }
.about p { margin-bottom: 8px; font-size: 13.5px; color: var(--text-2); }

/* ---------------- 弹层 / 提示 ---------------- */
.modal-open { overflow: hidden; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 18, 26, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 520px; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.modal-body { padding: 4px 20px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.answer-block { white-space: pre-wrap; line-height: 1.8; font-size: 14px; background: var(--card-2); padding: 14px 16px; border-radius: 12px; }
.detail-ans { font-size: 13.5px; color: var(--text-2); margin-top: 12px; line-height: 1.7; }
.detail-meta { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: #1f2430; color: #fff; padding: 10px 20px; border-radius: 12px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 200; max-width: 84vw; text-align: center;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { background: var(--green); }
.toast-warn { background: var(--amber); color: #241a05; }
.toast-error { background: var(--red); }

/* ---------------- 打印 ---------------- */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; padding: 0; color: #000; font-size: 12pt; }
  #print-area h1 { font-size: 18pt; text-align: center; margin-bottom: 4pt; }
  .print-meta { text-align: center; color: #666; font-size: 10pt; margin-bottom: 14pt; }
  .print-q { page-break-inside: avoid; margin-bottom: 14pt; }
  .pq-stem { font-weight: 600; margin-bottom: 4pt; line-height: 1.6; }
  .pq-opts { display: flex; flex-wrap: wrap; gap: 4pt 18pt; margin-bottom: 4pt; }
  .pq-ans { color: #444; border-top: 1px dashed #bbb; padding-top: 3pt; font-size: 10.5pt; }
  .pq-blank { height: 18pt; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .exam-layout { grid-template-columns: 1fr; }
  .exam-side { position: static; order: -1; }
  .sheet { grid-template-columns: repeat(10, 1fr); max-height: none; }
  .ct-row { grid-template-columns: 120px 1fr 40px 46px; }
  .ct-sub { display: none; }
  .chapter-row { grid-template-columns: 100px 1fr 38px; }
  .cr-act { display: none; }
}

@media (max-width: 760px) {
  .topbar { height: 54px; padding: 0 14px; }
  .nav { display: none; }
  .brand-text { font-size: 14.5px; }
  .page { padding: 16px 14px 90px; gap: 14px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: color-mix(in srgb, var(--card) 94%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; text-align: center; padding: 7px 0; font-size: 12px; color: var(--muted);
    border-radius: 10px;
  }
  .tabbar a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
  .hero { padding: 22px; flex-direction: column; align-items: flex-start; gap: 14px; }
  .hero h1 { font-size: 23px; }
  .hero-ring { width: 100%; height: 96px; }
  .hero-ring .ring { display: none; }
  .ring-label { position: static; display: flex; align-items: baseline; gap: 6px; }
  .ring-label b { font-size: 28px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 20px; }
  .qcard { padding: 18px 16px 16px; border-radius: 14px; }
  .qstem { font-size: calc(16.5px * var(--qscale)); }
  .exam-bar { top: 58px; padding: 10px 12px; }
  .ct-row { grid-template-columns: 96px 1fr 38px 44px; }
  .chart { height: 120px; }
  .modal-mask { padding: 10px; align-items: flex-end; }
  .modal { max-height: 92vh; }
  .qfoot .btn { flex: 1; }
  .qfoot-mid { flex: 0 0 auto; }
}

@media (max-width: 420px) {
  .brand-text { display: none; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .chips { gap: 6px; }
  .chip { font-size: 12px; padding: 3px 8px; }
}
