:root {
  --canvas: #ffffff;
  --canvas-subtle: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #57606a;
  --border: #d0d7de;
  --accent: #0969da;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 46rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

html[data-lang="zh"] .en,
html[data-lang="en"] .zh {
  display: none;
}

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

a:hover {
  text-decoration: underline;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--fg);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  z-index: 20;
}

.skip:focus {
  top: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.bar {
  width: min(var(--measure), calc(100% - 2rem));
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark img {
  display: block;
  width: 22px;
  height: 22px;
}

.wordmark:hover {
  text-decoration: none;
  color: var(--fg);
}

.site-nav {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

.site-nav a {
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 30px;
  padding: 0 0.65rem;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--canvas-subtle);
  color: var(--fg);
}

.lang-switch button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.doc {
  width: min(var(--measure), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

h1 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--border);
  font-size: 2em;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  margin: 0 0 1.25rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.meta dt {
  font-weight: 600;
  color: var(--fg);
}

.meta dd {
  margin: 0;
}

.status {
  margin: 0 0 1.25rem;
}

.status .k {
  font-weight: 600;
}

.toc {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
}

.toc-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.toc ol {
  margin: 0;
  padding-left: 1.4em;
  columns: 2;
  column-gap: 2rem;
}

.toc li {
  margin: 0 0 0.15em;
  break-inside: avoid;
}

.toc li + li {
  margin-top: 0;
}

h2,
h3 {
  scroll-margin-top: 72px;
}

.anchor {
  margin-left: 0.35em;
  color: var(--border);
  font-weight: 400;
  opacity: 0;
  text-decoration: none;
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

table {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--canvas-subtle);
  font-weight: 600;
}

h2 {
  margin: 1.6em 0 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
  font-size: 1.5em;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

h3 {
  margin: 1.4em 0 0.5em;
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.35;
}

p,
li,
dd {
  margin: 0 0 16px;
}

ul,
ol {
  margin: 0 0 16px;
  padding-left: 1.5em;
}

li + li {
  margin-top: 0.25em;
}

.fields {
  margin: 0 0 16px;
}

.fields dt {
  margin: 1.15rem 0 0.25rem;
  font-weight: 600;
}

.fields dd {
  margin: 0 0 0.15rem;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(175, 184, 193, 0.2);
  border-radius: 4px;
  padding: 0.15em 0.35em;
}

pre {
  margin: 0 0 16px;
  padding: 16px;
  overflow: auto;
  line-height: 1.45;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: 0.84rem;
}

.sample {
  margin: 0 0 16px;
}

.sample-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.sample pre {
  margin: 0;
}

footer {
  border-top: 1px solid var(--border);
}

.foot {
  width: min(var(--measure), calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.foot p {
  margin: 0;
}

@media (max-width: 640px) {
  .bar {
    flex-wrap: wrap;
    padding: 0.5rem 0;
  }

  .site-nav {
    margin-left: 0;
    order: 3;
    width: 100%;
  }

  .toc ol {
    columns: 1;
  }
}
