
  :root {
    --bg: #f7f8fa;
    --bg-soft: #ffffff;
    --bg-elevated: #ffffff;
    --sidebar-bg: #f0f2f5;
    --text: #1f2329;
    --text-soft: #5b6168;
    --text-muted: #8a9099;
    --border: #e4e7eb;
    --accent: #2f6fed;
    --accent-soft: #e8f0fe;
    --code-bg: #f6f8fa;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
    --radius: 12px;
  }
  [data-theme="dark"] {
    --bg: #0f1115;
    --bg-soft: #171a21;
    --bg-elevated: #1b1f27;
    --sidebar-bg: #14171d;
    --text: #e6e8eb;
    --text-soft: #aab2bd;
    --text-muted: #6b7480;
    --border: #262b34;
    --accent: #5b8bff;
    --accent-soft: #1c2942;
    --code-bg: #11141a;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
    --radius: 12px;
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
    transition: background .25s ease, color .25s ease;
  }

  /* ---------- Top bar ---------- */
  .topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    height: 60px; padding: 0 20px;
    background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
  .topbar .brand .logo {
    width: 26px; height: 26px; border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), #7b5bff);
    display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800;
  }
  .topbar .spacer { flex: 1; }
  .menu-btn {
    display: none; background: none; border: 1px solid var(--border); color: var(--text);
    width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 18px;
  }
  .theme-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text); height: 38px; padding: 0 14px; border-radius: 9px;
    cursor: pointer; font-size: 14px; font-weight: 600; transition: .2s;
  }
  .theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

  /* ---------- Layout ---------- */
  .layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; max-width: 1480px; margin: 0 auto; }
  /* 有右侧页面目录时，大屏展开第三列；整体加宽，让中间正文更舒展 */
  @media (min-width: 1300px) {
    .layout.has-page-toc { grid-template-columns: 260px minmax(0, 1fr) 210px; }
  }
  @media (max-width: 1299px) { .page-toc { display: none; } }

  /* ---------- Sidebar ---------- */
  .sidebar {
    position: sticky; top: 60px; align-self: flex-start;
    width: 280px; flex: 0 0 280px; height: calc(100vh - 60px);
    overflow-y: auto; padding: 22px 14px 40px;
    background: var(--sidebar-bg); border-right: 1px solid var(--border);
  }
  .sidebar h2 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin: 18px 12px 8px; }
  .sidebar nav a {
    display: block; padding: 8px 12px; margin: 2px 0; border-radius: 8px;
    color: var(--text-soft); text-decoration: none; font-size: 14px; font-weight: 500;
    border-left: 3px solid transparent; transition: .15s;
  }
  .sidebar nav a:hover { background: var(--bg-elevated); color: var(--text); }
  .sidebar nav a.active {
    background: var(--accent-soft); color: var(--accent);
    border-left-color: var(--accent); font-weight: 700;
  }
  .sidebar nav a .num { color: var(--text-muted); font-weight: 700; margin-right: 8px; font-size: 12px; }
  .sidebar nav a.active .num { color: var(--accent); }

  /* ---------- Content ---------- */
  .content { flex: 1; min-width: 0; padding: 44px 64px 120px; }
  .hero { margin-bottom: 44px; }
  .hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -.01em; }
  .hero p.sub { color: var(--text-soft); font-size: 16px; margin: 0; }
  .pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
  .pill { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

  section { scroll-margin-top: 76px; padding-top: 32px; }
  section > h2, section > h3 { scroll-margin-top: 86px; }
  section > h2 { font-size: 26px; margin: 0 0 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  section > h3 { font-size: 19px; margin: 32px 0 12px; color: var(--text); }
  section > h4 { font-size: 15.5px; margin: 24px 0 8px; color: var(--accent); font-weight: 700; }
  p { color: var(--text-soft); line-height: 1.8; margin: 12px 0; }
  ul, ol { color: var(--text-soft); padding-left: 24px; margin: 12px 0; }
  li { margin: 8px 0; line-height: 1.7; }
  strong { color: var(--text); }
  code.inline { background: var(--code-bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: 13px; font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; color: var(--accent); }

  pre { border-radius: var(--radius); border: 1px solid var(--border); padding: 0; overflow: auto; box-shadow: var(--shadow); margin: 20px 0; }
  pre code { display: block; padding: 20px 22px; font-size: 13.5px; line-height: 1.7; background: var(--code-bg) !important; font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; }
  pre { background: var(--code-bg); }

  .callout { border-radius: var(--radius); padding: 16px 20px; margin: 22px 0; border: 1px solid var(--border); background: var(--bg-elevated); border-left: 4px solid var(--accent); }
  .callout.warn { border-left-color: #f5a623; }
  .callout.tip { border-left-color: #2bbf7a; }
  .callout .t { font-weight: 700; margin-bottom: 6px; }
  .callout.warn .t { color: #f5a623; }
  .callout.tip .t { color: #2bbf7a; }
  .callout p { margin: 6px 0; font-size: 14.5px; line-height: 1.7; }

  /* 表格：加横向滚动容器，防止宽表撑爆正文 */
  .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 20px 0; box-shadow: var(--shadow); background: var(--bg-elevated); }
  .table-wrap table { margin: 0; border: none; min-width: 100%; }
  table { width: 100%; border-collapse: collapse; margin: 0; font-size: 14px; }
  th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); line-height: 1.65; vertical-align: top; }
  th { background: var(--bg-elevated); color: var(--text); font-weight: 700; white-space: nowrap; }
  td { color: var(--text-soft); }
  tr:last-child td { border-bottom: none; }
  tbody tr:hover td { background: rgba(128,128,128,0.04); }

  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  @media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

  .backtop {
    position: fixed; right: 24px; bottom: 24px; z-index: 25;
    width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--bg-elevated); color: var(--accent); font-size: 20px; cursor: pointer;
    box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s;
  }
  .backtop.show { opacity: 1; pointer-events: auto; }

  /* ---------- 页面内目录（右侧） ---------- */
  .page-toc {
    position: sticky; top: 80px; align-self: start;
    max-height: calc(100vh - 100px); overflow-y: auto;
    padding: 28px 10px 28px 16px; margin-left: 8px;
    border-left: 1px solid var(--border); font-size: 13px; line-height: 1.5;
  }
  .page-toc .pt-title {
    font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-muted); font-weight: 700; margin: 0 0 12px 10px;
  }
  .page-toc a {
    display: block; padding: 5px 10px; border-radius: 7px; margin: 1px 0;
    color: var(--text-soft); text-decoration: none;
    border-left: 2px solid transparent; transition: .15s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .page-toc a.lv3 { padding-left: 22px; font-size: 12.5px; }
  .page-toc a:hover { background: var(--bg-elevated); color: var(--text); }
  .page-toc a.active {
    color: var(--accent); border-left-color: var(--accent);
    background: var(--accent-soft); font-weight: 600;
  }

  /* ---------- Mobile ---------- */
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 18; }
  @media (max-width: 980px) {
    .menu-btn { display: inline-flex; }
    .layout { display: block; }
    .sidebar {
      position: fixed; top: 60px; left: 0; z-index: 20;
      transform: translateX(-100%); transition: transform .25s ease;
      box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .scrim.show { display: block; }
    .content { padding: 28px 22px 80px; }
    .hero h1 { font-size: 27px; }
    .table-wrap { margin: 18px -6px; border-radius: 10px; }
  }
  .footer { color: var(--text-muted); font-size: 13px; text-align: center; padding: 30px 0 10px; border-top: 1px solid var(--border); margin-top: 40px; }

  /* ---------- 知识图谱入口 ---------- */
  .graph-entry { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); padding: 24px 28px; margin: 22px 0 10px; }
  .graph-entry p { color: var(--text-soft); font-size: 14px; line-height: 1.85; margin: 0 0 18px; }
  .graph-open-btn { display: inline-block; font-size: 14px; font-weight: 700; padding: 11px 22px; border-radius: 10px; border: 1px solid transparent; background: var(--accent); color: #fff; text-decoration: none; transition: .15s; }
  .graph-open-btn:hover { opacity: .9; }
  .graph-open-link { display: inline-block; margin-left: 14px; font-size: 13px; color: var(--text-soft); text-decoration: none; }
  .graph-open-link:hover { color: var(--accent); text-decoration: underline; }

  .topbar .brand { color: var(--text); text-decoration: none; }
