:root {
  --bg: #f6f1e6;
  --surface: #fffaf0;
  --surface-2: #efe5d0;
  --text: #2f2418;
  --muted: #6e5c48;
  --border: #dccbaa;
  --accent: #3f8a4a;
  --accent-ink: #ffffff;
  --gold: #c99a2e;
  --danger: #b8432f;
  --code-bg: #2b241c;
  --code-text: #f4ead6;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1611;
    --surface: #231e17;
    --surface-2: #2d261d;
    --text: #efe6d6;
    --muted: #b3a28a;
    --border: #3d3427;
    --accent: #6cbf76;
    --accent-ink: #10200f;
    --gold: #e0b54c;
    --danger: #e57a63;
    --code-bg: #120f0b;
    --code-text: #f1e7d3;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1611;
  --surface: #231e17;
  --surface-2: #2d261d;
  --text: #efe6d6;
  --muted: #b3a28a;
  --border: #3d3427;
  --accent: #6cbf76;
  --accent-ink: #10200f;
  --gold: #e0b54c;
  --danger: #e57a63;
  --code-bg: #120f0b;
  --code-text: #f1e7d3;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); }
header.top {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
nav.links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; }
nav.links a { color: var(--muted); text-decoration: none; }
nav.links a:hover, nav.links a[aria-current="page"] { color: var(--text); }
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
aside.toc { position: sticky; top: 72px; align-self: start; font-size: 14px; }
aside.toc a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0; }
aside.toc a:hover { color: var(--text); }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  aside.toc { position: static; display: none; }
}
h1 { font-size: 32px; line-height: 1.2; margin: 8px 0 8px; }
h2 { font-size: 23px; margin: 40px 0 10px; padding-top: 8px; border-top: 1px solid var(--border); }
h3 { font-size: 18px; margin: 24px 0 8px; }
.lede { color: var(--muted); font-size: 18px; margin: 0 0 20px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font: 13.5px/1.55 var(--mono);
}
pre code { background: none; padding: 0; color: inherit; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.note {
  border-left: 4px solid var(--gold);
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 14px 0;
}
.note.warn { border-color: var(--danger); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 10px 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-left: 4px; white-space: nowrap; }
.tag.danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.tag.panel { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--text); }
.filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.danger { background: var(--danger); color: #fff; border-color: transparent; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 14px; color: var(--muted); }
.out {
  white-space: pre-wrap;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 12px 14px;
  border-radius: var(--radius);
  font: 13px/1.5 var(--mono);
  min-height: 80px;
  max-height: 420px;
  overflow: auto;
}
.ok { color: var(--accent); }
.bad { color: var(--danger); }
footer { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 16px; border-top: 1px solid var(--border); }
