:root {
  --ink: #171717;
  --muted: #6b6b6b;
  --line: #e8e8e6;
  --soft: #f7f7f5;
  --accent: #1f5eff;
  --header-height: 64px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 28px); }
body { margin: 0; color: var(--ink); background: #fff; font-size: 15px; line-height: 1.65; }
a { color: inherit; }
button, input { font: inherit; }

.docs-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-height); padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: max-content; color: var(--ink); font-weight: 720; font-size: 17px; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; color: #fff; background: var(--ink); border-radius: 8px; font-size: 15px; font-weight: 800; }
.brand-divider { width: 1px; height: 20px; margin: 0 2px; background: #d6d6d2; }
.brand-docs { font-weight: 520; color: #3d3d3d; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.search-trigger { width: 230px; padding: 8px 10px 8px 12px; display: flex; align-items: center; justify-content: space-between; color: #777; background: var(--soft); border: 1px solid transparent; border-radius: 9px; cursor: pointer; text-align: left; }
.search-trigger:hover { color: var(--ink); border-color: #ddd; background: #fff; }
kbd { padding: 1px 6px; color: #777; background: #fff; border: 1px solid #ddd; border-bottom-color: #c9c9c9; border-radius: 5px; font: 11px/18px inherit; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.console-link { padding: 8px 12px; color: #404040; text-decoration: none; border-radius: 8px; font-size: 14px; }
.console-link:hover { background: var(--soft); color: #000; }
.menu-button { display: none; width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 20px; }

.docs-shell { max-width: 1600px; min-height: calc(100vh - var(--header-height)); margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 1fr) 220px; }
.sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); padding: 22px 20px 80px 28px; overflow-y: auto; border-right: 1px solid var(--line); scrollbar-width: thin; }
.sidebar-search { display: none; margin-bottom: 22px; }
.sidebar-search button { width: 100%; padding: 9px 11px; display: flex; justify-content: space-between; color: #777; background: var(--soft); border: 0; border-radius: 8px; cursor: pointer; }
.sidebar-group { margin: 0 0 24px; }
.sidebar-group h2 { margin: 0 0 7px; padding: 0 10px; color: #777; font-size: 12px; line-height: 2; font-weight: 650; letter-spacing: .04em; }
.sidebar-link { display: block; margin: 2px 0; padding: 7px 10px; color: #4f4f4f; border-radius: 8px; text-decoration: none; line-height: 1.45; }
.sidebar-link:hover { color: var(--ink); background: var(--soft); }
.sidebar-link.active { color: var(--ink); background: #efefed; font-weight: 620; }

.article-wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 42px 64px 88px; min-width: 0; }
.breadcrumbs { margin-bottom: 32px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #919191; font-size: 13px; }
.breadcrumbs a { color: #616161; text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.article-meta { margin-top: 48px; padding-top: 20px; color: #929292; border-top: 1px solid var(--line); font-size: 13px; }

.toc { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); padding: 42px 26px 60px 8px; overflow-y: auto; }
.toc-title { margin-bottom: 12px; color: #4b4b4b; font-size: 13px; font-weight: 650; }
.toc-link { display: block; padding: 5px 0 5px 12px; color: #888; border-left: 1px solid #e4e4e4; text-decoration: none; font-size: 12px; line-height: 1.5; }
.toc-link.level-3 { padding-left: 24px; }
.toc-link:hover, .toc-link.active { color: var(--ink); border-left-color: var(--ink); }

.markdown-body { color: #2e2e2e; font-size: 16px; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: #111; line-height: 1.3; letter-spacing: -.025em; }
.markdown-body h1 { margin: 0 0 25px; font-size: clamp(30px, 4vw, 42px); font-weight: 740; }
.markdown-body h2 { margin: 48px 0 18px; padding-top: 4px; font-size: 25px; font-weight: 700; }
.markdown-body h3 { margin: 34px 0 13px; font-size: 20px; font-weight: 680; }
.markdown-body h4 { margin: 28px 0 10px; font-size: 17px; }
.markdown-body p { margin: 14px 0; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; text-underline-offset: 3px; }
.markdown-body strong { color: #161616; font-weight: 650; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; }
.markdown-body li { margin: 5px 0; padding-left: 3px; }
.markdown-body blockquote { margin: 22px 0; padding: 13px 18px; color: #4c4c4c; background: #f4f7ff; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }
.markdown-body blockquote p { margin: 0; }
.markdown-body code { padding: 2px 6px; color: #bd2748; background: #f5f5f3; border-radius: 5px; font: .875em/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.markdown-body pre { position: relative; margin: 20px 0; padding: 20px; color: #e8e8e8; background: #171717; border: 1px solid #2c2c2c; border-radius: 12px; overflow: auto; box-shadow: inset 0 1px rgba(255,255,255,.04); }
.markdown-body pre code { padding: 0; color: inherit; background: transparent; border-radius: 0; font-size: 13px; line-height: 1.65; }
.copy-code { position: absolute; top: 10px; right: 10px; padding: 5px 8px; color: #aaa; background: #292929; border: 1px solid #3c3c3c; border-radius: 6px; cursor: pointer; font-size: 11px; opacity: 0; transition: opacity .15s; }
.markdown-body pre:hover .copy-code, .copy-code:focus { opacity: 1; }
.markdown-body table { width: 100%; margin: 20px 0; border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; }
.markdown-body th, .markdown-body td { min-width: 110px; padding: 10px 13px; border: 1px solid #e2e2df; text-align: left; vertical-align: top; }
.markdown-body th { color: #333; background: var(--soft); font-weight: 650; }
.markdown-body img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.markdown-body hr { margin: 42px 0; border: 0; border-top: 1px solid var(--line); }

.article-pagination { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pagination-card { min-height: 82px; padding: 15px 17px; display: flex; flex-direction: column; justify-content: center; color: #555; border: 1px solid var(--line); border-radius: 11px; text-decoration: none; transition: border-color .15s, transform .15s; }
.pagination-card:hover { color: var(--ink); border-color: #aaa; transform: translateY(-1px); }
.pagination-card span { margin-bottom: 4px; color: #999; font-size: 12px; }
.pagination-card strong { font-size: 14px; font-weight: 620; }
.pagination-card.next { text-align: right; }

.search-dialog[hidden] { display: none; }
.search-dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 12vh 20px 20px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(10,10,10,.36); backdrop-filter: blur(3px); }
.search-panel { position: relative; width: min(650px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: #fff; border: 1px solid rgba(0,0,0,.13); border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.25); overflow: hidden; }
.search-input-wrap { padding: 13px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.search-input-wrap > span { color: #777; font-size: 24px; transform: rotate(-15deg); }
.search-input-wrap input { flex: 1; min-width: 0; padding: 3px; border: 0; outline: 0; font-size: 16px; }
.search-input-wrap button { padding: 3px 7px; color: #888; background: var(--soft); border: 0; border-radius: 5px; cursor: pointer; font-size: 11px; }
.search-results { padding: 8px; overflow-y: auto; }
.search-result { display: block; padding: 11px 12px; border-radius: 9px; text-decoration: none; }
.search-result:hover, .search-result.active { background: var(--soft); }
.search-result small { display: block; margin-bottom: 2px; color: #999; font-size: 11px; }
.search-result strong { display: block; margin-bottom: 3px; font-size: 14px; }
.search-result p { margin: 0; color: #777; font-size: 12px; line-height: 1.5; }
.search-empty { padding: 28px; color: #999; text-align: center; }
body.dialog-open { overflow: hidden; }

.not-found { min-height: 100vh; padding: 40px 20px; display: grid; place-content: center; justify-items: center; text-align: center; }
.not-found h1 { margin: 22px 0 4px; font-size: 32px; }
.not-found p { margin: 0 0 22px; color: var(--muted); }
.not-found a { color: var(--accent); text-decoration: none; }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
  .article-wrap { padding-inline: 52px; }
}

@media (max-width: 820px) {
  :root { --header-height: 58px; }
  .docs-header { padding: 0 16px; }
  .brand { gap: 8px; font-size: 15px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-divider { margin-inline: 0; }
  .search-trigger, .console-link { display: none; }
  .menu-button { display: block; }
  .docs-shell { display: block; }
  .sidebar { position: fixed; z-index: 45; top: var(--header-height); bottom: 0; left: 0; width: min(320px, 86vw); height: auto; padding: 20px; background: #fff; box-shadow: 16px 0 40px rgba(0,0,0,.12); transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-search { display: block; }
  .article-wrap { padding: 28px 22px 70px; }
  .breadcrumbs { margin-bottom: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .breadcrumbs > * { margin-right: 6px; }
  .markdown-body h1 { font-size: 30px; }
  .markdown-body h2 { margin-top: 40px; font-size: 23px; }
  .article-pagination { grid-template-columns: 1fr; }
  .article-pagination > span:empty { display: none; }
  .pagination-card.next { text-align: left; }
  .copy-code { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
