:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #657184;
  --line: #e5eaf1;
  --blue: #2878f0;
  --blue-soft: #edf5ff;
  --green: #13a36f;
  --surface: #ffffff;
  --sidebar: #f7f9fc;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--surface); letter-spacing: 0; }
button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.docs-header {
  height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  display: grid;
  grid-template-columns: 260px minmax(280px, 620px) 1fr;
  align-items: center;
  gap: 28px;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.docs-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.docs-brand img { width: 32px; height: 32px; object-fit: contain; background: transparent; }
.docs-brand strong { font-size: 16px; white-space: nowrap; }
.docs-search { height: 40px; border: 1px solid #dce3ed; background: #f7f9fc; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 7px; color: #7b8797; }
.docs-search:focus-within { border-color: #8ab8f6; background: #fff; box-shadow: 0 0 0 3px rgba(40,120,240,.1); }
.docs-search svg { width: 17px; flex: 0 0 auto; }
.docs-search input { border: 0; outline: 0; background: transparent; min-width: 0; flex: 1; color: var(--ink); }
.docs-search span { font-size: 11px; border: 1px solid #d9e0ea; background: #fff; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.home-link { justify-self: end; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: #48576a; font-size: 13px; }
.home-link:hover { color: var(--blue); }
.home-link svg { width: 16px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.icon-button svg { width: 19px; }
.mobile-only, .mobile-search { display: none; }

.docs-layout { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; }
.docs-sidebar { background: var(--sidebar); border-right: 1px solid var(--line); padding: 26px 20px 50px; position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto; }
.sidebar-title, .toc-title { font-size: 11px; font-weight: 800; color: #8a95a5; text-transform: uppercase; margin: 0 10px 16px; }
.nav-group { margin-bottom: 24px; }
.nav-group-title { padding: 0 10px; font-size: 13px; font-weight: 800; margin-bottom: 7px; }
.nav-group a { display: block; padding: 8px 10px; border-left: 2px solid transparent; text-decoration: none; color: #607086; font-size: 13px; line-height: 1.45; }
.nav-group a:hover { color: var(--ink); background: #f0f4f9; }
.nav-group a.active { color: var(--blue); border-left-color: var(--blue); background: #eaf3ff; font-weight: 700; }
.nav-loading { padding: 10px; color: var(--muted); font-size: 13px; }

.docs-main { min-width: 0; padding: 48px clamp(28px, 5vw, 84px) 100px; }
.docs-article { width: min(820px, 100%); margin: 0 auto; }
.article-head { padding-bottom: 26px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.article-category { color: var(--blue); font-size: 12px; font-weight: 800; margin-bottom: 12px; }
.article-head h1 { margin: 0; font-size: 46px; line-height: 1.17; font-weight: 760; }
.article-summary { margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.article-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 18px; font-size: 12px; color: #7b8797; }
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta svg { width: 14px; }
.article-visual { margin: 0 0 34px; border-bottom: 1px solid var(--line); padding-bottom: 28px; }
.article-visual img { display: block; width: 100%; max-height: 520px; object-fit: contain; background: transparent; cursor: zoom-in; }
.article-body { color: #334155; font-size: 15px; line-height: 1.8; word-break: break-word; }
.article-body h1 { display: none; }
.article-body h2 { color: var(--ink); font-size: 25px; line-height: 1.35; margin: 2em 0 .7em; scroll-margin-top: 90px; }
.article-body h3 { color: var(--ink); font-size: 18px; margin: 1.7em 0 .55em; scroll-margin-top: 90px; }
.article-body p { margin: 0 0 1.15em; }
.article-body ul, .article-body ol { padding-left: 1.45em; }
.article-body li { margin: .42em 0; }
.article-body a { color: var(--blue); }
.article-body blockquote { margin: 22px 0; padding: 13px 16px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: #355272; }
.article-body blockquote p { margin: 0; }
.article-body pre { margin: 22px 0; border: 1px solid #202f42; background: #111b2a; color: #e8eef8; padding: 17px 18px; overflow: auto; border-radius: 7px; line-height: 1.6; }
.article-body code { font-family: Consolas, monospace; font-size: .92em; }
.article-body :not(pre) > code { background: #eef2f7; color: #23415f; padding: 2px 5px; border-radius: 4px; }
.article-body img { max-width: 100%; height: auto; border: 1px solid var(--line); cursor: zoom-in; }
.article-body img:focus-visible { outline: 3px solid rgba(40, 120, 240, .24); outline-offset: 4px; }
.article-body table { display: block; width: 100%; margin: 22px 0; border-collapse: collapse; overflow-x: auto; }
.article-body th, .article-body td { min-width: 120px; padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.article-body th { background: var(--sidebar); color: var(--ink); }
.article-body hr { height: 1px; margin: 30px 0; border: 0; background: var(--line); }

.article-toc { border-left: 1px solid var(--line); padding: 34px 20px; position: sticky; top: 68px; height: calc(100vh - 68px); overflow: auto; }
.article-toc nav a { display: block; border-left: 1px solid #d9e0ea; padding: 6px 0 6px 12px; text-decoration: none; color: #7a8798; font-size: 12px; line-height: 1.45; }
.article-toc nav a.sub { padding-left: 23px; }
.article-toc nav a:hover, .article-toc nav a.active { color: var(--blue); border-left-color: var(--blue); }

.search-results { width: min(820px, 100%); margin: 0 auto; }
.search-results h1 { font-size: 28px; margin: 0 0 22px; }
.search-item { display: block; border-bottom: 1px solid var(--line); padding: 18px 2px; text-decoration: none; }
.search-item:hover strong { color: var(--blue); }
.search-item strong { display: block; font-size: 17px; }
.search-item p { color: var(--muted); line-height: 1.6; margin: 7px 0 0; font-size: 13px; }
.search-item span { color: var(--blue); font-size: 11px; }
.search-empty, .article-error { padding: 54px 0; text-align: center; color: var(--muted); }
.article-error button { margin-top: 16px; border: 0; background: var(--blue); color: #fff; padding: 9px 15px; border-radius: 6px; }
.article-loading { display: flex; gap: 7px; justify-content: center; padding: 100px 0; }
.article-loading span { width: 8px; height: 8px; background: var(--blue); border-radius: 50%; animation: loading 1s infinite alternate; }
.article-loading span:nth-child(2) { animation-delay: .2s; background: var(--green); }
.article-loading span:nth-child(3) { animation-delay: .4s; }
@keyframes loading { to { opacity: .25; transform: translateY(-5px); } }

.article-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.article-share-button { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); cursor: pointer; }
.article-share-button:hover { color: var(--blue); border-color: #8ab8f6; }
.article-share-button svg { width: 16px; height: 16px; }
.article-meta b { font: inherit; }
.docs-article { position: relative; isolation: isolate; }
.docs-article > :not(.doc-watermark) { position: relative; z-index: 1; }
.doc-watermark { position: absolute; z-index: 3; inset: 0; display: grid; grid-template-columns: repeat(auto-fill,minmax(var(--doc-watermark-spacing,180px),1fr)); grid-auto-rows: calc(var(--doc-watermark-spacing,180px) * .58); align-items: center; overflow: hidden; pointer-events: none; user-select: none; }
.doc-watermark span { justify-self: center; color: var(--ink); font-size: var(--doc-watermark-size,14px); font-weight: 700; white-space: nowrap; opacity: var(--doc-watermark-opacity,.08); transform: rotate(var(--doc-watermark-angle,-24deg)); }
.image-preview-watermark { position: absolute; z-index: 5; top: 0; left: 0; width: 0; height: 0; display: grid; grid-template-columns: repeat(var(--preview-watermark-columns,3),minmax(0,1fr)); grid-auto-rows: 1fr; align-items: center; padding: 2%; overflow: hidden; pointer-events: none; }
.image-preview-watermark:empty { display: none; }
.image-preview-watermark span { justify-self: center; color: #b7c7dc; font-size: var(--doc-watermark-size,14px); font-weight: 700; white-space: nowrap; opacity: var(--doc-watermark-opacity,.1); mix-blend-mode: difference; transform: rotate(var(--doc-watermark-angle,-24deg)); }
.docs-share-dialog { width: min(520px,calc(100vw - 28px)); max-width: none; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px rgba(15,23,42,.24); }
.docs-share-dialog::backdrop { background: rgba(15,23,42,.5); backdrop-filter: blur(3px); }
.share-dialog-shell > header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.share-dialog-shell > header > div { display: grid; gap: 2px; min-width: 0; }
.share-dialog-shell > header span { color: var(--blue); font-size: 11px; font-weight: 800; }
.share-dialog-shell > header strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.share-dialog-body { display: grid; gap: 18px; padding: 22px; }
.share-qr { width: 188px; height: 188px; display: grid; place-items: center; justify-self: center; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.share-qr img,.share-qr canvas { display: block; width: 164px !important; height: 164px !important; }
.share-link-field { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.share-link-field input { min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--sidebar); }
.docs-share-dialog .button { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); font-weight: 700; cursor: pointer; }
.docs-share-dialog .button:hover { color: var(--blue); border-color: #8ab8f6; }
.docs-share-dialog .button.primary { color: #fff; border-color: var(--blue); background: var(--blue); }
.docs-share-dialog .button.primary:hover { color: #fff; filter: brightness(.94); }
.docs-share-dialog .button.is-copy-success { color: #fff; border-color: #168a55; background: #168a55; }
.docs-share-dialog .button.is-copy-success svg { animation: copy-success-icon .28s cubic-bezier(.2,.85,.3,1.35); }
.share-link-field .button,.share-actions .button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.share-link-field svg,.share-actions svg { width: 16px; height: 16px; }
.share-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.docs-toast { position: fixed; z-index: 10000; left: 50%; bottom: max(28px,env(safe-area-inset-bottom)); max-width: min(420px,calc(100vw - 32px)); min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 10px 15px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; color: #fff; background: #172033; box-shadow: 0 14px 38px rgba(15,23,42,.28); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transform: translate(-50%,12px); transition: opacity .2s ease,transform .2s ease; }
.docs-toast.is-visible { opacity: 1; transform: translate(-50%,0); }
.docs-toast.is-error { background: #b42318; }
.docs-toast svg { width: 18px; height: 18px; flex: 0 0 auto; }
.reading-progress { position: fixed; z-index: 34; top: 67px; right: 0; left: 0; height: 2px; pointer-events: none; }
.reading-progress i { display: block; width: 0; height: 100%; background: var(--blue); transition: width .18s ease; }
.article-body pre { position: relative; }
.code-copy-button { position: absolute; top: 9px; right: 9px; min-width: 48px; height: 30px; padding: 0 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 5px; color: #dbeafe; background: rgba(17,24,39,.82); cursor: pointer; }
.related-docs { margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.related-docs > header span { color: var(--blue); font-size: 11px; font-weight: 800; }
.related-docs > header h2 { margin: 4px 0 18px; font-size: 25px; }
.related-docs > div { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.related-docs a { min-width: 0; display: grid; align-content: start; gap: 8px; padding: 17px; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; background: var(--surface); }
.related-docs a:hover { border-color: #8ab8f6; box-shadow: 0 10px 28px rgba(40,120,240,.08); }
.related-docs a strong { font-size: 15px; }
.related-docs a p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.related-docs a span { color: var(--blue); font-size: 10px; font-weight: 700; }

@media (max-width: 1120px) {
  .docs-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .article-toc { display: none; }
  .docs-header { grid-template-columns: 230px minmax(260px, 1fr) auto; }
}

@media (max-width: 760px) {
  .docs-header { height: 60px; grid-template-columns: auto minmax(0,1fr) auto; padding: 0 14px; gap: 10px; }
  .docs-header > .docs-search { display: none; }
  .docs-brand strong { font-size: 14px; }
  .docs-brand img { width: 29px; height: 29px; }
  .home-link span { display: none; }
  .home-link { width: 38px; height: 38px; border: 1px solid var(--line); justify-content: center; border-radius: 6px; }
  .mobile-only { display: inline-flex; }
  .mobile-search { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 60px; background: #fff; z-index: 20; }
  .docs-layout { display: block; min-height: calc(100vh - 120px); }
  .docs-sidebar { position: fixed; z-index: 45; top: 0; left: 0; height: 100vh; width: min(310px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 22px 0 60px rgba(15,23,42,.18); }
  body.menu-open .docs-sidebar { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; z-index: 40; border: 0; background: rgba(15,23,42,.42); width: 100%; height: 100%; }
  .docs-main { padding: 34px 20px 80px; }
  .article-head h1 { font-size: 32px; }
  .article-visual { margin-left: -12px; margin-right: -12px; }
  .article-actions { margin-top: 16px; }
  .reading-progress { top: 59px; }
  .article-share-button { width: 100%; justify-content: center; }
  .docs-share-dialog { width: 100%; max-height: calc(100dvh - 54px); margin: auto 0 0; border-width: 1px 0 0; border-radius: 8px 8px 0 0; }
  .docs-share-dialog[open] { animation: share-sheet-in .22s cubic-bezier(.22,.8,.2,1); }
  .share-dialog-body { padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .share-link-field { grid-template-columns: 1fr; }
  .share-actions { grid-template-columns: 1fr; }
  .related-docs > div { grid-template-columns: 1fr; }
}

@keyframes share-sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes copy-success-icon { from { opacity: 0; transform: scale(.55) rotate(-18deg); } to { opacity: 1; transform: scale(1) rotate(0); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .docs-header,.mobile-search,.docs-sidebar,.article-toc,.reading-progress,.article-actions,.doc-watermark { display: none !important; }
  .docs-layout,.docs-main { display: block; min-height: 0; padding: 0; }
  .docs-article { width: 100%; }
  .article-body { color: #111; }
}
