:root {
  --bg: #ffffff; --bg-soft: #f6f7f9; --border: #e5e7eb; --text: #1f2328; --muted: #6b7280;
  --primary: #2563eb; --primary-text: #1d4ed8; --code-bg: #f6f8fa; --highlight: #eef4ff;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --header: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --bg-soft: #181b22; --border: #2b303b; --text: #e6e8ee; --muted: #9aa2b1;
    --primary: #3b82f6; --primary-text: #93c5fd; --code-bg: #161b22; --highlight: #1d2740;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.7 var(--font); }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; height: var(--header); display: flex; align-items: center; gap: 20px;
  padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 17px; }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--primary); color: #fff; font-size: 15px; }
.links { display: flex; gap: 18px; }
.links a { color: var(--text); font-size: 14px; }
.menu { display: none; background: none; border: 0; color: var(--text); font-size: 20px; cursor: pointer; }
.search { position: relative; margin-left: auto; }
.search input { width: 240px; height: 34px; padding: 0 30px 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 14px; }
.search input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.search kbd { position: absolute; right: 8px; top: 7px; font: 12px var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.results { position: absolute; right: 0; top: 40px; width: 420px; max-height: 70vh; overflow: auto; margin: 0; padding: 6px;
  list-style: none; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgb(0 0 0 / .18); }
.results li a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.results li a:hover, .results li a.active { background: var(--highlight); text-decoration: none; }
.results small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results .group { color: var(--muted); font-size: 12px; margin-left: 6px; }
.gh { color: var(--text); font-size: 14px; }

/* Hero */
.hero { max-width: 880px; margin: 0 auto; padding: 72px 24px 32px; text-align: center; }
.hero h1 { font-size: 44px; line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto 28px; max-width: 680px; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; padding: 9px 18px; border-radius: 8px; border: 1px solid var(--border); color: var(--text); font-size: 15px; }
.btn:hover { text-decoration: none; background: var(--bg-soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.install { display: inline-block; margin-top: 28px; padding: 8px 16px; border-radius: 8px; background: var(--code-bg); font: 14px var(--mono); }

/* Layout */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; max-width: 1400px; margin: 0 auto; }
.layout.home { grid-template-columns: 250px minmax(0, 1fr) 0; }
.side { position: sticky; top: var(--header); height: calc(100vh - var(--header)); overflow: auto; padding: 20px 12px 40px 20px; border-right: 1px solid var(--border); font-size: 14px; }
.side summary { cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin: 14px 0 4px; list-style: none; }
.side summary::-webkit-details-marker { display: none; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--text); line-height: 1.5; }
.side li a:hover { background: var(--bg-soft); text-decoration: none; }
.side li a[aria-current] { background: var(--highlight); color: var(--primary-text); font-weight: 600; }
main { min-width: 0; padding: 32px 48px 80px; }
article { max-width: 820px; }
.toc { position: sticky; top: var(--header); height: calc(100vh - var(--header)); overflow: auto; padding: 32px 16px; font-size: 13px; }
.toc p { margin: 0 0 8px; font-weight: 600; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 4px 0; line-height: 1.45; }
.toc li.l3 { padding-left: 12px; }
.toc a { color: var(--muted); }
.toc a.active { color: var(--primary-text); }

/* Content */
article h1 { font-size: 32px; line-height: 1.25; margin: 0 0 20px; }
article h2 { font-size: 23px; margin: 44px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
article h3 { font-size: 18px; margin: 30px 0 8px; }
article p, article li { margin: 10px 0; }
article ul, article ol { padding-left: 24px; }
article code { font: .9em var(--mono); background: var(--code-bg); padding: .15em .35em; border-radius: 5px; }
article table { display: block; overflow-x: auto; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
article th, article td { border: 1px solid var(--border); padding: 7px 12px; text-align: left; vertical-align: top; }
article th { background: var(--bg-soft); }
article blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--border); color: var(--muted); }
article img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
article hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.code { position: relative; margin: 16px 0; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); font: 13px/1.6 var(--mono); }
.code pre code { background: none; padding: 0; }
.code pre, .code .c-chroma { background: var(--code-bg) !important; }
.copy { position: absolute; right: 8px; top: 8px; padding: 2px 8px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.code:hover .copy, .copy:focus { opacity: 1; }
.demo { margin: 0 0 28px; }
.demo iframe { display: block; width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); }
.demo figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.demo figcaption a { margin-left: 8px; }
.edit { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; }

@media (max-width: 1200px) { .layout { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .layout, .layout.home { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: var(--header); left: 0; width: 280px; z-index: 9; background: var(--bg); transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / .25); }
  .menu { display: block; }
  .links { display: none; }
  .search input { width: 150px; }
  .results { width: calc(100vw - 32px); right: -60px; }
  main { padding: 24px 16px 64px; }
  .hero h1 { font-size: 32px; }
  .demo iframe { height: 420px; }
}
