:root {
  --bg: #0b0f0e; --surface: #121917; --border: #22302c; --text: #e6efec; --muted: #8ea39c;
  --accent: #10b981; --accent-ink: #052e1f; --code: #0f1614; --warn: #fbbf24;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f7faf9; --surface: #fff; --border: #d7e3df; --text: #0d1714; --muted: #52645e; --accent: #047857; --code: #eef4f2; --warn: #92400e; color-scheme: light; }
}
:root[data-theme="light"] { --bg: #f7faf9; --surface: #fff; --border: #d7e3df; --text: #0d1714; --muted: #52645e; --accent: #047857; --code: #eef4f2; --warn: #92400e; color-scheme: light; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 30; }
header.bar { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { font-family: var(--mono); font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; }
.search input:hover { border-color: var(--muted); }
#results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; max-height: 70vh; overflow: auto; box-shadow: 0 12px 32px rgba(0,0,0,.35); }
#results a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
#results a:hover, #results a:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); }
#results a span { display: block; color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .empty { margin: 8px; color: var(--muted); font-size: 0.9rem; }
.icon-btn, .menu { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 11px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.icon-btn:hover, .menu:hover { border-color: var(--accent); }
.icon-btn:active, .menu:active { transform: translateY(1px); }
.menu { display: none; }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 220px; gap: 32px; max-width: 1280px; margin: 0 auto; padding: 0 16px; }
aside.side { position: sticky; top: 58px; align-self: start; max-height: calc(100vh - 58px); overflow: auto; padding: 24px 0; }
.side h2, .toc h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.side a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 0.93rem; }
.side a:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.side a[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.side .ext { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
main { padding: 32px 0 64px; min-width: 0; }
main h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.02em; }
main h2 { margin: 40px 0 12px; font-size: 1.4rem; padding-top: 8px; border-top: 1px solid var(--border); }
main h3 { margin: 28px 0 8px; font-size: 1.1rem; }
main h2 .anchor, main h3 .anchor { opacity: 0; margin-left: 6px; text-decoration: none; }
main h2:hover .anchor, main h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
main p, main li { max-width: 78ch; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--code); padding: 2px 5px; border-radius: 5px; }
pre { position: relative; background: var(--code); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
pre code { background: none; padding: 0; font-size: 0.86rem; line-height: 1.55; }
pre .copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 6px; padding: 3px 9px; font-size: 0.75rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
pre:hover .copy, pre .copy:focus-visible { opacity: 1; }
@media (hover: none) { pre .copy { opacity: 1; } }
pre .copy:hover { color: var(--text); border-color: var(--accent); }
table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.92rem; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
blockquote { margin: 16px 0; padding: 8px 16px; border-left: 3px solid var(--warn); background: var(--surface); border-radius: 0 8px 8px 0; }
blockquote p { margin: 6px 0; }
details { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; margin: 12px 0; background: var(--surface); }
summary { cursor: pointer; font-weight: 600; }
.tool { border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px 12px; margin: 16px 0; background: var(--surface); }
.tool h3 { font-family: var(--mono); margin-top: 14px; }
.tag { display: inline-block; font-size: 0.72rem; font-family: var(--sans); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px; margin-left: 8px; vertical-align: middle; }
nav.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; flex-wrap: wrap; }
nav.pager a { flex: 1; min-width: 160px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; text-decoration: none; color: var(--text); background: var(--surface); }
nav.pager a:hover { border-color: var(--accent); }
nav.pager small { display: block; color: var(--muted); }
nav.pager a.next { text-align: right; }
.toc { position: sticky; top: 58px; align-self: start; padding: 32px 0; max-height: calc(100vh - 58px); overflow: auto; font-size: 0.86rem; }
.toc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--border); color: var(--muted); text-decoration: none; }
.toc a.l3 { padding-left: 22px; }
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }
.meta { color: var(--muted); font-size: 0.85rem; }
footer.foot { max-width: 1280px; margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
@media (max-width: 1080px) { .layout { grid-template-columns: 220px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .menu { display: inline-block; }
  aside.side { display: none; position: static; max-height: none; padding: 12px 0; border-bottom: 1px solid var(--border); }
  aside.side[data-open="true"] { display: block; }
  .brand span { display: none; }
}
