:root {
  --bg: #0e1014;
  --panel: #16181d;
  --line: rgba(255, 255, 255, 0.045);
  --line-strong: rgba(255, 255, 255, 0.08);
  --text: #e8eaef;
  --muted: #9aa3b2;
  --faint: #6b7382;
  --accent: #3b9eff;
  --accent-2: #64a8e6;
  --accent-dim: rgba(59, 158, 255, 0.14);
  --code-bg: #12151b;
  --font: "Noto Sans SC", "Segoe UI", sans-serif;
  --font-display: "Outfit", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1400px, 100% - 48px); margin-inline: auto; }

.doc-top {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(14, 16, 20, 0.88);
  border-bottom: 1px solid var(--line);
}
.doc-top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 16px;
}
.brand {
  color: var(--text); font-weight: 650;
  font-family: var(--font-display); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.brand-ico { border-radius: 4px; }
.brand em { font-style: normal; color: var(--accent-2); margin-left: 2px; font-weight: 500; }

.docs-search-wrap { margin-top: 22px; max-width: 420px; }
.docs-search {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(14, 16, 20, 0.65);
  color: var(--text);
  font: inherit;
}
.docs-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: transparent;
}
.docs-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 16px 0 0;
  font-size: 0.92rem;
}
.docs-quick a { color: var(--accent-2); }
.docs-toolbar {
  display: none;
  padding-top: 16px;
}
.side-toggle {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.search-empty {
  color: var(--muted);
  padding: 12px 0 24px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .docs-toolbar { display: block; }
  .sidebar {
    position: static;
    max-height: 0;
    overflow: hidden;
    padding: 0 12px;
    border-width: 0;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
  }
  .sidebar.is-open {
    max-height: 50vh;
    overflow: auto;
    opacity: 1;
    padding: 14px 12px;
    border-width: 1px;
    margin-bottom: 16px;
  }
}
.doc-top nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.doc-top nav a {
  color: var(--muted); padding: 8px 12px; border-radius: 8px; text-decoration: none;
}
.doc-top nav a:hover, .doc-top nav a.here {
  color: var(--text); background: rgba(255,255,255,0.04);
}

.docs-hero {
  padding: 56px 0 36px;
  background:
    radial-gradient(ellipse 70% 80% at 20% 0%, rgba(59,158,255,0.14), transparent 55%),
    linear-gradient(180deg, #12151b, var(--bg));
  border-bottom: 1px solid var(--line);
}
.docs-hero .eyebrow {
  margin: 0 0 12px; color: var(--accent-2); font-size: 0.85rem;
  letter-spacing: 0.06em; font-family: var(--font-display);
}
.docs-hero h1 {
  margin: 0 0 12px; font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -0.03em; font-weight: 650;
}
.docs-hero .lead {
  margin: 0; max-width: 36rem; color: var(--muted); font-size: 1.05rem;
}

.docs-home { padding: 40px 0 72px; }
.cat-block { margin-bottom: 40px; }
.cat-block h2 {
  margin: 0 0 6px; font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 650;
}
.cat-desc { margin: 0 0 16px; color: var(--muted); font-size: 0.95rem; }
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.doc-cards.dense {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.doc-card {
  display: grid; gap: 6px; padding: 16px 16px 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
  color: inherit; text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.doc-card:hover {
  border-color: rgba(100,168,230,0.45);
  background: var(--accent-dim);
  transform: translateY(-1px);
  text-decoration: none;
}
.doc-card strong {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
}
.doc-card span {
  color: var(--muted); font-size: 0.86rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 36px;
  padding: 32px 0 72px;
  align-items: start;
}
.sidebar {
  position: sticky; top: 80px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  font-size: 0.86rem;
}
.side-title { margin: 0 0 10px; color: var(--faint); font-size: 0.75rem; letter-spacing: 0.06em; }
.sidebar .group { margin: 14px 0 6px; color: var(--accent-2); font-size: 0.78rem; font-weight: 600; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 6px 8px; border-radius: 7px; color: var(--muted); text-decoration: none;
}
.sidebar li a:hover, .sidebar li a.active {
  background: var(--accent-dim); color: var(--text);
}

.doc-head h1 {
  margin: 0 0 8px; font-size: 1.85rem; letter-spacing: -0.02em;
  font-family: var(--font-display); font-weight: 650;
}
.doc-head .crumb { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.doc-head .meta { color: var(--muted); margin: 0 0 24px; }
.doc-related {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.doc-related h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-family: var(--font-display);
}
.doc-related ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}
.doc-related a { color: var(--accent-2); }

.doc-pager {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.doc-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.02);
}
.doc-pager a:hover {
  border-color: rgba(59,158,255,0.35);
  background: rgba(59,158,255,0.06);
}
.doc-pager span {
  font-size: 0.78rem;
  color: var(--muted);
}
.doc-pager strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.doc-pager .pager-next { text-align: right; }
.doc-pager .is-empty { visibility: hidden; }

.search-hits {
  margin-top: 14px;
  max-width: 560px;
  display: grid;
  gap: 8px;
}
.search-hits-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.search-hit {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.search-hit:hover {
  border-color: rgba(59,158,255,0.35);
}
.search-hit span {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 700px) {
  .doc-pager { grid-template-columns: 1fr; }
  .doc-pager .pager-next { text-align: left; }
}

.doc-body h2 {
  margin-top: 2rem; font-size: 1.3rem; font-family: var(--font-display);
  border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.doc-body h3 { margin-top: 1.4rem; font-size: 1.08rem; }
.doc-body p, .doc-body li { color: #d5dae3; }
.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.doc-body th, .doc-body td {
  border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top;
}
.doc-body th { background: rgba(255,255,255,0.04); }
.doc-body code {
  font-family: var(--mono); font-size: 0.88em;
  background: rgba(255,255,255,0.06); padding: 0.1em 0.35em; border-radius: 4px;
}
.doc-body pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 168, 230, 0.45) rgba(255, 255, 255, 0.04);
}
.doc-body pre code { background: none; padding: 0; }
.doc-body blockquote {
  margin: 1rem 0; padding: 8px 14px; border-left: 3px solid var(--accent);
  background: rgba(59,158,255,0.06); color: var(--muted);
}

/* 滚动条：与暗色文档页一致（Firefox + WebKit） */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 168, 230, 0.4) rgba(255, 255, 255, 0.04);
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(100, 168, 230, 0.55), rgba(59, 158, 255, 0.35));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(120, 185, 255, 0.75), rgba(59, 158, 255, 0.55));
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

.doc-foot {
  border-top: 1px solid var(--line); padding: 24px 0 36px; color: var(--faint); font-size: 0.9rem;
}
.doc-foot a { color: var(--accent-2); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
