/* ========== 主题变量 ========== */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d8dee4;
  --accent: #0a7ea4;
  --accent-hover: #086a8a;
  --accent-soft: #e2f4fa;
  --on-accent: #ffffff;
  --mastered: #1a7f37;
  --mastered-soft: #dcf7e3;
  --fuzzy: #9a6700;
  --fuzzy-soft: #fff4c2;
  --unknown: #cf222e;
  --unknown-soft: #ffe9e7;
  --new: #8c959f;
  --new-soft: #eaeef2;
  --must: #cf222e;
  --high: #bc4c00;
  --plus: #0969da;
  --code-bg: #f6f8fa;
  --inline-code-bg: rgba(175, 184, 193, 0.22);
  --mark: #fff1a8;
  --frame: #8250df;
  --frame-soft: #f6f1ff;
  --frame-border: #dccbf7;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.05), 0 2px 8px rgba(31, 35, 40, 0.06);
  --radius: 12px;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-comment: #6e7781;
  --hl-number: #0550ae;
  --hl-title: #8250df;
  --hl-type: #953800;
  --hl-builtin: #0550ae;
  --hl-attr: #116329;
  --hl-meta: #6e7781;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1d232b;
    --text: #e6edf3;
    --muted: #9198a1;
    --border: #30363d;
    --accent: #3cc0e0;
    --accent-hover: #6fd2ea;
    --accent-soft: #0f2c35;
    --on-accent: #0d1117;
    --mastered: #3fb950;
    --mastered-soft: #13281b;
    --fuzzy: #d29922;
    --fuzzy-soft: #2e2410;
    --unknown: #f85149;
    --unknown-soft: #301617;
    --new: #6e7681;
    --new-soft: #21262d;
    --must: #ff7b72;
    --high: #f0883e;
    --plus: #58a6ff;
    --code-bg: #0d1117;
    --inline-code-bg: rgba(110, 118, 129, 0.35);
    --mark: #6b5a12;
    --frame: #c297ff;
    --frame-soft: #211a2e;
    --frame-border: #46385f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --hl-keyword: #ff7b72;
    --hl-string: #a5d6ff;
    --hl-comment: #8b949e;
    --hl-number: #79c0ff;
    --hl-title: #d2a8ff;
    --hl-type: #ffa657;
    --hl-builtin: #79c0ff;
    --hl-attr: #7ee787;
    --hl-meta: #8b949e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1d232b;
  --text: #e6edf3;
  --muted: #9198a1;
  --border: #30363d;
  --accent: #3cc0e0;
  --accent-hover: #6fd2ea;
  --accent-soft: #0f2c35;
  --on-accent: #0d1117;
  --mastered: #3fb950;
  --mastered-soft: #13281b;
  --fuzzy: #d29922;
  --fuzzy-soft: #2e2410;
  --unknown: #f85149;
  --unknown-soft: #301617;
  --new: #6e7681;
  --new-soft: #21262d;
  --must: #ff7b72;
  --high: #f0883e;
  --plus: #58a6ff;
  --code-bg: #0d1117;
  --inline-code-bg: rgba(110, 118, 129, 0.35);
  --mark: #6b5a12;
  --frame: #c297ff;
  --frame-soft: #211a2e;
  --frame-border: #46385f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --hl-keyword: #ff7b72;
  --hl-string: #a5d6ff;
  --hl-comment: #8b949e;
  --hl-number: #79c0ff;
  --hl-title: #d2a8ff;
  --hl-type: #ffa657;
  --hl-builtin: #79c0ff;
  --hl-attr: #7ee787;
  --hl-meta: #8b949e;
  color-scheme: dark;
}

/* ========== 基础 ========== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 64px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* ========== 顶栏 ========== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-icon { font-size: 22px; }
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; }
.nav a {
  color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); font-weight: 600; }
.badge {
  background: var(--unknown); color: #fff; border-radius: 10px; font-size: 11px; line-height: 1;
  padding: 3px 6px; font-weight: 600;
}
.search input {
  width: 200px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 16px; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }

@media (max-width: 820px) {
  .topbar { position: static; }
  .topbar-inner { height: auto; flex-wrap: wrap; gap: 8px 10px; padding: 10px 16px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .search { order: 4; flex-basis: 100%; }
  .search input { width: 100%; }
}

/* ========== 通用组件 ========== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  font-size: 14px; line-height: 1.4; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.danger { color: var(--unknown); }
.btn.danger.armed { background: var(--unknown); border-color: var(--unknown); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions.center { justify-content: center; }
.actions.small { margin-top: 10px; gap: 6px; }
kbd {
  display: inline-block; font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 4px;
  border: 1px solid currentColor; opacity: .7; font-weight: 500;
}
@media (hover: none) { kbd { display: none; } }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
a.chip:hover { text-decoration: none; color: var(--text); }
.chip.tag::before { content: "#"; opacity: .6; }
.prio { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; border: 1px solid currentColor; white-space: nowrap; vertical-align: middle; }
.p-must { color: var(--must); }
.p-high { color: var(--high); }
.p-plus { color: var(--plus); }
.p-misc { color: var(--muted); }
.back { display: inline-block; color: var(--muted); margin-bottom: 12px; }
.page-title { font-size: 24px; margin: 4px 0 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 状态色 */
.s-mastered { --c: var(--mastered); --cs: var(--mastered-soft); }
.s-fuzzy { --c: var(--fuzzy); --cs: var(--fuzzy-soft); }
.s-unknown { --c: var(--unknown); --cs: var(--unknown-soft); }
.s-new { --c: var(--new); --cs: var(--new-soft); }
.t-mastered { color: var(--mastered); }
.t-fuzzy { color: var(--fuzzy); }
.t-unknown { color: var(--unknown); }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--cs); color: var(--c); font-weight: 600; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; margin-top: 6px; }
.dot.s-new { background: transparent; border: 2px solid var(--new); }

.stackbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--new-soft); margin: 12px 0 8px; }
.stackbar .seg { display: block; height: 100%; background: var(--c); }

/* ========== 首页 ========== */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center; margin-bottom: 28px; }
.hero h1 { margin: 0 0 8px; font-size: 26px; }
.hero p { margin: 0; }
.hero-stats .big-pct { display: flex; align-items: baseline; gap: 8px; }
.hero-stats .big-pct b { font-size: 40px; line-height: 1; color: var(--mastered); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { text-align: center; padding: 8px 4px; border-radius: 10px; background: var(--cs); }
.stat b { display: block; font-size: 20px; color: var(--c); line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }
.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; padding: 14px 20px; border-left: 4px solid var(--accent); }
.cat { margin-bottom: 28px; }
.cat-title { font-size: 17px; margin: 0 0 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.topic-card { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; color: var(--text); padding: 16px 18px; transition: border-color .15s, transform .15s; }
.topic-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.tc-head { display: flex; align-items: center; gap: 8px; }
.tc-icon { font-size: 20px; }
.tc-title { font-weight: 650; font-size: 15.5px; flex: 1; }
.tc-summary { color: var(--muted); font-size: 13px; margin: 8px 0 0; flex: 1; line-height: 1.55; }
.tc-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 18px; }
}

/* ========== 方向页 ========== */
.topic-head h1 { margin: 0 0 6px; font-size: 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topic-head p { margin: 0; }
.topic-head { margin-bottom: 20px; }
details.intro { margin-bottom: 20px; padding: 0; }
details.intro > summary { cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none; }
details.intro > summary::-webkit-details-marker { display: none; }
details.intro > summary::after { content: "展开"; float: right; color: var(--muted); font-weight: 400; font-size: 13px; }
details.intro[open] > summary::after { content: "收起"; }
details.intro > .md { padding: 0 20px 16px; border-top: 1px solid var(--border); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 12px; }
.fgroup { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; cursor: pointer; color: var(--muted);
}
.fchip span { opacity: .75; font-size: 12px; }
.fchip:hover { color: var(--text); }
.fchip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.qlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.qlist li + li { border-top: 1px solid var(--border); }
.qrow { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; color: var(--text); }
.qrow:hover { background: var(--surface-2); text-decoration: none; }
.qrow-main { flex: 1; min-width: 0; }
.qrow-title { display: block; font-weight: 500; }
.qrow-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.qrow-meta .tag::before { content: "#"; opacity: .6; }
.qrow-snippet { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.qrow-snippet mark, .qrow-title mark { background: var(--mark); color: inherit; border-radius: 2px; }
.stars { color: var(--fuzzy); letter-spacing: 1px; }
.star-mark { color: #e3b341; }

/* ========== 刷题 ========== */
.practice { max-width: 860px; margin: 0 auto; }
.practice-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.practice-head .back { margin-bottom: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.counter { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; white-space: nowrap; }
.thin { height: 3px; background: var(--border); border-radius: 3px; margin: 10px 0 16px; overflow: hidden; }
.thin i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.qcard { padding: 24px 28px; }
.qmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qmeta .spacer { flex: 1; }
.star-btn { border: 1px solid var(--border); background: var(--surface); color: var(--new); border-radius: 8px; width: 32px; height: 28px; cursor: pointer; font-size: 15px; }
.star-btn.on { color: #e3b341; border-color: #e3b341; }
.qtitle { font-size: 21px; line-height: 1.45; margin: 16px 0 8px; }
.qbody { margin-bottom: 8px; }
.attempt { margin: 18px 0 16px; }
.attempt label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.attempt textarea {
  width: 100%; resize: vertical; min-height: 96px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); line-height: 1.6; outline: none;
}
.attempt textarea:focus { border-color: var(--accent); background: var(--surface); }
.answer-label { font-weight: 700; margin: 4px 0 6px; padding-top: 16px; border-top: 1px dashed var(--border); }
.grade-bar {
  position: sticky; bottom: 0; margin: 20px -28px -24px; padding: 14px 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.grade-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.grade-btns .btn { min-width: 92px; font-weight: 600; }
.g-unknown { color: var(--unknown); border-color: var(--unknown); }
.g-unknown:hover { background: var(--unknown-soft); }
.g-fuzzy { color: var(--fuzzy); border-color: var(--fuzzy); }
.g-fuzzy:hover { background: var(--fuzzy-soft); }
.g-mastered { color: var(--mastered); border-color: var(--mastered); }
.g-mastered:hover { background: var(--mastered-soft); }
.practice-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 10px; }
.summary { text-align: center; padding: 36px 24px; }
.summary-emoji { font-size: 44px; }
.summary h2 { margin: 8px 0; }
@media (max-width: 640px) {
  .container { padding: 14px 12px 56px; }
  .qcard { padding: 18px 16px; }
  .grade-bar { margin: 16px -16px -18px; padding: 12px 16px; }
  .grade-bar > .muted { display: none; }
  .grade-btns { width: 100%; }
  .grade-btns .btn { flex: 1; min-width: 0; }
  .qtitle { font-size: 19px; }
}

/* ========== 查漏补缺 / 随机 / 搜索 / 设置 ========== */
.review-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 24px; }
.rcard { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 16px 18px; }
.rcard .rnum { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--c, var(--text)); }
.rcard .btn { margin-top: 6px; }
@media (max-width: 820px) { .review-grid { grid-template-columns: repeat(2, 1fr); } }
.rsection { margin-bottom: 26px; }
.rsection h2 { font-size: 18px; margin: 0 0 10px; }
.rsection h3 { font-size: 14px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }

.random-form fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.random-form legend { font-weight: 700; margin-bottom: 8px; }
.topic-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 18px; }
.tcat-title { font-weight: 600; font-size: 13px; color: var(--muted); margin: 6px 0 2px; }
.tcheck, .radio { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
.radio { display: inline-flex; margin-right: 16px; }
.random-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; flex-wrap: wrap; }

.search-big { display: flex; gap: 8px; margin: 12px 0 16px; }
.search-big input { flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); outline: none; min-width: 0; }
.search-big input:focus { border-color: var(--accent); }

.settings-sec { margin-bottom: 16px; }
.settings-sec h2 { font-size: 17px; margin: 0 0 8px; }
.settings-sec p { margin: 6px 0; }
.seg-ctl { display: flex; gap: 16px; flex-wrap: wrap; }
.seg-ctl label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.token-form { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.token-form input { flex: 1; min-width: 180px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.kbd-table td { padding: 4px 16px 4px 0; }
.kbd-table kbd { display: inline-block; }
.error pre { white-space: pre-wrap; color: var(--unknown); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 10px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: opacity .2s, transform .2s; z-index: 50; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ========== Markdown 内容 ========== */
.md { line-height: 1.75; overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.35; margin: 1.3em 0 .5em; }
.md h1 { font-size: 1.6em; }
.md h2 { font-size: 1.3em; padding-bottom: .25em; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 1.12em; }
.md h4 { font-size: 1em; }
.md p { margin: .6em 0; }
.md ul, .md ol { padding-left: 1.6em; margin: .5em 0; }
.md li { margin: .2em 0; }
.md li > ul, .md li > ol { margin: .15em 0; }
.md strong { font-weight: 650; }
.md blockquote { margin: .8em 0; padding: .5em 1em; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text); }
.md blockquote p { margin: .3em 0; }
pre, code, textarea { tab-size: 4; -moz-tab-size: 4; }
.md blockquote.frame-quote { border-left-color: var(--frame); background: var(--frame-soft); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md code { font-size: .88em; background: var(--inline-code-bg); padding: .15em .4em; border-radius: 5px; }
.md pre {
  position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; line-height: 1.55; margin: .8em 0;
}
.md pre code { background: none; padding: 0; font-size: 13px; border-radius: 0; display: block; }
.copy-btn {
  position: absolute; top: 6px; right: 6px; font-size: 12px; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s;
}
.md pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }
.table-wrap { overflow-x: auto; margin: .8em 0; }
.md table { border-collapse: collapse; font-size: .94em; min-width: 60%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 650; }
.md input[type="checkbox"] { margin-right: 6px; }
.md li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.3em; }
.md img { max-width: 100%; }
.roadmap, .guide { padding: 28px 32px; }
@media (max-width: 640px) { .roadmap, .guide { padding: 18px 16px; } }

/* ========== 答题框架 ========== */
.frame-hint { margin: 10px 0 0; }
.frame-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; color: var(--frame); background: transparent; border: 1px dashed var(--frame-border);
}
.frame-btn:hover { background: var(--frame-soft); }
.frame-btn[aria-expanded="true"] { background: var(--frame-soft); border-style: solid; }
.frame-btn b { font-weight: 650; }
.frame-panel {
  margin-top: 10px; padding: 12px 16px; border-radius: 10px;
  background: var(--frame-soft); border: 1px solid var(--frame-border);
}
.frame-label { font-size: 12px; font-weight: 650; color: var(--frame); margin-bottom: 2px; }
.frame-own + .frame-generic { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--frame-border); }
.frame-panel .md > :first-child, .frame-box > .frame-label + * { margin-top: 0; }
.frame-panel .md > :last-child, .frame-box > :last-child { margin-bottom: 0; }
.frame-more { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--frame); }
.frame-box {
  margin: 4px 0 18px; padding: 12px 16px; border-radius: 0 10px 10px 0;
  background: var(--frame-soft); border-left: 4px solid var(--frame);
}
.fw-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.fw-toc a:hover { text-decoration: none; }
.guide h2, .fw-card { scroll-margin-top: 72px; }
.guide h2 { padding-top: 10px; border-top: 1px solid var(--border); }
.guide h2:first-child { border-top: 0; padding-top: 0; }
.fw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 14px; }
.fw-card { padding: 16px 18px; }
.fw-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--frame); }
.fw-card .md > :last-child { margin-bottom: 0; }

/* ========== 代码高亮（highlight.js token） ========== */
.hljs { color: var(--text); }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-template-tag { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-template-variable { color: var(--hl-string); }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: var(--hl-number); }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--hl-title); }
.hljs-type, .hljs-title.class_, .hljs-class .hljs-title { color: var(--hl-type); }
.hljs-built_in, .hljs-variable.language_ { color: var(--hl-builtin); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-name, .hljs-selector-attr { color: var(--hl-attr); }
.hljs-meta, .hljs-meta .hljs-keyword { color: var(--hl-meta); }
.hljs-addition { color: var(--mastered); background: var(--mastered-soft); }
.hljs-deletion { color: var(--unknown); background: var(--unknown-soft); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: bold; }
