/* ===================== 设计变量 ===================== */
:root {
  --bg: #f5f6f8;
  --bg-grad: radial-gradient(1200px 600px at 50% -260px, #e8efff 0%, transparent 60%);
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --text: #171a20;
  --text-2: #404652;
  --muted: #7b8394;
  --line: #e6e8ee;
  --line-strong: #d5d9e2;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #eaf1ff;
  --brand-text: #1a49b8;
  --ok: #0f9d58;
  --ok-soft: #e8f7ef;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --warn: #d97706;
  --warn-soft: #fef5e7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 8px 24px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .04);
  --radius: 16px;
}

html[data-theme="dark"] {
  --bg: #0e1014;
  --bg-grad: radial-gradient(1200px 600px at 50% -260px, #16233d 0%, transparent 60%);
  --panel: #16191f;
  --panel-2: #1b1f26;
  --text: #e9ecf1;
  --text-2: #c3c9d4;
  --muted: #8b93a1;
  --line: #262b34;
  --line-strong: #333a46;
  --brand: #4b8cff;
  --brand-2: #6a9dff;
  --brand-soft: #17233c;
  --brand-text: #9dbcff;
  --ok: #34c98a;
  --ok-soft: #10281d;
  --bad: #ff6b6b;
  --bad-soft: #2a1517;
  --warn: #e0a33e;
  --warn-soft: #2a2113;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px -14px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .2px; }
p { margin: 0; }
button { font-family: inherit; }
::selection { background: var(--brand-soft); }

/* ===================== 顶栏 ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--brand), #5b8dff);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .6);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.tabs { display: flex; gap: 2px; margin-left: auto; }

.tab {
  border: 0; background: transparent;
  color: var(--muted);
  font-size: 14px; font-weight: 500;
  padding: 7px 13px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--panel-2); color: var(--text-2); }
.tab.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }

.badge {
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px;
  background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
  line-height: 1;
}

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  flex: none;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
html[data-theme="dark"] .i-sun { display: block; }
html[data-theme="dark"] .i-moon { display: none; }
html:not([data-theme="dark"]) .i-sun { display: none; }
html:not([data-theme="dark"]) .i-moon { display: block; }

/* ===================== 布局 ===================== */
.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}
.wrap-quiz { max-width: 780px; }
.view { display: none; }
.view.is-active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }

/* ===================== 卡片 / 面板 ===================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 15.5px; }
.panel-actions { margin-left: auto; display: flex; gap: 8px; }
.page-head { margin: 4px 0 16px; }
.page-head h2 { font-size: 20px; font-weight: 700; }

/* ===================== 按钮 ===================== */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text-2);
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px -6px rgba(37, 99, 235, .8);
}
.btn-primary:hover { color: #fff; border-color: transparent; filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-mini { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 34px; font-size: 16px; border-radius: 12px; font-weight: 600; }
.btn-icon { padding: 6px 11px; }

/* ===================== 继续练习 ===================== */
.hero-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--panel) 40%, var(--brand-soft)));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.hero-left { min-width: 0; }
.hero-kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: .8px;
  color: var(--brand-text); text-transform: uppercase;
}
.hero-card h3 { font-size: 16px; margin: 2px 0; }
.hero-actions { margin-left: auto; display: flex; gap: 8px; }

/* ===================== 统计条 ===================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font-size: 21px; font-weight: 700;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 12px; color: var(--muted); }
.stat.is-brand b { color: var(--brand); }
.stat.is-ok b { color: var(--ok); }
.stat.is-bad b { color: var(--bad); }

/* ===================== 题库选择 ===================== */
.bank-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.bank-chip {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  position: relative;
}
.bank-chip:hover { border-color: var(--line-strong); background: var(--panel); }
.bank-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 18px; height: 18px; border-radius: 6px;
  border: 1.6px solid var(--line-strong);
  flex: none; margin-top: 2px;
  display: grid; place-items: center;
  color: #fff; font-size: 12px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.bank-chip.is-on { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); background: var(--brand-soft); }
.bank-chip.is-on .check-box { background: var(--brand); border-color: var(--brand); }
.bank-chip-main { min-width: 0; flex: 1; }
.bank-chip-main strong { display: block; font-size: 14px; font-weight: 600; }
.bank-chip-main em { font-style: normal; font-size: 12px; color: var(--muted); }
.bank-chip-bar {
  height: 3px; border-radius: 2px;
  background: var(--line);
  margin-top: 8px; overflow: hidden;
}
.bank-chip-bar i { display: block; height: 100%; background: var(--brand); border-radius: 2px; }

/* ===================== 部门切换 ===================== */
.dept-chip { user-select: none; }
.dept-chip.is-pinned {
  cursor: default;
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  background: var(--brand-soft);
}
.radio-box {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1.6px solid var(--line-strong);
  flex: none; margin-top: 3px;
  transition: background .15s, border-color .15s;
}
.dept-chip:hover .radio-box { border-color: var(--brand); }
.dept-chip.is-on .radio-box { background: var(--brand); border-color: var(--brand); }
.pin-tag {
  position: absolute; top: 8px; right: 10px;
  font-size: 10.5px; line-height: 1.7;
  padding: 0 7px; border-radius: 999px;
  background: var(--brand); color: #fff;
}


/* ===================== 模式 ===================== */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mode-card {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color .15s, background .15s;
  color: var(--text);
}
.mode-card:hover { border-color: var(--line-strong); background: var(--panel); }
.mode-card .mode-ico {
  font-size: 15px; color: var(--muted); line-height: 1;
  margin-bottom: 4px;
}
.mode-card strong { font-size: 14px; font-weight: 600; }
.mode-card em { font-style: normal; font-size: 12px; color: var(--muted); }
.mode-card.is-active {
  border-color: color-mix(in srgb, var(--brand) 60%, var(--line));
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent);
}
.mode-card.is-active .mode-ico, .mode-card.is-active strong { color: var(--brand-text); }

/* ===================== 表单 ===================== */
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 200px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }

select, .input {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b8394' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select:focus, .input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.input-sm { padding: 7px 10px; font-size: 13px; }

.pool-hint { margin-top: 12px; font-size: 13px; color: var(--muted); }
.pool-hint b { color: var(--brand); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.start-bar {
  display: flex; justify-content: center;
  margin: 18px 0 8px;
  z-index: 20;
}
.start-bar .btn-lg { box-shadow: 0 10px 30px -10px rgba(37, 99, 235, .55), var(--shadow-md); }

/* ===================== 刷题页 ===================== */
.quiz-top {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.quiz-progress { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.quiz-progress-bar {
  flex: 1; height: 6px; border-radius: 4px;
  background: var(--line); overflow: hidden;
}
.quiz-progress-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), #63a0ff);
  border-radius: 4px;
  transition: width .25s ease;
}
#quizCounter {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quiz-top-right { display: flex; align-items: center; gap: 8px; }
.chip {
  font-size: 12.5px; color: var(--ok);
  background: var(--ok-soft);
  border-radius: 8px; padding: 3px 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#favBtn.is-on { color: var(--warn); }
#favBtn.is-on { background: var(--warn-soft); }

.qcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 26px 20px;
  box-shadow: var(--shadow-md);
}
.qmeta { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.tag {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-type { color: var(--brand-text); background: var(--brand-soft); border-color: transparent; }
.tag-diff { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.tag-wrong { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.tag-cat { color: var(--text-2); }

.qtext {
  font-size: 18.5px;
  line-height: 1.65;
  font-weight: 600;
  letter-spacing: .1px;
  margin-bottom: 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

.options { display: flex; flex-direction: column; gap: 9px; }

.opt {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
  cursor: pointer;
  transition: border-color .13s, background .13s, box-shadow .13s;
}
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--brand-soft); }
.opt-key {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  color: var(--muted);
  transition: background .13s, color .13s, border-color .13s;
}
.opt-text { flex: 1; min-width: 0; word-break: break-word; }
.opt.is-picked { border-color: var(--brand); background: var(--brand-soft); }
.opt.is-picked .opt-key { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .opt-key { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt:disabled { cursor: default; }
.opt-mark { flex: none; font-size: 13px; font-weight: 700; color: var(--muted); align-self: center; }

.qactions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 18px;
}
.qactions #nextBtn { margin-left: auto; }
.qactions #submitBtn:not([hidden]) + #nextBtn { margin-left: 0; }
.qactions #submitBtn { margin-left: auto; }

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.65;
}
.feedback.is-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.feedback.is-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.feedback .fb-title { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.feedback.is-ok .fb-title { color: var(--ok); }
.feedback.is-bad .fb-title { color: var(--bad); }
.feedback .fb-text { color: var(--text-2); white-space: pre-wrap; }
.feedback .fb-text b { color: var(--ok); }

.kbd-hint {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted);
}
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  margin: 0 1px;
  color: var(--text-2);
}

/* ===================== 错题本 ===================== */
.toolbar { display: flex; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { flex: 1 1 200px; }
.toolbar .input-sm { flex: 0 0 auto; width: auto; }

.wrong-list { display: flex; flex-direction: column; gap: 10px; }

.wrong-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.wrong-item-top { display: flex; gap: 10px; align-items: flex-start; }
.wrong-q { font-size: 14.5px; font-weight: 600; line-height: 1.6; flex: 1; min-width: 0; }
.wrong-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.wrong-meta .wcount { color: var(--bad); font-weight: 700; }
.wrong-body { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13.5px; }
.wrong-body .ans-line { color: var(--ok); font-weight: 600; }
.wrong-body .exp-line { color: var(--text-2); margin-top: 4px; white-space: pre-wrap; }
.wrong-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.empty {
  text-align: center; padding: 48px 20px;
  color: var(--muted); font-size: 14px;
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ===================== 题库管理 ===================== */
.drop-zone {
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--panel-2);
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.is-over {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.drop-ico {
  font-size: 26px; color: var(--brand);
  width: 50px; height: 50px; margin: 0 auto 8px;
  border-radius: 14px;
  background: var(--brand-soft);
  display: grid; place-items: center;
  line-height: 1;
}
.drop-zone strong { display: block; font-size: 14.5px; }
.drop-zone p { margin-top: 6px; font-size: 12.5px; line-height: 1.7; }

.import-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 13.5px;
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 28%, var(--line));
  color: var(--text-2);
}
.import-result.is-bad {
  background: var(--bad-soft);
  border-color: color-mix(in srgb, var(--bad) 28%, var(--line));
}
.import-result .ir-title { font-weight: 700; color: var(--text); margin-bottom: 3px; }

.bank-list { display: flex; flex-direction: column; gap: 9px; }
.bank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.bank-row .br-main { flex: 1; min-width: 0; }
.bank-row strong { font-size: 14px; display: block; }
.bank-row .br-sub { font-size: 12.5px; color: var(--muted); }
.bank-row .br-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-text);
  font-weight: 600; flex: none;
}
.bank-row .br-tag.is-imp { background: var(--warn-soft); color: var(--warn); }

/* ===================== 统计页 ===================== */
.stats-banks, .stats-cats { display: flex; flex-direction: column; gap: 12px; }
.sbar { display: flex; flex-direction: column; gap: 5px; }
.sbar-top { display: flex; justify-content: space-between; font-size: 13.5px; gap: 10px; }
.sbar-top span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sbar-track { height: 7px; border-radius: 5px; background: var(--line); overflow: hidden; display: flex; }
.sbar-track i { height: 100%; }
.sbar-track i.ok { background: var(--ok); }
.sbar-track i.bad { background: var(--bad); }

/* ===================== 设置 ===================== */
.switch-row {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.switch-row:last-child { border-bottom: 0; padding-bottom: 0; }
.switch-row strong { font-size: 14px; font-weight: 600; }
.switch-row .muted { margin-top: 1px; }
.switch-row > div { flex: 1; }

.switch {
  appearance: none;
  width: 44px; height: 26px;
  border-radius: 14px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background .18s;
  margin: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .18s;
}
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(18px); }

/* ===================== 底部导航（移动端） ===================== */
.bottom-nav { display: none; }

/* ===================== Toast ===================== */
.toast {
  position: fixed;
  left: 50%; bottom: 34px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(23, 26, 32, .94);
  color: #fff;
  padding: 9px 18px;
  border-radius: 11px;
  font-size: 13.5px;
  z-index: 200;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
html[data-theme="dark"] .toast { background: #2b323d; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== 响应式 ===================== */
@media (max-width: 760px) {
  body { font-size: 14.5px; padding-bottom: 76px; }
  .topbar-inner { padding: 9px 14px; gap: 10px; }
  .tabs { display: none; }
  .wrap { padding: 16px 14px 40px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .bank-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dept-chip { padding: 10px 10px; gap: 8px; align-items: center; }
  .dept-chip .bank-chip-main strong { font-size: 13.5px; }
  .dept-chip .bank-chip-main em { font-size: 11px; white-space: nowrap; }
  .dept-chip .bank-chip-main .m-d { display: none; }
  .dept-chip .bank-chip-bar { margin-top: 6px; }
  .dept-chip .radio-box { margin-top: 0; }
  .pin-tag { top: 6px; right: 7px; font-size: 9.5px; padding: 0 5px; line-height: 1.6; }
  #view-home .wrap { padding-bottom: 132px; }
  .toast { bottom: calc(56px + 78px + env(safe-area-inset-bottom)); }
  .qcard { padding: 18px 16px 16px; border-radius: 15px; }
  .qtext { font-size: 16.5px; }
  .opt { font-size: 14.5px; padding: 11px 12px; }
  .kbd-hint { display: none; }

  .start-bar {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    margin: 0;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    z-index: 55;
  }
  .start-bar .btn-lg { width: 100%; padding: 12px 20px; }
  #view-home .wrap { padding-bottom: 96px; }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bn {
    flex: 1;
    border: 0; background: transparent;
    color: var(--muted);
    font-size: 11.5px;
    padding: 6px 0;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    font-weight: 500;
  }
  .bn.is-active { color: var(--brand); font-weight: 600; }
  .bn .dot {
    position: absolute;
    top: 5px; right: 50%; margin-right: -14px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--bad);
  }
  .quiz-top { gap: 8px; }
  .qactions .btn { padding: 9px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
