/* ───────────────────────── Tokens ───────────────────────── */
:root {
  --bg: #0c0e13;
  --bg-elev: #08090c;
  --surface: #12151c;
  --surface-2: #171b24;
  --surface-3: #1d2230;
  --border: #1e2330;
  --border-strong: #2b3242;
  --text: #e8ebf2;
  --text-2: #a6aec0;
  --muted: #717a91;
  --accent: #6d8cff;
  --accent-2: #a3b5ff;
  --accent-soft: rgba(109, 140, 255, 0.12);
  --accent-line: rgba(109, 140, 255, 0.38);
  --warn: #f3b162;
  --warn-soft: rgba(243, 177, 98, 0.1);
  --warn-line: rgba(243, 177, 98, 0.35);
  --danger: #ff7a7a;
  --danger-soft: rgba(255, 122, 122, 0.1);
  --danger-line: rgba(255, 122, 122, 0.35);
  --ok: #57d68d;

  --radius: 10px;
  --radius-sm: 7px;
  --header-h: 60px;
  --sidebar-w: 264px;
  --toc-w: 220px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ───────────────────────── Header ───────────────────────── */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); width: calc(var(--sidebar-w) - 36px); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; }
.brand-mark svg { width: 28px; height: 28px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; }

.search { position: relative; flex: 1; max-width: 560px; }
.search input {
  width: 100%; height: 38px;
  padding: 0 40px 0 38px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px;
  font: inherit; font-size: 14px;
  transition: border-color .15s, background .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 13px; top: 10px; color: var(--muted); pointer-events: none; }
.search-icon svg { width: 17px; height: 17px; }
.search-kbd {
  position: absolute; right: 10px; top: 8px;
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 7px;
}
.search input:focus ~ .search-kbd { display: none; }

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55);
  padding: 6px;
}
.sr-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.sr-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 9px 10px; border-radius: 8px; color: var(--text); cursor: pointer;
}
.sr-item:hover, .sr-item[aria-selected="true"] { background: var(--surface-3); text-decoration: none; }
.sr-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; flex: none; font: 600 14px var(--mono); }
.sr-icon svg { width: 16px; height: 16px; }
.sr-main { min-width: 0; flex: 1; }
.sr-title { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.sr-title .mono { font-family: var(--mono); }
.sr-desc { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-cat { font-size: 11px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 7px; font-weight: 500; }
mark { background: none; color: var(--accent-2); }
.sr-empty { padding: 22px 14px; text-align: center; color: var(--text-2); font-size: 14px; }
.sr-empty strong { color: var(--text); }
.sr-foot { display: flex; gap: 14px; justify-content: flex-end; padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 6px; font-size: 11px; color: var(--muted); }
.sr-foot kbd { border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; margin-right: 3px; }

.top-actions { display: flex; gap: 8px; margin-left: auto; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 500; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #7f9aff; }
.btn-ghost { color: var(--text-2); border-color: var(--border-strong); background: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--surface); }
.menu-btn { display: none; }

/* ───────────────────────── Layout ───────────────────────── */
.layout { padding-top: var(--header-h); }
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 30;
  width: var(--sidebar-w);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 12px 28px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.main { margin-left: var(--sidebar-w); min-height: calc(100vh - var(--header-h)); outline: none; }

.nav-group + .nav-group { margin-top: 22px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.nav-link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.nav-link[aria-current="page"] svg { color: var(--accent-2); }
.nav-link .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-link .ext { margin-left: auto; color: var(--muted); }
.nav-link .ext svg { width: 14px; height: 14px; }

.scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.6); z-index: 25; }

/* ───────────────────────── Page ───────────────────────── */
.page { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); gap: 48px; max-width: 1320px; padding: 32px 40px 80px; }
.article { min-width: 0; }
.loading { padding: 60px 40px; color: var(--muted); }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.crumbs [aria-current] { color: var(--text); }

.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--accent-2); margin-bottom: 8px; }
.eyebrow svg { width: 15px; height: 15px; }
h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px; font-weight: 700; }
h1.mono { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
h1 .slash { color: var(--accent); }
.lead { font-size: 17px; color: var(--text-2); margin: 0 0 18px; max-width: 70ch; }
p { margin: 0 0 14px; }
.prose { color: var(--text-2); max-width: 74ch; }
.prose strong { color: var(--text); }

.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-size: 13px; color: var(--muted); padding-bottom: 22px; margin-bottom: 26px; border-bottom: 1px solid var(--border); }
.doc-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px rgba(87,214,141,.15); }
.doc-meta .dot.idle { background: var(--muted); box-shadow: none; }
.doc-tools { margin-left: auto; display: flex; gap: 4px; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.tool-btn:hover { background: var(--surface); color: var(--text); }
.tool-btn svg { width: 15px; height: 15px; }

/* Inline code + code blocks */
:not(pre) > code { font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; color: var(--text); }
.code {
  position: relative; display: flex; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 48px 12px 14px; margin: 0 0 12px;
  font: 14px/1.55 var(--mono); color: var(--text); overflow-x: auto;
}
.code code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; white-space: normal; }
.code code > span { white-space: nowrap; }
.code .t-cmd { color: var(--accent-2); font-weight: 600; }
.code .t-req { color: var(--text); }
.code .t-opt { color: var(--muted); }
.copy-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.copy-btn:hover { color: var(--text); background: var(--surface-2); }
.copy-btn svg { width: 15px; height: 15px; }

/* Notices */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--accent-line); background: var(--accent-soft); margin: 0 0 18px; font-size: 14px; color: var(--text-2); }
.notice > svg { color: var(--accent-2); margin-top: 2px; }
.notice.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.notice.warn > svg { color: var(--warn); }
.notice.danger { border-color: var(--danger-line); background: var(--danger-soft); }
.notice.danger > svg { color: var(--danger); }
.notice-title { color: var(--text); font-weight: 600; margin-bottom: 6px; }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.legend { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 8px 0 4px; }
.legend dt code { white-space: nowrap; }
.legend dd { margin: 0; }
.time-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

/* Accordions */
.acc { border-bottom: 1px solid var(--border); }
.acc:first-of-type { border-top: 1px solid var(--border); }
.acc-head { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.acc-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 18px 4px; background: none; border: 0; cursor: pointer; text-align: left; color: var(--text);
}
.acc-btn:hover .acc-name { color: #fff; }
.acc-chev { color: var(--muted); transition: transform .18s ease; }
.acc-btn[aria-expanded="false"] .acc-chev { transform: rotate(-90deg); }
.acc-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-2); }
.acc-icon svg { width: 16px; height: 16px; }
.acc-count { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.acc-sub { font-size: 16px; }
.acc-panel { padding: 0 4px 26px; }
.acc-panel[hidden] { display: none; }
.acc-desc { color: var(--text-2); font-size: 14px; margin: -4px 0 16px; }
.acc.plain .acc-head { font-size: 16px; }
.acc.plain .acc-btn { padding: 14px 4px; }

/* Command cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 40px 14px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, background .15s, transform .15s;
}
.card:hover { border-color: var(--accent-line); background: var(--surface-2); }
.card:focus-within { border-color: var(--accent); }
.card-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-2); font: 600 15px var(--mono); }
.card-body { min-width: 0; }
.card-link { color: var(--text); font: 600 14.5px/1.35 var(--mono); }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card-link:hover { text-decoration: none; }
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.card-ext { position: absolute; z-index: 1; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); opacity: .55; }
.card:hover .card-ext, .card-ext:focus-visible { opacity: 1; }
.card-ext:hover { color: var(--text); background: var(--surface-3); }
.card-ext svg { width: 14px; height: 14px; }
.card-flags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.chip svg { width: 14px; height: 14px; color: var(--muted); }
.chip strong { color: var(--text); font-weight: 500; }
.chip.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.chip.warn svg { color: var(--warn); }
.chip.premium { border-color: rgba(241, 196, 15, .35); color: #f4d35e; }
.tag-sm { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }

/* Detail page sections */
.section { margin-top: 30px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.detail-acc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; }
.detail-acc .acc-head { font-size: 16px; }
.detail-acc .acc-btn { padding: 14px 16px; }
.detail-acc .acc-panel { padding: 0 16px 18px; }
.detail-acc .acc-icon { width: 26px; height: 26px; }

.args { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 4px; }
.args th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; border-bottom: 1px solid var(--border-strong); }
.args td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-2); }
.args tr:last-child td { border-bottom: 0; }
.args .arg-name { font: 600 13.5px var(--mono); color: var(--text); white-space: nowrap; }
.args .arg-type { font: 12.5px var(--mono); color: var(--accent-2); white-space: nowrap; }
.args .default { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.req { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.req.yes { background: rgba(255,122,122,.12); color: #ff9d9d; }
.req.no { background: var(--surface-3); color: var(--text-2); }
.args .m-only { display: none; }
.no-args { color: var(--muted); font-size: 14px; margin: 0; }

.example + .example { margin-top: 16px; }
.example-result { display: flex; gap: 8px; color: var(--text-2); font-size: 14px; margin: -4px 0 0; }
.example-result svg { width: 15px; height: 15px; margin-top: 3px; color: var(--ok); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 36px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.pager a:hover { border-color: var(--accent-line); text-decoration: none; background: var(--surface); }
.pager small { display: block; font-size: 12px; color: var(--muted); }
.pager .name { font: 600 14px var(--mono); }
.pager .next { text-align: right; grid-column: 2; }

/* Home */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); color: var(--text); }
.tile:hover { border-color: var(--accent-line); text-decoration: none; background: var(--surface-2); }
.tile .tile-top { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.tile .tile-top .acc-icon { width: 30px; height: 30px; }
.tile .tile-top .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.tile p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.h2 { font-size: 20px; font-weight: 600; margin: 36px 0 14px; letter-spacing: -0.01em; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 22px 48px; color: var(--text-2); }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; font-size: 14px; }
.steps li::after { content: ""; position: absolute; left: 14.5px; top: 32px; bottom: 4px; width: 1px; background: var(--border-strong); }
.steps li:last-child::after { display: none; }
.steps h3 { color: var(--text); font-size: 16px; margin: 0 0 4px; }

/* TOC */
.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; max-height: calc(100vh - var(--header-h) - 64px); overflow-y: auto; font-size: 13.5px; }
.toc-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--text); border-left-color: var(--accent); }
.toc .toc-sub a { padding-left: 26px; }
.toc-mobile { display: none; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toc-mobile summary { cursor: pointer; padding: 12px 14px; font-size: 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile[open] summary .acc-chev { transform: none; }
.toc-mobile summary .acc-chev { transform: rotate(-90deg); transition: transform .18s; }
.toc-mobile ol { list-style: none; margin: 0; padding: 0 14px 12px; columns: 2; column-gap: 16px; }
.toc-mobile a { display: block; padding: 4px 0; color: var(--text-2); font-size: 14px; }

.empty { text-align: center; padding: 80px 20px; color: var(--text-2); }
.empty h1 { font-size: 26px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ───────────────────────── Responsive ───────────────────────── */
@media (max-width: 1200px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .brand { width: auto; }
  .brand-tag { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px rgba(0,0,0,.4); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  .main { margin-left: 0; }
  .page { padding: 24px 20px 64px; }
  .top-actions .btn-ghost { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  .top-actions { display: none; }
  .search-kbd { display: none; }
  .page { padding: 20px 16px 56px; }
  h1 { font-size: 26px; }
  h1.mono { font-size: 24px; }
  .lead { font-size: 16px; }
  .cards { grid-template-columns: 1fr; }
  .doc-tools { margin-left: 0; }
  .toc-mobile ol { columns: 1; }
  .legend { grid-template-columns: 1fr; gap: 2px; }
  .legend dd { margin-bottom: 8px; }
  /* Stack the argument table */
  .args thead { display: none; }
  .args, .args tbody, .args tr, .args td { display: block; width: 100%; }
  .args tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .args tr:last-child { border-bottom: 0; }
  .args td { border: 0; padding: 2px 0; }
  .args td.c-name { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .args td.c-type, .args td.c-req { display: none; }
  .args .m-only { display: inline-flex; gap: 8px; align-items: center; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
/* ───────────────────────── Embed creator ───────────────────────── */
.page.page-wide { grid-template-columns: minmax(0, 1fr); max-width: 1480px; }
.ec-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.ec-top-tools { display: flex; gap: 4px; }
.ec-jump { display: none; }
.ec-jump:hover { text-decoration: none; }
.seg-sm button { height: 28px; padding: 0 11px; font-size: 13px; }

.ec-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
.ec-editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ec-side { min-width: 0; }
.ec-sticky { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.ec-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ec-label-row .section-title { margin: 0; }

.ec-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ec-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ec-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.ec-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.ec-head-actions { display: flex; gap: 2px; }

.ec-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ec-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.ec-count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.ec-count.near { color: var(--warn); }
.ec-count.over { color: var(--danger); font-weight: 600; }
.input { width: 100%; min-height: 36px; padding: 7px 10px; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 14px; line-height: 1.45; transition: border-color .15s; }
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 60px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.ec-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.ec-color { display: flex; gap: 8px; align-items: center; }
.ec-color input[type="color"] { width: 40px; height: 36px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-elev); cursor: pointer; flex: none; }
.ec-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ec-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.ec-color .input { max-width: 120px; }
.ec-color-inline .input { width: 100px; }
.ec-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; user-select: none; }
.ec-check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.ec-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.ec-hint { margin: 0; font-size: 13.5px; color: var(--text-2); }
.ec-small { font-size: 12.5px; color: var(--muted); }
.ec-err { color: var(--danger); }
.ec-muted { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ec-sub-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

.ec-group { border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.01); }
.ec-group > summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-2); list-style: none; }
.ec-group > summary::-webkit-details-marker { display: none; }
.ec-group > summary svg { width: 15px; height: 15px; transform: rotate(-90deg); transition: transform .15s; color: var(--muted); }
.ec-group[open] > summary svg { transform: none; }
.ec-group > summary:hover { color: var(--text); }
.ec-group-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 12px; }

.ec-item { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.ec-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ec-item-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.ec-type { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); }
.ec-type svg { width: 14px; height: 14px; }
.ec-ctl { display: flex; gap: 2px; }
.ec-ibtn { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.ec-ibtn:hover:not(:disabled) { color: var(--text); background: var(--surface-3); }
.ec-ibtn:disabled { opacity: .3; cursor: default; }
.ec-ibtn svg { width: 15px; height: 15px; }
.ec-btn-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: center; }
.ec-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.ec-add:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.ec-add svg { width: 14px; height: 14px; }
.ec-adders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 4px; }
.ec-adders .ec-muted { margin-right: 4px; }
.ec-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text-2); font-size: 13px; cursor: pointer; }
.ec-chip:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.ec-chip svg { width: 14px; height: 14px; }
.ec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ec-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.ec-status { font-size: 13px; color: var(--text-2); }
.ec-status.ok { color: var(--ok); }
.ec-status.err { color: var(--danger); }
.ec-list { margin: 0; padding-left: 18px; }
.ec-list li + li { margin-top: 2px; }
#ec-issues .notice { margin: 0 0 0; }
#ec-issues:empty { display: none; }
#ec-issues { display: flex; flex-direction: column; gap: 10px; }
.ec-json { margin: 0; max-height: 300px; overflow: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font: 12.5px/1.55 var(--mono); color: var(--text-2); white-space: pre; }
#ec-import { display: flex; flex-direction: column; gap: 8px; }
#ec-import[hidden] { display: none; }
.ec-code-box { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ec-code-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); }
.ec-code { font: 600 26px/1.1 var(--mono); letter-spacing: .12em; color: var(--text); }
.ec-code-box .code { margin: 0; }

/* Discord-style preview */
.dc { background: #313338; border-radius: 12px; padding: 16px 16px 18px; color: #dbdee1; font: 15px/1.375 "gg sans", "Noto Sans", var(--font); border: 1px solid #1e1f22; overflow: hidden; }
.dc-msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 16px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; background: #1e1f22; display: grid; place-items: center; }
.dc-avatar svg { width: 28px; height: 28px; }
.dc-body { min-width: 0; }
.dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; flex-wrap: wrap; }
.dc-name { color: #f2f3f5; font-weight: 500; font-size: 16px; }
.dc-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; line-height: 15px; }
.dc-time { color: #949ba4; font-size: 12px; margin-left: 2px; }
.dc-empty { color: #949ba4; font-style: italic; font-size: 14px; }
.dc a { color: #00a8fc; text-decoration: none; }
.dc a:hover { text-decoration: underline; }
.dc code { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 0 3px; font: 85% var(--mono); color: #dbdee1; }
.dc-pre { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 7px 9px; margin: 4px 0; white-space: pre-wrap; font: 13px/1.45 var(--mono); }
.dc-pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.dc-quote { border-left: 4px solid #4e5058; padding: 0 0 0 12px; margin: 2px 0; }
.dc-ul { margin: 2px 0; padding-left: 22px; }
.dc-h1 { font-size: 24px; font-weight: 700; line-height: 1.375; color: #f2f3f5; margin: 6px 0 2px; }
.dc-h2 { font-size: 20px; font-weight: 700; line-height: 1.375; color: #f2f3f5; margin: 6px 0 2px; }
.dc-h3 { font-size: 16px; font-weight: 700; line-height: 1.375; color: #f2f3f5; margin: 6px 0 2px; }
.dc-h1:first-child, .dc-h2:first-child, .dc-h3:first-child { margin-top: 0; }
.dc-sub { font-size: 12px; color: #949ba4; line-height: 1.3; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-ts { background: rgba(255,255,255,.06); border-radius: 3px; padding: 0 2px; }
.dc-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; transition: color .1s; cursor: pointer; }
.dc-spoiler:hover { color: inherit; background: rgba(255,255,255,.1); }
.dc-emoji { width: 1.375em; height: 1.375em; vertical-align: bottom; object-fit: contain; }
.dc-broken { display: none !important; }
.dc-content { word-wrap: break-word; }

.dc-embed { max-width: 520px; margin-top: 4px; background: #2b2d31; border: 1px solid rgba(255,255,255,.04); border-left: 4px solid #1e1f22; border-radius: 4px; padding: 8px 16px 16px 12px; }
.dc-embed-top { display: flex; gap: 16px; }
.dc-embed-main { min-width: 0; flex: 1; }
.dc-author { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-author a { color: #f2f3f5; }
.dc-author-icon { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dc-title { margin-top: 8px; font-size: 16px; font-weight: 600; color: #f2f3f5; }
.dc-title a { color: #00a8fc; }
.dc-desc { margin-top: 8px; font-size: 14px; line-height: 1.3; }
.dc-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dc-field-row { display: grid; gap: 8px; }
.dc-field-name { font-size: 14px; font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.dc-field-value { font-size: 14px; line-height: 1.3; }
.dc-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; margin-top: 8px; flex: none; }
.dc-image { display: block; max-width: 100%; max-height: 300px; border-radius: 4px; margin-top: 16px; object-fit: cover; }
.dc-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #dbdee1; }
.dc-footer-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.dc-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 8px; background: #4e5058; color: #fff !important; font-size: 14px; font-weight: 500; text-decoration: none !important; transition: background .15s; }
.dc-btn:hover { background: #6d6f78; }
.dc-btn svg { opacity: .9; }

.dc-v2 { margin-top: 4px; display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.dc-container { background: #393a41; border: 1px solid rgba(255,255,255,.05); border-left: 4px solid #4e5058; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.dc-container.spoiler { filter: blur(0); position: relative; }
.dc-container.spoiler::after { content: "SPOILER"; position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #949ba4; }
.dc-text { font-size: 15px; word-wrap: break-word; }
.dc-section { display: flex; gap: 16px; align-items: flex-start; }
.dc-sec-text { flex: 1; min-width: 0; word-wrap: break-word; }
.dc-sec-thumb { width: 85px; height: 85px; object-fit: cover; border-radius: 8px; flex: none; }
.dc-sec-btn { flex: none; align-self: center; }
.dc-gallery { display: grid; gap: 4px; border-radius: 8px; overflow: hidden; }
.dc-gal-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #2b2d31; }
.dc-gallery.g1 .dc-gal-img { aspect-ratio: auto; max-height: 320px; }
.dc-sep { height: 8px; position: relative; }
.dc-sep.lg { height: 24px; }
.dc-sep.line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #4e5058; }
.dc-container .dc-row { margin-top: 0; }

@media (max-width: 1100px) {
  .ec-layout { grid-template-columns: minmax(0, 1fr); }
  .ec-sticky { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .ec-jump { display: inline-flex; }
}
@media (max-width: 640px) {
  .ec-top { flex-wrap: wrap; }
  .ec-btn-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ec-btn-row .input.mono { grid-column: 1; grid-row: 2; }
  .ec-btn-row .ec-ibtn { grid-column: 2; grid-row: 1 / span 2; }
  .dc { padding: 12px; }
  .dc-msg { grid-template-columns: 32px minmax(0, 1fr); gap: 0 10px; }
  .dc-avatar { width: 32px; height: 32px; }
  .dc-avatar svg { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

@media print {
  .topbar, .sidebar, .toc, .toc-mobile, .doc-tools, .copy-btn, .card-ext, .pager, .skip-link { display: none !important; }
  .main { margin: 0; }
  .layout { padding: 0; }
  body { background: #fff; color: #111; }
  .page { display: block; padding: 0; }
  .acc-panel[hidden] { display: block !important; }
  .card, .notice, .code, .detail-acc { background: #fff !important; border-color: #ccc !important; color: #111 !important; }
  .lead, .prose, .card p, .args td, .acc-desc { color: #333 !important; }
}
