/* ==========================================================================
   业务知识题库 · 样式表
   政务蓝 / 清爽专业 / 响应式（PC 侧边栏 + 移动端底部导航）
   ========================================================================== */

/* ---------- 设计变量 ---------- */
:root {
  --brand-900: #0b2250;
  --brand-800: #123a86;
  --brand-700: #12468f;
  --brand-600: #1f5fc4;
  --brand-500: #2f7ff0;
  --brand-400: #63a4f7;
  --brand-050: #eef4fe;
  --brand-100: #dbe8fd;

  --bg: #eef3fa;
  --bg-2: #f6f9fd;
  --surface: #ffffff;
  --surface-2: #f8fafd;

  --text: #14213a;
  --text-2: #5b6c85;
  --text-3: #8b9bb4;

  --line: #e4ebf5;
  --line-2: #d5e0ef;

  --ok: #0f9d58;
  --ok-bg: #e9f8f0;
  --ok-line: #b9e6cd;
  --bad: #e0454b;
  --bad-bg: #fdecec;
  --bad-line: #f5c6c8;
  --warn: #d98b0f;
  --gold: #f0b429;

  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  --sh-1: 0 1px 2px rgba(16, 39, 78, .05), 0 4px 14px rgba(16, 39, 78, .05);
  --sh-2: 0 10px 34px rgba(16, 39, 78, .10);
  --sh-3: 0 24px 64px rgba(6, 22, 52, .30);

  --sidebar-w: 250px;
  --nav-h: 60px;
  --tabbar-h: 62px;

  --stem-fs: 17px;
  --opt-fs: 15px;
}

/* 字号档位（由设置面板切换 body[data-font]） */
body[data-font="sm"] { --stem-fs: 15.5px; --opt-fs: 14px; }
body[data-font="md"] { --stem-fs: 17px; --opt-fs: 15px; }
body[data-font="lg"] { --stem-fs: 19.5px; --opt-fs: 16.5px; }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

::selection { background: var(--brand-100); color: var(--brand-800); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: #c6d4e8 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c6d4e8; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #a9bcd8; background-clip: content-box; }

.ic { width: 1em; height: 1em; flex: none; display: block; }

/* ==========================================================================
   一、登录页
   ========================================================================== */
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 28px 20px;
  background:
    radial-gradient(1100px 620px at 10% 4%, rgba(90, 165, 255, .40), transparent 62%),
    radial-gradient(900px 560px at 92% 96%, rgba(30, 205, 200, .22), transparent 60%),
    linear-gradient(155deg, #061a3d 0%, #10306e 40%, #1a55bb 100%);
}

.login::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(900px 700px at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(900px 700px at 50% 40%, #000 30%, transparent 78%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(408px, 100%);
  padding: 42px 38px 34px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .985);
  box-shadow: var(--sh-3);
  animation: cardIn .5s cubic-bezier(.2, .9, .25, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }

.brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-600), var(--brand-400));
  box-shadow: 0 10px 24px rgba(31, 95, 196, .34), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.brand-mark svg { width: 32px; height: 32px; }

.login-title { margin: 18px 0 0; font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.login-sub { margin: 7px 0 0; font-size: 13px; color: var(--text-3); letter-spacing: .3px; }

.login-form { margin-top: 28px; }

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 8px 0 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field:focus-within {
  border-color: var(--brand-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 127, 240, .13);
}
.field > .ic { width: 18px; height: 18px; color: var(--text-3); }
.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  letter-spacing: .4px;
}
.field input::placeholder { color: #a8b6cb; letter-spacing: 0; }

.eye {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: color .16s, background .16s;
}
.eye:hover { color: var(--brand-600); background: var(--brand-050); }
.eye .ic { width: 18px; height: 18px; }

.login-error {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--bad);
  background: var(--bad-bg);
  border: 1px solid var(--bad-line);
}
.login-error .ic { width: 16px; height: 16px; }

.login-form.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.btn-primary {
  width: 100%;
  height: 48px;
  margin-top: 20px;
  border-radius: 13px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  box-shadow: 0 10px 22px rgba(31, 95, 196, .30);
  transition: transform .16s, box-shadow .16s, filter .16s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(31, 95, 196, .38); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { filter: grayscale(.15) brightness(.97); opacity: .78; cursor: default; transform: none; }

.spinner {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-foot {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px dashed var(--line-2);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.9;
}
.login-foot b { color: var(--text-2); font-weight: 600; }

/* ==========================================================================
   二、整体布局
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- 侧边栏（PC） ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.sb-head { display: flex; align-items: center; gap: 11px; padding: 4px 8px 12px; }
.sb-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-600), var(--brand-400));
  box-shadow: 0 6px 15px rgba(31, 95, 196, .28);
}
.sb-logo svg { width: 21px; height: 21px; }
.sb-name { font-size: 15px; font-weight: 700; letter-spacing: .3px; line-height: 1.25; }
.sb-tag { font-size: 11.5px; color: var(--text-3); letter-spacing: .6px; }

.sb-group { font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: 1.4px; padding: 6px 12px 4px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 14.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .16s, color .16s;
}
.nav-item .ic { width: 19px; height: 19px; }
.nav-item:hover { background: var(--brand-050); color: var(--brand-700); }
.nav-item.on {
  background: linear-gradient(90deg, rgba(47, 127, 240, .14), rgba(47, 127, 240, .03));
  color: var(--brand-700);
  font-weight: 600;
}
.nav-item.on::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-500);
  transform: translateY(-50%);
}
.nav-item .cnt {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  color: var(--text-3);
  background: #f0f4fa;
}
.nav-item.on .cnt { color: var(--brand-700); background: rgba(47, 127, 240, .16); }

.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.progress-card {
  padding: 14px;
  border-radius: var(--r-md);
  background: linear-gradient(150deg, #12386f, #1f63c8);
  color: #fff;
  box-shadow: 0 10px 24px rgba(18, 56, 111, .22);
}
.pc-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; opacity: .82; letter-spacing: .5px; }
.ring-wrap { display: flex; align-items: center; gap: 13px; margin-top: 11px; }
.ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(#7fd4ff var(--p, 0turn), rgba(255, 255, 255, .18) 0);
  flex: none;
}
.ring i {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #12386f;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; font-style: normal;
}
.pc-nums { font-size: 12.5px; line-height: 1.75; opacity: .92; }
.pc-nums b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.sb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border-radius: 11px;
  font-size: 13.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background .16s, color .16s, border-color .16s;
}
.sb-btn:hover { background: #fff; border-color: var(--line-2); color: var(--brand-700); }
.sb-btn .ic { width: 17px; height: 17px; }

/* ---------- 主区 ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--nav-h);
  padding: 0 22px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.tb-title { font-size: 16px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.tb-pill {
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-050);
  border: 1px solid var(--brand-100);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tb-spacer { flex: 1; }

.tb-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: color .16s, border-color .16s, background .16s;
}
.tb-btn:hover { color: var(--brand-700); border-color: var(--brand-100); background: var(--brand-050); }
.tb-btn .ic { width: 17px; height: 17px; }
.tb-btn.icon-only { width: 36px; padding: 0; justify-content: center; }
.tb-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 2px #fff;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 22px calc(28px + env(safe-area-inset-bottom, 0px));
}

/* 桌面端背景装饰：让大面积留白不显空 */
@media (min-width: 1024px) {
  .main {
    background:
      radial-gradient(760px 380px at 78% -6%, rgba(47, 127, 240, .075), transparent 62%),
      radial-gradient(620px 360px at 4% 104%, rgba(30, 205, 200, .06), transparent 62%);
  }
}

:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 8px; }

/* ==========================================================================
   三、题目卡片
   ========================================================================== */
.qcard {
  position: relative;
  padding: 26px 30px 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fdfeff 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(16, 39, 78, .04), 0 10px 30px rgba(16, 39, 78, .06);
  animation: qIn .32s cubic-bezier(.2, .9, .25, 1) both;
}
.qcard::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400) 42%, rgba(99, 164, 247, 0));
}
@keyframes qIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.qhead { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.qno {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--brand-700);
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--brand-050);
  border: 1px solid var(--brand-100);
  font-variant-numeric: tabular-nums;
}
.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 8px;
  letter-spacing: .4px;
}
.tag.single { color: #1a5bbf; background: #eaf1fe; }
.tag.judge { color: #0b7b74; background: #e6f7f5; }
.tag.multiple { color: #8a5a00; background: #fdf3e0; }
.tag.essay { color: #6b3ea8; background: #f2ecfd; }
.qhead .spacer { flex: 1; }

.star {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #c2cede;
  transition: color .16s, background .16s, transform .16s;
}
.star:hover { color: var(--gold); background: #fff8e8; transform: scale(1.06); }
.star.on { color: var(--gold); }
.star.on svg { fill: var(--gold); }
.star .ic { width: 19px; height: 19px; }

.stem {
  margin: 16px 0 20px;
  font-size: var(--stem-fs);
  line-height: 1.88;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

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

.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border-radius: 13px;
  border: 1.5px solid var(--line-2);
  background: #fbfcfe;
  transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
}
.opt:hover:not(.locked) { border-color: var(--brand-400); background: #f4f8ff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31, 95, 196, .09); }
.opt .k {
  flex: none;
  width: 29px; height: 29px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-700);
  background: #fff;
  border: 1.5px solid var(--line-2);
  transition: all .16s;
}
.opt .t { flex: 1; font-size: var(--opt-fs); line-height: 1.72; padding-top: 2px; padding-right: 4px; word-break: break-word; }
.opt .mark { flex: none; width: 20px; height: 20px; margin-top: 4px; opacity: 0; transition: opacity .2s; }
.opt .mark svg { width: 20px; height: 20px; }

.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .k { color: #fff; background: var(--ok); border-color: var(--ok); }
.opt.correct .mark { opacity: 1; color: var(--ok); }

.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .k { color: #fff; background: var(--bad); border-color: var(--bad); }
.opt.wrong .mark { opacity: 1; color: var(--bad); }

.opt.picked-only { border-color: var(--brand-500); background: var(--brand-050); }
.opt.picked-only .k { color: #fff; background: var(--brand-500); border-color: var(--brand-500); }

.opt.locked { cursor: default; }
.opt.dim { opacity: .58; }

/* 结果提示条 */
.verdict {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 15px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
  animation: qIn .26s ease both;
}
.verdict .ic { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.verdict b { font-weight: 700; }
.verdict.ok { color: #0a7a44; background: var(--ok-bg); border: 1px solid var(--ok-line); }
.verdict.bad { color: #b8373d; background: var(--bad-bg); border: 1px solid var(--bad-line); }
.verdict.info { color: var(--brand-700); background: var(--brand-050); border: 1px solid var(--brand-100); }

/* 卡片操作区 */
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.actions .spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text-2);
  transition: transform .16s, border-color .16s, color .16s, background .16s, box-shadow .16s;
}
.btn .ic { width: 17px; height: 17px; }
.btn:hover:not(:disabled) { color: var(--brand-700); border-color: var(--brand-400); background: var(--brand-050); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.solid {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  box-shadow: 0 8px 18px rgba(31, 95, 196, .26);
}
.btn.solid:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(31, 95, 196, .33); color: #fff; background: linear-gradient(135deg, var(--brand-600), var(--brand-500)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--brand-050); }
.btn.tint {
  color: var(--brand-700);
  border-color: var(--brand-100);
  background: var(--brand-050);
}
.btn.tint:hover:not(:disabled) { border-color: var(--brand-400); background: #e5eefe; }

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 72px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.empty .eic {
  width: 62px; height: 62px;
  border-radius: 20px;
  display: grid; place-items: center;
  color: var(--brand-500);
  background: var(--brand-050);
  margin-bottom: 6px;
}
.empty .eic svg { width: 30px; height: 30px; }
.empty h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.empty p { margin: 0; font-size: 13.5px; color: var(--text-3); line-height: 1.8; }

/* 搜索 */
.searchbar { position: relative; margin-bottom: 16px; }
.searchbar .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--text-3); }
.searchbar input {
  width: 100%;
  height: 52px;
  padding: 0 46px 0 46px;
  border-radius: 14px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--sh-1);
  outline: 0;
  font-size: 15px;
  transition: border-color .18s, box-shadow .18s;
}
.searchbar input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(47, 127, 240, .13); }
.searchbar input::-webkit-search-cancel-button,
.searchbar input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.searchbar .clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--text-3); }
.searchbar .clear:hover { background: var(--brand-050); color: var(--brand-600); }

.reslist { display: flex; flex-direction: column; gap: 10px; }
.res {
  display: block;
  width: 100%;
  padding: 15px 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.res:hover { border-color: var(--brand-400); transform: translateY(-1px); box-shadow: var(--sh-2); }
.res-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.res-stem { font-size: 14.5px; line-height: 1.75; color: var(--text); }
.res-stem mark { background: #fff3bf; color: #8a5a00; padding: 0 2px; border-radius: 3px; }
.res-meta { margin-top: 7px; font-size: 12.5px; color: var(--text-3); }
.res-meta em { font-style: normal; color: var(--ok); font-weight: 600; }

/* ==========================================================================
   四、答题卡抽屉
   ========================================================================== */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(13, 28, 55, .42);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s;
}
.mask.on { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  top: 0; right: 0;
  z-index: 61;
  width: min(392px, 92vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -18px 0 50px rgba(10, 26, 56, .18);
  transform: translateX(102%);
  transition: transform .3s cubic-bezier(.2, .9, .25, 1);
}
.sheet.on { transform: none; }

.sh-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.sh-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.sh-head .spacer { flex: 1; }
.close-x { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); }
.close-x:hover { background: var(--surface-2); color: var(--text); }
.close-x .ic { width: 18px; height: 18px; }

.sh-body { flex: 1; overflow-y: auto; padding: 16px 20px 26px; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-3); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface-2); }
.legend i.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.legend i.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.legend i.cur { background: #fff; border-color: var(--brand-500); box-shadow: inset 0 0 0 2px rgba(47, 127, 240, .28); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 4px; }
.chip {
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: all .16s;
}
.chip:hover { border-color: var(--brand-400); color: var(--brand-700); }
.chip.on { color: #fff; background: var(--brand-600); border-color: var(--brand-600); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; margin-top: 16px; }
.cell {
  position: relative;
  height: 42px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.cell:hover { transform: translateY(-1px); border-color: var(--brand-400); }
.cell.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.cell.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.cell.cur { color: var(--brand-700); border-color: var(--brand-500); box-shadow: inset 0 0 0 2px rgba(47, 127, 240, .30); font-weight: 700; }
.cell .fd { position: absolute; top: 4px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

.sh-foot { padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sh-foot .btn { flex: 1; height: 44px; }

/* ==========================================================================
   五、设置面板
   ========================================================================== */
.set-row { display: flex; align-items: center; gap: 14px; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .lb { flex: 1; font-size: 14.5px; }
.set-row .lb small { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.seg { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { padding: 6px 14px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); transition: all .16s; }
.seg button.on { color: #fff; background: var(--brand-600); font-weight: 600; }

.switch { width: 48px; height: 28px; border-radius: 20px; background: #d7e0ee; position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(16, 39, 78, .22); transition: transform .2s; }
.switch.on { background: var(--brand-600); }
.switch.on::after { transform: translateX(20px); }

/* ==========================================================================
   六、移动端底部导航
   ========================================================================== */
.tabbar { display: none; }

/* ==========================================================================
   七、响应式
   ========================================================================== */
@media (max-width: 1023px) {
  body[data-font="sm"] { --stem-fs: 15px; --opt-fs: 13.5px; }
  body[data-font="md"] { --stem-fs: 16.5px; --opt-fs: 15px; }
  body[data-font="lg"] { --stem-fs: 18px; --opt-fs: 16px; }

  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }

  .content { padding: 16px 14px calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom, 0px)); }
  .qcard { padding: 20px 17px 16px; border-radius: var(--r-md); }
  .opt { padding: 13px 14px; gap: 11px; }
  .actions { gap: 8px; margin-top: 18px; padding-top: 16px; }
  .actions .btn { padding: 0 14px; font-size: 14px; }
  .actions .btn .lbl { display: none; }
  .actions .btn.solid .lbl { display: inline; }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10.5px;
    color: var(--text-3);
    transition: color .16s;
  }
  .tab .ic { width: 21px; height: 21px; }
  .tab.on { color: var(--brand-600); font-weight: 600; }
  .tab.on .ic { filter: drop-shadow(0 3px 6px rgba(47, 127, 240, .35)); }

  .topbar { padding: 0 14px; gap: 9px; }
  .tb-title { font-size: 15.5px; }
  .tb-btn .lbl { display: none; }
  .tb-btn { padding: 0 10px; }
  .tb-btn.icon-only { width: 36px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
}

@media (max-width: 560px) {
  .login-card { padding: 34px 24px 26px; border-radius: 20px; }
  .login-title { font-size: 20px; }
  .tb-pill { font-size: 12px; padding: 3px 9px; }
  .qhead { gap: 7px; }
  .sheet { width: 100vw; }
  .verdict { font-size: 13.5px; padding: 12px 13px; }
}

@media (min-width: 1024px) and (max-width: 1180px) {
  :root { --sidebar-w: 216px; }
  .content { max-width: 100%; padding: 22px 20px; }
}

/* 打印：只留题目内容 */
@media print {
  .sidebar, .topbar, .tabbar, .sheet, .mask, .actions { display: none !important; }
  .app { display: block; }
  .content { max-width: 100%; padding: 0; }
  .qcard { box-shadow: none; border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
