:root {
  color-scheme: light;
  --canvas: #fcfcfe;
  --panel: #fff;
  --ink: #171b31;
  --muted: #545e74;
  --line: #dfe3ee;
  --accent: #4849b5;
  --accent-strong: #393a9c;
  --accent-wash: #eeeffc;
  --soft: #f5f6fb;
  --header-height: 68px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-height) + 22px); }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button, input { font: inherit; }
button { cursor: pointer; }
svg { width: 1.15em; height: 1.15em; flex: none; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 10; padding: 10px; background: var(--panel); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}
.header-inner, .site-footer {
  width: min(100% - 48px, 1440px);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-inner { min-height: calc(var(--header-height) - 1px); }
.brand, .header-actions, .platform-link, .search-trigger { display: inline-flex; align-items: center; }
.brand { gap: 10px; white-space: nowrap; }
.brand strong { font-size: 19px; letter-spacing: -.035em; }
.brand-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: white; background: var(--accent); }
.brand-label { padding-left: 10px; border-left: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.header-actions { gap: 22px; }
.platform-link { gap: 5px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.search-trigger {
  gap: 8px;
  min-width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}
.search-trigger:hover { border-color: var(--accent); color: var(--accent); }
kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }

.home { width: min(100% - 72px, 1200px); margin: 50px auto 68px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 36%);
  align-items: center;
  gap: clamp(24px, 6vw, 84px);
  min-height: 330px;
  padding: clamp(30px, 5vw, 68px);
  border: 1px solid #dce0f8;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 95% 95%, #dbdefb 0%, transparent 52%),
    linear-gradient(118deg, #f2f1fc 0%, #f4f5ff 52%, #e9edfc 100%);
}
.eyebrow { margin: 0 0 14px; color: var(--accent-strong); font-size: 15px; font-weight: 700; }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 68px); letter-spacing: -.052em; line-height: 1.1; }
.hero-description { margin: 18px 0 25px; color: var(--muted); font-size: clamp(16px, 1.6vw, 19px); line-height: 1.65; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .secondary { display: inline-flex; align-items: center; gap: 9px; padding: 10px 15px; border-radius: 8px; font-size: 15px; font-weight: 650; }
.primary { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-strong); color: #fff; }
.secondary { border: 1px solid #cdd1ee; background: #ffffff70; color: var(--accent-strong); }
.secondary:hover { background: white; }
.hero-index { border-top: 1px solid #b8bde3; border-bottom: 1px solid #b8bde3; padding: 18px 4px 12px; }
.hero-index-title { display: flex; align-items: center; gap: 8px; color: var(--accent-strong); }
.hero-index ol { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: step; }
.hero-index li { display: flex; align-items: center; gap: 14px; counter-increment: step; border-bottom: 1px solid #d3d6ee; }
.hero-index li:last-child { border-bottom: 0; }
.hero-index li::before { content: '0' counter(step); color: var(--accent-strong); font: 13px ui-monospace, monospace; }
.hero-index a { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex: 1; padding: 12px 0; font-weight: 600; }
.hero-index a svg, .topic a svg { color: var(--accent); }

.topics { margin-top: 50px; }
.topics > h2 { font-size: 26px; margin: 0 0 15px; }
.topic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.topic { border-top: 1px solid var(--line); padding-top: 17px; }
.topic-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--accent-wash); color: var(--accent); }
.topic h3 { margin: 11px 0 5px; font-size: 19px; }
.topic p { margin: 0; min-height: 3.2em; color: var(--muted); font-size: 14px; line-height: 1.6; }
.topic ul, .sidebar ul, .toc ul, .mobile-toc ul, #search-results { list-style: none; margin: 0; padding: 0; }
.topic ul { margin-top: 8px; }
.topic a { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.topic a:hover { text-decoration: underline; text-underline-offset: 4px; }

.docs {
  width: min(100% - 48px, 1440px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 190px;
  gap: clamp(25px, 4vw, 58px);
  align-items: start;
}
.sidebar, .toc {
  position: sticky;
  top: var(--header-height);
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  padding: 30px 0;
  scrollbar-width: thin;
}
.sidebar { border-right: 1px solid var(--line); padding-right: 15px; }
.sidebar section + section { margin-top: 23px; }
.sidebar h2, .toc h2 { margin: 0 0 8px; font-size: 14px; }
.sidebar a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.sidebar a:hover, .sidebar [aria-current] { color: var(--accent-strong); background: var(--accent-wash); }
.sidebar [aria-current] { font-weight: 700; }
.article-main { padding: 40px 0 55px; width: 100%; max-width: 840px; justify-self: center; }
.crumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.crumb a:hover { text-decoration: underline; }
.article-main h1, .missing h1 { margin: 15px 0 10px; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.04em; line-height: 1.2; }
.article-summary { color: var(--muted); margin: 0 0 25px; font-size: 17px; line-height: 1.65; }
.prose { font-size: 16px; line-height: 1.85; overflow-wrap: anywhere; }
.prose h2 { font-size: 25px; line-height: 1.4; margin: 34px 0 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 24px 0 8px; font-size: 19px; }
.prose p, .prose ol, .prose ul, .prose pre, .prose blockquote { margin: 0 0 15px; }
.prose ol, .prose ul { padding-left: 1.6em; }
.prose li + li { margin-top: 6px; }
.prose a:not(.section-link) { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.prose img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.prose blockquote { border-left: 3px solid var(--accent); padding: 9px 15px; background: var(--accent-wash); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose pre { overflow: auto; padding: 14px 16px; border-radius: 8px; color: #e9ebff; background: #252842; }
.prose code { font: .91em ui-monospace, SFMono-Regular, Consolas, monospace; }
.prose :not(pre) > code { border-radius: 4px; padding: 2px 5px; background: var(--soft); }
.section-link { opacity: 0; color: var(--accent); padding-inline: 4px; font-size: .75em; }
h2:hover .section-link, h3:hover .section-link, .section-link:focus-visible { opacity: 1; }
.table-scroll { overflow-x: auto; margin-bottom: 16px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose td, .prose th { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--soft); }
.prose td:first-child { min-width: 104px; }
.toc nav { border-left: 1px solid var(--line); padding-left: 14px; }
.toc a, .mobile-toc a { display: block; padding: 5px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.toc a:hover, .mobile-toc a:hover { color: var(--accent); }
.mobile-nav, .mobile-toc { display: none; }
.adjacent { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 35px; padding-top: 16px; border-top: 1px solid var(--line); }
.adjacent a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; font-weight: 650; }
.adjacent a:last-child { text-align: right; }
.adjacent small { display: block; color: var(--muted); font-weight: 400; margin-bottom: 3px; }
.missing { width: min(100% - 48px, 800px); padding: 70px 0; margin: auto; }

.site-footer { padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer a { display: inline-flex; align-items: center; gap: 4px; }
#search-dialog { width: min(600px, 100% - 28px); max-height: min(680px, 88dvh); margin: min(8vh, 65px) auto auto; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); }
#search-dialog::backdrop { background: #171b318a; }
.search-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.search-head h2 { margin: 0; font-size: 19px; }
.search-head button { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; color: var(--muted); }
.search-field { display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); }
.search-field:focus-within { border-color: var(--accent); }
.search-field input { flex: 1; width: 100%; border: 0; background: transparent; color: var(--ink); padding: 10px 0; outline: none; }
#search-status { color: var(--muted); font-size: 13px; margin: 10px 0; }
#search-results a { display: block; border-top: 1px solid var(--line); padding: 9px 6px; }
#search-results a:hover, #search-results a:focus-visible { background: var(--accent-wash); }
#search-results span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }

@media (max-width: 1080px) {
  .docs { grid-template-columns: 210px minmax(0, 1fr); gap: 30px; }
  .toc { display: none; }
  .mobile-toc { display: block; margin: 0 0 20px; }
}
@media (max-width: 900px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic p { min-height: auto; }
}
@media (max-width: 700px) {
  :root { --header-height: 57px; }
  .header-inner, .site-footer, .docs, .home { width: calc(100% - 32px); }
  .header-actions { gap: 10px; }
  .search-trigger { min-width: auto; padding: 7px; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .home { margin-top: 25px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 23px; }
  .topics { margin-top: 32px; }
  .docs { display: block; }
  .sidebar { position: static; max-height: none; border: 0; padding: 15px 0 0; }
  .mobile-nav { display: block; }
  .mobile-nav nav { padding: 15px 0; }
  .desktop-nav { display: none; }
  .mobile-nav, .mobile-toc { border: 1px solid var(--line); border-radius: 7px; padding: 8px 11px; font-size: 14px; }
  summary { cursor: pointer; font-weight: 650; }
  .mobile-toc ul { padding: 7px 0 0 13px; }
  .article-main { padding: 24px 0 40px; }
  .search-trigger { position: relative; }
  .search-trigger span { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 400px) {
  .brand-label { display: none; }
  .topic-grid { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .site-footer, .sidebar, .toc, .mobile-toc, .adjacent, .section-link { display: none; }
  .docs { display: block; width: 100%; }
  .article-main { padding: 0; max-width: none; }
  .prose pre { color: black; background: white; border: 1px solid #888; }
}
