:root {
  --ink: #1f2328;
  --muted: #646a72;
  --line: #e3dfd5;
  --bg: #f7f5f0;
  --accent: #1f4b9c;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
@media (max-width: 860px) {
  body { display: block; }
  .toc { position: static !important; height: auto !important; border-right: 0 !important; border-bottom: 1px solid var(--line); }
}
.toc {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 20px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
  font-size: 14px;
}
.toc h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 6px; }
.toc ol { padding-left: 20px; margin: 0; }
.toc li { margin: 3px 0; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
.toc .back { color: var(--accent); font-weight: 600; }

.doc { max-width: 940px; padding: 28px 40px 80px; }
.doc h1 { font-size: 32px; margin: 0 0 8px; }
.doc h2 { font-size: 23px; margin: 44px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 17px; margin: 26px 0 6px; }
.lead { font-size: 17px; color: #3b4047; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; background: #ece8de; padding: 1px 5px; border-radius: 4px; }
dfn { font-style: normal; font-weight: 600; }

pre {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  background: #23262b;
  color: #eef0f2;
  padding: 14px 16px;
  border-radius: 8px;
  overflow: auto;
  margin: 10px 0;
}
pre.syntax { background: #fff; color: var(--ink); border: 1px solid var(--line); }
pre.cheat { font-size: 13px; }

.example-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin: 14px 0 20px;
  overflow: hidden;
}
.example-wrap pre { margin: 0; border-radius: 0; }
.example-out { padding: 14px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.example-card { width: 100%; max-width: 640px; }
.example-card svg { width: 100%; height: auto; display: block; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.example-msg { margin: 0; font-size: 13px; color: #8a5a00; background: #fff6e0; padding: 4px 8px; border-radius: 5px; }
.open-link { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.open-link:hover { text-decoration: underline; }

table { border-collapse: collapse; width: 100%; margin: 10px 0 16px; font-size: 14.5px; background: #fff; }
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: #efece4; font-weight: 600; }
table.ref td:first-child { white-space: nowrap; }

.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 10px 0; }
.swatch { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.swatch .chip { width: 22px; height: 22px; border-radius: 5px; flex: none; }
.swatch small { color: var(--muted); font-size: 11.5px; margin-left: auto; text-align: right; }

dl dt { font-weight: 600; margin-top: 14px; }
dl dd { margin: 4px 0 0 0; color: #3b4047; }
.docfoot { margin-top: 50px; padding-top: 14px; border-top: 1px solid var(--line); }
