/* ===========================================================
   北极星普拉提知识库 — 样式表
   =========================================================== */

:root {
  --paper: #f4f7f8;
  --paper-2: #ffffff;
  --ink: #16232b;
  --ink-2: #33424c;
  --muted: #5f6f79;
  --faint: #8c9aa3;
  --line: #e3e9ec;
  --line-strong: #cbd5da;
  --accent: #16afd0;
  --teal: #0b7f97;
  --teal-2: #0b7f97;
  --teal-soft: #e4f6fb;
  --gold: #a87a1e;
  --gold-soft: #f8f0de;
  --rose: #b4575f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 35, 43, .04), 0 8px 24px -12px rgba(22, 35, 43, .14);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --nav-w: 274px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 100% -10%, #eef4f6 0%, transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 布局 ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 20px 32px 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 253, 249, .92), rgba(246, 244, 239, .75));
  backdrop-filter: blur(6px);
  z-index: 40;
}

.brand { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 10px;
  background: var(--teal);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { line-height: 1.35; min-width: 0; }
.brand-title { font-family: var(--serif); font-size: 16.5px; letter-spacing: .04em; color: var(--ink); white-space: nowrap; display: block; }
.brand-sub { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; display: block; }

.nav { margin-top: 26px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-label {
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--faint); padding: 0 10px; margin-bottom: 6px;
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; margin: 1px 0;
  border-radius: 8px;
  color: var(--ink-2); text-decoration: none;
  font-size: 14px;
  transition: background .18s ease, color .18s ease;
}
.nav a:hover { background: rgba(13, 80, 84, .07); }
.nav a.active { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.nav a .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--line-strong); flex: 0 0 5px;
  transition: background .18s ease, transform .18s ease;
}
.nav a.active .dot { background: var(--gold); transform: scale(1.4); }

.sidebar-foot {
  margin-top: 26px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--faint); line-height: 1.6;
}
.sidebar-foot a { color: var(--teal-2); text-decoration: none; }

.main { min-width: 0; }

.scrim {
  position: fixed; inset: 0; z-index: 38;
  background: rgba(22, 35, 43, .38);
  opacity: 0; pointer-events: none;
  transition: opacity .24s ease;
}
@media (min-width: 981px) { .scrim { display: none; } }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(18px, 4vw, 48px);
  background: rgba(246, 244, 239, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-toggle {
  display: none;
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--paper-2);
  color: var(--ink); cursor: pointer; font-size: 17px;
}
.crumb { font-size: 12.5px; color: var(--faint); letter-spacing: .06em; white-space: nowrap; }
.crumb b { color: var(--ink-2); font-weight: 600; }

.search-wrap { position: relative; margin-left: auto; width: min(360px, 46vw); }
.search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(19, 112, 119, .12); }
.search-input { padding-right: 34px; }
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: #eef2f4; color: var(--muted); font-size: 10px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.search-clear:hover { background: #d3dde1; color: var(--ink); }
.search-clear[hidden] { display: none; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; stroke: var(--faint); fill: none; stroke-width: 2;
  pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 8px); right: 0; left: 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: min(60vh, 460px); overflow-y: auto;
  padding: 6px;
  display: none;
}
.search-results.open { display: block; }
.search-hit {
  display: block; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: inherit;
}
.search-hit:hover, .search-hit:focus { background: var(--teal-soft); outline: none; }
.search-hit .h-title { font-size: 13.5px; font-weight: 600; color: var(--teal); }
.search-hit .h-snip { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.search-hit mark, .hit-mark { background: var(--gold-soft); color: #8a6416; padding: 0 1px; border-radius: 2px; }
.search-empty { padding: 12px; font-size: 12.5px; color: var(--faint); }
.search-kbd {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px;
}
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-family: inherit; font-size: 12.5px; cursor: pointer;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--line-strong); background: var(--paper-2); }

/* ---------- 内容容器 ---------- */
.content {
  max-width: 980px;
  padding: 0 clamp(18px, 4vw, 48px) 96px;
  margin: 0 auto;
}

/* ---------- Hero ---------- */
.hero { padding: clamp(36px, 6vw, 64px) 0 8px; position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--gold); display: block; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.25;
  letter-spacing: .01em;
  margin: 14px 0 10px;
  font-weight: 600;
}
.hero h1 em { font-style: normal; color: var(--teal); }
.hero .lede {
  font-size: clamp(15px, 1.6vw, 17px);
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 22px;
}
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line); color: var(--muted);
}
.chip b { color: var(--ink-2); font-weight: 600; }
.chip.teal { background: var(--teal-soft); border-color: #d7eef5; color: var(--teal); }
.chip.gold { background: var(--gold-soft); border-color: #eadfc4; color: #8a6416; }

.hero .stat-row { grid-template-columns: 1fr 1fr; }
.hero-grid {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px;
  align-items: start;
  margin-top: 26px;
}
.hero-figure {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.hero-figure svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.hero-figure figcaption {
  font-size: 11.5px; color: var(--faint); padding: 9px 4px 2px;
  display: flex; justify-content: space-between; gap: 10px;
}

/* ---------- 段落 ---------- */
section, h3, h4 { scroll-margin-top: 84px; }
#exercises { scroll-margin-top: 236px; }
.section { padding: 54px 0 8px; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: none; }
.section-head { margin-bottom: 26px; }
.section-num {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  color: var(--gold); text-transform: uppercase;
}
.section h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(23px, 2.8vw, 30px);
  line-height: 1.35; margin: 6px 0 8px; letter-spacing: .01em;
}
.section .sub { color: var(--muted); font-size: 14.5px; max-width: 68ch; margin: 0; }

h3 { font-family: var(--sans); font-size: 17px; margin: 34px 0 10px; letter-spacing: .01em; }
h4 { font-size: 14.5px; margin: 20px 0 6px; color: var(--ink-2); }
p { margin: 0 0 14px; }
.section > p, .section > ul, .section > ol,
.p-body ul, .r-body ul, .r-body p, .callout p { max-width: 48em; }
a { color: var(--teal-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
strong { font-weight: 650; color: var(--ink); }
em { color: var(--ink-2); }
small { font-size: 12.5px; color: var(--faint); }

.lead-in { font-size: 16.5px; color: var(--ink-2); }
.muted { color: var(--muted); }
.hairline { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.callout {
  display: grid; grid-template-columns: 3px 1fr; gap: 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px 16px 16px;
  margin: 18px 0;
  font-size: 14px;
}
.callout::before { content: ""; background: var(--gold); border-radius: 2px; margin-right: 14px; }
.callout.warn::before { background: var(--rose); }
.callout .callout-title { font-weight: 650; font-size: 13px; letter-spacing: .06em; color: var(--ink); margin-bottom: 4px; }
.callout p:last-child { margin-bottom: 0; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.tag {
  font-size: 11.5px; padding: 2px 8px; border-radius: 6px;
  background: var(--teal-soft); color: var(--teal); white-space: nowrap;
}
.tag.gray { background: #edf2f4; color: var(--muted); }
.tag.gold { background: var(--gold-soft); color: #8a6416; }

ul, ol { margin: 0 0 14px; padding-left: 1.15em; }
li { margin: 4px 0; }
li::marker { color: var(--line-strong); }
.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.checklist li::before {
  content: ""; flex: 0 0 16px; height: 16px; margin-top: 4px;
  border: 1.5px solid var(--line-strong); border-radius: 4px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.card h4 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stat { background: var(--paper-2); padding: 14px 16px; }
.stat .k { font-family: var(--serif); font-size: 24px; color: var(--teal); line-height: 1.2; }
.stat .k small { font-family: var(--sans); font-size: 11px; color: var(--faint); letter-spacing: .05em; }
.stat .v { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 认证地图 ---------- */
.path { position: relative; margin: 22px 0 8px; padding-left: 26px; }
.path::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(180deg, var(--teal) 0%, var(--gold) 100%);
  border-radius: 2px; opacity: .35;
}
.stage { position: relative; padding: 4px 0 22px; }
.stage::before {
  content: ""; position: absolute; left: -26px; top: 12px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper-2); border: 2px solid var(--teal);
  box-shadow: 0 0 0 3px var(--paper);
}
.stage:last-child::before { border-color: var(--gold); }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.stage-k { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--gold); }
.stage h3 { margin: 0; font-size: 17px; }
.stage .stage-sub { font-size: 12.5px; color: var(--faint); }
.course-list { display: grid; gap: 8px; margin-top: 12px; }
.course {
  display: grid; grid-template-columns: 120px 1fr; gap: 4px 14px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
  font-size: 13.5px;
}
.course .c-name { font-weight: 650; color: var(--ink); }
.course .c-name span { display: block; font-weight: 400; font-size: 11px; color: var(--faint); letter-spacing: .04em; }
.course .c-desc { color: var(--muted); font-size: 13px; line-height: 1.6; }
.course .c-meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- 原则 ---------- */
.principle {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin: 12px 0;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.principle[open] { border-color: #d7eef5; box-shadow: var(--shadow); }
.principle > summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 16px 18px;
}
.principle > summary::-webkit-details-marker { display: none; }
.principle .p-num {
  font-family: var(--serif); font-size: 19px; color: var(--teal);
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #d7eef5; background: var(--teal-soft);
  display: grid; place-items: center;
}
.principle .p-title { font-size: 16.5px; font-weight: 650; line-height: 1.4; }
.principle .p-title span { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 400; }
.principle .p-ess { font-size: 13px; color: var(--muted); margin-top: 2px; }
.principle .p-chev { color: var(--faint); transition: transform .2s ease; }
.principle[open] .p-chev { transform: rotate(180deg); }
.p-body { padding: 0 18px 20px 76px; }
.p-body h4 { margin-top: 16px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 30px; }

/* ---------- 动作库 ---------- */
.lib-toolbar {
  position: sticky; top: 63px; z-index: 20;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 24px -20px rgba(22, 35, 43, .45);
  padding: 12px 14px;
  margin: 6px 0 18px;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-row + .filter-row { margin-top: 8px; }
.filter-label { font-size: 11px; letter-spacing: .14em; color: var(--faint); text-transform: uppercase; margin-right: 4px; }
.fchip {
  font-family: inherit; font-size: 12.5px;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper-2);
  color: var(--ink-2); cursor: pointer;
  transition: all .16s ease;
}
.fchip:hover { border-color: var(--line-strong); }
.fchip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #ffffff; }
.fchip.small { font-size: 11.5px; padding: 3px 9px; }

.lib-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 12.5px; color: var(--faint); }
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.switch input { accent-color: var(--teal); }

.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.ex-card {
  position: relative;
  text-align: left;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px 14px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex; flex-direction: column; gap: 6px;
}
.ex-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cbd5da; }
.ex-card:focus-visible { outline: 2px solid var(--teal-2); outline-offset: 2px; }
.ex-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ex-card .ttl { display: block; min-width: 0; }
.ex-card .zh, .ex-card .en, .ex-card .desc { display: block; }
.ex-card .zh { font-size: 15px; font-weight: 650; line-height: 1.45; }
.ex-card .en { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.ex-card .desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.ex-card .foot { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 8px; }
.lvl {
  font-size: 10.5px; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
  background: #edf2f4; color: var(--muted);
}
.lvl.基础 { background: #e7f3ed; color: #2f7d5b; }
.lvl.中级 { background: #f8f0de; color: #8a6416; }
.lvl.高级 { background: #f8eaeb; color: #b4575f; }
.mastered-dot {
  position: absolute; top: 10px; right: 12px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
}
.ex-empty { padding: 38px 16px; text-align: center; color: var(--faint); font-size: 13.5px; border: 1px dashed var(--line-strong); border-radius: 12px; }

/* ---------- 对话框 ---------- */
dialog.ex-dialog {
  width: min(760px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-2);
  color: inherit;
  box-shadow: 0 30px 80px -30px rgba(22, 35, 43, .45);
}
dialog::backdrop { background: rgba(22, 35, 43, .42); backdrop-filter: blur(2px); }
.dlg-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 20px 22px 14px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.dlg-head h3 { margin: 0; font-size: 20px; font-family: var(--serif); font-weight: 600; }
.dlg-head .en { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.dlg-close {
  border: 1px solid var(--line); background: var(--paper); border-radius: 9px;
  width: 32px; height: 32px; cursor: pointer; color: var(--muted); font-size: 15px;
}
.dlg-close:hover { border-color: var(--line-strong); color: var(--ink); }
.dlg-body { padding: 18px 22px 26px; }
.dlg-body h4 { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin: 18px 0 6px; }
.dlg-body h4:first-child { margin-top: 0; }
.dlg-body ol, .dlg-body ul { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--faint); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--ink-2); }
.dlg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: #f7fafb;
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(13, 80, 84, .03); }
td strong { color: var(--ink); }
td .mini { font-size: 11.5px; color: var(--faint); display: block; }

/* ---------- 康复 ---------- */
.rehab-grid { display: grid; gap: 12px; }
.rehab {
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2);
  padding: 0; overflow: hidden;
}
.rehab > summary {
  cursor: pointer; list-style: none; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.rehab > summary::-webkit-details-marker { display: none; }
.rehab .ico {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  background: var(--gold-soft); color: #8a6416;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
  font-family: var(--serif);
}
.rehab .r-title { font-weight: 650; font-size: 15.5px; line-height: 1.4; }
.rehab .r-title span { display: block; font-size: 11px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; font-weight: 400; }
.rehab .r-pop { margin-left: auto; font-size: 11.5px; color: var(--faint); text-align: right; }
.r-body { padding: 0 18px 18px 64px; font-size: 14px; }
.r-body h4 { margin: 14px 0 4px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.r-body .tag, .pill-row .tag { border: 1px solid transparent; cursor: pointer; font-family: inherit; transition: background .15s ease; }
.r-body .tag:hover, .pill-row .tag:hover { background: #d7eef5; }
.pill-row a.tag { text-decoration: none; }
.r-body ul { padding-left: 1.1em; }
.r-body p { font-size: 13.5px; }

/* ---------- 图 ---------- */
.figure { margin: 20px 0 24px; }
.figure svg { width: 100%; height: auto; display: block; }
.figure figcaption { font-size: 12px; color: var(--faint); margin-top: 8px; line-height: 1.6; }
.diagram {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 40px; padding: 26px 0 40px;
  font-size: 12.5px; color: var(--faint);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
}
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 35;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2);
  cursor: pointer; box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { transform: translateY(-2px); }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw);
    transform: translateX(-102%);
    transition: transform .26s ease;
    box-shadow: 20px 0 60px -30px rgba(0,0,0,.35);
    background: var(--paper-2);
  }
  .sidebar.open { transform: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: grid; place-items: center; }
  .hero .stat-row { grid-template-columns: 1fr 1fr; }
.hero-grid { grid-template-columns: 1fr; }
  .p-grid { grid-template-columns: 1fr; }
  .course { grid-template-columns: 1fr; }
  .course .c-meta { grid-column: 1; }
  .lib-toolbar { position: static; }
  #exercises { scroll-margin-top: 74px; }
  .r-body { padding-left: 18px; }
}
@media (max-width: 620px) {
  body { font-size: 15.5px; }
  .crumb { display: none; }
  .search-wrap { width: 100%; }
  .btn-ghost .label { display: none; }
  .dlg-two { grid-template-columns: 1fr; }
  .principle > summary { grid-template-columns: 36px 1fr auto; padding: 14px; }
  .principle .p-num { width: 36px; height: 36px; font-size: 16px; }
  .p-body { padding: 0 14px 18px 14px; }
  .ex-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

/* ---------- 打印 ---------- */
@media print {
  .sidebar, .topbar, .to-top, .lib-toolbar, .dlg-close { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body { background: #fff; font-size: 11pt; }
  .content { max-width: none; padding: 0; }
  .section { break-inside: auto; page-break-inside: auto; }
  .card, .principle, .ex-card, .rehab { break-inside: avoid; }
  details { display: block; }
  details > *:not(summary) { display: block !important; }
  details:not([open]) .p-body { display: block !important; }
  a { color: inherit; text-decoration: none; }
  .ex-grid { grid-template-columns: 1fr 1fr; }
}

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

/* ---------- 著作五大原则 ---------- */
.bp-card { display: flex; flex-direction: column; padding: 18px 18px 16px; }
.bp-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.bp-num {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  background: var(--gold-soft); color: #8a6416;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 14px;
}
.bp-zh { display: block; font-size: 16px; font-weight: 650; line-height: 1.3; }
.bp-en { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.bp-ess { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; margin: 0 0 8px; }
.bp-card ul { font-size: 12.5px; color: var(--muted); padding-left: 1.05em; margin: 0 0 12px; }
.bp-card li { margin: 3px 0; }
.bp-course {
  margin-top: auto; padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--gold); letter-spacing: .02em;
}

.book-card {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 26px;
  background: linear-gradient(180deg, #f7fafb, var(--paper-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; margin: 16px 0 8px;
}
.book-eyebrow { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.book-card h4 { font-family: var(--serif); font-size: 18px; margin: 6px 0 12px; font-weight: 600; letter-spacing: .01em; }
.book-meta { margin: 0 0 12px; display: grid; gap: 5px; font-size: 12.5px; }
.book-meta > div { display: grid; grid-template-columns: 42px 1fr; gap: 8px; }
.book-meta dt { color: var(--faint); font-size: 11.5px; }
.book-meta dd { margin: 0; color: var(--ink-2); }
.book-note { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin: 0; max-width: none; }
.chapter-list { margin: 0; padding-left: 1.1em; font-size: 12.5px; color: var(--ink-2); }
.chapter-list li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.chapter-list li:last-child { border-bottom: none; }
@media (max-width: 760px) { .book-card { grid-template-columns: 1fr; gap: 16px; } }
@media (min-width: 900px) {
  #bookPrinciples { grid-template-columns: repeat(6, 1fr); }
  #bookPrinciples .bp-card { grid-column: span 2; }
  #bookPrinciples .bp-card:nth-child(4),
  #bookPrinciples .bp-card:nth-child(5) { grid-column: span 3; }
}
