:root {
  --red: #c4161c;
  --red-ink: #b0141a;
  --bg: #f5f3f0;
  --surface: #ffffff;
  --ink: #15151a;
  --ink2: #4a4a54;
  --ink3: #6e6e78;
  --line: #e2ded8;
  --code-bg: #1d1d23;
  --code-ink: #ececf1;
  --radius: 14px;
  --wrap: 1040px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --red: #da2029;
    --red-ink: #ff7f85;
    --bg: #0e0e12;
    --surface: #18181e;
    --ink: #f2f0ec;
    --ink2: #c4c2cc;
    --ink3: #9a98a4;
    --line: #2c2c34;
    --code-bg: #08080b;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

a { color: var(--red-ink); }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); padding: 8px 12px;
}
.skip:focus { left: 8px; top: 8px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px; margin-right: auto;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 20px;
}
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.nav a {
  color: var(--ink2); text-decoration: none; font-size: 16px; padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
.lang { display: flex; gap: 2px; font-size: 14px; font-weight: 600; }
.lang a, .lang span {
  padding: 3px 8px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); color: var(--ink2);
}
.lang a:hover { color: var(--ink); border-color: var(--ink3); }
.lang [aria-current] { background: var(--red); border-color: var(--red); color: #fff; }
@media (max-width: 639px) { .nav { order: 1; flex-basis: 100%; } }

main { padding: 32px 0 48px; }
main h1 { font-size: 32px; line-height: 1.2; margin: 0 0 8px; }
main h2 { font-size: 24px; line-height: 1.3; margin: 40px 0 8px; scroll-margin-top: 16px; }
main h3 { font-size: 19px; line-height: 1.35; margin: 28px 0 6px; scroll-margin-top: 16px; }
.lead { color: var(--ink2); font-size: 18px; margin-top: 0; }
.prose { max-width: 820px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px;
}

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; }
.toc ul { margin: 0; }

pre {
  margin: 8px 0 16px; padding: 12px 14px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-ink); border-radius: 10px;
  font-family: var(--mono); font-size: 14px; line-height: 1.5; tab-size: 4;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
pre.response { border-left: 4px solid var(--ink3); }
pre.response::before {
  content: attr(data-status); display: block; margin-bottom: 4px;
  color: var(--ink3); font-weight: 600;
}
.file { margin: 24px 0 4px; font-family: var(--mono); font-size: 15px; font-weight: 600; }

.table { overflow-x: auto; margin: 12px 0 16px; }
.table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.table th, .table td {
  text-align: left; vertical-align: top;
  padding: 8px 10px; border: 1px solid var(--line);
}
.table th { background: var(--surface); font-weight: 600; }
@media (max-width: 479px) {
  .table table { font-size: 14px; }
  .table th, .table td { padding: 6px 8px; }
}

.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  color: var(--ink3); font-size: 15px;
}
.site-footer .wrap { padding-top: 24px; padding-bottom: 28px; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--ink2); }

@media print {
  :root {
    --bg: #fff; --surface: #fff; --ink: #000; --ink2: #000; --ink3: #333;
    --line: #999; --red-ink: #000; --code-bg: #fff; --code-ink: #000;
    color-scheme: light;
  }
  body { font-size: 11pt; line-height: 1.45; }
  .skip, .nav, .lang { display: none; }
  pre { border: 1px solid var(--line); white-space: pre-wrap; }
  .wrap, .prose { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  h1, h2, h3 { break-after: avoid; }
  tr, pre { break-inside: avoid; }
}
