:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --card: #ffffff;
  --card-2: #f3f4f7;
  --line: #e6e8ee;
  --text: #171a20;
  --muted: #69707e;
  --chip: #eef0f4;
  --accent: #4f7cff;
  --accent-soft: #ecf1ff;
  --ok: #178a4c;
  --ok-bg: #e9f7ef;
  --bad: #c9352f;
  --bad-bg: #fdecec;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .06);
  --bar-bg: rgba(245, 246, 248, .88);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --card-2: #1d2129;
    --line: #262b34;
    --text: #e8ebf1;
    --muted: #98a1b1;
    --chip: #232833;
    --accent: #6d95ff;
    --accent-soft: #1c2540;
    --ok: #3ecf8e;
    --ok-bg: #12271e;
    --bad: #f0776f;
    --bad-bg: #2a1517;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --bar-bg: rgba(15, 17, 21, .88);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(120px + env(safe-area-inset-bottom));
}

/* ---------- 首页 ---------- */
.hero { display: flex; gap: 14px; align-items: center; padding: 10px 2px 6px; }
.hero h1 { font-size: 26px; margin: 0; letter-spacing: .02em; }
.hero p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.hero-logo svg { display: block; border-radius: 14px; box-shadow: var(--shadow); }
.bankcard { display: block; background: var(--card); border-radius: 18px; padding: 16px; margin-top: 14px; text-decoration: none; box-shadow: var(--shadow); }
.bankcard:active { transform: scale(.995); }
.bc-head { display: flex; align-items: center; gap: 10px; }
.bc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: 0 0 auto; box-shadow: 0 0 0 4px rgba(79, 124, 255, .14); }
.bc-title { min-width: 0; }
.bc-title h3 { margin: 0; font-size: 17px; }
.bc-title p { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; }
.chev { margin-left: auto; color: var(--muted); font-size: 22px; line-height: 1; }
.bc-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.bc-bar { height: 6px; border-radius: 999px; background: var(--chip); margin-top: 14px; overflow: hidden; }
.bc-bar i { display: block; height: 100%; border-radius: 999px; background: var(--c); transition: width .3s; }
.bc-foot { display: flex; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.bc-foot b { color: var(--text); }
.home-foot { margin-top: 22px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- 使用者切换（本地 2 人档案） ---------- */
.userbar { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ub-label { color: var(--muted); font-size: 13px; }
.uchips { display: flex; gap: 8px; }
.uchip { padding: 6px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 13.5px; box-shadow: var(--shadow); }
.uchip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.uchip small { font-weight: 400; opacity: .82; margin-left: 6px; font-size: 12px; }
.ub-edit { margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 4px 2px; }

/* ---------- 顶栏 / 标签页 ---------- */
.topbar { display: flex; align-items: center; gap: 8px; padding: 2px 0 10px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; color: var(--text); background: var(--card); box-shadow: var(--shadow); text-decoration: none; flex: 0 0 auto; }
.tb-title { flex: 1; min-width: 0; }
.tb-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title span { display: block; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; background: var(--card); color: var(--muted); text-decoration: none; font-size: 14px; border: 1px solid var(--line); }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 题目卡 ---------- */
.card { background: var(--card); border-radius: var(--radius, 16px); box-shadow: var(--shadow); padding: 16px; }
.qhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.qidx { color: var(--muted); font-size: 12.5px; }
.favbtn { margin-left: auto; color: var(--muted); padding: 4px; border-radius: 8px; line-height: 0; }
.favbtn.on { color: #f0a500; }
.favbtn svg path { fill: transparent; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.favbtn.on svg path { fill: currentColor; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; flex: 0 0 auto; }
.b-single { color: #2456d9; background: #e9efff; }
.b-multi { color: #7b3fe4; background: #f2ebff; }
.b-judge { color: #0d7a6e; background: #e2f6f2; }
@media (prefers-color-scheme: dark) {
  .b-single { color: #9db8ff; background: #1c2440; }
  .b-multi { color: #c4a8ff; background: #271d3d; }
  .b-judge { color: #7ed6c6; background: #12302b; }
}
.qtext { font-size: 16.5px; line-height: 1.75; word-break: break-word; }
.opts { margin-top: 14px; }
.opt { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; margin-top: 10px; font-size: 16px; line-height: 1.55; transition: border-color .15s, background .15s; }
.opt .k { flex: 0 0 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; background: var(--chip); color: var(--muted); font-size: 14px; margin-top: 1px; transition: background .15s; }
.opt .t { flex: 1; word-break: break-word; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .k { background: var(--accent); color: #fff; }
.opt.ok { border-color: var(--ok); background: var(--ok-bg); }
.opt.ok .k { background: var(--ok); color: #fff; }
.opt.bad { border-color: var(--bad); background: var(--bad-bg); }
.opt.bad .k { background: var(--bad); color: #fff; }
.fb { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 12px; font-size: 14px; flex-wrap: wrap; }
.fb.ok { background: var(--ok-bg); color: var(--ok); }
.fb.bad { background: var(--bad-bg); color: var(--bad); }
.fb.reveal { background: var(--chip); color: var(--muted); }
.fb .link { margin-left: auto; text-decoration: underline; font-size: 13px; color: inherit; }
.explain { margin-top: 14px; padding: 12px 14px; background: var(--card-2); border-radius: 12px; font-size: 14.5px; line-height: 1.7; }
.explain > b { display: block; font-size: 12px; color: var(--muted); letter-spacing: .1em; margin-bottom: 6px; }
.explain p { margin: 0; }
.expimg { max-width: 100%; display: block; border-radius: 10px; margin-top: 8px; }

/* ---------- 底部操作条 ---------- */
.bottombar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 720px; display: flex; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bar-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 20; }
.btn { flex: 1; height: 46px; border-radius: 13px; font-size: 16px; font-weight: 600; border: 1px solid transparent; }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--text); font-weight: 500; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn[disabled] { opacity: .45; }

/* ---------- 空状态 ---------- */
.empty { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.8; }
.empty a { color: var(--accent); }

/* ---------- 速查列表 ---------- */
.listbar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 2px 0 10px; }
#qinput { width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 0 14px; font-size: 15px; outline: none; appearance: none; }
#qinput:focus { border-color: var(--accent); }
.chips { display: flex; gap: 8px; align-items: center; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.listcount { margin-left: auto; color: var(--muted); font-size: 12.5px; flex: 0 0 auto; padding-left: 8px; }
.qitem { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; margin-top: 10px; }
.qitem summary { display: flex; gap: 9px; align-items: flex-start; list-style: none; cursor: pointer; }
.qitem summary::-webkit-details-marker { display: none; }
.qsum { flex: 1; font-size: 14.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qitem[open] .qsum { -webkit-line-clamp: unset; display: block; }
.anschip { flex: 0 0 auto; font-weight: 700; color: var(--accent); font-size: 14px; }

.listnote { margin-top: 8px; font-size: 12.5px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 7px 10px; line-height: 1.55; }
.listnote b { color: var(--text); }
.ansline { margin-top: 10px; font-size: 13.5px; background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; line-height: 1.6; word-break: break-word; }
.ansline b { color: var(--accent); margin-right: 6px; }
.warnchip { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--bad-bg); color: var(--bad); font-size: 12px; white-space: nowrap; }
.retrytag { padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.qbody { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.optlist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 15px; }
.optlist li { padding: 6px 8px; border-radius: 8px; line-height: 1.6; }
.optlist li.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }

/* ---------- 菜单 / 提示 ---------- */
.mask { position: fixed; inset: 0; background: rgba(10, 12, 16, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet { width: 100%; max-width: 720px; background: var(--card); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
.sheet h4 { margin: 0; font-size: 16px; }
.sheet-sub { margin: 2px 0 12px; color: var(--muted); font-size: 12.5px; }
.sheet button { display: block; width: 100%; text-align: left; padding: 13px 14px; border-radius: 12px; background: var(--card-2); margin-top: 8px; font-size: 15px; border: 1px solid var(--line); }
.sheet button.danger { color: var(--bad); border-color: transparent; background: var(--bad-bg); }
.sheet button.close { text-align: center; color: var(--muted); background: transparent; border-color: transparent; }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translate(-50%, 6px); background: rgba(20, 22, 28, .92); color: #fff; font-size: 13.5px; padding: 8px 14px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 80vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
