:root {
  --bg: #fff8f2;
  --surface: #fffdf9;
  --line: rgba(169, 72, 0, .16);
  --text: #2d1b12;
  --muted: #705f55;
  --brand: #a94800;
  --brand-dark: #7c3200;
  --hint: #f8ede4;
  --page-gutter: 40px;
  color-scheme: light;
}

html.dark {
  --bg: #181917;
  --surface: #22211e;
  --line: rgba(234, 184, 148, .2);
  --text: #f2eee7;
  --muted: #c9b8aa;
  --brand: #ef8b4d;
  --brand-dark: #f0a06e;
  --hint: #2a241f;
  color-scheme: dark;
}

* { box-sizing: border-box; letter-spacing: 0; }
html { min-width: 0; background: var(--bg); scroll-behavior: smooth; }
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 system-ui, "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: transparent; color: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }

.docs-layout {
  width: min(1260px, calc(100% - var(--page-gutter) * 2));
  margin: 32px auto 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.sidebar { position: sticky; top: 24px; min-width: 0; max-height: calc(100dvh - 48px); overflow-y: auto; }
.docs-menu { border-right: 1px solid var(--line); padding-right: 16px; }
.docs-menu summary { margin-bottom: 12px; color: var(--text); cursor: pointer; font-size: 14px; font-weight: 700; }
.toc { display: grid; gap: 2px; }
.toc a {
  display: block;
  padding: 7px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.toc a:hover, .toc a[aria-current="location"] { background: var(--hint); color: var(--brand-dark); }
.toc a[aria-current="location"] { border-left-color: var(--brand); }
.toc a.sub { padding-left: 24px; font-size: 13px; }
.docs-content { min-width: 0; padding-bottom: 64px; overflow-wrap: anywhere; }
.docs-intro { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.docs-intro h1 { margin: 0; font-size: 34px; line-height: 1.35; }
.docs-intro h1 span { color: var(--brand); }
.docs-intro p { margin: 12px 0 0; color: var(--muted); }
.tutorial section { padding-bottom: 32px; }
.tutorial section + section { padding-top: 32px; border-top: 1px solid var(--line); }
.tutorial h2 { margin: 0 0 16px; font-size: 26px; line-height: 1.4; }
.tutorial h3 { margin: 28px 0 12px; color: var(--brand-dark); font-size: 19px; line-height: 1.5; }
.docs-intro, .tutorial h2, .tutorial h3 { scroll-margin-top: 24px; }
.tutorial p { margin: 0 0 16px; }
.tutorial p, .tutorial li { color: var(--muted); }
.tutorial ol, .tutorial ul { margin: 0 0 18px; padding-left: 24px; }
.tutorial li { margin: 8px 0; }
.tutorial strong { color: var(--text); }
.tutorial a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.tutorial a:hover { color: var(--brand-dark); }
.support { display: block; text-align: center; }
.support h2 { margin: 0; font-size: 20px; }
.support a { display: block; width: 200px; max-width: 100%; margin: 16px auto 0; line-height: 0; }
.support img { display: block; width: 100%; height: auto; border-radius: 8px; }
.tutorial .reference-note { margin: 0 0 32px; padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--hint); font-size: 14px; }
.tutorial figure { margin: 20px 0 24px; }
.tutorial figure img { display: block; max-width: 100%; height: auto; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tutorial blockquote { margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--hint); }
.tutorial blockquote p { margin: 0; font-size: 14px; }
.tutorial code { color: var(--brand-dark); font: .94em/1.75 Consolas, "Cascadia Code", monospace; }
.tutorial code.plain-link { text-decoration: underline; text-underline-offset: 3px; }
.tutorial pre {
  max-width: 100%;
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hint);
}
.tutorial pre code {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}
.docs-footer { padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

@media (max-width: 1100px) { :root { --page-gutter: 22px; } }
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 24px; }
  .sidebar { position: static; max-height: none; overflow: visible; }
  .docs-menu { padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .docs-menu summary { margin: 0; padding: 4px 0; }
  .toc { margin-top: 12px; }
}
@media (max-width: 640px) {
  :root { --page-gutter: 20px; }
  .docs-content { padding-bottom: 40px; }
  .docs-intro h1 { font-size: 28px; }
  .tutorial h2 { font-size: 23px; }
  .support h2 { margin-bottom: 16px; font-size: 20px; }
  .tutorial figure { margin: 16px 0 20px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
