/* HuayEngine API Docs — static, no build step.
   Theme tokens live on :root; dark mode follows the OS unless the reader picks one. */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e9ecf5;
  --border: #e2e5ef;
  --border-strong: #cfd4e3;
  --text: #171a26;
  --text-2: #3b4154;
  --muted: #646b80;
  --accent: #5146e5;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(81, 70, 229, 0.09);
  --accent-text: #4338ca;
  --hero-from: #4f46e5;
  --hero-to: #7c3aed;

  --get: #0b8a5f;
  --get-bg: rgba(11, 138, 95, 0.1);
  --post: #2459d6;
  --post-bg: rgba(36, 89, 214, 0.1);
  --patch: #b86a00;
  --patch-bg: rgba(184, 106, 0, 0.12);
  --del: #c62828;
  --del-bg: rgba(198, 40, 40, 0.1);

  --info: #2459d6;
  --info-bg: #eef3ff;
  --info-border: #c9d8ff;
  --warn: #9a5b00;
  --warn-bg: #fff7e6;
  --warn-border: #f5d79a;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --danger-border: #f6c2bb;
  --tip: #0b7a55;
  --tip-bg: #ecfbf4;
  --tip-border: #b7ead3;

  --code-bg: #0f1324;
  --code-head: #161b31;
  --code-text: #e4e7f2;
  --code-muted: #8a92ad;
  --tok-key: #9cc4ff;
  --tok-str: #a5e3a1;
  --tok-num: #f7b77a;
  --tok-kw: #d7a6ff;
  --tok-com: #6f7895;
  --tok-lit: #ff9ab0;

  --inline-code-bg: #eef0f7;
  --inline-code-text: #3a3f8f;

  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(20, 24, 40, 0.06), 0 8px 24px -12px rgba(20, 24, 40, 0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 60px;
  --side-w: 288px;

  --font: "IBM Plex Sans Thai", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e16;
    --surface: #131622;
    --surface-2: #191d2c;
    --surface-3: #212638;
    --border: #252a3c;
    --border-strong: #343a52;
    --text: #e8eaf3;
    --text-2: #c3c8d8;
    --muted: #949bb2;
    --accent: #8f87ff;
    --accent-2: #b28dff;
    --accent-soft: rgba(143, 135, 255, 0.13);
    --accent-text: #b4adff;
    --hero-from: #3b35b8;
    --hero-to: #6430b8;
    --get: #3fd39b;
    --get-bg: rgba(63, 211, 155, 0.13);
    --post: #7aa7ff;
    --post-bg: rgba(122, 167, 255, 0.14);
    --patch: #ffbd5c;
    --patch-bg: rgba(255, 189, 92, 0.14);
    --del: #ff8a80;
    --del-bg: rgba(255, 138, 128, 0.13);
    --info: #8fb2ff;
    --info-bg: rgba(122, 167, 255, 0.09);
    --info-border: rgba(122, 167, 255, 0.28);
    --warn: #ffc56b;
    --warn-bg: rgba(255, 189, 92, 0.08);
    --warn-border: rgba(255, 189, 92, 0.3);
    --danger: #ff9a90;
    --danger-bg: rgba(255, 120, 108, 0.08);
    --danger-border: rgba(255, 120, 108, 0.3);
    --tip: #5fe0ad;
    --tip-bg: rgba(63, 211, 155, 0.08);
    --tip-border: rgba(63, 211, 155, 0.28);
    --code-bg: #0a0d18;
    --code-head: #10142a;
    --inline-code-bg: #1f2436;
    --inline-code-text: #c6c1ff;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0e16;
  --surface: #131622;
  --surface-2: #191d2c;
  --surface-3: #212638;
  --border: #252a3c;
  --border-strong: #343a52;
  --text: #e8eaf3;
  --text-2: #c3c8d8;
  --muted: #949bb2;
  --accent: #8f87ff;
  --accent-2: #b28dff;
  --accent-soft: rgba(143, 135, 255, 0.13);
  --accent-text: #b4adff;
  --hero-from: #3b35b8;
  --hero-to: #6430b8;
  --get: #3fd39b;
  --get-bg: rgba(63, 211, 155, 0.13);
  --post: #7aa7ff;
  --post-bg: rgba(122, 167, 255, 0.14);
  --patch: #ffbd5c;
  --patch-bg: rgba(255, 189, 92, 0.14);
  --del: #ff8a80;
  --del-bg: rgba(255, 138, 128, 0.13);
  --info: #8fb2ff;
  --info-bg: rgba(122, 167, 255, 0.09);
  --info-border: rgba(122, 167, 255, 0.28);
  --warn: #ffc56b;
  --warn-bg: rgba(255, 189, 92, 0.08);
  --warn-border: rgba(255, 189, 92, 0.3);
  --danger: #ff9a90;
  --danger-bg: rgba(255, 120, 108, 0.08);
  --danger-border: rgba(255, 120, 108, 0.3);
  --tip: #5fe0ad;
  --tip-bg: rgba(63, 211, 155, 0.08);
  --tip-border: rgba(63, 211, 155, 0.28);
  --code-bg: #0a0d18;
  --code-head: #10142a;
  --inline-code-bg: #1f2436;
  --inline-code-text: #c6c1ff;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────── */
[hidden] {
  display: none !important;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
p {
  margin: 0 0 14px;
}
ul,
ol {
  margin: 0 0 14px;
  padding-left: 22px;
}
li {
  margin: 4px 0;
}
strong {
  font-weight: 600;
  color: var(--text);
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
code,
kbd {
  font-family: var(--mono);
  font-size: 0.86em;
}
:not(pre) > code {
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: 1.5px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
td code,
li code,
p code,
h2 code,
.callout code {
  white-space: normal;
  overflow-wrap: anywhere;
}
h1,
h2,
h3,
h4 {
  line-height: 1.3;
  color: var(--text);
  margin: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  box-shadow: 0 4px 12px -4px rgba(81, 70, 229, 0.55);
}
.brand-mark svg {
  width: 17px;
  height: 17px;
}
.brand-sub {
  font-weight: 500;
  color: var(--muted);
}
.nav-version {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.nav-spacer {
  flex: 1;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.menu-btn {
  display: none;
}
.env-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.env-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 13px/1 var(--font);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.env-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.env-switch .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--patch);
}
.env-switch button[data-env="production"] .dot {
  background: var(--get);
}
.studio-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  white-space: nowrap;
}
.studio-link:hover {
  text-decoration: none;
  filter: brightness(1.08);
}
.studio-link svg {
  width: 15px;
  height: 15px;
}

/* ── Layout ───────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--nav-h);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: var(--nav-h);
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 18px 14px 40px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: thin;
}
.side-search {
  position: relative;
  margin: 0 4px 14px;
}
.side-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: 400 14px var(--font);
}
.side-search input::placeholder {
  color: var(--muted);
}
.side-search svg {
  position: absolute;
  left: 11px;
  top: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.nav-group {
  margin-bottom: 14px;
}
.nav-group-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.nav-link .ni {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  font-size: 14px;
}
.nav-link .nl {
  flex: 1;
  min-width: 0;
}
.nav-sub {
  margin: 0 0 4px 22px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.nav-sub .nav-link {
  font-size: 13px;
  padding: 4px 8px;
}
.nav-sub .nav-link .nl {
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-empty {
  display: none;
  padding: 10px;
  color: var(--muted);
  font-size: 13.5px;
}
.sidebar.filtering .nav-empty.show {
  display: block;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 0 40px 80px;
}
.content-inner {
  max-width: 940px;
  margin: 0 auto;
}

/* ── Method + tag pills ───────────────────────────────── */
.m {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.4;
  flex: 0 0 auto;
}
.m-get {
  color: var(--get);
  background: var(--get-bg);
}
.m-post {
  color: var(--post);
  background: var(--post-bg);
}
.m-patch {
  color: var(--patch);
  background: var(--patch-bg);
}
.m-del {
  color: var(--del);
  background: var(--del-bg);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.tag-idem {
  color: var(--patch);
  background: var(--patch-bg);
  border-color: transparent;
}
.tag-ext {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
}
.tag-transfer {
  color: var(--get);
  background: var(--get-bg);
  border-color: transparent;
}
.tag-irrev {
  color: var(--del);
  background: var(--del-bg);
  border-color: transparent;
}
.req {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 6px;
  border-radius: 4px;
  margin-left: 6px;
  color: var(--del);
  background: var(--del-bg);
  vertical-align: 1px;
}
.opt {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 4px;
  margin-left: 6px;
  color: var(--muted);
  background: var(--surface-3);
  vertical-align: 1px;
}
.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  margin: 28px 0 8px;
  padding: 40px 40px 34px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(900px 300px at 100% -20%, rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(500px 240px at -10% 120%, rgba(255, 255, 255, 0.1), transparent 60%),
    linear-gradient(135deg, var(--hero-from), var(--hero-to));
  box-shadow: 0 24px 50px -28px rgba(81, 70, 229, 0.7);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, 0.06);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 12px var(--mono);
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.hero h1 {
  color: #fff;
  font-size: clamp(28px, 4.2vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 16px 0 10px;
}
.hero p {
  font-size: 16.5px;
  max-width: 640px;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
}
.base-url {
  margin-top: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 640px;
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: rgba(10, 8, 40, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  z-index: 1;
}
.base-url .bl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
}
.base-url code {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 14.5px;
  color: #fff;
  background: none;
  padding: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.base-url .copy-chip {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 8px;
}
.fact {
  padding: 16px 16px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.fact .fk {
  font-size: 12.5px;
  color: var(--muted);
}
.fact .fv {
  font-weight: 700;
  font-size: 16px;
  margin-top: 2px;
}
.fact .fd {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Sections ─────────────────────────────────────────── */
.section {
  padding-top: 44px;
}
.section > h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.section > h2 .si {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
  background: var(--accent-soft);
}
.section-lead {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 22px;
}
.section h3 {
  font-size: 18.5px;
  font-weight: 650;
  margin: 30px 0 10px;
}
.section h4 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 10px;
}
.anchor {
  opacity: 0;
  margin-left: 6px;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8em;
  transition: opacity 0.15s;
}
h2:hover .anchor,
h3:hover .anchor,
.ep-head:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}
.anchor:hover {
  text-decoration: none;
  color: var(--accent-text);
}

/* ── Tables ───────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
}
th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-2);
}
tr:last-child td {
  border-bottom: 0;
}
td:first-child {
  color: var(--text);
}
td.f {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
}
td.t {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent-text);
  white-space: nowrap;
}
td.c {
  white-space: nowrap;
}
.table-tight td {
  padding: 8px 14px;
}
.yes {
  color: var(--get);
  font-weight: 600;
}
.no {
  color: var(--muted);
}

/* ── Callouts ─────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  margin: 0 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 14.5px;
  line-height: 1.7;
}
.callout .ci {
  flex: 0 0 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
  color: #fff;
}
.callout > div {
  min-width: 0;
}
.callout p:last-child,
.callout ul:last-child,
.callout ol:last-child {
  margin-bottom: 0;
}
.callout strong {
  color: inherit;
}
.callout-info {
  background: var(--info-bg);
  border-color: var(--info-border);
}
.callout-info .ci {
  background: var(--info);
}
.callout-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}
.callout-warn .ci {
  background: var(--warn);
}
.callout-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}
.callout-danger .ci {
  background: var(--danger);
}
.callout-tip {
  background: var(--tip-bg);
  border-color: var(--tip-border);
}
.callout-tip .ci {
  background: var(--tip);
}
.callout-title {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
.callout-warn .callout-title {
  color: var(--warn);
}
.callout-danger .callout-title {
  color: var(--danger);
}
.callout-info .callout-title {
  color: var(--info);
}
.callout-tip .callout-title {
  color: var(--tip);
}

/* ── Endpoint cards ───────────────────────────────────── */
.endpoint {
  margin: 0 0 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.ep-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.ep-head .m {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 7px;
}
.ep-path {
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.ep-path .pfx {
  color: var(--muted);
  font-weight: 500;
}
.ep-title {
  flex-basis: 100%;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ep-body {
  padding: 18px 20px 6px;
}
.ep-body > h4:first-child {
  margin-top: 0;
}

/* ── Code ─────────────────────────────────────────────── */
.codeblock {
  margin: 0 0 18px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 7px 14px;
  background: var(--code-head);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font: 500 12px var(--mono);
  color: var(--code-muted);
}
.code-head .ct {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--code-text);
  tab-size: 2;
  scrollbar-width: thin;
}
pre code {
  font-size: inherit;
  white-space: pre;
}
.copy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--code-text);
  font: 500 12px var(--font);
  cursor: pointer;
  flex: 0 0 auto;
}
.copy-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}
.copy-chip svg {
  width: 13px;
  height: 13px;
}
.tok-key {
  color: var(--tok-key);
}
.tok-str {
  color: var(--tok-str);
}
.tok-num {
  color: var(--tok-num);
}
.tok-kw {
  color: var(--tok-kw);
}
.tok-com {
  color: var(--tok-com);
  font-style: italic;
}
.tok-lit {
  color: var(--tok-lit);
}
.tok-hdr {
  color: var(--tok-key);
}
.code-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.code-pair .codeblock {
  margin-bottom: 18px;
}

/* tabs */
.tabs {
  margin: 0 0 18px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--code-bg);
}
.tab-list {
  display: flex;
  gap: 2px;
  padding: 6px 6px 0;
  background: var(--code-head);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar {
  display: none;
}
.tab-list button {
  border: 0;
  background: transparent;
  color: var(--code-muted);
  font: 500 13px var(--font);
  padding: 8px 14px 9px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  white-space: nowrap;
}
.tab-list button:hover {
  color: var(--code-text);
}
.tab-list button[aria-selected="true"] {
  background: var(--code-bg);
  color: #fff;
}
.tabs .codeblock {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.tabs [role="tabpanel"][hidden] {
  display: none;
}

/* ── Misc components ──────────────────────────────────── */
.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 6px 0 20px;
  flex-wrap: wrap;
}
.flow-node {
  flex: 1 1 140px;
  min-width: 120px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.flow-node .fn-t {
  font-weight: 700;
  font-size: 14.5px;
}
.flow-node .fn-d {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 2px;
}
.flow-node.hl {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
}
.flow-node.hl .fn-d {
  color: rgba(255, 255, 255, 0.82);
}
.flow-arrow {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.3;
}
.flow-arrow b {
  display: block;
  font-size: 18px;
  color: var(--accent);
}
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 2px 0 14px 46px;
  margin: 0;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 13px var(--font);
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.steps > li::after {
  content: "";
  position: absolute;
  left: 14.5px;
  top: 34px;
  bottom: 2px;
  width: 1px;
  background: var(--border);
}
.steps > li:last-child::after {
  display: none;
}
.steps .st {
  font-weight: 650;
  color: var(--text);
}
.state-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 16px;
}
.state-flow .pill {
  margin: 0;
}
.state-flow .arr {
  color: var(--muted);
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card h4 {
  margin-top: 0;
}
.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}
.dl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.dl-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}
.dl-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.dl-ico {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 700 11px var(--mono);
}
.dl-card .dt {
  font-weight: 650;
  font-size: 14.5px;
}
.dl-card .dd {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.filter {
  position: relative;
  margin: 0 0 12px;
  max-width: 360px;
}
.filter input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 400 14px var(--font);
}
.filter svg {
  position: absolute;
  left: 11px;
  top: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}
.checklist li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.checklist li:last-child {
  border-bottom: 0;
}
.checklist label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 4px;
  cursor: pointer;
  font-size: 14.5px;
  color: var(--text-2);
}
.checklist input {
  margin-top: 5px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.checklist input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
.checklist .ck-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 4px;
  margin-right: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin: 4px 0 8px;
}
.progress > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--hero-from), var(--hero-to));
  transition: width 0.25s;
}
details.more {
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
details.more > summary {
  cursor: pointer;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-2);
  list-style: none;
}
details.more > summary::-webkit-details-marker {
  display: none;
}
details.more > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
  transition: transform 0.15s;
}
details.more[open] > summary::before {
  transform: rotate(90deg);
}
details.more > div {
  padding: 2px 16px 4px;
}
.footer {
  margin-top: 60px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
}

/* ── Toast + overlay ──────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1b1f33;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.overlay {
  display: none;
}
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  box-shadow: var(--shadow);
}
.to-top.show {
  opacity: 1;
  pointer-events: auto;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1180px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .code-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
@media (max-width: 960px) {
  .menu-btn {
    display: inline-grid;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--nav-h);
    z-index: 45;
    width: min(320px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
  }
  body.nav-open .sidebar {
    transform: none;
  }
  body.nav-open .overlay {
    display: block;
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    z-index: 44;
    background: rgba(10, 12, 24, 0.45);
  }
  .content {
    padding: 0 24px 60px;
  }
}
@media (max-width: 720px) {
  .studio-link span,
  .brand-sub,
  .nav-version {
    display: none;
  }
  .studio-link {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
  .grid-2,
  .dl-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .flow {
    flex-direction: column;
  }
  .flow-arrow {
    padding: 6px 0;
  }
  .flow-arrow b {
    transform: rotate(90deg);
  }
}
@media (max-width: 560px) {
  body {
    font-size: 15px;
  }
  .navbar {
    padding: 0 12px;
    gap: 8px;
  }
  .nav-actions {
    gap: 6px;
  }
  .env-switch button {
    padding: 8px 9px;
    font-size: 12.5px;
  }
  .env-switch .dot {
    display: none;
  }
  .content {
    padding: 0 16px 50px;
  }
  .hero {
    padding: 28px 20px 24px;
    border-radius: 16px;
    margin-top: 16px;
  }
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
  .ep-head,
  .ep-body {
    padding-left: 14px;
    padding-right: 14px;
  }
  .section > h2 {
    font-size: 22px;
  }
  pre {
    font-size: 12.5px;
  }
}
@media (max-width: 400px) {
  .brand > span:not(.brand-mark) {
    display: none;
  }
}
@media print {
  .navbar,
  .sidebar,
  .toast,
  .to-top,
  .copy-chip {
    display: none !important;
  }
  .layout {
    padding-top: 0;
  }
  .content {
    padding: 0;
  }
  .endpoint,
  .codeblock {
    break-inside: avoid;
  }
}
