/* pandecta-default v1.0.0 */
:root {
  --pandecta-accent: #2563eb;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'Noto Sans SC',
    'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --header-height: 60px;
  --sidebar-width: 284px;
  --toc-width: 248px;
  --content-max: 880px;
  --radius: 10px;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-code: #f6f8fa;
  --bg-inline-code: #eff2f5;
  --text: #1f2328;
  --text-muted: #59636e;
  --text-faint: #818b98;
  --border: #d1d9e0;
  --border-soft: #e7ecf0;
  --link: #2563eb;
  --link-hover: #2563eb;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.06), 0 8px 24px rgba(31, 35, 40, 0.06);
  --shadow-small: 0 1px 3px rgba(31, 35, 40, 0.08);
  --focus: color-mix(in srgb, #2563eb 55%, transparent);
}
[data-theme='dark'] {
  --bg: #0f1419;
  --bg-elevated: #161b22;
  --bg-soft: #12181f;
  --bg-code: #161b22;
  --bg-inline-code: #21262d;
  --text: #e6edf3;
  --text-muted: #9aa7b4;
  --text-faint: #7d8794;
  --border: #30363d;
  --border-soft: #21262d;
  --shadow: 0 1px 2px rgba(1, 4, 9, 0.6), 0 8px 24px rgba(1, 4, 9, 0.4);
  --shadow-small: 0 1px 3px rgba(1, 4, 9, 0.5);
}
*,
*::before,
*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  position: relative;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  /* 背景色作为底色，流体光斑从上方叠上来 */
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
}
.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;
}
.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }


/* ── 流体背景 ─────────────────────────────────────────────
 * 三层柔光在页面底层缓慢漂移。全部为 transform 动画（走合成层），
 * 不触发重排；深色模式降低亮度避免刺眼；prefers-reduced-motion 下静止。
 */
.fluid-bg {
  position: fixed; inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.fluid-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(110px);
  /* 极低透明度：只作为"氛围"，不能压过正文的可读性 */
  opacity: .1;
  will-change: transform;
  background: var(--pandecta-accent);
}
.fluid-blob-1 {
  width: 46vw; height: 46vw; min-width: 380px; min-height: 380px;
  top: -14vh; left: -10vw;
  animation: fluid-drift-a 34s ease-in-out infinite;
}
.fluid-blob-2 {
  width: 38vw; height: 38vw; min-width: 320px; min-height: 320px;
  top: 34vh; right: -12vw;
  opacity: .075;
  animation: fluid-drift-b 43s ease-in-out infinite;
}
.fluid-blob-3 {
  width: 30vw; height: 30vw; min-width: 260px; min-height: 260px;
  bottom: -16vh; left: 28vw;
  opacity: .055;
  animation: fluid-drift-c 51s ease-in-out infinite;
}

@keyframes fluid-drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(9vw, 7vh, 0) scale(1.12); }
  66%      { transform: translate3d(3vw, 15vh, 0) scale(0.94); }
}
@keyframes fluid-drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  40%      { transform: translate3d(-11vw, -9vh, 0) scale(1.16); }
  70%      { transform: translate3d(-4vw, 6vh, 0) scale(0.9); }
}
@keyframes fluid-drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  35%      { transform: translate3d(-13vw, -7vh, 0) scale(1.1); }
  72%      { transform: translate3d(7vw, -13vh, 0) scale(0.92); }
}

/* 深色模式下降低亮度：同样的透明度在高对比背景上会显得更亮 */
:root[data-theme='dark'] .fluid-blob { opacity: .085; }
:root[data-theme='dark'] .fluid-blob-2 { opacity: .06; }
:root[data-theme='dark'] .fluid-blob-3 { opacity: .045; }

/* 尊重系统的减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  .fluid-blob { animation: none; }
}

/* 内容层需在背景之上。注意不要在这里改 position：.skip-link 依赖 absolute
 * 脱离文档流，一旦被覆盖成 relative 就会在顶栏上方撑出一块空白。 */
.layout, .search-overlay { position: relative; z-index: 1; }
.skip-link { z-index: 1; }

/* ── 顶栏 ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-height);
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-right: 6px;
  color: var(--text);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--link); }
/*
 * 品牌标识：内联 SVG。
 * 底色由 SVG 内部的 fill="currentColor" 决定，因此这里只给颜色。
 * 用块级不可收缩的尺寸，避免在窄屏被压扁。
 */
.brand-mark {
  display: block;
  width: 26px; height: 26px;
  flex: 0 0 auto;
  color: var(--pandecta-accent);
}
.brand-title { overflow: hidden; text-overflow: ellipsis; }
.top-nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.top-nav-item { position: relative; }
.top-nav-link {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.top-nav-link:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.top-nav-link.active { color: var(--link); background: color-mix(in srgb, var(--pandecta-accent) 10%, transparent); }
.top-nav-children {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s;
}
.top-nav-item:hover .top-nav-children,
.top-nav-item:focus-within .top-nav-children { opacity: 1; visibility: visible; transform: translateY(0); }
.top-nav-children a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.top-nav-children a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.icon-button:hover { color: var(--text); background: var(--bg-soft); }
.icon-button svg { width: 18px; height: 18px; }
.menu-toggle { display: none; }
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  padding: 7px 10px;
  color: var(--text-faint);
  font: inherit;
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  cursor: pointer;
}
.search-trigger:hover { border-color: var(--border); color: var(--text-muted); }
.search-trigger svg { width: 15px; height: 15px; flex: 0 0 auto; }
.search-trigger-label { flex: 1; text-align: left; }

/* ── 页面 banner ──────────────────────────────────────── */
.page-banner {
  position: relative;
  /* 抵消 .content 的左右内边距，让 banner 通栏 */
  margin: -30px -44px 22px;
  max-height: 260px;
  overflow: hidden;
  background: var(--bg-soft);
}
.page-banner img {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
}
.page-banner-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  background: linear-gradient(to top, rgba(8, 12, 20, .72), rgba(8, 12, 20, .08) 62%, transparent);
}
.page-banner-inner {
  width: 100%; max-width: var(--content-max);
  margin: 0 auto; padding: 0 40px 22px;
}
.page-banner-title {
  margin: 0;
  font-size: 26px; font-weight: 660; letter-spacing: -.01em;
  color: #fff; text-shadow: 0 1px 12px rgba(0, 0, 0, .35);
}

/* ── 页面元信息（贡献者 / 更新 / commit / 编辑）────────── */
.page-meta {
  /* 与上方正文留出呼吸；下方与页脚横线之间也要留够，否则「提交」这行会贴线 */
  margin: 28px 0 0;
  padding: 16px 0 14px;
  border-top: 1px solid var(--border-soft);
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between;
  gap: 8px 26px;
  font-size: 13px; color: var(--text-muted);
}
.meta-rows { display: flex; flex-wrap: wrap; gap: 6px 24px; min-width: 0; }
.meta-row { display: inline-flex; align-items: baseline; gap: 8px; }
.meta-label { color: var(--text-faint); font-size: 12px; }
.meta-value { display: inline-flex; align-items: center; gap: 5px; }
.meta-value code {
  padding: 1px 6px; font-size: 12px;
  background: var(--bg-inline-code); border-radius: 5px;
}
.meta-value a { color: var(--accent); text-decoration: none; }
.meta-value a:hover { text-decoration: underline; text-underline-offset: 2px; }
.meta-edit {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: auto;
  font-size: 12.5px; color: var(--text-muted);
  text-decoration: none;
}
.meta-edit:hover { color: var(--pandecta-accent); text-decoration: underline; text-underline-offset: 2px; }
.meta-edit svg { width: 13px; height: 13px; }

/* ── 品牌区与产品切换器 ───────────────────────────────── */
.brand-area { position: relative; display: flex; align-items: center; }
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 8px; margin-left: -8px;
  font-size: 15px; font-weight: 650; color: var(--text);
  text-decoration: none; border-radius: 8px;
  background: none; border: 0; font-family: inherit; cursor: pointer;
}
a.brand:hover { background: var(--bg-soft); }
.brand-switcher { border: 0; }
.brand-switcher svg { width: 14px; height: 14px; color: var(--text-faint); transition: transform .16s ease; }
.brand-switcher[aria-expanded='true'] svg { transform: rotate(180deg); }
.brand-mark {
  display: block;
  width: 22px; height: 22px;
  flex: 0 0 auto;
  color: var(--pandecta-accent);
}
.brand-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 自绘下拉框 ───────────────────────────────────────── */
.dropdown { position: relative; display: inline-flex; }
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 10px;
  max-width: 150px;
  color: var(--text-muted);
  font: inherit; font-size: 13px; font-family: inherit;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.dropdown-trigger:hover { background: var(--bg-elevated); border-color: var(--border); }
.dropdown-trigger[aria-expanded='true'] { border-color: var(--pandecta-accent); }
.dropdown-trigger svg { width: 14px; height: 14px; color: var(--text-faint); flex: none; transition: transform .16s ease; }
.dropdown-trigger[aria-expanded='true'] > svg:last-child { transform: rotate(180deg); }
.dropdown-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-trigger.icon-only { padding: 6px; }
.dropdown-trigger.icon-only > svg { display: none; }

/* 三态主题图标：只显示当前模式 */
.theme-icon { display: none; }
.theme-icon.visible { display: inline-flex; }
.theme-icon svg { width: 16px; height: 16px; display: block; color: var(--text-muted); }

/* 弹出面板 */
.menu-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 190px; max-width: 320px;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: menu-in .12s ease;
}
.menu-panel[hidden] { display: none; }
.menu-panel-right { left: auto; right: 0; }
/* 由脚本根据视口空间动态添加：右边界不够时右对齐 */
.menu-panel.panel-right { left: auto; right: 0; }
/* 窄屏兜底：占满可用宽度，避免溢出产生水平滚动条 */
.menu-panel.panel-edge {
  left: 50%; right: auto;
  width: calc(100vw - 24px);
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
}
.menu-panel-title {
  padding: 6px 10px 8px;
  font-size: 11px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-faint);
}
.menu-list { display: flex; flex-direction: column; gap: 1px; max-height: min(60vh, 420px); overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  font: inherit; font-size: 13px; font-family: inherit;
  color: var(--text-muted); text-align: left;
  background: none; border: 0; border-radius: 7px;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-soft); color: var(--text); outline: none; }
.menu-item.active { color: var(--pandecta-accent); font-weight: 600; }
.menu-item .menu-icon svg { width: 15px; height: 15px; display: block; }
.menu-check { margin-left: auto; display: inline-flex; }
.menu-check svg { width: 15px; height: 15px; }
.menu-item:not(.active) .menu-check { display: none; }
.menu-loading, .menu-error { padding: 10px; font-size: 12px; color: var(--text-faint); }

/* 产品切换器条目 */
.site-switcher-panel { min-width: 260px; }
.site-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  font: inherit; font-family: inherit; text-align: left;
  color: var(--text); background: none; border: 0; border-radius: 8px;
  cursor: pointer;
}
.site-item:hover, .site-item:focus-visible { background: var(--bg-soft); outline: none; }
.site-item.active { background: color-mix(in srgb, var(--pandecta-accent) 8%, transparent); }
.site-initial {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: color-mix(in srgb, var(--pandecta-accent) 14%, transparent);
  color: var(--pandecta-accent); font-size: 12px; font-weight: 700;
}
.site-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.site-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-path { font-size: 11px; color: var(--text-faint); }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}




/* ── 侧边栏固定首页入口 ───────────────────────────────── */
.sidebar-inner { display: flex; flex-direction: column; }
.sidebar-home {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); text-decoration: none;
  border-radius: 8px;
}
.sidebar-home:hover { color: var(--text); background: var(--bg-soft); }
.sidebar-home.active { color: var(--pandecta-accent); background: color-mix(in srgb, var(--pandecta-accent) 9%, transparent); }
.sidebar-home svg { width: 15px; height: 15px; flex: none; }
.sidebar-tree { padding-top: 10px; border-top: 1px solid var(--border-soft); }

/* ── 头栏左侧组合 ─────────────────────────────────────── */
.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* 门户入口按钮：与其它 icon-button 同尺寸 */
.portal-link { text-decoration: none; }

/* ── 主题与下拉按钮统一 36px 高、图标按钮 1:1 ─────────── */
.dropdown-trigger {
  height: 34px;
  box-sizing: border-box;
  padding: 0 10px;
}
.dropdown-trigger.icon-only {
  width: 34px;
  padding: 0;
  justify-content: center;
  align-items: center;
}
.theme-switch .dropdown-trigger { width: 34px; height: 34px; }
.lang-trigger { gap: 6px; }
.lang-code { font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.lang-trigger svg { width: 15px; height: 15px; }

/* ── 语言选择面板（可搜索卡片）────────────────────────── */
.locale-panel { min-width: 320px; max-width: 380px; padding: 10px; }
.locale-search { position: relative; margin: 4px 0 10px; }
.locale-search input {
  width: 100%; height: 32px;
  padding: 0 10px 0 32px;
  font: inherit; font-size: 13px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  outline: none;
}
.locale-search input:focus { border-color: var(--pandecta-accent); background: var(--bg-elevated); }
.locale-search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--text-faint);
}
.locale-search-icon svg { width: 14px; height: 14px; }
.locale-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 260px; overflow-y: auto; }
.locale-card {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  font: inherit; font-family: inherit; text-align: left;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
}
.locale-card:hover { border-color: var(--border); background: var(--bg-elevated); }
.locale-card.active {
  border-color: var(--pandecta-accent);
  background: color-mix(in srgb, var(--pandecta-accent) 8%, transparent);
}
.locale-code {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 22px; padding: 0 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: var(--pandecta-accent);
  background: color-mix(in srgb, var(--pandecta-accent) 12%, transparent);
  border-radius: 5px;
}
.locale-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locale-card .menu-check { margin-left: auto; }
.locale-card .menu-check svg { width: 13px; height: 13px; }
.locale-empty { padding: 14px 10px; font-size: 12.5px; color: var(--text-faint); text-align: center; }

/* ── 搜索框清除按钮 ───────────────────────────────────── */
.search-clear {
  position: absolute; right: 42px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  color: var(--text-faint); background: none; border: 0; border-radius: 6px;
  cursor: pointer;
}
.search-clear:hover { color: var(--text); background: var(--bg-soft); }
.search-clear svg { width: 16px; height: 16px; }
.search-clear[hidden] { display: none; }

/* ── 右侧目录与正文之间的分界线 ───────────────────────── */
/* ── 三栏布局 ─────────────────────────────────────────── */
/*
 * 页面骨架：让内容区至少占满「视口高度 - 顶栏」，页脚才会被推到最底部。
 *
 * 文档站常见问题：仓库里只有一两页时，页脚会浮在页面中部。
 * 这里用 grid 的行高把 main 撑开（1fr），而不是给 body 写死 min-height ——
 * 后者在侧边栏 sticky 的情况下会把页面撑出多余滚动。
 */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: minmax(calc(100vh - var(--header-height)), auto);
  max-width: 1600px;
  margin: 0 auto;
}
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.layout.with-toc { grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width); }
.layout.no-sidebar.with-toc { grid-template-columns: minmax(0, 1fr) var(--toc-width); }

/* ── 侧边栏 ───────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 14px 48px 18px;
  border-right: 1px solid var(--border-soft);
  scrollbar-width: thin;
}
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-children { margin: 2px 0 2px 10px; padding-left: 10px; border-left: 1px solid var(--border-soft); }
.sidebar-item, .sidebar-group { margin: 1px 0; }
.sidebar-link {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13.8px;
  line-height: 1.55;
}
.sidebar-link:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.sidebar-link.active {
  color: var(--link);
  font-weight: 600;
  background: color-mix(in srgb, var(--pandecta-accent) 10%, transparent);
}
.sidebar-section-link { font-weight: 600; color: var(--text); }
.sidebar details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  color: var(--text-muted);
  font-size: 13.8px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  list-style: none;
}
.sidebar details > summary::-webkit-details-marker { display: none; }
.sidebar details > summary:hover { color: var(--text); background: var(--bg-soft); }
.sidebar details > summary::after {
  content: '+';
  flex: 0 0 auto;
  color: var(--text-faint);
  font-weight: 400;
  font-size: 14px;
}
.sidebar details[open] > summary::after { content: '−'; }
.sidebar details > summary .summary-title { overflow: hidden; text-overflow: ellipsis; }

/* ── 正文 ─────────────────────────────────────────────── */
.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* 底部留白交给 .page-footer：这样页脚的盒子（含内边距）能真正贴到视口底 */
  padding: 30px 44px 0;
  width: 100%;
  max-width: none;
}
/* content-inner 撑满剩余高度，页脚用 margin-top:auto 贴到页面底部 */
.content-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 18px; font-size: 13px; color: var(--text-faint); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--link); }
.breadcrumbs .crumb-sep { color: var(--text-faint); opacity: 0.6; }
.breadcrumbs .crumb-current { color: var(--text-muted); font-weight: 500; }
.fallback-notice {
  display: flex;
  gap: 10px;
  margin: 0 0 22px;
  padding: 11px 14px;
  color: var(--text-muted);
  font-size: 13.5px;
  background: color-mix(in srgb, var(--pandecta-accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--pandecta-accent) 24%, var(--border-soft));
  border-radius: var(--radius);
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.footer-brand .brand-mark { width: 20px; height: 20px; }
.footer-meta { display: inline-flex; flex-wrap: wrap; gap: 12px; }
.page-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  /* 内容不足一屏时，自动把页脚推到页面底部 */
  margin-top: auto;
  /* 与上方 page-meta 之间要留出足够间隙，「提交」那行才不会贴着横线 */
  padding-top: 26px;
  /* 页面底部留白放在页脚上，页脚才能贴到视口底 */
  padding-bottom: 72px;
  color: var(--text-faint);
  font-size: 12.5px;
  border-top: 1px solid var(--border-soft);
}


/* ── 外链图标与悬浮预览 ─────────────────────────────────── */
.external-link { text-decoration: none; }
.external-link-icon {
  display: inline-block;
  width: .78em; height: .78em;
  margin-left: .22em;
  vertical-align: baseline;
  opacity: .55;
  transition: opacity .12s ease;
}
.external-link:hover .external-link-icon { opacity: 1; }

.link-preview {
  position: fixed;
  z-index: 200;
  max-width: 320px;
  padding: 9px 12px;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}
.link-preview.visible { opacity: 1; transform: none; }
.link-preview-host {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text);
}
.link-preview-host svg { width: 12px; height: 12px; opacity: .5; }
.link-preview-path {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-faint);
  word-break: break-all;
  line-height: 1.5;
}

/* 公式右键菜单 */
.math-menu {
  position: fixed;
  z-index: 210;
  min-width: 180px;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.math-menu[hidden] { display: none; }
.math-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font: inherit; font-size: 13px; text-align: left;
  color: var(--text);
  background: none; border: 0; border-radius: 6px;
  cursor: pointer;
}
.math-menu-item:hover { background: var(--bg-soft); }
.math-menu-item svg { width: 14px; height: 14px; opacity: .6; }

/* ── Mermaid 图表 ─────────────────────────────────────── */
.mermaid-diagram {
  position: relative;
  margin: 22px 0;
  padding: 44px 20px 20px;
  overflow-x: auto;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}
/*
 * 关键：SVG 必须能收缩。
 * mermaid 给 SVG 写死了 width 与 max-width:2.5em 之外的固定值，
 * 甘特图这类超宽图表会撑破容器、被裁掉右侧内容。
 * 这里强制 svg 宽度由容器决定，配合 viewBox 等比缩放。
 */
/* 只作用于图表本身的 SVG。用子选择器是必须的：辅助按钮里也有 <svg> 图标，
 * 写宽泛的 .mermaid-diagram svg 会把按钮图标一起拉成 100% 宽。
 *
 * 这里**不能**写 width:100%：饼图、小型流程图本来就只有 300~400px，
 * 强制拉满会把文字与图元放得很大、非常难看。
 * 正确做法是只限制最大宽度，让 mermaid 自带的 useMaxWidth 处理超宽图。 */
.mermaid-diagram > svg {
  display: block;
  margin: 0 auto;
  max-width: 100% !important;
  height: auto !important;
}
/* 渲染前先隐藏原始定义，避免用户看到代码块闪现 */
.mermaid-diagram > script { display: none; }
.mermaid-diagram[data-rendered='true'] { background: transparent; border-color: transparent; padding: 0; }
.mermaid-diagram[data-rendered='error'] {
  padding: 16px;
  background: color-mix(in srgb, #dc2626 8%, transparent);
  border-color: color-mix(in srgb, #dc2626 30%, transparent);
}

/* 图表辅助控件 */
.mermaid-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 2;
}
.mermaid-diagram:hover .mermaid-actions,
.mermaid-diagram:focus-within .mermaid-actions { opacity: 1; }
.mermaid-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  cursor: pointer;
}
.mermaid-action:hover { color: var(--text); border-color: var(--border); }
.mermaid-action svg { width: 14px; height: 14px; }
.mermaid-action.copied { color: var(--pandecta-accent); border-color: var(--pandecta-accent); }

/* 图表全屏查看 */
.mermaid-modal {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background: rgba(8, 12, 20, .62);
  backdrop-filter: blur(3px);
}
.mermaid-modal[hidden] { display: none; }
.mermaid-modal-body {
  position: relative;
  display: flex;
  width: 100%; max-width: 1400px; max-height: 100%;
  padding: 44px 28px 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32);
}
/* 滚动只发生在内容区，关闭按钮留在卡片外层不跟着滚 */
.mermaid-modal-scroll {
  width: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
/* 图比容器窄时水平居中；比容器宽时从左侧开始，可横向滚动 */
.mermaid-modal-scroll > svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.mermaid-modal-close {
  position: absolute; top: 8px; right: 8px;
  z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  border: 1px solid var(--border-soft); border-radius: 8px;
  cursor: pointer;
}
.mermaid-modal-close:hover { color: var(--text); border-color: var(--border); }
.mermaid-modal-close svg { width: 16px; height: 16px; }

/* ── KaTeX 公式 ───────────────────────────────────────── */
.katex-display {
  margin: 20px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
.katex { font-size: 1.05em; }
/* 深色模式下 KaTeX 默认用黑色字形，需要跟随主题反色 */
:root[data-theme='dark'] .katex { color: var(--text); }

/* ── Markdown 正文 ────────────────────────────────────── */
.markdown-body { word-wrap: break-word; }
.markdown-body > :first-child { margin-top: 0 !important; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin: 1.7em 0 0.7em;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--header-height) + 18px);
}
.markdown-body h1 { font-size: 2.05em; margin-top: 0; padding-bottom: 0.35em; border-bottom: 1px solid var(--border-soft); }
.markdown-body h2 { font-size: 1.5em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border-soft); }
.markdown-body h3 { font-size: 1.24em; }
.markdown-body h4 { font-size: 1.06em; }
.markdown-body h5, .markdown-body h6 { font-size: 0.95em; color: var(--text-muted); }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body table, .markdown-body pre, .markdown-body blockquote { margin: 0 0 1em; }
/* 代码块在窄容器里必须能收缩，否则会撑破三栏布局 */
.markdown-body > * { min-width: 0; max-width: 100%; }
.markdown-body ul, .markdown-body ol { padding-left: 1.6em; }
.markdown-body li + li { margin-top: 0.28em; }
.markdown-body li > ul, .markdown-body li > ol { margin: 0.28em 0; }
.markdown-body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 2px; }
.markdown-body a:hover { text-decoration-color: currentColor; }
.markdown-body strong { font-weight: 650; }
.markdown-body hr { height: 1px; margin: 2em 0; background: var(--border-soft); border: 0; }
.markdown-body blockquote {
  padding: 2px 16px;
  color: var(--text-muted);
  border-left: 4px solid color-mix(in srgb, var(--pandecta-accent) 45%, var(--border));
  background: color-mix(in srgb, var(--pandecta-accent) 4%, transparent);
  border-radius: 0 8px 8px 0;
}
.markdown-body blockquote > :last-child { margin-bottom: 0; }
.markdown-body code {
  padding: 0.16em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-inline-code);
  border-radius: 5px;
}
/* ── 代码卡片 ─────────────────────────────────────────
 * 卡片 = 标签栏 + 正文。标签栏常驻（含红绿灯、语言、复制按钮），
 * 正文用 CSS 计数器生成行号，不需要在 HTML 里插入额外元素。
 */
.code-card {
  margin: 20px 0;
  max-width: 100%;
  min-width: 0;
  background: var(--bg-code);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
}
.code-card-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 12px;
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  border-bottom: 1px solid var(--border-soft);
}
.code-lights { display: inline-flex; gap: 6px; flex: none; }
.code-lights i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.code-lights .light-red { background: #ff5f57; }
.code-lights .light-amber { background: #febc2e; }
.code-lights .light-green { background: #28c840; }
.code-lang {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}
/*
 * 只允许横向滚动。
 * overflow-x: auto 会让 overflow-y 一并变成 auto，任何超出容器的子元素
 * （比如用 bottom: -7px 画的下划线）都会撑出一条竖向滚动条，
 * 所以这里显式裁剪纵向，并隐藏横向滚动条外观。
 */
.code-tabs {
  display: flex; align-items: center; gap: 2px;
  flex: 1; min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.code-tabs::-webkit-scrollbar { width: 0; height: 0; }
.code-tab {
  flex: none;
  padding: 3px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.code-tab:hover { color: var(--text); background: var(--bg-soft); }
/*
 * 选中态：强调色文字 + 内描边 + 底部强调线。
 * 强调线用 inset 阴影而不是伪元素 —— 伪元素一旦超出按钮边界，
 * 就会在 .code-tabs 里制造纵向滚动（见上面的注释）。
 */
.code-tab.active {
  color: var(--pandecta-accent);
  background: var(--bg-elevated);
  font-weight: 650;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--pandecta-accent) 35%, transparent),
    inset 0 -2px 0 0 var(--pandecta-accent),
    0 1px 2px rgba(0, 0, 0, .06);
}
.code-copy {
  flex: none;
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  padding: 0;
  color: var(--text-faint);
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease;
}
.code-copy svg { width: 14px; height: 14px; transition: transform .12s ease; }
.code-copy:hover { color: var(--text); border-color: var(--border); }
/* 复制成功：实心强调底 + 对勾，短暂停留后自行恢复 */
.code-copy.copied {
  color: #fff;
  background: var(--pandecta-accent);
  border-color: var(--pandecta-accent);
  animation: copy-pop .28s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes copy-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
.code-card-body { overflow-x: auto; }
.code-pane { display: block; }
.code-pane[hidden] { display: none; }

.markdown-body pre {
  max-width: 100%;
  min-width: 0;
  margin: 0;
  position: relative;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.62;
  background: none;
  border: 0;
  border-radius: 0;
}
.markdown-body pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0;
  font-size: inherit;
  background: none;
  border-radius: 0;
  white-space: pre;
}

/* 行号：用计数器 + ::before，选中代码时不会被连带复制 */
.markdown-body pre code .line { counter-increment: code-line; }
.markdown-body pre code { counter-reset: code-line; }
.markdown-body pre code .line::before {
  content: counter(code-line);
  display: inline-block;
  width: 2.2em;
  margin-right: 1.1em;
  text-align: right;
  color: var(--text-faint);
  opacity: .65;
  user-select: none;
  -webkit-user-select: none;
}
.markdown-body pre.shiki { background-color: var(--shiki-light-bg); border-color: var(--border-soft); }
.markdown-body pre.shiki code { background: none; }
.markdown-body .shiki span { color: var(--shiki-light); }
[data-theme='dark'] .markdown-body pre.shiki { background-color: var(--shiki-dark-bg); }
[data-theme='dark'] .markdown-body .shiki span { color: var(--shiki-dark); }
.markdown-body table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.markdown-body th, .markdown-body td { padding: 8px 13px; border: 1px solid var(--border-soft); }
.markdown-body th { font-weight: 600; background: var(--bg-soft); text-align: left; }
.markdown-body tr:nth-child(2n) td { background: color-mix(in srgb, var(--bg-soft) 55%, transparent); }
.markdown-body img { border-radius: 8px; }
.markdown-body details {
  margin: 0 0 1em;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.markdown-body summary { cursor: pointer; font-weight: 600; }
.markdown-body .heading-anchor {
  margin-left: 8px;
  color: var(--text-faint);
  font-size: 0.8em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.markdown-body h1:hover .heading-anchor,
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor,
.markdown-body h4:hover .heading-anchor,
.markdown-body .heading-anchor:focus { opacity: 1; }
.markdown-body .task-list-item { list-style: none; margin-left: -1.3em; }
.markdown-body .task-list-item input { margin-right: 0.55em; }
.markdown-body .footnotes { font-size: 0.88em; color: var(--text-muted); border-top: 1px solid var(--border-soft); margin-top: 2.5em; padding-top: 1em; }


/* ── 目录（右栏） ─────────────────────────────────────── */
.toc {
  /* 全高：分界线从内容顶部延伸到底部，不随目录条目多少截断 */
  align-self: stretch;
  min-height: 100%;
  position: relative;
  /* 与正文之间的分界线 */
  border-left: 1px solid var(--border-soft);
  padding: 30px 18px 48px 18px;
  font-size: 13px;
}
/*
 * 目录布局：标题 / 列表 / 阅读进度三段。
 * 列表单独滚动并隐藏滚动条 —— 条目多时仍可滚动查看，但不出现可见滚动条。
 * 隐藏滚动条的同时保留可滚动能力：滚动条宽度设为 0，而不是 overflow: hidden。
 */
.toc-inner {
  position: sticky;
  top: calc(var(--header-height) + 30px);
  max-height: calc(100vh - var(--header-height) - 60px);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.toc-scroll {
  overflow-y: auto;
  min-height: 0;
  /* 隐藏滚动条但保留滚动：IntersectionObserver 与键盘仍可操作 */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* 顶部/底部渐隐，暗示内容被裁切而非硬截断 */
  mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
}
.toc-scroll::-webkit-scrollbar { width: 0; height: 0; }
.toc-title { margin: 0 0 10px; padding-left: 12px; color: var(--text); font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border-soft); }
.toc-list a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; color: var(--text-muted); border-left: 2px solid transparent; line-height: 1.5; }
.toc-list a:hover { color: var(--text); text-decoration: none; border-left-color: var(--border); }
.toc-list a.active { color: var(--link); border-left-color: var(--pandecta-accent); }
.toc-list .toc-depth-3 a { padding-left: 24px; font-size: 12.5px; }

/* ── 阅读进度 ─────────────────────────────────────────── */
/* 底部全宽细条：贴在视口底部，纯装饰 */
.reading-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  z-index: 60;
  background: color-mix(in srgb, var(--border-soft) 60%, transparent);
  pointer-events: none;
}
.reading-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--pandecta-accent);
  transition: width .08s linear;
}

/* 右侧目录底部的文本说明 */
.reading-status {
  flex: none;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.reading-status-line { display: block; }
.reading-status b { color: var(--text-muted); font-weight: 650; }
.reading-status-time { opacity: .8; }

/* ── 上一页 / 下一页 ──────────────────────────────────── */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 44px; }
.pager-link {
  display: block;
  padding: 13px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.pager-link:hover { border-color: var(--border); box-shadow: var(--shadow-small); text-decoration: none; }
.pager-link.next { text-align: right; }
.pager-label { display: block; color: var(--text-faint); font-size: 12px; margin-bottom: 2px; }
.pager-title { color: var(--link); font-weight: 600; font-size: 14px; }

/* ── 搜索 ─────────────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  background: rgba(9, 13, 18, 0.46);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s;
}
.search-overlay.open { opacity: 1; visibility: visible; }
.search-panel {
  width: min(640px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-form { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.search-form svg { width: 17px; height: 17px; color: var(--text-faint); flex: 0 0 auto; }
.search-input { flex: 1; min-width: 0; padding: 4px 0; color: var(--text); font: inherit; font-size: 15px; background: none; border: 0; outline: none; }
.search-close { flex: 0 0 auto; }
.search-results { overflow-y: auto; padding: 6px; }
.search-hint, .search-empty { padding: 18px 14px; color: var(--text-faint); font-size: 13.5px; }
.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
}
.search-result:hover, .search-result:focus-visible { background: var(--bg-soft); text-decoration: none; }
.search-result-title { font-weight: 600; font-size: 14px; color: var(--link); }
.search-result-meta { margin-top: 2px; color: var(--text-faint); font-size: 12px; }
.search-result-snippet { margin-top: 3px; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }

/* ── 404 ──────────────────────────────────────────────── */
.not-found { padding: 10vh 0; text-align: center; }
.not-found h1 { font-size: 3em; margin: 0 0 8px; border: 0; }
.not-found p { color: var(--text-muted); }
.not-found .button {
  display: inline-block;
  margin-top: 18px;
  padding: 9px 18px;
  color: #fff;
  background: var(--pandecta-accent);
  border-radius: 8px;
  font-size: 14px;
}
.not-found .button:hover { text-decoration: none; filter: brightness(1.06); }

.sidebar-backdrop { display: none; }

/* ── 响应式 ───────────────────────────────────────────── */
@media (max-width: 1240px) {
  .layout, .layout.with-toc { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1024px) {
  .content { padding: 26px 30px 64px; }
  .search-trigger { min-width: 0; }
  .search-trigger-label { display: none; }
  .search-trigger kbd { display: none; }
  .top-nav { display: none; }
}
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .layout, .layout.with-toc { display: block; }
  .content { padding: 22px 20px 60px; }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(320px, 86vw);
    height: auto;
    padding: 18px 14px 40px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    z-index: 50;
    background: rgba(9, 13, 18, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .brand-title { max-width: 46vw; }
  .header-actions { gap: 4px; }
  .dropdown-trigger { max-width: 96px; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { text-align: left; }
  .markdown-body h1 { font-size: 1.7em; }
  .markdown-body h2 { font-size: 1.34em; }
}
@media (max-width: 560px) {
  .site-header { padding: 0 10px; gap: 6px; }
  .dropdown.version-select { display: none; }
  .content { padding: 18px 15px 52px; }
  .search-overlay { padding-top: 6vh; }
  .markdown-body table { font-size: 13px; }
}

@media print {
  .site-header, .sidebar, .toc, .pager, .search-overlay, .breadcrumbs, .page-footer { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .markdown-body a { color: inherit; text-decoration: underline; }
  .markdown-body pre { border: 1px solid #ccc; }
}
