:root {
  --docs-bg: #f8f9fb;
  --docs-bg-muted: #f8f9fb;
  --docs-bg-panel: #f3f6fb;
  --docs-card: #ffffff;
  --docs-fg: #161c2d;
  --docs-muted: #6e727d;
  --docs-faint: #9aa0ab;
  --docs-border: #e8e9ed;
  --docs-accent: #2f6fed;
  --docs-accent-soft: #e8f1fe;
  --docs-sidebar-w: 268px;
  --docs-toc-w: 268px;
  --docs-code: #9f1239;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  color: var(--docs-fg);
  background: var(--docs-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--docs-accent); }

.app-shell { min-height: 100%; background: var(--docs-bg); }
.app-body {
  display: grid;
  grid-template-columns: var(--docs-sidebar-w) minmax(0, 1fr) var(--docs-toc-w);
  min-height: 100vh;
}
.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 12px 32px;
  background: var(--docs-bg-panel);
  border-right: 1px solid #e2e8f0;
}
.app-main {
  min-width: 0;
  padding: 56px 32px 80px;
  max-width: 900px;
  width: 100%;
  justify-self: center;
}
.app-toc {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 56px 16px 32px 8px;
  background: var(--docs-bg);
}

.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 10px 14px;
  color: var(--docs-fg);
}
.sidebar-brand:hover { color: var(--docs-fg); }
.sidebar-brand-name { font-size: 15px; font-weight: 600; }
.sidebar-brand-sub { font-size: 12px; color: var(--docs-muted); }
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin: 0 0 12px;
  padding: 0 10px;
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  background: var(--docs-card);
}
.sidebar-search input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--docs-fg);
}
.sidebar-search input::placeholder { color: var(--docs-faint); }
.sidebar-kbd { display: inline-flex; gap: 2px; flex-shrink: 0; }
.sidebar-kbd kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--docs-border);
  border-radius: 4px;
  background: var(--docs-bg);
  font-size: 11px;
  color: var(--docs-muted);
}
.app-search-icon { width: 16px; height: 16px; display: block; color: var(--docs-muted); }
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-link {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  color: var(--docs-muted);
  margin: 1px 0;
  font-size: 14px;
  line-height: 1.35;
}
.sidebar-link:hover { background: var(--docs-accent-soft); color: var(--docs-fg); }
.sidebar-link.active {
  background: var(--docs-accent-soft);
  color: var(--docs-accent);
  font-weight: 500;
}
.sidebar-link-doc { padding-left: 16px; }
.sidebar-folder { margin-top: 4px; }
.sidebar-folder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--docs-muted);
  list-style: none;
}
.sidebar-folder-title::-webkit-details-marker { display: none; }
.sidebar-folder-title.current { color: var(--docs-fg); }
.sidebar-chevron {
  width: 16px;
  height: 16px;
  color: var(--docs-faint);
  transition: transform 0.15s;
}
.sidebar-folder:not([open]) .sidebar-chevron { transform: rotate(-90deg); }
.sidebar-hidden { display: none !important; }

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 10px;
}
.toc-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--docs-muted);
}
.toc-title-icon { width: 16px; height: 16px; }
.toc-ring { width: 18px; height: 18px; color: var(--docs-accent); }
.toc-ring-track { stroke: color-mix(in srgb, var(--docs-fg) 12%, transparent); }
.toc-ring-fill { stroke: currentColor; transition: stroke-dashoffset 0.12s linear; }
.toc-nav-wrap { position: relative; padding-left: 12px; }
.toc-rail {
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: color-mix(in srgb, var(--docs-fg) 10%, transparent);
}
.toc-rail-fill {
  width: 2px;
  margin-left: -0.5px;
  background: var(--docs-accent);
  border-radius: 1px;
}
.toc-nav { display: flex; flex-direction: column; }
.toc-link {
  display: block;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--docs-muted);
  line-height: 1.45;
}
.toc-link:hover { color: var(--docs-fg); }
.toc-link.active { color: var(--docs-accent); font-weight: 500; }
.toc-empty { padding: 0 8px; color: var(--docs-faint); font-size: 13px; }

.doc-detail-header h1 {
  margin: 0;
  font-size: 1.75em;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.doc-detail-subtitle {
  margin: 10px 0 2em;
  color: var(--docs-muted);
  font-size: 1.125em;
  line-height: 1.6;
}
.doc-content { font-size: 16px; line-height: 1.8; }
.doc-detail-header h1,
.doc-content h2,
.doc-content h3 { scroll-margin-top: 16px; }
.doc-content h2,
.doc-content h3 {
  margin-top: 1.6em;
  margin-bottom: 0.55em;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.doc-content h2 { font-size: 1.25em; }
.doc-content h3 { font-size: 1.1em; }
.doc-content p { margin: 0 0 1em; }
.doc-content blockquote {
  margin: 1em 0;
  padding: 8px 16px;
  border-left: 3px solid var(--docs-accent);
  background: var(--docs-bg-muted);
  color: var(--docs-muted);
}
.doc-content code {
  padding: 2px 6px;
  background: var(--docs-accent-soft);
  border-radius: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--docs-code);
}
.doc-content pre {
  margin: 1em 0;
  padding: 14px 16px;
  background: #18181b;
  color: #e4e4e7;
  border-radius: 8px;
  overflow-x: auto;
}
.doc-content pre code { padding: 0; background: transparent; color: inherit; }
.doc-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.doc-content th,
.doc-content td {
  padding: 8px 12px;
  border: 1px solid var(--docs-border);
  text-align: left;
  vertical-align: top;
}
.doc-content th { background: var(--docs-bg-muted); font-weight: 600; }
.doc-content ul,
.doc-content ol { padding-left: 1.5em; margin: 0 0 1em; }
.doc-content a { color: var(--docs-accent); text-decoration: underline; text-underline-offset: 2px; }
.doc-content figure {
  margin: 1em 0 1.5em;
  padding: 0;
}
.doc-content figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--docs-border);
  border-radius: 10px;
  background: #f3f6fb;
}
.doc-content figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--docs-muted);
  line-height: 1.5;
}

.doc-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 1.75em;
}
.doc-feature-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--docs-border);
  border-radius: 12px;
  background: var(--docs-card);
  color: inherit;
  text-decoration: none;
}
a.doc-feature-card:hover {
  background: var(--docs-accent-soft);
  color: inherit;
}
.doc-feature-card h3 { margin: 0 0 6px; font-size: 14px; letter-spacing: 0; }
.doc-feature-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--docs-muted);
}

.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
}
.doc-pager-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--docs-border);
  border-radius: 12px;
  background: var(--docs-card);
  color: inherit;
  text-decoration: none;
}
.doc-pager-link:hover { background: var(--docs-accent-soft); color: inherit; }
.doc-pager-link.next { text-align: right; align-items: flex-end; }
.doc-pager-dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--docs-muted);
}
.doc-pager-title { font-size: 15px; font-weight: 600; }

@media (max-width: 1100px) {
  .app-body { grid-template-columns: var(--docs-sidebar-w) minmax(0, 1fr); }
  .app-toc { display: none; }
}
@media (max-width: 768px) {
  .app-body { grid-template-columns: 1fr; }
  .app-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--docs-border);
    padding: 8px 12px 12px;
  }
  .app-main { padding: 20px 16px 48px; max-width: none; }
  .sidebar-kbd { display: none; }
  .doc-detail-header h1 { font-size: 26px; }
  .doc-card-grid,
  .doc-pager { grid-template-columns: 1fr; }
  .doc-pager-link.next { text-align: left; align-items: flex-start; }
}
