/* ==========================================================================
   bili-open-mcp · 站点样式
   深色优先，浅色可切换。品牌色取自哔哩哔哩（粉 #FB7299 / 蓝 #23ADE5）。
   零依赖、零外部字体，离线可用。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --pink: #fb7299;
  --blue: #23ade5;
  --accent: var(--pink);
  --accent-2: var(--blue);

  --bg: #0a0d14;
  --bg-soft: #0f131c;
  --card: #141926;
  --card-2: #1a2032;
  --border: #232b3d;
  --border-2: #2e3850;
  --fg: #e7eaf0;
  --fg-strong: #ffffff;
  --muted: #96a0b5;
  --muted-2: #6b7688;

  --ok: #2dcc70;
  --warn: #f5a623;
  --err: #ff5c6c;
  --info: var(--blue);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
    Roboto, Helvetica, Arial, sans-serif;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, .75);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);
  --topbar-h: 60px;
  --sidebar-w: 264px;
  --toc-w: 220px;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --card: #ffffff;
  --card-2: #f2f4f8;
  --border: #e3e7ef;
  --border-2: #d2d8e4;
  --fg: #1c212c;
  --fg-strong: #000000;
  --muted: #5c6675;
  --muted-2: #8a94a6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -14px rgba(16, 24, 40, .18);
  --shadow-lg: 0 24px 64px -28px rgba(16, 24, 40, .28);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--muted-2); background-clip: content-box; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: var(--fg-strong);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  flex: none;
}
.brand small {
  color: var(--muted-2);
  font-weight: 500;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 7px;
  margin-left: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 10px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.topnav a:hover { color: var(--fg); background: var(--card-2); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--fg-strong); background: var(--card-2); }

.topbar-spacer { flex: 1 1 auto; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-2); }

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  min-width: 190px;
}
.search-trigger:hover { color: var(--fg); border-color: var(--border-2); }
.search-trigger kbd {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--bg-soft);
}

.menu-btn { display: none; }

/* ---------- 页面骨架 ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 880px; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 40px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 96px;
  align-items: start;
}
.layout--no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.layout--plain { grid-template-columns: minmax(0, 1fr); }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 32px);
  max-height: calc(100vh - var(--topbar-h) - 56px);
  overflow-y: auto;
  padding-right: 6px;
  font-size: 14px;
}
.sidebar-group + .sidebar-group { margin-top: 22px; }
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 8px;
  padding-left: 10px;
}
.sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  line-height: 1.5;
  border-left: 2px solid transparent;
}
.sidebar a:hover { color: var(--fg); background: var(--card-2); text-decoration: none; }
.sidebar a.is-active { color: var(--accent); border-left-color: var(--accent); background: var(--card-2); }
.sidebar a .count { float: right; color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- 右栏 TOC ---------- */
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 32px);
  max-height: calc(100vh - var(--topbar-h) - 56px);
  overflow-y: auto;
  font-size: 13px;
  border-left: 1px solid var(--border);
  padding-left: 18px;
}
.toc-title {
  font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted-2); margin: 0 0 10px;
}
.toc a { display: block; color: var(--muted); padding: 3px 0; line-height: 1.45; }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.lvl-3 { padding-left: 12px; font-size: 12.5px; }
.toc a.is-active { color: var(--accent); font-weight: 600; }

/* ---------- 主内容 ---------- */
.main { min-width: 0; }

.page-title {
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 10px;
  color: var(--fg-strong);
}
.page-lede { color: var(--muted); font-size: 1.02rem; margin: 0 0 28px; }

.breadcrumb {
  font-size: 13px; color: var(--muted-2); margin: 0 0 14px;
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb span.sep { color: var(--muted-2); opacity: .6; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 420px at 12% -12%, color-mix(in srgb, var(--pink) 20%, transparent), transparent 62%),
    radial-gradient(760px 400px at 88% -6%, color-mix(in srgb, var(--blue) 20%, transparent), transparent 60%),
    var(--bg-soft);
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--border) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 55%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 78% 62% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 0%, #000 20%, transparent 78%);
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto;
  padding: 76px 24px 64px;
  text-align: center;
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--fg);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border-2);
  border-radius: 99px;
  padding: 5px 14px 5px 10px;
  margin-bottom: 22px;
  backdrop-filter: blur(6px);
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent);
  flex: none;
}

.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3.6vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -.035em;
  margin: 0 0 18px;
  color: var(--fg-strong);
  font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--pink) 8%, var(--blue) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  font-size: clamp(1rem, .95rem + .35vw, 1.16rem);
  color: var(--muted);
  max-width: 720px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 34px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s, filter .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(120deg, var(--pink), var(--blue));
  color: #fff;
  box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--pink) 70%, transparent);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost {
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border-color: var(--border-2);
  color: var(--fg);
}
.btn-ghost:hover { border-color: var(--muted-2); }

/* 首页命令框 */
.cmd {
  display: flex; align-items: center; gap: 12px;
  max-width: 560px; margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 13px 14px 13px 18px;
  box-shadow: var(--shadow);
  text-align: left;
}
.cmd code {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg);
  overflow-x: auto;
  white-space: nowrap;
  flex: 1;
  scrollbar-width: none;
}
.cmd code::-webkit-scrollbar { display: none; }
.cmd .prompt { color: var(--accent); user-select: none; }

/* ---------- 统计条 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat {
  background: var(--bg);
  padding: 26px 16px;
  text-align: center;
}
.stat b {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--fg-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat span { font-size: 12.5px; color: var(--muted); }

/* ---------- 通用区块 ---------- */
.section { padding: 72px 0; }
.section + .section { padding-top: 0; }
.section-head { max-width: 720px; margin: 0 0 36px; }
.section-head h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
  letter-spacing: -.02em;
  margin: 0 0 10px;
  color: var(--fg-strong);
}
.section-head p { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--border-2); }
.card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  color: var(--fg-strong);
  display: flex; align-items: center; gap: 9px;
}
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .ico {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 15px;
  flex: none;
}

/* 链接卡片 */
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }

/* ---------- 工具 / 端点 卡片列表 ---------- */
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-card h3 {
  margin: 0;
  font-size: 15px;
  font-family: var(--mono);
  color: var(--fg-strong);
  letter-spacing: -.01em;
}
.tool-card .desc { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }

.param-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.param-table th, .param-table td {
  text-align: left; padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.param-table th {
  color: var(--muted-2); font-weight: 600; font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase;
}
.param-table td:first-child { font-family: var(--mono); color: var(--fg); white-space: nowrap; }
.param-table td:last-child { color: var(--muted); }
.param-table tr:last-child td { border-bottom: 0; }
.param-table .req { color: var(--err); font-weight: 700; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--muted);
  letter-spacing: .02em;
  white-space: nowrap;
  font-family: var(--sans);
}
.badge-method { font-family: var(--mono); font-weight: 700; letter-spacing: .03em; }
.badge-GET { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge-POST { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.badge-PUT { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.badge-DELETE { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); background: color-mix(in srgb, var(--err) 12%, transparent); }
.badge-scope { color: var(--pink); border-color: color-mix(in srgb, var(--pink) 40%, transparent); background: color-mix(in srgb, var(--pink) 12%, transparent); font-family: var(--mono); }
.badge-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.badge-info { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); background: color-mix(in srgb, var(--info) 12%, transparent); }
.badge-muted { color: var(--muted-2); }

/* ---------- 工具条（筛选 / 搜索） ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 24px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.input {
  flex: 1 1 220px;
  min-width: 180px;
  height: 38px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: var(--ring); }
select.input { flex: 0 0 auto; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font: inherit;
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.chip:hover { color: var(--fg); border-color: var(--border-2); }
.chip[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(120deg, var(--pink), var(--blue));
  border-color: transparent;
}
.chip .n { opacity: .65; margin-left: 5px; font-size: 11.5px; }
/* 从侧边栏带着 #模块 进来时，被自动按下的那个开关闪一下，说明"筛的就是它" */
.chip.is-target { outline: 2px solid var(--pink); outline-offset: 2px; }

.result-count { color: var(--muted-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.empty {
  text-align: center; padding: 64px 20px; color: var(--muted-2);
  border: 1px dashed var(--border-2); border-radius: var(--radius);
}

/* ---------- 端点列表 ---------- */
.ep-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ep {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: baseline;
  padding: 13px 18px;
  background: var(--card);
  color: inherit;
}
.ep:hover { background: var(--card-2); text-decoration: none; }
.ep-title { color: var(--fg-strong); font-weight: 600; font-size: 14.5px; }
.ep-path { font-family: var(--mono); font-size: 12.5px; color: var(--muted); word-break: break-all; }
.ep-folder { font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.ep-scopes { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.ep[hidden] { display: none; }

/* ---------- 代码块 ---------- */
.code {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 18px 0;
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.code-lang {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.code-copy {
  margin-left: auto;
  font: inherit; font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.code-copy:hover { color: var(--fg); border-color: var(--border-2); }
.code-copy.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.code pre {
  margin: 0;
  padding: 15px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--fg);
  tab-size: 2;
}
.code code { font-family: inherit; background: none; padding: 0; border: 0; font-size: inherit; }

/* 行内代码 */
:not(pre) > code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .12em .38em;
  color: var(--fg);
  word-break: break-word;
}
a > code { color: var(--accent); }

/* 语法着色（深色 / 浅色各一套） */
.tok-str { color: #a5d6a7; }
.tok-com { color: #6b7688; font-style: italic; }
.tok-key { color: #ff9ec4; }
.tok-num { color: #82d2ff; }
.tok-fn  { color: #ffd479; }
html[data-theme="light"] .tok-str { color: #0a7f3f; }
html[data-theme="light"] .tok-com { color: #8a94a6; }
html[data-theme="light"] .tok-key { color: #b3238a; }
html[data-theme="light"] .tok-num { color: #0b62c4; }
html[data-theme="light"] .tok-fn  { color: #9a5b00; }

/* ---------- Markdown 正文 ---------- */
.prose { font-size: 15.5px; line-height: 1.8; max-width: 78ch; }
.prose > *:first-child { margin-top: 0; }
.prose h1 { font-size: 2rem; margin: 0 0 20px; letter-spacing: -.025em; color: var(--fg-strong); }
.prose h2 {
  font-size: 1.45rem; margin: 52px 0 16px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border); letter-spacing: -.02em; color: var(--fg-strong);
}
.prose h3 { font-size: 1.15rem; margin: 36px 0 12px; color: var(--fg-strong); }
.prose h4 { font-size: 1rem; margin: 26px 0 10px; color: var(--fg-strong); }
.prose h2 code, .prose h3 code, .prose h4 code { font-size: .86em; }
.prose p { margin: 15px 0; }
.prose ul, .prose ol { margin: 15px 0; padding-left: 26px; }
.prose li { margin: 6px 0; }
.prose li > ul, .prose li > ol { margin: 6px 0; }
.prose blockquote {
  margin: 20px 0; padding: 14px 20px;
  border-left: 3px solid var(--border-2);
  background: var(--card);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }

.prose-table { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose thead th {
  background: var(--card-2); color: var(--fg-strong); font-weight: 600;
  font-size: 12.5px; letter-spacing: .02em; white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--bg-soft); }

/* 提示块 */
.callout {
  display: flex; gap: 12px;
  margin: 20px 0; padding: 14px 18px;
  border: 1px solid var(--border-2);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 14.5px;
}
.callout .callout-ico { flex: none; font-size: 15px; line-height: 1.6; }
.callout > div > *:first-child { margin-top: 0; }
.callout > div > *:last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-bottom: 4px; color: var(--fg-strong); font-size: 13px; letter-spacing: .02em; }
.callout-important { border-left-color: var(--pink); }
.callout-note { border-left-color: var(--blue); }
.callout-tip { border-left-color: var(--ok); }
.callout-warning { border-left-color: var(--warn); }
.callout-caution { border-left-color: var(--err); }

/* 锚点 */
.anchor { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--muted-2); }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }

/* ---------- 标签页 ---------- */
.tabs { margin: 20px 0; }
.tablist {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: -1px;
}
.tab {
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 8px 14px;
  border: 0; background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--fg); background: var(--card-2); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabpanel[hidden] { display: none; }
.tabpanel .code { margin-top: 14px; }

/* ---------- API 详情页 ---------- */
.api-head {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px;
  margin-bottom: 28px;
}
.api-url {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  white-space: nowrap;
  margin-top: 12px;
}
.api-url .u { color: var(--fg); }
.api-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- 搜索弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  background: color-mix(in srgb, #000 62%, transparent);
  backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-box {
  width: 100%; max-width: 620px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 74vh;
}
.modal-input {
  width: 100%;
  border: 0; border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font: inherit; font-size: 15px;
  padding: 16px 18px;
}
.modal-input:focus { outline: none; }
.modal-results { overflow-y: auto; padding: 6px; }
.sr {
  display: block; padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: inherit;
  cursor: pointer;
}
.sr:hover, .sr[aria-selected="true"] { background: var(--card-2); text-decoration: none; }
.sr-kind { font-size: 11px; color: var(--muted-2); float: right; }
.sr-title { font-size: 14px; color: var(--fg-strong); font-weight: 600; }
.sr-desc { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.modal-foot {
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 11.5px; color: var(--muted-2);
  display: flex; gap: 14px; flex-wrap: wrap;
}

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 48px 0 40px;
  margin-top: 40px;
  font-size: 13.5px;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(200px, 1.6fr) repeat(auto-fit, minmax(130px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}
.footer h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted-2); margin: 0 0 12px;
}
.footer a { color: var(--muted); display: block; padding: 3px 0; }
.footer a:hover { color: var(--fg); }
.footer-note {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  font-size: 12.5px;
  color: var(--muted-2);
  line-height: 1.75;
}

/* ---------- 回顶部 ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, color .15s, transform .15s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--fg); transform: translateY(-2px); }

/* ---------- 进度条 ---------- */
.progress {
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--pink), var(--blue));
  transition: width .1s linear;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .search-trigger { min-width: 38px; padding: 0 10px; }
  .search-trigger .label, .search-trigger kbd { display: none; }
  .topnav { display: none; }
  .layout, .layout--no-toc { grid-template-columns: minmax(0, 1fr); padding: 22px 18px 72px; gap: 24px; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0; bottom: 0;
    width: min(84vw, 320px);
    max-height: none;
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    padding: 20px 16px 40px;
    z-index: 90;
    transform: translateX(-102%);
    transition: transform .22s ease;
    overflow-y: auto;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim {
    position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 80;
    background: color-mix(in srgb, #000 55%, transparent);
  }
  .scrim[hidden] { display: none; }
  .hero-inner { padding: 52px 18px 44px; }
  .section { padding: 52px 0; }
  .ep { grid-template-columns: 56px minmax(0, 1fr); }
  .ep-scopes { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .prose { font-size: 15px; }
  .prose h2 { font-size: 1.25rem; }
}

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

/* ---------- 打印 ---------- */
@media print {
  .topbar, .sidebar, .toc, .to-top, .progress, .toolbar, .hero-actions, .footer-grid { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; padding: 0; }
  .prose { max-width: none; }
  .code { break-inside: avoid; }
}
