/* ============================================================
   纳米Work 文档站 — TRAE 风格框架
   设计原则：中性灰、窄列阅读、轻边框、低装饰、清晰层级
   ============================================================ */
:root {
  --c-fg: #1d2129;
  --c-muted: #4e5969;
  --c-subtle: #86909c;
  --c-bg: #ffffff;
  --c-bg-alt: #f7f8fa;
  --c-hover: #f7f8fa;
  --c-sidebar-active: #edf0f4;
  --c-border: #e5e6eb;
  --c-border-soft: #edf0f3;
  --c-link: #165dff;
  --c-bullet: #337aff;
  --c-nav-active: #272e3b;
  --c-nav-active-text: #ffffff;
  --c-code: #f7f8fa;
  --c-overlay: rgba(29, 33, 41, .34);
  --c-focus: rgba(22, 93, 255, .5);
  --c-warning-bg: #fff9ef;
  --c-warning-border: #f3dfb7;
  --c-tip-bg: #f2f7ff;
  --c-tip-border: #d9e7ff;
  --sidebar-w: 300px;
  --toc-w: 260px;
  --navbar-h: 64px;
  /* 【正文宽度总开关】正文宽度 = 「视口宽度 − 左侧导航」这块右侧区域 × 此比例，居中显示。
     用无单位小数：0.70 = 70%，0.60 更窄、0.80 更宽、1.0 铺满。当前 0.70。
     说明：基数固定为「视口−左侧栏」，不含右侧目录(TOC)，因此正文宽度与位置恒定，
     窗口在 1180px 附近 TOC 显隐时正文完全不动。TOC 以浮层落在正文右侧的空白里，
     宽度自动取「右侧空白」与 --toc-w 的较小值——想让目录更宽，把此比例调小(留白更多)。 */
  --content-ratio: 0.70;
  /* 正文最大像素上限：默认 100000px 相当于「不限制」，宽度仅由 --content-ratio 控制；
     若想在超宽屏上避免正文行过长，把它改成一个具体像素（如 900px）即可作为上限兜底。 */
  --content-max: 100000px;
  /* 【左边距比例】正文左边缘距左侧导航的间距 =「视口 − 左侧导航」× 此比例。
     正文不再几何居中，而是靠左：左留白小，且随窗口变窄而同步变小、绝不反向变大；
     窗口变宽时左留白按比例温和增大。跨 1180px（目录显隐）时连续、不跳变。
     0.05 = 5%（约 1600px 宽时 65px）；想更贴近侧栏改小（如 0.03），想更居中改大。 */
  --content-gap-ratio: 0.05;
  color-scheme: light;
  font-size: 15px;
}

:root[data-theme="dark"] {
  --c-fg: #f2f3f5;
  --c-muted: #c9cdd4;
  --c-subtle: #86909c;
  --c-bg: #17191d;
  --c-bg-alt: #202328;
  --c-hover: #202328;
  --c-sidebar-active: #2b3037;
  --c-border: #343941;
  --c-border-soft: #292d33;
  --c-link: #6aa1ff;
  --c-bullet: #6aa1ff;
  --c-nav-active: #f2f3f5;
  --c-nav-active-text: #17191d;
  --c-code: #202328;
  --c-overlay: rgba(0, 0, 0, .56);
  --c-focus: rgba(106, 161, 255, .62);
  --c-warning-bg: #2a241b;
  --c-warning-border: #57472d;
  --c-tip-bg: #1d2738;
  --c-tip-border: #2c4568;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background: var(--c-bg);
}

body {
  min-width: 320px;
  color: var(--c-fg);
  background: var(--c-bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--c-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

/* ---------- 顶部产品导航 ---------- */
.navbar {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  height: var(--navbar-h);
  padding: 0 24px;
  gap: 16px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}

.navbar-logo {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  height: 32px;
  padding-right: 24px;
}

.navbar-logo::after {
  position: absolute;
  top: 4px;
  right: 0;
  width: 1px;
  height: 24px;
  background: var(--c-border);
  content: "";
}

.logo-img {
  display: block;
  width: auto;
  height: 26px;
}

.navbar-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.navbar-nav::-webkit-scrollbar {
  display: none;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--c-muted);
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}

.navbar-nav a:hover {
  color: var(--c-fg);
  background: var(--c-hover);
  text-decoration: none;
}

.navbar-nav a.active {
  color: var(--c-nav-active-text);
  background: var(--c-nav-active);
  font-weight: 600;
}

.navbar-right {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
  gap: 10px;
}

.search-shell {
  position: relative;
  display: flex;
  align-items: center;
  width: 280px;
  min-height: 30px;
  border-radius: 4px;
  background: var(--c-bg);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, .05),
    0 0 0 1px rgba(213, 219, 227, .78);
}

:root[data-theme="dark"] .search-shell {
  box-shadow: 0 0 0 1px var(--c-border);
}

.search-shell:focus-within {
  box-shadow: 0 0 0 2px rgba(22, 93, 255, .18), 0 0 0 1px var(--c-link);
}

.search-icon {
  flex: 0 0 auto;
  margin-left: 10px;
  color: var(--c-subtle);
}

.doc-search {
  width: 100%;
  height: 30px;
  padding: 5px 4px 5px 7px;
  border: 0;
  outline: 0;
  color: var(--c-fg);
  background: transparent;
  font-size: 13px;
  line-height: 20px;
}

.doc-search::-webkit-search-cancel-button,
.doc-search::-webkit-search-decoration {
  display: none;
  -webkit-appearance: none;
  appearance: none;
}

.doc-search::placeholder {
  color: var(--c-subtle);
}

.search-clear {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 2px;
  border: 0;
  border-radius: 4px;
  color: var(--c-subtle);
  background: transparent;
  cursor: pointer;
}

.search-clear[hidden] {
  display: none !important;
}

.search-clear:hover {
  color: var(--c-fg);
  background: var(--c-hover);
}

.search-results {
  position: absolute;
  z-index: 120;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: 390px;
  max-height: min(420px, calc(100vh - 92px));
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg);
  box-shadow: 0 12px 32px rgba(29, 33, 41, .13);
}

.search-results.show {
  display: block;
}

.search-results a {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 48px;
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--c-fg);
  font-size: 14px;
  line-height: 20px;
}

.search-results a:hover {
  background: var(--c-hover);
  text-decoration: none;
}

.search-result-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.search-result-title {
  color: var(--c-fg);
  font-weight: 500;
}

.search-result-snippet {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--c-subtle);
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-section {
  flex: 0 0 auto;
  margin-left: 16px;
  color: var(--c-subtle);
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}

.search-hit {
  padding: 0 1px;
  border-radius: 2px;
  color: inherit;
  background: rgba(255, 196, 0, .28);
  font-weight: 600;
}

.content mark.search-page-hit {
  color: inherit;
  background: rgba(255, 196, 0, .28);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.search-empty {
  padding: 18px 12px;
  color: var(--c-subtle);
  text-align: center;
  font-size: 13px;
}

.navbar-cta {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--c-nav-active-text);
  background: var(--c-nav-active);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}

.navbar-cta:hover {
  opacity: .88;
  text-decoration: none;
}

.theme-btn,
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--c-muted);
  background: transparent;
  cursor: pointer;
}

.theme-btn[hidden] {
  display: none !important;
}

.theme-btn:hover,
.menu-btn:hover {
  color: var(--c-fg);
  background: var(--c-hover);
}

.theme-moon,
:root[data-theme="dark"] .theme-sun {
  display: none;
}

:root[data-theme="dark"] .theme-moon {
  display: block;
}

.menu-btn {
  display: none;
}

/* ---------- 页面布局 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--navbar-h);
}

.sidebar {
  position: sticky;
  top: var(--navbar-h);
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: calc(100vh - var(--navbar-h));
  padding: 20px 0 40px 12px;
  overflow-y: auto;
  background: var(--c-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}

.sidebar-mask {
  display: none;
}

.sidebar-sections {
  display: none;
}

.nav-group-title {
  margin: 0 0 6px 8px;
  padding: 6px 14px;
  color: var(--c-fg);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}

.sidebar-context {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 20px 14px 8px;
  padding: 0 12px 14px;
  border-bottom: 1px solid var(--c-border);
}

.sidebar-context-label {
  color: var(--c-subtle);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: .04em;
}

.sidebar-context strong {
  color: var(--c-fg);
  font-size: 15px;
  font-weight: 600;
  line-height: 24px;
}

.nav-tree ul {
  list-style: none;
}

.nav-tree li > a,
.nav-tree li > .dir-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 12px);
  min-height: 40px;
  margin: 0 0 0 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 0;
  color: var(--c-fg);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  text-align: left;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.nav-tree li > a:hover,
.nav-tree li > .dir-label:hover {
  background: var(--c-hover);
  text-decoration: none;
}

.nav-tree li > a.active {
  color: var(--c-fg);
  background: var(--c-sidebar-active);
  box-shadow: inset 3px 0 0 var(--c-link);
  font-weight: 600;
}

.nav-tree li > a.active:hover {
  background: var(--c-sidebar-active);
}

.dir-label .arrow {
  flex: 0 0 auto;
  margin-left: 10px;
  color: var(--c-subtle);
  font-size: 14px;
  transition: transform .15s ease;
}

li.collapsed > .dir-label .arrow {
  transform: rotate(-90deg);
}

li.collapsed > ul {
  display: none;
}

.nav-tree ul ul {
  margin-left: 28px;
  border-left: 1px solid var(--c-border-soft);
}

.nav-tree ul ul li > a,
.nav-tree ul ul li > .dir-label {
  width: calc(100% - 28px);
  margin-left: 0;
  padding-left: 16px;
  color: var(--c-muted);
}

.nav-tree ul ul li > a.active {
  color: var(--c-fg);
}

/* ---------- 正文 ---------- */
.content-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  /* 靠左：正文左边缘固定在「视口 − 左侧导航」× --content-gap-ratio 处（左留白小）。
     窗口变窄 → 左边距按比例变小、正文只从右侧收缩，左留白只减不增；
     窗口变宽 → 左边距温和增大。始终连续，跨 1180px（目录显隐）不跳变、不位移。
     右侧目录为 fixed 浮层，落在正文右边的空白里，不参与此布局。 */
  align-items: flex-start;
  min-width: 0;
  padding-left: calc((100vw - var(--sidebar-w)) * var(--content-gap-ratio));
}

.content {
  width: 100%;
  max-width: min(calc((100vw - var(--sidebar-w)) * var(--content-ratio)), var(--content-max));
  padding: 44px 40px 32px;
  color: var(--c-fg);
  font-size: 15px;
  line-height: 26px;
}

.article-head {
  margin-bottom: 5px;
}

.breadcrumb {
  margin-bottom: 12px;
  color: var(--c-subtle);
  font-size: 13px;
  line-height: 20px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.content h1 {
  margin: 0;
  color: var(--c-fg);
  font-size: 30px;
  font-weight: 500;
  line-height: 38px;
  letter-spacing: 0;
}

.copy-page {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  color: var(--c-muted);
  background: var(--c-bg);
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
}

.copy-page:hover {
  color: var(--c-fg);
  background: var(--c-hover);
}

.content h2,
.content h3,
.content h4 {
  color: var(--c-fg);
  scroll-margin-top: calc(var(--navbar-h) + 20px);
}

.content h2 {
  margin: 32px 0 12px;
  padding: 0;
  border: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 30px;
}

.content h3 {
  margin: 28px 0 12px;
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
}

.content h4 {
  margin: 20px 0 10px;
  font-size: 17px;
  font-weight: 700;
  line-height: 26px;
}

.content h2 .anchor,
.content h3 .anchor,
.content h4 .anchor {
  margin-left: 7px;
  color: var(--c-subtle);
  font-size: .72em;
  font-weight: 400;
  opacity: 0;
}

.content h2:hover .anchor,
.content h3:hover .anchor,
.content h4:hover .anchor,
.content h2 .anchor:focus-visible,
.content h3 .anchor:focus-visible,
.content h4 .anchor:focus-visible {
  opacity: 1;
}

.content p {
  margin: 6px 0;
  color: var(--c-fg);
}

.content ul,
.content ol {
  margin: 8px 0;
  padding-left: 23px;
}

.content li {
  margin: 4px 0;
}

.content li::marker {
  color: var(--c-bullet);
}

.content ol li::marker {
  color: var(--c-muted);
}

.content b,
.content strong {
  font-weight: 600;
}

.content code {
  padding: 1px 5px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  color: var(--c-fg);
  background: var(--c-code);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
}

.content pre {
  margin: 14px 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-code);
}

.content pre code {
  padding: 0;
  border: 0;
  color: var(--c-fg);
  background: transparent;
  font-size: 13px;
  line-height: 22px;
}

.content table {
  display: block;
  width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 22px;
}

.content th,
.content td {
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  text-align: left;
}

.content th {
  background: var(--c-bg-alt);
  font-weight: 600;
}

.content blockquote {
  margin: 14px 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--c-border);
  color: var(--c-muted);
}

.content blockquote p {
  color: inherit;
}

.content hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--c-border);
}

.content img {
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border: 1px solid var(--c-border);
  border-radius: 6px;
}

.callout {
  display: flex;
  gap: 10px;
  margin: 14px 0;
  padding: 11px 14px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-bg-alt);
  font-size: 14px;
  line-height: 22px;
}

.callout .callout-icon {
  flex: 0 0 auto;
}

.callout-tip {
  border-color: var(--c-tip-border);
  background: var(--c-tip-bg);
}

.callout-note {
  border-color: var(--c-border);
  background: var(--c-bg-alt);
}

.callout-warning {
  border-color: var(--c-warning-border);
  background: var(--c-warning-bg);
}

.mobile-toc {
  display: none;
}

/* ---------- 页脚 ---------- */
.page-footer {
  width: 100%;
  max-width: min(calc((100vw - var(--sidebar-w)) * var(--content-ratio)), var(--content-max));
  padding: 12px 40px 72px;
}

.updated-at {
  min-height: 56px;
  padding: 18px 0;
  border-top: 1px solid var(--c-border);
  color: var(--c-subtle);
  font-size: 13px;
  line-height: 20px;
}

.pager {
  display: flex;
  gap: 12px;
}

.pager a {
  display: block;
  flex: 1;
  min-height: 70px;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  color: var(--c-fg);
  transition: border-color .15s ease, background .15s ease;
}

.pager a:hover {
  border-color: var(--c-subtle);
  background: var(--c-hover);
  text-decoration: none;
}

.pager .pager-label {
  display: block;
  margin-bottom: 3px;
  color: var(--c-subtle);
  font-size: 12px;
  line-height: 18px;
}

.pager .next {
  text-align: right;
}

.pager .spacer {
  flex: 1;
}

/* ---------- 右侧页内目录 ----------
   fixed 浮层，落在居中正文右侧的空白区：不占用正文宽度、不移动正文布局。
   宽度自动收敛到「右侧空白」与 --toc-w 的较小值，保证永不压住正文；
   right/left 之间的空白越大（正文越窄），目录越宽，直至 --toc-w 上限。
   pointer-events：容器透传，仅目录本身可点，避免空白挡住「返回顶部」按钮。 */
.toc {
  position: fixed;
  z-index: 40;
  top: var(--navbar-h);
  right: 24px;
  /* 目录浮层落在正文右侧的实际空白里。正文靠左后，右侧空白 =「视口右侧区域」×(1 − 正文比例 − 左边距比例)，
     目录宽度自动收敛到「该空白 − 边距」与 --toc-w 的较小值，保证永不压住正文。 */
  width: min(var(--toc-w), calc((100vw - var(--sidebar-w)) * (1 - var(--content-ratio) - var(--content-gap-ratio)) - 40px));
  height: calc(100vh - var(--navbar-h));
  padding: 20px 0 40px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 21px;
  pointer-events: none;
}

.toc-title,
.toc ul {
  pointer-events: auto;
}

.toc-title {
  margin-bottom: 8px;
  padding-left: 16px;
  color: var(--c-fg);
  font-weight: 600;
}

.toc ul {
  border-left: 1px solid var(--c-border);
  list-style: none;
}

.toc li a {
  display: block;
  margin-left: -1px;
  padding: 6px 8px 6px 16px;
  border-left: 2px solid transparent;
  color: var(--c-subtle);
  transition: color .15s ease, border-color .15s ease;
}

.toc li.h3 a {
  padding-left: 30px;
}

.toc li a:hover {
  color: var(--c-fg);
  text-decoration: none;
}

.toc li a.active {
  border-left-color: var(--c-link);
  color: var(--c-fg);
  font-weight: 500;
}

/* ---------- 空态 ---------- */
.empty-state {
  padding: 80px 20px;
  color: var(--c-subtle);
  text-align: center;
}

.empty-state .big {
  margin-bottom: 12px;
  font-size: 52px;
}

.empty-state a.btn {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 20px;
  border-radius: 6px;
  color: var(--c-nav-active-text);
  background: var(--c-nav-active);
  font-weight: 600;
}

.empty-state a.btn:hover {
  opacity: .88;
  text-decoration: none;
}

/* ---------- 返回顶部 ---------- */
.back-top {
  position: fixed;
  z-index: 60;
  right: 22px;
  bottom: 22px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-border);
  border-radius: 50%;
  color: var(--c-muted);
  background: var(--c-bg);
  box-shadow: 0 4px 14px rgba(29, 33, 41, .08);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, color .15s ease, background .15s ease;
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
}

.back-top:hover {
  color: var(--c-fg);
  background: var(--c-hover);
}

/* ---------- 小桌面 / 平板 ---------- */
@media (max-width: 1180px) {
  .search-shell {
    width: 220px;
  }

  .toc {
    display: none;
  }

  .mobile-toc {
    position: relative;
    display: block;
    margin-top: 12px;
  }

  .mobile-toc summary {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    color: var(--c-muted);
    background: var(--c-bg);
    font-size: 13px;
    line-height: 20px;
    cursor: pointer;
    list-style: none;
  }

  .mobile-toc summary::-webkit-details-marker {
    display: none;
  }

  .mobile-toc summary::before {
    margin-right: 7px;
    color: var(--c-subtle);
    content: "☷";
    font-size: 16px;
  }

  .mobile-toc ul {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: var(--c-bg);
    box-shadow: 0 12px 30px rgba(29, 33, 41, .12);
    list-style: none;
  }

  .mobile-toc li {
    margin: 0;
  }

  .mobile-toc a {
    display: block;
    padding: 7px 10px;
    border-radius: 4px;
    color: var(--c-muted);
    font-size: 14px;
    line-height: 20px;
  }

  .mobile-toc li.h3 a {
    padding-left: 24px;
  }

  .mobile-toc a:hover {
    color: var(--c-fg);
    background: var(--c-hover);
    text-decoration: none;
  }
}

@media (max-width: 960px) {
  .search-shell {
    width: 180px;
  }

  .navbar-cta {
    display: none;
  }
}

/* ---------- 手机 ---------- */
@media (max-width: 767px) {
  .navbar {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }

  :root {
    --navbar-h: 56px;
  }

  .menu-btn {
    display: inline-flex;
    flex: 0 0 36px;
  }

  .navbar-logo {
    height: 32px;
    padding-right: 12px;
  }

  .navbar-logo::after {
    right: 0;
  }

  .logo-img {
    max-width: 106px;
    height: 24px;
  }

  .navbar-nav,
  .search-shell,
  .navbar-cta {
    display: none;
  }

  .navbar-right {
    margin-left: auto;
  }

  .theme-btn {
    width: 36px;
    height: 36px;
  }

  .sidebar-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 12px 12px 8px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--c-border);
  }

  .sidebar-context {
    margin-top: 2px;
  }

  .sidebar-sections .nav-group-title {
    grid-column: 1 / -1;
    margin: 0;
    padding: 4px 0;
  }

  .sidebar-sections a {
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    color: var(--c-muted);
    background: var(--c-bg);
    font-size: 13px;
    line-height: 20px;
    text-align: center;
  }

  .sidebar-sections a:hover {
    text-decoration: none;
  }

  .sidebar-sections a.active {
    border-color: var(--c-nav-active);
    color: var(--c-nav-active-text);
    background: var(--c-nav-active);
    font-weight: 600;
  }

  .sidebar {
    position: fixed;
    z-index: 90;
    top: var(--navbar-h);
    bottom: 0;
    left: 0;
    width: 280px;
    height: auto;
    padding-top: 16px;
    border-right: 1px solid var(--c-border);
    box-shadow: 8px 0 28px rgba(29, 33, 41, .12);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-mask.show {
    position: fixed;
    z-index: 80;
    inset: var(--navbar-h) 0 0;
    display: block;
    background: var(--c-overlay);
  }

  .content-wrap {
    padding-left: 0;
  }

  .content {
    max-width: none;
    padding: 28px 16px 32px;
  }

  .breadcrumb {
    margin-bottom: 8px;
  }

  .title-row {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .content h1 {
    font-size: 30px;
    line-height: 38px;
  }

  .copy-page {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
  }

  .copy-page span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .mobile-toc {
    margin-top: -4px;
  }

  .content h2 {
    margin-top: 30px;
    font-size: 24px;
    line-height: 30px;
  }

  .content h3 {
    font-size: 20px;
    line-height: 28px;
  }

  .page-footer {
    max-width: none;
    padding: 8px 16px 56px;
  }

  .pager {
    flex-direction: column;
  }

  .pager .spacer {
    display: none;
  }

  .back-top {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 390px) {
  .logo-img {
    max-width: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
