:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1b2030;
  --ink-2: #3d4356;
  --muted: #7b8296;
  --line: #e7eaf3;
  --primary: #5558d9;
  --primary-2: #7a6cf0;
  --primary-soft: #eef0ff;
  --green: #0f9d58;
  --green-soft: #e6f7ee;
  --red: #e0443e;
  --red-soft: #fdeceb;
  --amber: #c47b0a;
  --amber-soft: #fdf3e1;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(21, 29, 54, .05);
  --shadow: 0 1px 2px rgba(21, 29, 54, .04), 0 14px 32px -18px rgba(31, 41, 87, .22);
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.65;
  background:
    radial-gradient(1100px 520px at 88% -12%, #e9e6ff 0%, rgba(233, 230, 255, 0) 62%),
    radial-gradient(900px 460px at 18% 108%, #e3f3ef 0%, rgba(227, 243, 239, 0) 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); }

.app { display: flex; min-height: 100vh; }

/* ---------------- 侧栏 ---------------- */
.sidebar {
  width: 236px;
  flex: none;
  padding: 22px 16px;
  background: rgba(255, 255, 255, .78);
  border-right: 1px solid rgba(226, 230, 242, .9);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.logo {
  width: 42px; height: 42px; flex: none;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--primary-2), var(--primary) 60%, #4340b8);
  color: #fff; font-weight: 700; font-size: 20px;
  display: grid; place-items: center;
  box-shadow: 0 8px 18px -8px rgba(85, 88, 217, .8);
}
.brand-text h1 { font-size: 16.5px; font-weight: 700; letter-spacing: .3px; }
.brand-text p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  border: 0; background: transparent;
  padding: 10px 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 14px; text-align: left;
  transition: background .16s, color .16s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-item:hover { background: rgba(85, 88, 217, .07); color: var(--primary); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--red); color: #fff;
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}

.sidebar-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px dashed var(--line); }
.phone-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid #d9dcf2; background: linear-gradient(145deg, #f4f4ff, #eceeff);
  color: var(--primary); font-weight: 600; font-size: 12.5px;
  padding: 8px 10px; border-radius: 9px; margin-bottom: 10px;
  transition: all .16s;
}
.phone-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.phone-btn:hover { border-color: #c3c5f2; background: var(--primary-soft); }
.mini-stat { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); padding: 3px 0; }
.mini-stat b { color: var(--ink); font-size: 14px; }
.side-tip { font-size: 11px; color: #a2a8ba; margin-top: 10px; line-height: 1.6; }

/* ---------------- 主区域 ---------------- */
.view { flex: 1; min-width: 0; padding: 34px clamp(20px, 4vw, 54px) 60px; max-width: 1180px; }
.loading { color: var(--muted); padding: 60px 0; text-align: center; }
.loading small { display: block; max-width: 380px; margin: 10px auto 0; font-size: 12px; line-height: 1.75; color: #a2a8ba; }
.boot-noscript {
  max-width: 420px; margin: 14px auto 0; padding: 10px 13px; border-radius: 10px;
  background: var(--amber-soft); color: var(--amber); font-size: 12.5px; line-height: 1.7;
}
.boot-error {
  text-align: left; max-width: 100%; max-height: 180px; overflow: auto;
  background: #f7f8fe; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-top: 10px; font-size: 11.5px; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-all;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 25px; font-weight: 700; letter-spacing: .3px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-head .head-actions { display: flex; gap: 10px; align-items: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-left: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  transition: transform .12s, box-shadow .16s, background .16s, border-color .16s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfd3e6; background: #fbfbfe; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(145deg, var(--primary-2), var(--primary));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 10px 20px -12px rgba(85, 88, 217, .95);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(145deg, var(--primary-2), var(--primary)); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f3c9c6; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 13px 26px; font-size: 15px; border-radius: 12px; }
.btn.wide { width: 100%; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 2px 4px; font-size: 13px; }
.btn.link:hover { background: transparent; text-decoration: underline; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 46px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13px; transition: all .15s;
}
.chip:hover { border-color: #c8cbf0; color: var(--primary); }
.chip.on { background: var(--primary-soft); border-color: #c5c7f4; color: var(--primary); font-weight: 600; }
.chip.type-on { background: #eefaf4; border-color: #b9e6cf; color: #0b7a45; font-weight: 600; }

/* ---------------- 练习设置 ---------------- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: 18px; align-items: start; }
.setup-grid .card + .card { margin-top: 0; }

.bank-list { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow: auto; padding-right: 4px; }
.bank-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer; transition: all .15s; background: #fff;
}
.bank-row:hover { border-color: #cdd0ec; background: #fcfcff; }
.bank-row.on { border-color: #c3c5f2; background: var(--primary-soft); }
.bank-row input { display: none; }
.check {
  width: 19px; height: 19px; border-radius: 6px; border: 1.6px solid #cfd3e3;
  flex: none; display: grid; place-items: center; background: #fff; transition: all .15s;
}
.bank-row.on .check { background: var(--primary); border-color: var(--primary); }
.check svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2.6; fill: none; opacity: 0; }
.bank-row.on .check svg { opacity: 1; }
.bank-row .bank-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-row .bank-meta { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.bank-row .grow { min-width: 0; flex: 1; }
.bank-row .count { color: var(--muted); font-size: 12px; flex: none; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 9px; }
.field-label .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.custom-count { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.custom-count input, .input {
  width: 92px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px;
  outline: none; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.custom-count input:focus, .input:focus, textarea:focus { border-color: #b9bbee; box-shadow: 0 0 0 3px rgba(85, 88, 217, .1); }

.segmented { display: flex; background: #f3f4fa; padding: 4px; border-radius: 11px; gap: 4px; }
.segmented button {
  flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted); font-weight: 500; transition: all .15s;
}
.segmented button.on { background: #fff; color: var(--primary); font-weight: 700; box-shadow: var(--shadow-sm); }

.pool-note {
  display: flex; align-items: center; justify-content: space-between;
  background: #f8f9fe; border: 1px dashed #dcdef3; border-radius: 11px;
  padding: 10px 14px; font-size: 12.5px; color: var(--muted); margin: 18px 0 12px;
}
.pool-note b { color: var(--primary); font-size: 17px; margin: 0 2px; }
.pool-note.warn b { color: var(--red); }

.quick-tip { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.6; padding: 0 4px; }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center; padding: 54px 20px; color: var(--muted);
}
.empty .empty-icon {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary); display: grid; place-items: center;
  font-size: 26px;
}
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty p { font-size: 13px; margin-bottom: 18px; }

/* ---------------- 答题 ---------------- */
.quiz-shell { max-width: 820px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.quiz-progress { flex: 1; }
.bar { height: 8px; border-radius: 99px; background: #e9ebf6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary-2), var(--primary)); transition: width .3s ease; }
.quiz-progress .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 7px; }
.quiz-score { display: flex; gap: 10px; font-size: 13px; font-weight: 600; }
.quiz-score .ok { color: var(--green); }
.quiz-score .no { color: var(--red); }
.quiz-score .timer { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }

.question-card { padding: 26px 28px 22px; }
.q-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; flex-wrap: wrap; }
.type-badge {
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 7px;
  background: var(--primary-soft); color: var(--primary); letter-spacing: .3px;
}
.type-badge.multi { background: #f2ecff; color: #7b4dd6; }
.type-badge.judge { background: #e8f6ff; color: #0879a8; }
.type-badge.fill { background: #fff4e5; color: #b06a00; }
.type-badge.essay { background: #fdecf3; color: #b03b6a; }
.q-no, .bank-name { font-size: 12px; color: var(--muted); }
.q-no::after { content: "·"; margin-left: 9px; color: #c7cbd9; }
.missing-tag { font-size: 11px; color: var(--amber); background: var(--amber-soft); padding: 2px 8px; border-radius: 6px; }

.stem { font-size: 17px; line-height: 1.8; font-weight: 500; white-space: pre-wrap; word-break: break-word; margin-bottom: 20px; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 13px;
  width: 100%; text-align: left; padding: 13px 15px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color .14s, background .14s, box-shadow .14s;
  font-size: 14.5px; line-height: 1.65;
}
.option:hover:not(.locked) { border-color: #c5c7ee; background: #fbfbff; }
.option .key {
  width: 27px; height: 27px; flex: none; border-radius: 8px;
  background: #f1f2f9; color: #555b70; font-weight: 700; font-size: 13px;
  display: grid; place-items: center; transition: all .14s;
}
.option .txt { padding-top: 1px; word-break: break-word; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(85, 88, 217, .07); }
.option.selected .key { background: var(--primary); color: #fff; }
.option.correct { border-color: #45b97c; background: var(--green-soft); }
.option.correct .key { background: var(--green); color: #fff; }
.option.wrong { border-color: #eb7b76; background: var(--red-soft); }
.option.wrong .key { background: var(--red); color: #fff; }
.option.locked { cursor: default; opacity: 1; }
.option:disabled { opacity: 1; -webkit-text-fill-color: inherit; }
.option .mark { margin-left: auto; font-size: 15px; font-weight: 700; padding-left: 8px; }
.option.correct .mark { color: var(--green); }
.option.wrong .mark { color: var(--red); }

.answer-input, .answer-textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 13px 15px; outline: none; background: #fff; font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.answer-textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.answer-input:focus, .answer-textarea:focus { border-color: #b9bbee; box-shadow: 0 0 0 3px rgba(85, 88, 217, .1); }
.answer-input:disabled, .answer-textarea:disabled { background: #f7f8fc; color: #6e7488; }

.feedback { margin-top: 20px; border-radius: 13px; padding: 16px 18px; border: 1px solid; }
.feedback.good { background: var(--green-soft); border-color: #bce7cf; }
.feedback.bad { background: var(--red-soft); border-color: #f6cdca; }
.feedback.neutral { background: var(--amber-soft); border-color: #f2ddb5; }
.fb-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.feedback.good .fb-title { color: #0b7a45; }
.feedback.bad .fb-title { color: #c0322c; }
.feedback.neutral .fb-title { color: #9a6206; }
.fb-row { font-size: 13.5px; margin-top: 5px; color: var(--ink-2); }
.fb-row b { color: var(--ink); }
.fb-expl { font-size: 13px; color: #555d72; margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(0, 0, 0, .08); white-space: pre-wrap; line-height: 1.7; }
.self-judge { display: flex; gap: 9px; margin-top: 13px; }
.revise-row { margin-top: 10px; }

.q-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.q-actions .right { display: flex; gap: 10px; margin-left: auto; }
.kbd-hint { text-align: center; color: #a2a8ba; font-size: 11.5px; margin-top: 16px; }
.kbd-hint kbd {
  background: #fff; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-family: inherit; font-size: 10.5px; color: var(--muted);
}

/* ---------------- 结果 ---------------- */
.result-hero { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.ring {
  --val: 0;
  width: 148px; height: 148px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--val) * 1%), #eceef7 0);
  display: grid; place-items: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: 11px; background: #fff; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); }
.ring .ring-in { position: relative; text-align: center; }
.ring .ring-in b { display: block; font-size: 34px; line-height: 1.1; letter-spacing: -1px; }
.ring .ring-in span { font-size: 11.5px; color: var(--muted); }
.result-info h3 { font-size: 21px; margin-bottom: 6px; }
.result-info p { color: var(--muted); font-size: 13px; }
.result-stats { display: flex; gap: 28px; margin-top: 18px; flex-wrap: wrap; }
.result-stats .rs b { display: block; font-size: 21px; line-height: 1.2; }
.result-stats .rs span { font-size: 11.5px; color: var(--muted); }
.result-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

.wrong-review { margin-top: 20px; }
.review-item { border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px; margin-bottom: 10px; background: #fff; }
.review-item .ri-head { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.review-item .ri-stem { font-size: 14px; font-weight: 500; line-height: 1.7; }
.review-item .ri-ans { font-size: 12.5px; color: var(--green); margin-top: 7px; }
.review-item .ri-your { font-size: 12.5px; color: var(--red); margin-top: 5px; }
.review-item .ri-expl { font-size: 12.5px; color: var(--muted); margin-top: 5px; white-space: pre-wrap; }

/* ---------------- 题库管理 ---------------- */
.dropzone {
  border: 1.8px dashed #cfd2ea; border-radius: 15px; background: #fafbff;
  padding: 26px; display: flex; align-items: center; gap: 18px; transition: all .16s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dz-icon {
  width: 52px; height: 52px; flex: none; border-radius: 15px;
  background: #fff; border: 1px solid var(--line); display: grid; place-items: center;
  color: var(--primary); font-size: 22px; box-shadow: var(--shadow-sm);
}
.dropzone .dz-text { flex: 1; min-width: 0; }
.dropzone .dz-text b { font-size: 14.5px; display: block; }
.dropzone .dz-text p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dropzone .btn { flex: none; }

.import-extra { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.import-extra .input { flex: 1; min-width: 180px; width: auto; }
.paste-panel { margin-top: 14px; }
.paste-panel textarea {
  width: 100%; min-height: 170px; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; outline: none; resize: vertical; line-height: 1.75; font-size: 13.5px;
}
.paste-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.import-status { margin-top: 14px; }
.report-line { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.report-line:last-child { border-bottom: 0; }
.report-line .fname { font-weight: 600; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-line .nums { color: var(--muted); }
.report-line .warns { color: var(--amber); flex: 1; }

.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.bank-card { border: 1px solid var(--line); border-radius: 14px; padding: 17px 18px; background: #fff; transition: box-shadow .16s, transform .16s; }
.bank-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.bank-card .bc-head { display: flex; align-items: flex-start; gap: 9px; }
.bank-card h4 { font-size: 15px; font-weight: 700; flex: 1; word-break: break-word; }
.bank-card .bc-date { color: #a2a8ba; font-size: 11px; flex: none; }
.bank-card .bc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 12px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: #f4f5fa; color: #666d82; }
.tag b { color: var(--ink); }
.bank-card .bc-foot { display: flex; align-items: center; gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; flex-wrap: wrap; }
.bank-card .bc-foot .acc { font-size: 12px; color: var(--muted); margin-right: auto; white-space: nowrap; }
.bank-card .bc-foot .btn, .bank-card .bc-foot .icon-btn { flex: none; }
.icon-btn { border: 0; background: none; color: #9aa0b2; padding: 3px 6px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.icon-btn:hover { color: var(--red); background: var(--red-soft); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box input { width: 100%; padding: 9px 13px 9px 34px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #fff; }
.search-box input:focus { border-color: #b9bbee; box-shadow: 0 0 0 3px rgba(85, 88, 217, .08); }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: #9aa0b2; fill: none; stroke-width: 2; }

.q-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.q-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.q-item .qi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.q-item .qi-no { font-size: 11.5px; color: #a2a8ba; font-weight: 600; }
.q-item .qi-stem { font-size: 13.8px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.qi-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; color: #5c6378; font-size: 12.5px; }
.qi-opts span { display: inline-flex; gap: 5px; }
.qi-opts b { color: #9aa0b2; font-weight: 600; }
.q-item .qi-ans { font-size: 12.5px; color: var(--green); margin-top: 7px; background: var(--green-soft); display: inline-block; padding: 2px 9px; border-radius: 6px; }
.q-item .qi-expl { font-size: 12.3px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }
.q-item .qi-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.q-item .qi-stat { font-size: 11px; color: #a2a8ba; margin-left: auto; }
.missing-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-right: 4px; }

.load-more { text-align: center; padding: 16px 0 4px; }

/* ---------------- 错题本 ---------------- */
.wrong-item { display: flex; gap: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; }
.wrong-item .wi-body { flex: 1; min-width: 0; }
.wrong-item .wi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.wrong-item .wi-bank { font-size: 11.5px; color: #a2a8ba; }
.wrong-item .wi-stem { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.wrong-item .wi-ans { font-size: 12.5px; color: var(--green); margin-top: 6px; }
.wrong-item .wi-expl { font-size: 12.3px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.wrong-item .wi-side { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.wrong-item .wi-count { font-size: 11.5px; color: var(--red); background: var(--red-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.wrong-item .wi-last { font-size: 10.5px; color: #a2a8ba; }

/* ---------------- 统计 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-card .sc-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-card .sc-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; line-height: 1.2; }
.stat-card .sc-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-card .sc-sub { font-size: 11.5px; color: #a2a8ba; margin-top: 2px; }

.stats-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 18px; align-items: start; margin-top: 18px; }
.stats-two .card + .card { margin-top: 0; }

.history-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 6px 2px 0; justify-content: flex-start; }
.hist-col { flex: 0 1 46px; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; height: 100%; justify-content: flex-end; }
.hist-col .hb {
  width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #8b8df0, var(--primary));
  min-height: 4px; transition: height .3s;
}
.hist-col .hb.low { background: linear-gradient(180deg, #f3a7a3, #e0443e); }
.hist-col .hd { font-size: 10px; color: #a2a8ba; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.history-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.history-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.history-table td { padding: 8px; border-bottom: 1px dashed var(--line); }
.history-table tr:last-child td { border-bottom: 0; }
.history-table .acc-good { color: var(--green); font-weight: 600; }
.history-table .acc-bad { color: var(--red); font-weight: 600; }

.bank-acc-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.bank-acc-row:last-child { border-bottom: 0; }
.bank-acc-row .ba-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-acc-row .ba-bar { width: 110px; height: 7px; background: #eef0f8; border-radius: 99px; overflow: hidden; flex: none; }
.bank-acc-row .ba-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6fd3a4, var(--green)); border-radius: 99px; }
.bank-acc-row .ba-pct { width: 46px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bank-acc-row .ba-count { width: 70px; text-align: right; font-size: 11px; color: #a2a8ba; }

.type-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.type-row .tr-label { width: 58px; font-size: 12.5px; flex: none; }
.type-row .tr-bar { flex: 1; height: 7px; background: #eef0f8; border-radius: 99px; overflow: hidden; }
.type-row .tr-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #9b9df3, var(--primary)); }
.type-row .tr-pct { width: 52px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.type-row .tr-n { width: 54px; text-align: right; font-size: 11px; color: #a2a8ba; }

/* ---------------- Modal / Toast ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(23, 27, 45, .42);
  backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  width: min(640px, 100%); max-height: 88vh; overflow: auto; background: #fff;
  border-radius: 18px; box-shadow: 0 30px 70px -20px rgba(20, 25, 50, .45); padding: 24px;
  animation: pop .16s ease;
}
@keyframes pop { from { transform: scale(.97) translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .form-row { margin-bottom: 13px; }
.modal .form-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.modal input[type=text], .modal textarea, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  outline: none; background: #fff;
}
.modal textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: #b9bbee; box-shadow: 0 0 0 3px rgba(85, 88, 217, .09); }
.modal .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.phone-lead { font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; }
.phone-urls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.phone-url {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #f7f8fe; border: 1px dashed #cfd2ea; border-radius: 10px;
  padding: 11px 13px; color: var(--primary); font-weight: 700; font-size: 15px;
  font-variant-numeric: tabular-nums; word-break: break-all;
}
.phone-steps { display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.phone-steps > div { display: flex; gap: 9px; align-items: flex-start; }
.phone-steps b {
  flex: none; width: 19px; height: 19px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary); font-size: 11.5px; display: grid; place-items: center; margin-top: 1px;
}
.phone-warn {
  font-size: 12px; color: var(--amber); background: var(--amber-soft);
  border-radius: 8px; padding: 8px 11px; line-height: 1.65;
}

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: #232838; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 12px 26px -10px rgba(0, 0, 0, .4);
  opacity: 0; pointer-events: none; transition: all .22s; z-index: 120; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b3322d; }

.install-tip {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(420px, calc(100vw - 28px)); z-index: 60;
  background: #232838; color: #fff; border-radius: 14px;
  padding: 13px 14px; box-shadow: 0 18px 34px -14px rgba(0, 0, 0, .5);
  display: flex; gap: 10px; align-items: center;
  animation: tip-in .28s ease;
}
@keyframes tip-in { from { transform: translate(-50%, 14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.install-tip .it-icon {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: linear-gradient(145deg, var(--primary-2), var(--primary));
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.install-tip .it-text { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.55; color: #e7e9f5; }
.install-tip .it-text b { color: #fff; }
.install-tip .it-close { border: 0; background: transparent; color: #9aa0b8; font-size: 18px; padding: 2px 5px; flex: none; }
.install-tip .it-btn { border: 0; background: #fff; color: #30364f; font-weight: 700; font-size: 12px; padding: 7px 11px; border-radius: 8px; flex: none; }


.hidden { display: none !important; }

/* ---------------- 数据备份 ---------------- */
.backup-note { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 14px; }
.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.backup-warn {
  background: var(--amber-soft); color: var(--amber); border: 1px solid #f1dfb8;
  border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px;
}
.backup-hint { color: var(--muted); font-size: 12px; margin-top: 11px; line-height: 1.65; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .setup-grid, .stats-two { grid-template-columns: 1fr; }
  .setup-grid .card + .card { margin-top: 0; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; z-index: 80;
    flex-direction: row; align-items: stretch; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid rgba(226, 230, 242, .95);
    background: rgba(255, 255, 255, .95);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    overflow: visible;
    box-shadow: 0 -8px 30px -18px rgba(31, 41, 87, .28);
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 0; margin: 0; width: 100%; }
  .nav-item {
    flex: 1; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 7px 2px 5px; border-radius: 10px;
    font-size: 10.5px; line-height: 1.2; text-align: center; min-width: 0;
  }
  .nav-item svg { width: 21px; height: 21px; }
  .nav-item span:not(.nav-badge) { display: block; }
  .nav-badge {
    position: absolute; top: 2px; left: calc(50% + 4px); margin: 0;
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px;
  }
  .view { padding: 18px 15px calc(86px + env(safe-area-inset-bottom)); max-width: 100%; }
  body.quiz-mode .sidebar { display: none; }
  body.quiz-mode .view { padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  .page-head h2 { font-size: 21px; }
  .page-head p { font-size: 12.5px; }
  .page-head .head-actions { margin-left: auto; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .sc-value { font-size: 24px; }
  .import-extra { flex-direction: column; align-items: stretch; }
  .import-extra .input { width: 100%; }
  .bank-card .bc-foot .acc { flex: 1 0 100%; margin-bottom: 2px; }
  .question-card { padding: 20px 17px 18px; }
  .stem { font-size: 15.5px; }
  .quiz-top { gap: 10px; flex-wrap: wrap; }
  .quiz-score { order: 3; }
  .dropzone { flex-direction: column; text-align: center; }
  .result-hero { gap: 20px; }
  .ring { width: 120px; height: 120px; }
  .wrong-item { flex-direction: column; }
  .wrong-item .wi-side { flex-direction: row; align-items: center; }
  .history-table { font-size: 12px; }
  .history-table th, .history-table td { padding: 7px 6px; }
  .history-table th:nth-child(2), .history-table td:nth-child(2),
  .history-table th:nth-child(5), .history-table td:nth-child(5) { display: none; }
  .backup-actions .btn { flex: 1; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .install-tip { bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 110; }
  body.quiz-mode .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}
