:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --text: #17202a;
  --muted: #617083;
  --line: #dce3ec;
  --accent: #0f8b8d;
  --accent-strong: #0b6364;
  --warm: #b14d3a;
  --code: #10212b;
  --shadow: 0 16px 36px rgba(31, 45, 61, .10);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111417;
  --surface: #191f24;
  --surface-soft: #20282f;
  --text: #eef3f7;
  --muted: #a8b4c0;
  --line: #303941;
  --accent: #31c7b7;
  --accent-strong: #83eadf;
  --warm: #f08b65;
  --code: #0d1117;
  --shadow: 0 18px 40px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 190px; white-space: nowrap; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.brand-title { display: inline-block; color: var(--text); font-size: 18px; font-weight: 800; line-height: 1; letter-spacing: 0; }
.topnav { display: flex; gap: 20px; color: var(--muted); font-size: 15px; }
.topnav a:hover, .side-nav a:hover, .footer a:hover { color: var(--accent-strong); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.text-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
}
.text-button:hover { border-color: var(--accent); color: var(--accent-strong); }
[data-menu-toggle] { display: none; }
.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 66px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.theme-switch-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 4px 10px rgba(15, 139, 141, .24);
  transition: transform .18s ease, background .18s ease;
}
[data-theme="dark"] .theme-switch-indicator {
  transform: translateX(30px);
  background: #4d5f73;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .28);
}
.theme-switch-icon {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  padding: 7px;
  border-radius: 999px;
  transition: color .18s ease;
}
.theme-switch-sun { color: #fff; }
.theme-switch-moon { color: var(--muted); }
[data-theme="dark"] .theme-switch-sun { color: var(--muted); }
[data-theme="dark"] .theme-switch-moon { color: #fff; }

.site-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.sidebar-panel { height: 100%; overflow: auto; padding: 24px 18px 32px; }
.search-box { position: relative; margin-bottom: 22px; }
.search-box label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.search-box input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}
.search-results {
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 8px;
}
.search-result { display: block; padding: 10px; border-radius: 6px; }
.search-result:hover { background: var(--surface-soft); }
.search-result strong { display: block; font-size: 14px; }
.search-result span { display: block; color: var(--muted); font-size: 12px; }
.search-empty { padding: 12px; color: var(--muted); font-size: 14px; }

.side-group { margin: 0 0 12px; }
.side-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 0 0 8px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}
.side-group-title:hover { color: var(--accent-strong); background: var(--surface-soft); }
.side-group-title::after { content: "▾"; font-size: 13px; transition: transform .18s ease; }
.side-group.collapsed .side-group-title::after { transform: rotate(-90deg); }
.side-group.collapsed .side-group-pages { display: none; }
.side-nav a {
  display: block;
  padding: 10px 12px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.35;
}
.side-nav a.active {
  color: var(--text);
  background: var(--surface-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.content {
  min-width: 0;
  padding: 44px clamp(24px, 5vw, 80px) 72px;
}
.doc-article, .home-content > section {
  max-width: 920px;
}
.breadcrumb {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}
.breadcrumb span::before { content: "/"; margin-right: 10px; color: var(--line); }
h1 {
  margin: 0 0 18px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}
h2 { margin: 42px 0 14px; font-size: 26px; line-height: 1.2; letter-spacing: 0; }
h3 { margin: 28px 0 10px; font-size: 19px; letter-spacing: 0; }
p, li { color: var(--muted); }
.doc-article > p:first-of-type { font-size: 18px; color: var(--text); }

.hero {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: 52px;
  max-width: 1220px;
  min-height: calc(100vh - 180px);
  padding-bottom: 36px;
}
.eyebrow { margin: 0 0 12px; color: var(--accent-strong); font-weight: 700; }
.hero-copy p:not(.eyebrow) { font-size: 19px; max-width: 700px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.primary-link, .secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
}
.primary-link { background: var(--accent); color: #fff; }
.secondary-link { border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.hero-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.hero-showcase figure {
  margin: 0;
  aspect-ratio: 3 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-showcase .showcase-main { grid-column: 1 / -1; }
.hero-showcase img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-section { margin-top: 8px; padding-top: 28px; border-top: 1px solid var(--line); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.card-grid a, .feature-strip > div {
  display: grid;
  gap: 8px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}
.card-grid span, .feature-strip span { color: var(--muted); font-size: 14px; }
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.link-grid a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
  color: var(--accent-strong);
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: var(--surface-soft); }
td { color: var(--muted); }
pre {
  position: relative;
  overflow: auto;
  background: var(--code);
  color: #d9eef2;
  border-radius: 8px;
  padding: 18px;
  border: 1px solid var(--line);
}
code { font-family: "JetBrains Mono", Consolas, monospace; font-size: 14px; }
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
}
.doc-alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 18px 0;
  color: var(--muted);
}
.doc-alert-important, .doc-alert-warning { border-left-color: var(--warm); }
.doc-figure { margin: 28px 0; }
.doc-figure img {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: zoom-in;
}
.doc-figure figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; }
.page-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.page-nav a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}
.page-nav small { display: block; color: var(--muted); }
.page-nav strong { color: var(--accent-strong); }

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 28px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0,0,0,.45);
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(0,0,0,.76);
}
.lightbox[hidden], .backdrop[hidden] { display: none; }
.lightbox img { max-height: 86vh; border-radius: 8px; background: #fff; }
.lightbox button {
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  background: rgba(255,255,255,.1);
  color: #fff;
}

@media (max-width: 1080px) {
  .site-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; min-height: auto; }
}

@media (max-width: 767px) {
  .topbar { padding: 0 14px; gap: 10px; min-height: 62px; }
  .brand { min-width: 0; }
  .topnav { display: none; }
  [data-menu-toggle] { display: inline-flex; align-items: center; }
  .top-actions { gap: 6px; }
  .text-button { padding: 0 9px; }
  .site-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 62px auto 0 0;
    z-index: 50;
    width: min(88vw, 340px);
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 30px 18px 54px; }
  h1 { font-size: 36px; }
  h2 { font-size: 23px; }
  .feature-strip, .card-grid, .link-grid, .page-nav { grid-template-columns: 1fr; }
  .hero { gap: 24px; }
}
