/* ============================================================
   鏁板缁冧範鍙?v2 路 鏍峰紡
   涓ゅ鏇磋交鐨勮瑙夋柟妗堬細A 绾哥櫧 / B 闆捐摑
   閫氳繃 html[data-design] 鍒囨崲锛宧tml[data-mode] 鎺у埗娣辨祬鑹?   ============================================================ */

/* ---------- A 绾哥櫧 ---------- */
html[data-design="a"] {
  --bg: #f7f7f4;
  --bg-image: radial-gradient(900px 420px at 88% -8%, #ffffff 0%, rgba(255,255,255,0) 60%);
  --card: #ffffff;
  --card-2: #fbfbf9;
  --ink: #15171c;
  --ink-2: #3a3f47;
  --muted: #5f6672;
  --line: #e7e7e0;
  --line-2: #d9d9d0;
  --brand: #2f5cf6;
  --brand-2: #1e46d6;
  --brand-soft: #eef2ff;
  --brand-ink: #ffffff;
  --ok: #1a7f45;
  --ok-soft: #e9f7ee;
  --bad: #c43b31;
  --bad-soft: #fdeceb;
  --warn: #b26a05;
  --warn-soft: #fdf3e3;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .05);
  --shadow-2: 0 16px 40px rgba(20, 22, 26, .10);
  --topbar: rgba(255, 255, 255, .86);
  --focus: #b9c6ff;
  --hm: #2f5cf6;
}

/* ---------- B 闆捐摑 ---------- */
html[data-design="b"] {
  --bg: #ecf1f8;
  --bg-image: radial-gradient(900px 480px at 10% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 58%);
  --card: #ffffff;
  --card-2: #f6f9fd;
  --ink: #152238;
  --ink-2: #324563;
  --muted: #5b6b85;
  --line: #dfe7f3;
  --line-2: #cfdaea;
  --brand: #0f766e;
  --brand-2: #0b5f59;
  --brand-soft: #e4f4f1;
  --brand-ink: #ffffff;
  --ok: #0f766e;
  --ok-soft: #e4f4f1;
  --bad: #c2410c;
  --bad-soft: #fdeee5;
  --warn: #a16207;
  --warn-soft: #fdf6e3;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 12px;
  --shadow: 0 2px 6px rgba(21, 34, 56, .05);
  --shadow-2: 0 20px 48px rgba(21, 34, 56, .10);
  --topbar: rgba(255, 255, 255, .78);
  --focus: #a7ded6;
  --hm: #0f766e;
}

/* ---------- 娣辫壊 ---------- */
html[data-mode="dark"] {
  --bg: #0f131a;
  --bg-image: radial-gradient(900px 420px at 85% -10%, #182130 0%, rgba(24, 33, 48, 0) 60%);
  --card: #171c25;
  --card-2: #131820;
  --ink: #e8ecf4;
  --ink-2: #c3cbd9;
  --muted: #8d99ad;
  --line: #242c39;
  --line-2: #303a4a;
  --topbar: rgba(15, 19, 26, .82);
  --shadow-2: 0 20px 48px rgba(0, 0, 0, .5);
}
html[data-mode="dark"][data-design="a"] {
  --brand: #8aa6ff; --brand-2: #6f8ff5; --brand-soft: #1c2440; --brand-ink: #0f131a;
  --ok: #5fd08a; --ok-soft: #12261a; --bad: #ff8b80; --bad-soft: #2a1614; --warn: #f0c26b;
}
html[data-mode="dark"][data-design="b"] {
  --brand: #5fd3c6; --brand-2: #46bfb2; --brand-soft: #0f2b2a; --brand-ink: #0f131a;
  --ok: #5fd3c6; --ok-soft: #0f2b2a; --bad: #ff9a76; --bad-soft: #2b1a12; --warn: #e8c979;
}
@media (prefers-color-scheme: dark) {
  html[data-mode="auto"] {
    --bg: #0f131a;
    --bg-image: radial-gradient(900px 420px at 85% -10%, #182130 0%, rgba(24, 33, 48, 0) 60%);
    --card: #171c25;
    --card-2: #131820;
    --ink: #e8ecf4;
    --ink-2: #c3cbd9;
    --muted: #8d99ad;
    --line: #242c39;
    --line-2: #303a4a;
    --topbar: rgba(15, 19, 26, .82);
    --shadow-2: 0 20px 48px rgba(0, 0, 0, .5);
  }
  html[data-mode="auto"][data-design="a"] {
    --brand: #8aa6ff; --brand-2: #6f8ff5; --brand-soft: #1c2440; --brand-ink: #0f131a;
    --ok: #5fd08a; --ok-soft: #12261a; --bad: #ff8b80; --bad-soft: #2a1614; --warn: #f0c26b;
  }
  html[data-mode="auto"][data-design="b"] {
    --brand: #5fd3c6; --brand-2: #46bfb2; --brand-soft: #0f2b2a; --brand-ink: #0f131a;
    --ok: #5fd3c6; --ok-soft: #0f2b2a; --bad: #ff9a76; --bad-soft: #2b1a12; --warn: #e8c979;
  }
}

/* ---------- 鍩虹 ---------- */
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease; }
button:active { transform: scale(.99); }
button:disabled { cursor: not-allowed; }
a { color: var(--brand); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--card-2); padding: 1px 5px; border-radius: 5px; }

.tex { display: inline-block; max-width: 100%; }
.katex { font-size: 1.06em; }
.katex-display { margin: .4em 0; }

/* ---------- 甯冨眬 ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar-wrap {
  position: sticky; top: 0; z-index: 30;
  background: var(--topbar);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 28px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink);
  font-size: 20px; font-weight: 700;
}
.brand-text { text-align: left; font-weight: 700; font-size: 16px; line-height: 1.15; }
.brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 2px; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.navbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 10px;
  color: var(--muted); font-size: 14px;
}
.navbtn svg { width: 17px; height: 17px; }
.navbtn:hover { color: var(--ink); background: var(--card-2); }
.navbtn.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.iconbtn { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { color: var(--ink); background: var(--card-2); }

.view { width: 100%; max-width: 1040px; margin: 0 auto; padding: 38px 28px 70px; flex: 1; }
.site-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 20px 30px; }

h1 { font-size: 30px; line-height: 1.25; margin: 8px 0 6px; letter-spacing: -.4px; font-weight: 750; }
h2 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
p { margin: 0; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--brand); text-transform: uppercase; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ---------- 棣栭〉 ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.hero-text { max-width: 620px; }
.hero-text p { margin-top: 6px; }
.hero-progress { text-align: center; flex: none; }
.ring {
  width: 96px; height: 96px; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center; position: relative; margin: 0 auto 8px;
}
.ring::before { content: ""; position: absolute; inset: 8px; background: var(--card); border-radius: 50%; }
.ring span { position: relative; font-size: 22px; font-weight: 750; letter-spacing: -.5px; }
.ring span small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 1px; }
.ring.big { width: 148px; height: 148px; }
.ring.big::before { inset: 11px; }
.ring.big span { font-size: 38px; }

.continue-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 20px; margin-bottom: 26px;
  background: var(--brand-soft); border: 1px solid var(--brand);
  border-radius: var(--radius-lg);
}
.continue-info { display: flex; flex-direction: column; gap: 3px; }
.continue-info b { font-size: 15px; }
.badge { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--brand-ink); background: var(--brand); border-radius: 999px; padding: 1px 8px; margin-bottom: 2px; }
.continue-btns { display: flex; gap: 8px; flex: none; }

.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.8px; line-height: 1.3; margin-top: 2px; }
.stat-value i { font-style: normal; font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat.tone-ok .stat-value { color: var(--ok); }
.stat.tone-bad .stat-value { color: var(--bad); }
.stat.tone-warn .stat-value { color: var(--warn); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0 6px; }
.quick-card {
  text-align: left; padding: 15px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px;
}
.quick-card b { font-size: 15px; font-weight: 650; }
.quick-card span { font-size: 12.5px; color: var(--muted); }
.quick-card:hover:not(:disabled) { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.quick-card:disabled { opacity: .5; }

.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.chapter-card {
  text-align: left; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.chapter-card:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.chapter-title { font-weight: 650; font-size: 15px; }
.chapter-meta { font-size: 12.5px; color: var(--muted); }

.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .35s ease; }
.progress.thin { height: 5px; }
.progress.inline { display: inline-block; width: 110px; vertical-align: middle; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.recent { padding: 6px 18px; }
.recent-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.recent-row:last-child { border-bottom: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.recent-topic { font-weight: 550; }
.recent-ch { color: var(--muted); font-size: 12.5px; }
.recent-time { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ---------- 缁冧範 ---------- */
.page-head { margin-bottom: 22px; }
.practice { max-width: 880px; margin: 0 auto; }
.practice-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pmeta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pbadge { font-size: 13px; font-weight: 650; background: var(--brand-soft); color: var(--brand); padding: 4px 11px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.pcount { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pscore { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pactions { display: flex; align-items: center; gap: 6px; }
.timer { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer svg { width: 14px; height: 14px; }

.qcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 30px 22px; margin-top: 14px; box-shadow: var(--shadow);
}
.qcard.compact { padding: 20px 22px; margin-top: 0; margin-bottom: 14px; }
.qhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; font-size: 11.5px; color: var(--ink-2); background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.chip.soft { color: var(--muted); }
.chip.time { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.fav { color: var(--line-2); padding: 4px; border-radius: 8px; }
.fav svg { width: 19px; height: 19px; }
.fav:hover { color: var(--brand); }
.fav.on { color: var(--warn); }
.fav.on svg { fill: currentColor; stroke: currentColor; }

.stem { font-size: 18px; line-height: 1.95; color: var(--ink); }
.stem.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.answer-line { margin-top: 10px; font-size: 13px; color: var(--muted); }
.answer-line b { color: var(--ok); font-size: 15px; margin-left: 2px; }
.stem img, .explain-body img, .explain-img { max-width: 100%; height: auto; }
.options { display: grid; gap: 10px; margin-top: 20px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  padding: 13px 16px;
  background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 16px; line-height: 1.75; color: var(--ink);
}
.opt:hover:not(:disabled) { border-color: var(--brand); background: var(--card-2); }
.key {
  width: 26px; height: 26px; flex: none; margin-top: 1px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 13px; font-weight: 700; color: var(--muted); background: var(--card-2);
}
.otext { flex: 1; min-width: 0; }
.opt.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.opt.is-selected .key { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .key { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt.is-dim { opacity: .55; }
.opt:disabled { cursor: default; }
.opt-mark { margin-left: auto; font-size: 14px; font-weight: 800; line-height: 26px; }
.opt-mark.ok { color: var(--ok); }
.opt-mark.bad { color: var(--bad); }

.muted-options { margin-top: 14px; }
.opt-static { display: flex; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: 15px; }
.opt-static .key { margin-top: 0; }
.opt-static.is-answer { border-color: var(--ok); background: var(--ok-soft); }
.opt-static.is-answer .key { background: var(--ok); border-color: var(--ok); color: #fff; }

.feedback { margin-top: 20px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid transparent; animation: slide-in .22s ease; }
.feedback.ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad); }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.bad .verdict { color: var(--bad); }
.verdict svg { width: 18px; height: 18px; }
.explain { margin-top: 10px; }
.explain-title { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--muted); margin-bottom: 3px; }
.explain-body { font-size: 15px; line-height: 1.95; color: var(--ink-2); }
.empty-explain { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.explain-img { display: block; margin-top: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.videolink { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--brand); text-decoration: none; }
.videolink svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }

.actionbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.hint { font-size: 13px; color: var(--muted); }
.actionbtns { display: flex; gap: 8px; flex: none; }

.primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: var(--brand-ink);
  padding: 11px 20px; border-radius: 11px; font-weight: 650; font-size: 15px;
  box-shadow: 0 2px 8px rgba(47, 92, 246, .22);
}
.primary:hover:not(:disabled) { background: var(--brand-2); }
.primary:disabled { opacity: .45; box-shadow: none; }
.primary svg { width: 16px; height: 16px; }
.kbd { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); font-weight: 500; }

.ghostbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line-2); color: var(--ink-2); font-size: 13.5px; background: var(--card);
}
.ghostbtn:hover { border-color: var(--brand); color: var(--brand); }
.ghostbtn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.ghostbtn.danger { color: var(--bad); border-color: var(--bad); }
.ghostbtn.danger:hover { background: var(--bad-soft); }

/* ---------- 鎬荤粨 ---------- */
.summary { max-width: 880px; margin: 0 auto; }
.summary-hero { display: flex; align-items: center; gap: 40px; margin: 22px 0 26px; padding: 28px 32px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.summary-nums { display: grid; grid-template-columns: repeat(4, auto); gap: 26px; }
.summary-nums b { display: block; font-size: 26px; font-weight: 750; letter-spacing: -.8px; }
.summary-nums span { font-size: 12.5px; color: var(--muted); }
.summary-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fold { margin-top: 12px; }
.fold summary { cursor: pointer; font-size: 13.5px; color: var(--brand); font-weight: 600; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "鈻?"; }
.fold[open] summary::before { content: "鈻?"; }
.fold .explain-body { margin-top: 10px; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- 閿欓 / 鏀惰棌 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.filter { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); background: var(--card); }
.filter:hover { border-color: var(--brand); color: var(--brand); }
.filter.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.empty { text-align: center; padding: 54px 20px; background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--radius-lg); color: var(--muted); }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 26px; font-weight: 700; }
.empty p { margin-bottom: 14px; }

/* ---------- 缁熻 ---------- */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; gap: 4px; padding: 18px 20px 6px; overflow-x: auto; }
.hm-cell { width: 14px; height: 14px; border-radius: 4px; background: var(--line); display: inline-block; }
.hm-cell.lv1, .hm-cell.lv1 { background: color-mix(in srgb, var(--hm) 25%, var(--line)); }
.hm-cell.lv2 { background: color-mix(in srgb, var(--hm) 48%, var(--line)); }
.hm-cell.lv3 { background: color-mix(in srgb, var(--hm) 72%, var(--line)); }
.hm-cell.lv4 { background: var(--hm); }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 10px 20px 16px; font-size: 11.5px; color: var(--muted); }
.hm-legend .hm-cell { width: 11px; height: 11px; }
.hm-card { display: flex; align-items: center; gap: 8px 26px; flex-wrap: wrap; padding: 4px 4px 4px 0; }
.hm-card .heatmap { padding: 16px 6px 8px 20px; }
.hm-side { display: flex; flex-direction: column; gap: 1px; }
.hm-num { font-size: 23px; font-weight: 750; letter-spacing: -.6px; line-height: 1.3; }
.hm-legend { margin-left: auto; padding: 0 20px 0 0; }
@media (max-width: 980px) {
  .hm-legend { margin-left: 20px; padding: 0; }
}

.tablewrap { overflow-x: auto; padding: 4px 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }

.weak-list { display: grid; gap: 8px; }
.weak-row {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.weak-row:hover { border-color: var(--brand); }
.weak-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weak-ch { color: var(--muted); font-size: 12.5px; }
.weak-rate { font-weight: 700; color: var(--bad); font-size: 13px; }
.weak-row svg { width: 15px; height: 15px; color: var(--muted); }

/* ---------- 璁剧疆 ---------- */
.settings { padding: 4px 22px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row b { display: block; font-size: 14.5px; font-weight: 650; }
.set-row .muted { font-size: 12.5px; }
.goal-edit { display: flex; align-items: center; gap: 8px; }
.goal-edit input { width: 84px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); }
.switch { width: 46px; height: 26px; border-radius: 999px; background: var(--line-2); padding: 3px; transition: background .18s ease; flex: none; }
.switch span { display: block; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .22); transition: transform .18s ease; }
.switch.on { background: var(--brand); }
.switch.on span { transform: translateX(20px); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; }
.segbtn { padding: 6px 13px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.segbtn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.settings-inline { padding: 16px 20px; }
.row-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sync-note { padding: 0 2px 4px; margin-top: 4px; }

/* ---------- 寮瑰眰 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 14, 22, .5);
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .14s ease;
}
.modal {
  width: min(560px, 100%); max-height: 82vh; overflow: auto;
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  padding: 20px 22px 22px;
}
.modal.drawer { width: min(470px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head b { font-size: 16px; }
.modal-head .iconbtn { margin-right: -6px; }
.jump-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 16px; }
.jump-cell {
  padding: 10px 0; border-radius: 9px; border: 1px solid var(--line);
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); background: var(--card-2);
}
.jump-cell:hover { border-color: var(--brand); }
.jump-cell.current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); font-weight: 700; }
.jump-cell.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.jump-cell.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.keys { display: grid; gap: 4px; margin-top: 12px; }
.key-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.key-row:last-child { border-bottom: none; }
kbd {
  min-width: 96px; text-align: center; font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 8px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--line-2); box-shadow: 0 1px 0 var(--line-2);
}
.key-row span { color: var(--ink-2); font-size: 13.5px; }

/* ---------- Toast / 閿欒椤?---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 12px);
  background: var(--ink); color: var(--bg); font-size: 13.5px; padding: 9px 18px; border-radius: 999px;
  z-index: 200; opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none;
  box-shadow: var(--shadow-2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fatal { max-width: 560px; margin: 90px auto; padding: 0 24px; text-align: center; }
.fatal h1 { font-size: 24px; }
.fatal p { color: var(--muted); margin-top: 10px; }

/* ---------- B 鏂规宸紓锛氭棤杈规鍗＄墖 + 鑳跺泭瀵艰埅 ---------- */
html[data-design="b"] .nav {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow);
}
html[data-design="b"] .navbtn { border-radius: 999px; }
html[data-design="b"] .stat,
html[data-design="b"] .quick-card,
html[data-design="b"] .chapter-card,
html[data-design="b"] .card,
html[data-design="b"] .qcard,
html[data-design="b"] .weak-row,
html[data-design="b"] .continue-card { border-color: transparent; }
html[data-design="b"] .stat,
html[data-design="b"] .quick-card,
html[data-design="b"] .chapter-card,
html[data-design="b"] .qcard { box-shadow: 0 8px 24px rgba(21, 34, 56, .07); }
html[data-design="b"] .empty { border-color: var(--line-2); }

/* ---------- 鍔ㄧ敾 ---------- */
@keyframes slide-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 鍝嶅簲寮?---------- */
@media (max-width: 980px) {
  .grid.stats { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .summary-hero { flex-direction: column; align-items: flex-start; gap: 22px; }
  .summary-nums { grid-template-columns: repeat(4, 1fr); width: 100%; gap: 12px; }
}
@media (max-width: 720px) {
  .topbar-wrap {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--card);
  }
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand-text small { display: none; }
  .brand-text { font-size: 15px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0;
    background: var(--topbar);
    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));
    justify-content: space-around; z-index: 40;
  }
  html[data-design="b"] .nav {
    border: none; border-top: 1px solid var(--line); border-radius: 0;
    background: var(--topbar); box-shadow: none;
  }
  .navbtn { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 10.5px; border-radius: 9px; }
  .navbtn svg { width: 19px; height: 19px; }
  .top-actions { margin-left: auto; }
  .iconbtn { width: 44px; height: 44px; }
  .view { padding: 22px 16px 96px; }
  .site-foot { padding-bottom: 84px; }
  h1 { font-size: 24px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-progress { display: flex; align-items: center; gap: 12px; }
  .ring { width: 72px; height: 72px; margin: 0; }
  .ring span { font-size: 18px; }
  .continue-card { flex-direction: column; align-items: stretch; }
  .continue-btns { justify-content: flex-end; }
  .quick { grid-template-columns: 1fr 1fr; }
  .qcard { padding: 18px 16px; }
  .stem { font-size: 16.5px; line-height: 1.9; }
  .opt { font-size: 15px; padding: 12px 13px; gap: 10px; }
  .actionbar { flex-direction: column; align-items: stretch; }
  .hint { order: 2; font-size: 12px; text-align: center; }
  .actionbtns .primary { width: 100%; justify-content: center; }
  .actionbtns { width: 100%; }
  .pbadge { max-width: 40vw; }
  .pscore { display: none; }
  .pactions .ghostbtn { padding: 6px 10px; font-size: 12.5px; }
  .summary-hero { padding: 22px 18px; }
  .summary-nums { grid-template-columns: repeat(2, 1fr); }
  .settings { padding: 0 16px; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .row-actions-inline { justify-content: flex-start; }
  .goal-edit { width: 100%; }
  .goal-edit input { flex: 1; width: auto; min-width: 0; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .jump-grid { grid-template-columns: repeat(5, 1fr); }
  .modal { padding: 18px 16px; }
  .table th, .table td { padding: 10px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
