/* ==========================================================================
   Coffee Router Docs
   中性色、柔和表面、统一圆角
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f6f6f5;
  --surface-2: #efefed;
  --surface-3: #e7e7e4;
  --text: #1c1c1e;
  --text-2: #5d5d62;
  --text-3: #9b9ba0;
  --line: #ededeb;
  --overlay: rgba(18, 18, 20, 0.28);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-chip: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04);

  --hl-keyword: #7b4c8a;
  --hl-string: #50704f;
  --hl-number: #96602f;
  --hl-comment: #a3a3a8;
  --hl-title: #345f88;
  --hl-attr: #6f5c32;
  --hl-meta: #8a8a8f;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --header-h: 64px;
  --sidebar-w: 260px;
  --toc-w: 220px;
  --content-w: 740px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121212;
  --surface: #1b1b1b;
  --surface-2: #232323;
  --surface-3: #2c2c2c;
  --text: #ececec;
  --text-2: #a9a9ad;
  --text-3: #6f6f74;
  --line: #242424;
  --overlay: rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px #262626;
  --shadow-chip: 0 1px 2px rgba(0, 0, 0, 0.4);

  --hl-keyword: #c3a1d0;
  --hl-string: #a5c2a0;
  --hl-number: #d8ab7e;
  --hl-comment: #6c6c71;
  --hl-title: #94b8d8;
  --hl-attr: #cdb98a;
  --hl-meta: #8f8f94;

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--bg);
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  box-shadow: var(--shadow-chip);
}

::selection {
  background: var(--surface-3);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

/* ---------- 顶部 ---------- */
.announcement {
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 1px 0 var(--line);
}

.header-inner {
  max-width: 1160px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-inner.is-wide {
  max-width: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  white-space: nowrap;
}
.brand img {
  border-radius: 50%;
}
.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-divider {
  display: none;
}
.brand-suffix {
  color: var(--text-3);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  height: 38px;
  padding: 0 8px 0 14px;
  margin-right: 12px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-3);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.2s;
}
.search-trigger:hover {
  background: var(--surface-2);
}
.search-trigger span {
  flex: 1;
  text-align: left;
}

.header-links {
  display: flex;
  gap: 2px;
  margin-right: 4px;
}
.header-links a {
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-2);
  transition: color 0.2s, background 0.2s;
}
.header-links a:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}
.menu-btn,
.search-icon-btn {
  display: none;
}

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

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--text) 86%, var(--bg));
}

/* ---------- 首页 ---------- */
.home {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px 48px;
}

.hero {
  padding: 104px 0 56px;
  max-width: 640px;
}
.hero h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.hero-sub {
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-2);
}
.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  height: 52px;
  margin-top: 36px;
  padding: 0 14px 0 18px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text-3);
  font-size: 15px;
  cursor: text;
  transition: background 0.2s;
}
.hero-search:hover {
  background: var(--surface-2);
}
.hero-search span {
  flex: 1;
  text-align: left;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.endpoints {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 72px;
}
.endpoint {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 16px 20px 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
}
.endpoint-body {
  flex: 1;
  min-width: 0;
}
.endpoint-label {
  font-size: 13px;
  color: var(--text-3);
}
.endpoint-url {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 14.5px;
  color: var(--text);
}

.copy-btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow-chip);
  transition: color 0.2s;
}
.copy-btn:hover {
  color: var(--text);
}

.home-group {
  margin-bottom: 52px;
}
.home-group h2 {
  margin: 0 0 16px 4px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 104px;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: background 0.2s;
}
.doc-card:hover {
  background: var(--surface-2);
}
.doc-card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.doc-card-desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  color: var(--text-3);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 28px 44px;
  font-size: 13px;
  color: var(--text-3);
  box-shadow: 0 -1px 0 var(--line);
}
.site-footer a {
  transition: color 0.2s;
}
.site-footer a:hover {
  color: var(--text);
}
.page-home .site-footer {
  margin-top: 32px;
}

/* ---------- 文档页布局 ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1440px;
  margin: 0 auto;
}
.doc-layout.no-sidebar {
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 32px 16px 48px 20px;
}
.nav-group + .nav-group {
  margin-top: 28px;
}
.nav-group-title {
  padding: 0 12px 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 2px 0;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-2);
  transition: color 0.2s, background 0.2s;
}
.sidebar li a:hover {
  color: var(--text);
  background: var(--surface);
}
.sidebar li a.active {
  color: var(--text);
  background: var(--surface);
  font-weight: 500;
}
.draft-dot {
  margin-left: auto;
  padding: 0 6px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
}
.draft-dot::before {
  content: "草稿";
}
.sidebar-backdrop {
  display: none;
}

.doc-main {
  min-width: 0;
  padding: 52px 56px 0;
}
.doc-main .site-footer {
  max-width: var(--content-w);
  margin: 80px auto 0;
  padding-left: 0;
  padding-right: 0;
}

.doc {
  max-width: var(--content-w);
  margin: 0 auto;
}

.draft-banner {
  display: inline-block;
  margin-bottom: 20px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--surface);
}

.doc-header {
  margin-bottom: 40px;
}
.doc-eyebrow {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-3);
}
.doc-header h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.doc-lead {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-2);
}

.doc-meta {
  margin-top: 64px;
  font-size: 13px;
  color: var(--text-3);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: background 0.2s;
}
.pager-link:hover {
  background: var(--surface-2);
}
.pager-link.next {
  text-align: right;
  grid-column: 2;
}
.pager-label {
  font-size: 12.5px;
  color: var(--text-3);
}
.pager-title {
  font-size: 15px;
  font-weight: 500;
}

/* ---------- 页内目录 ---------- */
.toc {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 52px 20px 40px 4px;
  scrollbar-width: none;
}
.toc-title {
  margin: 0 0 10px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li a {
  display: block;
  padding: 5px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
  transition: color 0.2s, background 0.2s;
}
.toc li.toc-l3 a {
  padding-left: 22px;
}
.toc li a:hover {
  color: var(--text);
}
.toc li a.active {
  color: var(--text);
  background: var(--surface);
}

/* ---------- 正文排版 ---------- */
.prose {
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--text);
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose p {
  margin: 0 0 1.1em;
}
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.4;
}
.prose h2 {
  margin: 2.4em 0 0.75em;
  font-size: 22px;
}
.prose h3 {
  margin: 1.9em 0 0.6em;
  font-size: 18px;
}
.prose h4 {
  margin: 1.6em 0 0.5em;
  font-size: 16px;
}
.heading-anchor {
  margin-left: 8px;
  color: var(--text-3);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s;
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor {
  opacity: 1;
}

.prose a {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--surface-3);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s;
}
.prose a:hover {
  text-decoration-color: var(--text);
}
.prose a.heading-anchor {
  text-decoration: none;
  font-weight: 400;
}

.prose strong {
  font-weight: 600;
}

.prose ul,
.prose ol {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}
.prose li {
  margin: 0.3em 0;
  padding-left: 0.2em;
}
.prose li > ul,
.prose li > ol {
  margin: 0.3em 0 0;
}
.prose li::marker {
  color: var(--text-3);
}
.prose ul.contains-task-list {
  list-style: none;
  padding-left: 0.1em;
}
.task-list-item input {
  margin: 0 8px 0 0;
  vertical-align: -1px;
  accent-color: var(--text);
}

.prose blockquote {
  position: relative;
  margin: 0 0 1.2em;
  padding: 2px 0 2px 20px;
  color: var(--text-2);
}
.prose blockquote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 3px;
  background: var(--surface-3);
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose hr {
  height: 1px;
  margin: 2.6em 0;
  border: 0;
  background: var(--line);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  vertical-align: middle;
  cursor: zoom-in;
}

.prose mark {
  background: var(--surface-2);
  color: inherit;
  padding: 1px 4px;
  border-radius: var(--r-xs);
}

/* 行内代码 */
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.18em 0.45em;
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text);
  white-space: break-spaces;
}
.prose a code {
  color: inherit;
}
.prose h2 code,
.prose h3 code {
  font-size: 0.82em;
}

/* 代码块 */
.code-block {
  margin: 0 0 1.4em;
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 8px 0 20px;
}
.code-lang {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}
.code-copy {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
}
.code-block:hover .code-copy,
.code-copy:focus-visible,
.code-copy.is-done {
  opacity: 1;
}
.code-copy:hover {
  color: var(--text);
  background: var(--surface-2);
}
.code-block pre {
  margin: 0;
  padding: 0 20px 18px;
  overflow-x: auto;
}
.code-block code {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  tab-size: 2;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-doctag,
.hljs-type,
.hljs-built_in,
.hljs-title.class_ {
  color: var(--hl-keyword);
}
.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-template-tag {
  color: var(--hl-string);
}
.hljs-number,
.hljs-symbol,
.hljs-bullet {
  color: var(--hl-number);
}
.hljs-comment,
.hljs-quote {
  color: var(--hl-comment);
}
.hljs-title,
.hljs-title.function_,
.hljs-name {
  color: var(--hl-title);
}
.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable,
.hljs-property,
.hljs-selector-class,
.hljs-selector-id,
.hljs-params {
  color: var(--hl-attr);
}
.hljs-meta,
.hljs-punctuation {
  color: var(--hl-meta);
}
.hljs-deletion {
  color: #b5524a;
}
.hljs-emphasis {
  font-style: italic;
}
.hljs-strong {
  font-weight: 600;
}

/* 表格 */
.table-wrap {
  margin: 0 0 1.4em;
  border-radius: var(--r-md);
  box-shadow: 0 0 0 1px var(--line) inset;
  overflow-x: auto;
}
.prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.6;
}
.prose th,
.prose td {
  padding: 11px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.prose th {
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  white-space: nowrap;
}
.prose tr:last-child td {
  border-bottom: 0;
}
.prose td code {
  white-space: nowrap;
}

/* 提示块 */
.callout {
  margin: 0 0 1.4em;
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-2);
}
.callout-title {
  margin: 0 0 4px !important;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.callout > :last-child {
  margin-bottom: 0;
}
.callout p {
  margin-bottom: 0.6em;
}
.callout :not(pre) > code {
  background: var(--surface-2);
}
.callout .code-block {
  background: var(--bg);
}

/* 折叠块 */
.details {
  margin: 0 0 10px;
  border-radius: var(--r-md);
  background: var(--surface);
}
.details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-radius: var(--r-md);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition: background 0.2s;
}
.details summary:hover {
  background: var(--surface-2);
}
.details summary::-webkit-details-marker {
  display: none;
}
.details summary::after {
  content: "";
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s;
}
.details[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}
.details-body {
  padding: 0 20px 6px;
  font-size: 14.5px;
  color: var(--text-2);
}
.details + :not(.details) {
  margin-top: 1.4em;
}

/* 选项卡 */
.tabs {
  margin: 0 0 1.4em;
}
.tab-bar {
  display: inline-flex;
  max-width: 100%;
  gap: 2px;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-btn {
  padding: 5px 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  font-size: 13.5px;
  color: var(--text-3);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-chip);
}
.tabs.is-ready .tab-panel:not(.active) {
  display: none;
}
.tabs:not(.is-ready) .tab-panel::before {
  content: attr(data-title);
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}
.tab-panel > :last-child {
  margin-bottom: 0;
}

/* 脚注 */
.footnotes-sep {
  margin-top: 3em !important;
}
.footnotes {
  font-size: 13.5px;
  color: var(--text-2);
}

/* 公式 / 流程图 */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
pre.mermaid {
  margin: 0 0 1.4em;
  padding: 24px;
  text-align: center;
  border-radius: var(--r-md);
  background: var(--surface);
  color: transparent;
}
pre.mermaid[data-processed] {
  color: inherit;
}

/* ---------- 搜索 ---------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 13vh 16px 16px;
}
.search-modal[hidden] {
  display: none;
}
.search-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
}
.search-panel {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 68vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl);
  background: var(--bg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: pop 0.18s ease;
}
.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 60px;
  color: var(--text-3);
  box-shadow: 0 1px 0 var(--line);
}
.search-input-row input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--text);
}
.search-input-row input::placeholder {
  color: var(--text-3);
}
.search-input-row input::-webkit-search-cancel-button {
  display: none;
}
.search-results {
  overflow-y: auto;
  padding: 8px;
}
.search-results:empty {
  display: none;
}
.search-item {
  display: block;
  padding: 12px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.search-item.active {
  background: var(--surface);
}
.search-item-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.search-item-title {
  font-size: 14.5px;
  font-weight: 500;
}
.search-item-group {
  font-size: 12px;
  color: var(--text-3);
}
.search-item-snippet {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-item mark {
  background: none;
  color: var(--text);
  font-weight: 600;
}
.search-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
}

/* 图片放大 */
.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(10, 10, 12, 0.8);
  cursor: zoom-out;
  animation: fade 0.18s ease;
}
.zoom-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-md);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 130;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  animation: pop 0.18s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

/* ---------- 404 ---------- */
.not-found {
  max-width: 560px;
  margin: 0 auto;
  padding: 140px 28px;
  text-align: center;
}
.not-found-code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-3);
}
.not-found h1 {
  margin: 12px 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.not-found p {
  color: var(--text-2);
}
.not-found .hero-actions {
  justify-content: center;
}

/* ---------- 预览模式 ---------- */
.preview-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
}
.page-preview .toc {
  top: 40px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .doc-layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .doc-layout.no-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 960px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .menu-btn {
    display: inline-grid;
    margin-left: -10px;
  }
  .sidebar {
    position: fixed;
    top: 8px;
    left: 8px;
    bottom: 8px;
    z-index: 60;
    width: min(300px, 84vw);
    height: auto;
    padding-top: 24px;
    border-radius: var(--r-xl);
    background: var(--bg);
    box-shadow: var(--shadow-pop);
    transform: translateX(calc(-100% - 16px));
    transition: transform 0.25s ease;
  }
  .sidebar-open .sidebar {
    transform: none;
  }
  .sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: var(--overlay);
  }
  .doc-main {
    padding: 36px 32px 0;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .header-links {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 0 18px;
  }
  .search-trigger {
    display: none;
  }
  .search-icon-btn {
    display: inline-grid;
  }
  .brand-suffix {
    display: none;
  }
  .hero {
    padding: 64px 0 40px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .hero-sub {
    font-size: 15px;
  }
  .home {
    padding: 0 18px 32px;
  }
  .endpoints,
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .endpoints {
    margin-bottom: 52px;
  }
  .endpoint {
    padding: 16px 14px 16px 20px;
  }
  .doc-main {
    padding: 28px 20px 0;
  }
  .doc-header h1 {
    font-size: 26px;
  }
  .prose {
    font-size: 15px;
  }
  .code-copy {
    opacity: 1;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager-link.next {
    grid-column: 1;
  }
  .site-footer {
    flex-direction: column;
    padding: 24px 18px 36px;
  }
  .search-modal {
    padding: 10px;
  }
  .search-panel {
    max-height: 85vh;
  }
}
