:root {
  --bg: #FBFBFE; --surface: #FFFFFF; --surface-2: #F3F4FB; --border: #E3E5F0; --border-strong: #CDD1E4;
  --fg: #0B1020; --fg-2: #2B3150; --muted: #525A7A;
  --iris: #4F46E5; --iris-soft: rgba(79, 70, 229, .08); --violet: #7C3AED; --signal: #0E7490;
  --ok: #047857; --ok-soft: rgba(4, 120, 87, .08); --warn: #B45309; --warn-soft: rgba(180, 83, 9, .08);
  --danger: #B91C1C; --danger-soft: rgba(185, 28, 28, .07);
  --code-bg: #0B1020; --code-fg: #E6E9F5; --code-border: #1E2647; --code-muted: #8A93BC;
  --hl-key: #A5B4FC; --hl-str: #67E8F9; --hl-num: #F0ABFC; --hl-kw: #C4B5FD; --hl-com: #6B7499; --hl-fn: #93C5FD;
  --shadow: 0 1px 2px rgba(11, 16, 32, .04), 0 4px 16px rgba(11, 16, 32, .04);
  --header-bg: rgba(251, 251, 254, .82);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sidebar: 268px; --toc: 220px; --content: 780px; --header-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070B18; --surface: #0E1430; --surface-2: #131A3B; --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14);
    --fg: #EAEDFB; --fg-2: #C9CEEA; --muted: #969FC9;
    --iris: #A5B4FC; --iris-soft: rgba(129, 140, 248, .12); --violet: #C4B5FD; --signal: #22D3EE;
    --ok: #34D399; --ok-soft: rgba(52, 211, 153, .10); --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, .10);
    --danger: #F87171; --danger-soft: rgba(248, 113, 113, .10);
    --code-bg: #050816; --code-border: rgba(255, 255, 255, .07);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .06);
    --header-bg: rgba(7, 11, 24, .78);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070B18; --surface: #0E1430; --surface-2: #131A3B; --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14);
  --fg: #EAEDFB; --fg-2: #C9CEEA; --muted: #969FC9;
  --iris: #A5B4FC; --iris-soft: rgba(129, 140, 248, .12); --violet: #C4B5FD; --signal: #22D3EE;
  --ok: #34D399; --ok-soft: rgba(52, 211, 153, .10); --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, .10);
  --danger: #F87171; --danger-soft: rgba(248, 113, 113, .10);
  --code-bg: #050816; --code-border: rgba(255, 255, 255, .07);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  --header-bg: rgba(7, 11, 24, .78);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 16px/1.7 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: var(--iris); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--iris); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
h1, h2, h3 { font-family: "Space Grotesk", Inter, sans-serif; letter-spacing: -.02em; color: var(--fg); text-wrap: balance; }
p, li { text-wrap: pretty; }
code, pre, kbd, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-ligatures: none; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- header */
header.top {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: var(--header-bg); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.top-in { height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--fg); font: 700 1.15rem "Space Grotesk", sans-serif; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.bars { display: inline-flex; gap: 2.5px; align-items: flex-end; height: 18px; }
.bars i { width: 3px; border-radius: 2px; background: linear-gradient(180deg, #22D3EE, #6366F1); animation: eq 1.4s var(--ease) infinite; }
.bars i:nth-child(1) { height: 60%; } .bars i:nth-child(2) { height: 100%; animation-delay: .18s; }
.bars i:nth-child(3) { height: 40%; animation-delay: .36s; } .bars i:nth-child(4) { height: 80%; animation-delay: .54s; }
@keyframes eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.45); } }
.bars i { transform-origin: bottom; }
.tag { font: 500 .72rem "JetBrains Mono", monospace; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 9px; letter-spacing: .02em; }
.top-spacer { flex: 1; }
.lang { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); }
.lang a { min-width: 36px; min-height: 32px; display: grid; place-items: center; padding: 0 8px; border-radius: 7px; font: 600 .78rem Inter, sans-serif; color: var(--muted); transition: background-color .2s var(--ease), color .2s var(--ease); }
.lang a:hover { color: var(--fg); text-decoration: none; }
.lang a[aria-current="true"] { background: var(--iris-soft); color: var(--iris); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg);
  font: 500 .9rem Inter, sans-serif; cursor: pointer; text-decoration: none;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--iris); border-color: transparent; color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0B1020; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0B1020; } }
.btn.primary:hover { filter: brightness(1.06); background: var(--iris); }
.icon-btn { width: 40px; padding: 0; }
.menu-btn { display: none; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

/* ---------------------------------------------------------------- layout */
.shell { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc); gap: 0; }
aside.side {
  position: sticky; top: var(--header-h); align-self: start; height: calc(100dvh - var(--header-h));
  overflow-y: auto; padding: 24px 16px 40px 20px; border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.search { position: relative; margin-bottom: 18px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input {
  width: 100%; min-height: 40px; padding: 0 40px 0 34px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--fg); font: 400 .9rem Inter, sans-serif;
}
.search input::placeholder { color: var(--muted); }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: .7rem; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; }
.nav-group { margin: 0 0 18px; }
.nav-group h4 { margin: 0 0 6px; padding: 0 10px; font: 600 .72rem Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-group a {
  display: flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--fg-2); font-size: .92rem; position: relative;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.nav-group a:hover { background: var(--surface-2); text-decoration: none; color: var(--fg); }
.nav-group a.active { color: var(--iris); background: var(--iris-soft); font-weight: 500; }
.nav-group a.active::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--iris); }
.nav-empty { display: none; padding: 8px 10px; color: var(--muted); font-size: .88rem; }
main { min-width: 0; padding: 40px 48px 96px; }
.content { max-width: var(--content); margin: 0 auto; }
aside.toc { position: sticky; top: var(--header-h); align-self: start; padding: 40px 20px 0 8px; height: calc(100dvh - var(--header-h)); overflow-y: auto; }
aside.toc h4 { margin: 0 0 10px; font: 600 .72rem Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
aside.toc nav a { display: block; padding: 5px 0 5px 12px; border-left: 1px solid var(--border); color: var(--muted); font-size: .85rem; line-height: 1.4; transition: color .2s var(--ease), border-color .2s var(--ease); }
aside.toc nav a:hover { color: var(--fg); text-decoration: none; }
aside.toc nav a.active { color: var(--iris); border-left-color: var(--iris); }
.toc-card { margin-top: 24px; padding: 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--border); font-size: .84rem; color: var(--muted); line-height: 1.5; }
.toc-card strong { display: block; color: var(--fg); font-weight: 600; margin-bottom: 4px; }
.toc-card .btn { margin-top: 10px; width: 100%; min-height: 36px; padding: 0 10px; font-size: .84rem; white-space: nowrap; }

/* ---------------------------------------------------------------- hero */
.hero { padding: 8px 0 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 500 .78rem "JetBrains Mono", monospace; color: var(--signal); letter-spacing: .04em; text-transform: uppercase; }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: #22D3EE; box-shadow: 0 0 0 4px rgba(34, 211, 238, .18); }
.hero h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); line-height: 1.08; margin: 14px 0 14px; font-weight: 700; }
.hero h1 .grad { background: linear-gradient(90deg, var(--iris), var(--violet) 50%, var(--signal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.12rem; color: var(--fg-2); margin: 0 0 26px; max-width: 64ch; }
.endpoint {
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; border-radius: 14px;
  background: var(--code-bg); border: 1px solid var(--code-border); color: var(--code-fg); max-width: 100%;
}
.endpoint .verb { font: 600 .72rem "JetBrains Mono", monospace; color: #22D3EE; border: 1px solid rgba(34, 211, 238, .35); border-radius: 6px; padding: 2px 7px; flex: none; }
.endpoint code { flex: 1; min-width: 0; font-size: .92rem; overflow-x: auto; white-space: nowrap; scrollbar-width: none; background: none; border: 0; padding: 0; color: var(--code-fg); }
.endpoint .copy { flex: none; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 36px 0 8px; }
.stat { padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat b { display: block; font: 700 1.7rem "Space Grotesk", sans-serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--fg); }
.stat span { font-size: .86rem; color: var(--muted); line-height: 1.45; display: block; margin-top: 4px; }

/* ---------------------------------------------------------------- prose */
section.doc { padding-top: 56px; }
section.doc > h2 { font-size: 1.65rem; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }
.anchor { color: var(--border-strong); font-weight: 500; opacity: 0; transition: opacity .2s var(--ease); }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--iris); text-decoration: none; }
section.doc > .sub { color: var(--muted); margin: 0 0 22px; }
h3 { font-size: 1.15rem; margin: 34px 0 10px; }
p { margin: 0 0 14px; color: var(--fg-2); }
ul, ol { margin: 0 0 16px; padding-left: 1.3em; color: var(--fg-2); }
li { margin: 6px 0; }
li::marker { color: var(--muted); }
strong { color: var(--fg); font-weight: 600; }
:not(pre) > code { font-size: .85em; padding: .12em .42em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--fg); overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
hr { border: 0; border-top: 1px solid var(--border); margin: 48px 0 0; }

.steps { counter-reset: step; display: grid; gap: 12px; margin: 8px 0 18px; padding: 0; list-style: none; }
.steps li { counter-increment: step; position: relative; margin: 0; padding: 16px 18px 16px 58px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 15px; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; font: 700 .9rem "Space Grotesk", sans-serif; color: var(--iris); background: var(--iris-soft);
}
.steps li strong { display: block; margin-bottom: 2px; }
.steps li p { margin: 0; }

/* tables */
.table-wrap { overflow-x: auto; margin: 6px 0 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; vertical-align: top; padding: 11px 16px; border-bottom: 1px solid var(--border); }
th { font: 600 .74rem Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
td { color: var(--fg-2); }
td.num { font-variant-numeric: tabular-nums; }

/* callouts */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; margin: 16px 0 20px; border: 1px solid; font-size: .95rem; }
.callout svg { margin-top: 3px; }
.callout p { margin: 0; color: var(--fg-2); }
.callout.info { background: var(--iris-soft); border-color: color-mix(in srgb, var(--iris) 25%, transparent); }
.callout.info svg { color: var(--iris); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.callout.warn svg { color: var(--warn); }

/* policy */
.policy { display: grid; gap: 10px; margin: 10px 0 18px; }
.rule { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.rule .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.rule.go .ic { background: var(--ok-soft); color: var(--ok); }
.rule.wait .ic { background: var(--warn-soft); color: var(--warn); }
.rule.never .ic { background: var(--danger-soft); color: var(--danger); }
.rule b { display: block; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.rule p { margin: 0; font-size: .94rem; }
.rule .label { font: 600 .7rem "JetBrains Mono", monospace; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; display: block; }
.rule.go .label { color: var(--ok); } .rule.wait .label { color: var(--warn); } .rule.never .label { color: var(--danger); }

/* code */
.code { position: relative; margin: 10px 0 22px; border-radius: 14px; background: var(--code-bg); border: 1px solid var(--code-border); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--code-border); }
.code-head span { font: 500 .75rem "JetBrains Mono", monospace; color: var(--code-muted); }
.code pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; font-size: .84rem; line-height: 1.65; color: var(--code-fg); tab-size: 4; scrollbar-width: thin; }
.code pre code { font-family: inherit; }
.copy {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--code-muted); font: 500 .78rem Inter, sans-serif; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.copy:hover { background: rgba(255, 255, 255, .07); color: var(--code-fg); }
.copy svg { width: 15px; height: 15px; }
.copy .ok { display: none; }
.copy.done { color: #34D399; }
.copy.done .ok { display: block; } .copy.done .cp { display: none; }
.hljs-keyword, .hljs-built_in, .hljs-literal { color: var(--hl-kw); }
.hljs-string { color: var(--hl-str); }
.hljs-number { color: var(--hl-num); }
.hljs-comment, .hljs-meta { color: var(--hl-com); font-style: italic; }
.hljs-attr, .hljs-variable, .hljs-params { color: var(--hl-key); }
.hljs-title, .hljs-title.function_, .hljs-title.class_ { color: var(--hl-fn); }
.hljs-punctuation { color: var(--code-muted); }

/* tabs */
.tabs { margin: 10px 0 22px; }
.tablist { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); width: fit-content; max-width: 100%; }
.tablist button {
  min-height: 34px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--muted);
  font: 500 .84rem "JetBrains Mono", monospace; cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tablist button:hover { color: var(--fg); }
.tablist button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.tabs .code { margin-top: 10px; }
.tabpanel[hidden] { display: none; }
.tabpanel p { font-size: .94rem; margin: 10px 0 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .86rem; color: var(--fg-2); }
.chip code { white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }

footer.foot { margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .86rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.scrim { display: none; }

/* ---------------------------------------------------------------- démo live */
.demo { margin: 6px 0 8px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.demo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.demo-head .tablist { background: var(--surface); }
.demo-head .tablist button[aria-selected="true"] { background: var(--surface-2); }
.demo-body { padding: 18px; display: grid; gap: 16px; }
.demo-body .tabpanel { display: grid; gap: 14px; }
.demo-body .tabpanel[hidden] { display: none; }
.field > label { display: block; font-size: .86rem; font-weight: 500; color: var(--fg); margin-bottom: 6px; }
.input { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg); font: 400 .9rem "JetBrains Mono", monospace; }
.key-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.key-row .input { flex: 1; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--fg-2); cursor: pointer; min-height: 32px; }
.check input { width: 16px; height: 16px; accent-color: var(--iris); cursor: pointer; }
.drop { position: relative; display: grid; place-items: center; gap: 4px; text-align: center; padding: 26px 16px; border-radius: 14px; border: 1.5px dashed var(--border-strong); background: var(--bg); color: var(--muted); font-size: .92rem; transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.drop:hover, .drop.over { border-color: var(--iris); background: var(--iris-soft); }
.drop:focus-within { border-color: var(--iris); }
.drop > svg { width: 26px; height: 26px; color: var(--iris); margin-bottom: 4px; }
.drop b { color: var(--fg); font-weight: 600; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .9rem; color: var(--fg-2); }
.file-info[hidden] { display: none; }
.file-info .name { font-weight: 600; color: var(--fg); overflow-wrap: anywhere; }
.select { min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg); font: 400 .86rem Inter, sans-serif; cursor: pointer; }
.select[hidden] { display: none; }
.opts { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; }
.run-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[hidden] { display: none; }
.demo-note { font-size: .82rem; color: var(--muted); margin: 0; line-height: 1.5; }
.mic-help { margin: 0; font-size: .94rem; }
.live { border-top: 1px solid var(--border); padding: 18px; display: grid; gap: 14px; }
.live[hidden] { display: none; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font: 600 .8rem Inter, sans-serif; background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--border); }
.badge i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.listen { color: var(--signal); }
.badge.listen i { animation: pulse 1.2s var(--ease) infinite; }
.badge.machine { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.human { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.wait { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.status .msg { font-size: .95rem; color: var(--fg); font-weight: 500; flex: 1 1 260px; }
.clock { font: 500 .9rem "JetBrains Mono", monospace; color: var(--muted); font-variant-numeric: tabular-nums; }
.track { position: relative; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(99, 102, 241, .16), rgba(34, 211, 238, .24)); }
.track .cut { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); }
.track .cut[hidden] { display: none; }
.mk { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.mk.provisional { background: var(--warn); }
.mk.machine { background: var(--danger); }
.mk.human { background: var(--ok); }
.mk.beep { background: var(--iris); border-radius: 3px; }
.track-scale { display: flex; justify-content: space-between; font: 400 .74rem "JetBrains Mono", monospace; color: var(--muted); margin-top: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mk { position: static; margin: 0; width: 10px; height: 10px; border-width: 0; box-shadow: none; }
.log { margin: 0; padding: 0; list-style: none; max-height: 240px; overflow-y: auto; border-radius: 12px; background: var(--code-bg); border: 1px solid var(--code-border); font: 400 .8rem/1.6 "JetBrains Mono", monospace; color: var(--code-fg); }
.log li { margin: 0; padding: 6px 14px; border-bottom: 1px solid var(--code-border); display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; }
.log li:last-child { border-bottom: 0; }
.log .t { color: var(--code-muted); font-variant-numeric: tabular-nums; }
.log .k-machine { color: #FCA5A5; }
.log .k-human { color: #6EE7B7; }
.log .k-wait { color: #FCD34D; }
.log .k-beep { color: #A5B4FC; }
.log .k-info { color: var(--code-muted); }
.log .k-cut { color: #FCA5A5; font-weight: 600; }
.toc-dl { display: inline-block; margin-top: 8px; font-size: .82rem; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1279px) {
  .shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  aside.toc { display: none; }
}
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  aside.side {
    position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; width: min(86vw, 320px); height: 100dvh;
    background: var(--bg); border-right: 1px solid var(--border); transform: translateX(-102%);
    transition: transform .28s var(--ease); padding-top: 20px;
  }
  body.nav-open aside.side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 8, 22, .5); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  main { padding: 28px 16px 72px; }
  .tag.hide-sm { display: none; }
}
@media (max-width: 599px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .top-in { padding: 0 12px; gap: 8px; }
  .dl-label { display: none; }
  section.doc > h2 { font-size: 1.4rem; }
  td:first-child { white-space: normal; }
  .rule { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
