:root {
  color-scheme: dark;
  --bg: #0e0f13;
  --panel: #15161c;
  --raised: #1c1d25;
  --line: #2a2c35;
  --text: #e9ebf1;
  --muted: #9da2b0;
  --faint: #6f7483;
  --accent: #7c6cf0;
  --accent-ink: #a99ff8;
  --code-bg: #0a0b0f;
  --code-text: #dfe3ec;
  --t-k: #c792ea;
  --t-s: #a5d6a7;
  --t-n: #f78c6c;
  --t-c: #6f7483;
  --t-v: #82aaff;
  --get: #2f9e64;
  --post: #5b6ee1;
  --put: #8b5cf6;
  --patch: #c98a12;
  --delete: #d9484f;
  --note: #4c8dff;
  --tip: #2f9e64;
  --important: #7c6cf0;
  --warning: #d9a514;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #f6f6f9;
    --raised: #eeeef4;
    --line: #e1e2ea;
    --text: #1c1d24;
    --muted: #555b6b;
    --faint: #80869a;
    --accent: #5a48d8;
    --accent-ink: #4b3bc4;
    --code-bg: #f4f4f8;
    --code-text: #1f2330;
    --t-k: #8b3fc7;
    --t-s: #2e7d32;
    --t-n: #c2410c;
    --t-c: #80869a;
    --t-v: #1d5fd1;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
}

a {
  color: var(--accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
}

.links {
  display: flex;
  gap: 18px;
  margin-inline-start: auto;
  font-size: 15px;
}

.links a {
  color: var(--muted);
}

.links a:hover {
  color: var(--text);
}

.menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.menu span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 220px;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 24px 16px 40px;
  border-inline-end: 1px solid var(--line);
}

.sidebar ul,
.toc ul {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.section {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
}

.sidebar a:hover {
  background: var(--raised);
  color: var(--text);
  text-decoration: none;
}

.sidebar a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 36px 48px 80px;
}

article {
  max-width: 780px;
}

.toc {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 36px 16px;
  font-size: 14px;
}

.toc a {
  display: block;
  padding: 3px 10px;
  color: var(--muted);
}

h1 {
  margin: 0 0 18px;
  font-size: 34px;
  line-height: 1.25;
}

h2 {
  margin: 44px 0 12px;
  padding-top: 8px;
  font-size: 23px;
  line-height: 1.35;
}

h3 {
  margin: 30px 0 8px;
  font-size: 18px;
}

h2,
h3 {
  position: relative;
}

.anchor {
  position: absolute;
  inset-inline-start: -22px;
  color: var(--faint);
  opacity: 0;
}

h2:hover .anchor,
h3:hover .anchor {
  opacity: 1;
  text-decoration: none;
}

p,
ul,
ol {
  margin: 0 0 16px;
}

li {
  margin: 4px 0;
}

strong {
  color: var(--text);
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--raised);
  font: 0.86em/1.5 var(--mono);
  direction: ltr;
  unicode-bidi: isolate;
}

pre {
  position: relative;
  margin: 0 0 18px;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-text);
  direction: ltr;
  text-align: left;
}

pre code {
  padding: 0;
  background: none;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
}

.t-k {
  color: var(--t-k);
}

.t-s {
  color: var(--t-s);
}

.t-n {
  color: var(--t-n);
}

.t-c {
  color: var(--t-c);
  font-style: italic;
}

.t-v {
  color: var(--t-v);
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--raised);
  color: var(--muted);
  font: 12px/1.6 var(--font);
  cursor: pointer;
  opacity: 0;
}

pre:hover .copy,
.copy:focus-visible {
  opacity: 1;
}

.tabs {
  margin: 0 0 18px;
}

.tabs pre {
  margin: 0;
  border-start-start-radius: 0;
}

.tablist {
  display: flex;
  gap: 2px;
  direction: ltr;
}

.tablist button {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--panel);
  color: var(--muted);
  font: 600 14px/1.5 var(--font);
  cursor: pointer;
}

.tablist button[aria-selected="true"] {
  background: var(--code-bg);
  color: var(--text);
}

.tabs.ready .panel[hidden] {
  display: none;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  direction: ltr;
  overflow-x: auto;
}

.endpoint code {
  padding: 0;
  background: none;
  font-size: 15px;
  white-space: nowrap;
}

.param {
  color: var(--accent-ink);
}

.method {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
  font: 700 12px/1.6 var(--mono);
  letter-spacing: 0.03em;
}

.method.get {
  background: var(--get);
}

.method.post {
  background: var(--post);
}

.method.put {
  background: var(--put);
}

.method.patch {
  background: var(--patch);
}

.method.delete {
  background: var(--delete);
}

.callout {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-inline-start: 4px solid var(--note);
  border-radius: 10px;
  background: color-mix(in srgb, var(--note) 9%, transparent);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.callout.tip {
  border-color: var(--tip);
  background: color-mix(in srgb, var(--tip) 9%, transparent);
}

.callout.important {
  border-color: var(--important);
  background: color-mix(in srgb, var(--important) 12%, transparent);
}

.callout.warning {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 10%, transparent);
}

.table {
  margin: 0 0 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

th {
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

blockquote {
  margin: 0 0 18px;
  padding-inline-start: 14px;
  border-inline-start: 3px solid var(--line);
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 780px;
  margin-top: 56px;
}

.pager a {
  display: flex;
  flex: 0 1 48%;
  flex-direction: column;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
}

.pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.pager .next {
  margin-inline-start: auto;
  text-align: end;
}

.pager small {
  color: var(--faint);
}

.choose {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.choose h1 {
  margin: 16px 0 4px;
}

.choose p {
  color: var(--muted);
}

.choices {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.choices a {
  min-width: 140px;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.choices a + a {
  background: var(--raised);
  color: var(--text);
}

.choices a:hover {
  text-decoration: none;
  filter: brightness(1.1);
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .menu {
    display: flex;
  }

  .sidebar {
    position: fixed;
    inset: 60px 0 0;
    z-index: 9;
    display: none;
    height: auto;
    background: var(--bg);
    border: 0;
  }

  body.nav-open .sidebar {
    display: block;
  }

  .content {
    padding: 24px 16px 64px;
  }

  h1 {
    font-size: 28px;
  }

  .brand span {
    font-size: 15px;
  }

  .links {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .brand span {
    white-space: nowrap;
  }

  .links a:first-child {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .copy,
  .anchor {
    transition: opacity 0.15s;
  }
}
