/* ============================================================
   大四刷题 · 样式表
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --text: #141a24;
  --text-2: #3c4658;
  --muted: #6b7688;
  --line: #e6e9f2;
  --brand: #4f7cff;
  --brand-2: #7aa2ff;
  --brand-soft: #eef2ff;
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.09);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.08);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --shadow: 0 6px 24px rgba(23, 37, 84, 0.06);
  --shadow-lg: 0 18px 44px rgba(23, 37, 84, 0.13);
  --radius: 18px;
  --radius-sm: 12px;
  --fs: 16px;
  --sidebar-w: 228px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
[data-theme="dark"] {
  --bg: #0d1017;
  --surface: #161b24;
  --surface-2: #1b2130;
  --text: #e9edf6;
  --text-2: #c2cad9;
  --muted: #93a0b5;
  --line: #252c3a;
  --brand: #6d91ff;
  --brand-2: #8fb0ff;
  --brand-soft: #1c2740;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; display: block; fill: currentColor; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
::selection { background: var(--brand); color: #fff; }

/* 布局 ------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 6px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f7cff, #8f6dff);
  color: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 6px 16px rgba(79, 124, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; font-size: 16px; }
.brand-text small { font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-size: 14.5px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.sidebar-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.data-badge { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.data-badge b { color: var(--text-2); font-weight: 600; display: block; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-title { font-size: 16.5px; font-weight: 700; flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 11px; transition: transform 0.12s, background 0.15s, color 0.15s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }
.icon-btn:active { transform: scale(0.94); }
.streak-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 12px; border-radius: 99px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 13px; font-weight: 700;
}
.streak-pill b { color: inherit; }

.view { width: 100%; max-width: 980px; margin: 0 auto; padding: 22px 22px 96px; flex: 1 1 auto; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: 0 14px; height: 54px; }
  .view { padding: 14px 14px calc(var(--tabbar-h) + 30px + var(--safe-b)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; color: var(--muted); font-weight: 600;
  }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--brand); }
}

/* 通用组件 ---------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pad { padding: 18px 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; } .mt28 { margin-top: 28px; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.hide { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-size: 14.5px; font-weight: 650;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #7a6cff);
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(79, 124, 255, 0.32);
}
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn-soft:hover { color: var(--brand); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.btn-lg { height: 48px; padding: 0 24px; border-radius: 14px; font-size: 15.5px; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.chip.brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.4s ease; }
.progress.ok > i { background: linear-gradient(90deg, #16a34a, #4ade80); }

.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: var(--surface-2); }
.ring .ring-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; }

.kv { display: flex; flex-direction: column; gap: 2px; }
.kv b { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.kv span { font-size: 12px; color: var(--muted); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 54px 20px; text-align: center; color: var(--muted);
}
.empty .empty-ico { font-size: 40px; opacity: 0.5; }
.empty h3 { color: var(--text); font-size: 16px; }

/* 首页 ------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 24px 26px;
  background: linear-gradient(135deg, #4f7cff 0%, #6f5bff 52%, #9a5bff 100%);
  color: #fff; box-shadow: 0 16px 40px rgba(79, 92, 255, 0.32);
}
.hero::after {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  right: -70px; top: -120px; background: rgba(255, 255, 255, 0.14);
}
.hero::before {
  content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%;
  right: 60px; bottom: -130px; background: rgba(255, 255, 255, 0.1);
}
.hero h1 { font-size: 22px; line-height: 1.35; }
.hero p { margin-top: 6px; color: rgba(255, 255, 255, 0.86); font-size: 13.5px; }
.hero-stats { display: flex; gap: 26px; margin-top: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-stats .kv b { font-size: 24px; color: #fff; }
.hero-stats .kv span { color: rgba(255, 255, 255, 0.78); }
.hero-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.28); color: #fff; backdrop-filter: blur(4px); }
.hero .btn:hover { background: rgba(255, 255, 255, 0.26); color: #fff; border-color: #fff; }
.hero .btn-white { background: #fff; color: #3d5bff; border-color: #fff; font-weight: 700; }
.hero .btn-white:hover { background: #f1f5ff; color: #3d5bff; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.section-head h2 { font-size: 16.5px; }
.section-head a { font-size: 12.5px; color: var(--muted); }
.section-head a:hover { color: var(--brand); }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.subject-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 16px 17px 15px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
  overflow: hidden;
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.subject-card .sc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.subject-card h3 { font-size: 16px; }
.sc-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.sc-bar { flex: 1 1 auto; }
.sc-bar .progress { margin-top: 6px; }
.sc-ring { flex: 0 0 auto; }
.sc-accent { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.quick {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 15px 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}
.quick:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.quick .q-ico { font-size: 20px; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; background: var(--brand-soft); }
.quick b { font-size: 14.5px; }
.quick span { font-size: 12px; color: var(--muted); }

/* 科目页 ----------------------------------------------------- */
.subject-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.subject-hero .sh-main { flex: 1 1 260px; min-width: 0; }
.subject-hero h1 { font-size: 24px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.mode-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px 15px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  text-align: left;
}
.mode-btn:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-2px); }
.mode-btn b { font-size: 14px; }
.mode-btn span { font-size: 11.5px; color: var(--muted); }
.mode-btn .m-ico { font-size: 17px; }

.chapter-list { display: flex; flex-direction: column; }
.chapter-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.chapter-item:last-child { border-bottom: 0; }
.chapter-item:hover .ch-name { color: var(--brand); }
.ch-num { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.ch-main { flex: 1 1 auto; min-width: 0; }
.ch-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.ch-side { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* 答题页 ----------------------------------------------------- */
.quiz-wrap { display: flex; flex-direction: column; gap: 14px; }
.quiz-top { display: flex; align-items: center; gap: 8px; }
.quiz-progress { flex: 1 1 auto; }
.quiz-progress .progress { height: 6px; }
.quiz-progress .qp-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.q-card { padding: 22px 24px; }
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.q-stem { font-size: 17px; line-height: 1.75; font-weight: 550; white-space: pre-wrap; word-break: break-word; }
.q-stem img { max-width: 100%; border-radius: 10px; margin: 8px 0; }
.q-stem .hl { background: var(--warn-soft); border-radius: 4px; padding: 0 2px; }
.opt-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
  text-align: left; width: 100%;
}
.opt:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.opt:active { transform: scale(0.995); }
.opt .key {
  width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center;
  border-radius: 8px; background: var(--surface-2); color: var(--text-2);
  font-size: 13px; font-weight: 800; margin-top: 1px;
}
.opt .txt { flex: 1 1 auto; font-size: 15px; line-height: 1.65; word-break: break-word; }
.opt .mark { flex: 0 0 auto; font-size: 15px; font-weight: 800; }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .key { background: var(--brand); color: #fff; }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.ok .key { background: var(--ok); color: #fff; }
.opt.bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.bad .key { background: var(--bad); color: #fff; }
.opt.locked { cursor: default; }
.opt.locked:hover { border-color: var(--line); }
.opt.locked.ok:hover, .opt.locked.bad:hover { border-color: currentColor; }
.opt.dim { opacity: 0.62; }

.q-feedback { margin-top: 16px; border-radius: 14px; padding: 14px 16px; font-size: 14px; }
.q-feedback.ok { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.q-feedback.bad { background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.q-feedback .fb-title { font-weight: 800; display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.q-feedback.ok .fb-title { color: var(--ok); }
.q-feedback.bad .fb-title { color: var(--bad); }
.explain { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.explain h4 { font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; margin-bottom: 7px; }
.explain .ex-body { font-size: 14.5px; line-height: 1.8; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.explain .ex-body img { max-width: 100%; border-radius: 10px; margin: 8px 0; }
.note-box { margin-top: 14px; }
.note-box textarea {
  width: 100%; min-height: 66px; resize: vertical; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-family: inherit; font-size: 13.5px; line-height: 1.6;
}
.note-box textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.quiz-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quiz-actions .spacer { flex: 1 1 auto; }
.kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line); border-bottom-width: 2px;
  background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--muted);
  text-align: center; font-family: ui-monospace, monospace;
}
.answer-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; }
.ac-cell {
  height: 40px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.ac-cell.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.ac-cell.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.ac-cell.cur { outline: 2px solid var(--brand); outline-offset: 1px; }
.ac-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 14px; }
.ac-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }

.timer { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.timer.warn { background: var(--bad-soft); color: var(--bad); }

/* 结果页 ----------------------------------------------------- */
.result-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.result-num { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-item {
  display: flex; gap: 12px; padding: 13px 15px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color 0.15s;
}
.result-item:hover { border-color: var(--brand); }
.result-item .ri-idx { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 800;
  background: var(--bad-soft); color: var(--bad); }
.result-item .ri-stem { font-size: 13.5px; line-height: 1.6; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-item .ri-ans { font-size: 12px; color: var(--muted); margin-top: 5px; }
.result-item .ri-ans b { color: var(--ok); }
.result-item .ri-ans s { color: var(--bad); }

/* 列表/表格 -------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.list-item:hover { border-color: var(--brand); transform: translateY(-1px); }
.list-item .li-main { flex: 1 1 auto; min-width: 0; }
.list-item .li-title { font-size: 14.5px; font-weight: 600; }
.list-item .li-sub { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 auto; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 11px; border: 1px solid var(--line); gap: 2px; }
.seg button { height: 28px; padding: 0 11px; border-radius: 8px; border: 0; background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(20, 30, 60, 0.08); }

.search-box { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.search-box svg { color: var(--muted); flex: 0 0 auto; }
.search-box input { flex: 1 1 auto; border: 0; background: transparent; outline: none;
  font-size: 15px; color: var(--text); font-family: inherit; min-width: 0; }
.search-box input::placeholder { color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-card { padding: 15px 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-card .sc-head { display: flex; align-items: center; justify-content: space-between; }
.stat-card .kv b { font-size: 24px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin-top: 14px; }
.chart .bar { flex: 1 1 0; min-width: 6px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand)); opacity: 0.9;
  transition: height 0.4s ease; position: relative; }
.chart .bar.zero { background: var(--surface-2); }
.chart-x { display: flex; gap: 6px; margin-top: 6px; }
.chart-x span { flex: 1 1 0; text-align: center; font-size: 10px; color: var(--muted); }

/* 设置 ------------------------------------------------------- */
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.form-row:last-child { border-bottom: 0; }
.form-row .fr-main { flex: 1 1 auto; min-width: 0; }
.form-row .fr-title { font-size: 14.5px; font-weight: 600; }
.form-row .fr-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch { width: 46px; height: 27px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); position: relative; transition: background 0.2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform 0.2s; }
.switch.on { background: var(--brand); border-color: var(--brand); }
.switch.on::after { transform: translateX(19px); }
.code-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; overflow-x: auto; color: var(--text-2); white-space: pre; }

/* 弹窗 / Toast ----------------------------------------------- */
.modal-mask { position: fixed; inset: 0; z-index: 100; background: rgba(10, 15, 30, 0.45);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fade 0.16s ease; }
.modal {
  width: 100%; max-width: 560px; max-height: 86vh; overflow: auto;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line); animation: pop 0.18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 0; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-root { position: fixed; z-index: 200; left: 50%; bottom: 84px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(20, 26, 36, 0.94); color: #fff; padding: 9px 16px; border-radius: 99px;
  font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toast-in 0.2s ease; max-width: 84vw; text-align: center; }
.toast.ok { background: rgba(22, 163, 74, 0.96); }
.toast.bad { background: rgba(239, 68, 68, 0.96); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 14px; margin: 8px 0; }
.sk-card { height: 120px; border-radius: var(--radius); }

/* 其它 ------------------------------------------------------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 14px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 13px; color: var(--text-2); }
.banner b { color: var(--text); }
.banner.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 28%, transparent); }
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.link { color: var(--brand); cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line);
  border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* 答题补充组件 ----------------------------------------------- */
.ri-idx {
  width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center;
  border-radius: 9px; font-size: 12px; font-weight: 800;
  background: var(--brand-soft); color: var(--brand);
}
.mode-btn.active { border-color: var(--brand); }
.fill-row { display: flex; gap: 10px; align-items: center; }
.fill-input {
  flex: 1 1 auto; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--text); font-family: inherit; font-size: 15px; min-width: 0;
}
.fill-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.fill-input:disabled { opacity: 0.75; }
.note-wrap { animation: fade 0.18s ease; }
.review-item {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  overflow: hidden;
}
.review-item > summary {
  list-style: none; cursor: pointer; display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px;
}
.review-item > summary::-webkit-details-marker { display: none; }
.review-item[open] > summary { border-bottom: 1px dashed var(--line); }
.review-item .ri-stem { flex: 1 1 auto; font-size: 13.5px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.review-body { padding: 13px 15px 15px; font-size: 13.5px; color: var(--text-2); }
.opt-mini {
  display: flex; gap: 9px; padding: 7px 10px; border-radius: 9px; font-size: 13px;
  line-height: 1.55; background: var(--surface-2); margin-bottom: 6px;
}
.opt-mini .key { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center;
  border-radius: 6px; background: var(--surface); font-size: 11px; font-weight: 800; color: var(--muted); }
.opt-mini.ok { background: var(--ok-soft); }
.opt-mini.ok .key { background: var(--ok); color: #fff; }
.sync-steps li { margin-bottom: 2px; }
.sync-steps code, .code-block code { font-family: ui-monospace, Consolas, monospace; }
mark { background: var(--warn-soft); color: var(--text); border-radius: 3px; padding: 0 2px; }
.toolbar .btn-sm { height: 34px; }
@media (max-width: 560px) {
  .fill-input { height: 44px; }
  .review-item .ri-stem { -webkit-line-clamp: 3; }
}

@media (max-width: 560px) {
  .q-card { padding: 18px 16px; border-radius: 16px; }
  .q-stem { font-size: 16px; }
  .opt { padding: 12px 13px; }
  .opt .txt { font-size: 14.5px; }
  .hero { padding: 20px 18px; border-radius: 18px; }
  .hero h1 { font-size: 19px; }
  .hero-stats { gap: 18px; }
  .result-num { font-size: 36px; }
  .quiz-actions .btn { flex: 1 1 auto; }
  .modal { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
