:root {
  --ink: #12202c;
  --mute: #5a6b78;
  --paper: #f3f6f8;
  --sheet: #ffffff;
  --line: #d5dee6;
  --side: #15202b;
  --side-ink: #d7e2ec;
  --side-mute: #8ea0af;
  --side-line: #2a3a48;
  --get: #0b7a6b;
  --get-bg: #e4f5f1;
  --note: #9a5b00;
  --note-bg: #fff4dd;
  --halt: #9b2c2c;
  --halt-bg: #fdecec;
  --link: #0d5c8c;
  --cta: #0b7a6b;
  --cta-ink: #ffffff;
  --code: #101820;
  --code-ink: #d8e4ee;
  --code-mute: #7f93a3;
  --key: #7ec8b8;
  --str: #e2c27a;
  --cmt: #6f8393;
  --focus: #0b7a6b;
  --wrap: 1120px;
  --spec: 248px;
  --sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
}

body.is-locked {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--link);
  text-underline-offset: 0.16em;
}

a:hover {
  color: #083e60;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 80;
  padding: 0.4rem 0.7rem;
  background: var(--sheet);
  color: var(--ink);
}

.skip:focus {
  top: 0.75rem;
}

.mast {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--sheet);
  border-bottom: 1px solid var(--line);
}

.mast.is-stuck {
  box-shadow: 0 1px 0 var(--line);
}

.mast-bar {
  width: min(var(--wrap), calc(100% - 2rem));
  margin: 0 auto;
  min-height: 3.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.brand small {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--mute);
}

.mast-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav ul {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.7rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.94rem;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: #eef3f6;
}

.nav a.cta,
a.cta {
  background: var(--cta);
  color: var(--cta-ink);
  text-decoration: none;
  font-weight: 650;
}

.nav a.cta:hover,
a.cta:hover {
  background: #086457;
  color: var(--cta-ink);
}

a.ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}

a.ghost:hover {
  border-color: #b7c6d1;
  background: #f8fbfc;
}

a.cta {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border-radius: 6px;
}

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.86rem;
  cursor: pointer;
}

.layout {
  width: min(var(--wrap), calc(100% - 2rem));
  margin: 1.15rem auto 2.5rem;
  display: grid;
  grid-template-columns: var(--spec) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.spec {
  position: sticky;
  top: 4.4rem;
  max-height: calc(100vh - 5rem);
  overflow: auto;
  background: var(--side);
  color: var(--side-ink);
  border-radius: 10px;
  padding: 0.95rem 0.75rem 1.1rem;
}

.spec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.4rem 0.7rem;
  border-bottom: 1px solid var(--side-line);
  margin-bottom: 0.7rem;
}

.spec-head strong {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--side-mute);
}

.spec-close {
  display: none;
  border: 1px solid var(--side-line);
  background: transparent;
  color: var(--side-ink);
  border-radius: 5px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.tree {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.6rem;
  border: 1px dashed var(--side-line);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--side-mute);
  white-space: pre;
}

.toc-label {
  margin: 0.55rem 0.4rem 0.25rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--side-mute);
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.45rem;
  color: var(--side-ink);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.86rem;
}

.toc a:hover,
.toc a.is-active {
  background: #1f2d3a;
  color: #fff;
}

.verb {
  flex: 0 0 auto;
  min-width: 2.4rem;
  padding: 0.05rem 0.28rem;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-align: center;
  background: #1a3d38;
  color: #8ee0d2;
}

.verb.note {
  background: #3d3218;
  color: #f0cf86;
}

.doc {
  min-width: 0;
}

.crumb {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--mute);
}

.crumb a {
  color: var(--link);
  text-decoration: none;
}

.hero,
.block {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.3rem 1.4rem;
  margin-bottom: 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--get-bg);
  color: var(--get);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.chip.dim {
  background: #eef3f6;
  color: var(--mute);
}

.path {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--mute);
}

.path b {
  color: var(--get);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.7rem, 3vw, 2.25rem);
}

h2 {
  margin: 0 0 0.55rem;
  font-size: 1.28rem;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.notice {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--note);
  background: var(--note-bg);
  color: #5c3a08;
  font-size: 0.92rem;
}

.lead,
.intro {
  margin: 0 0 0.9rem;
  color: #2b3c49;
}

.acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1.15rem;
}

.metric {
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.metric strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.metric span {
  color: var(--mute);
  font-size: 0.86rem;
}

.block-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.block-head code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--get);
  background: var(--get-bg);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.card,
.os,
.faq details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 0.9rem 0.95rem;
}

.card a,
.os a {
  text-decoration: none;
}

.kicker {
  display: inline-block;
  margin-bottom: 0.3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--get);
}

.figure {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef3f6;
}

.figure img {
  width: 100%;
}

.figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--mute);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.ticks {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
}

.ticks li + li {
  margin-top: 0.35rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f6;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--mute);
}

tr:last-child td {
  border-bottom: 0;
}

td code,
p code,
li code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: #eef3f6;
  padding: 0.05rem 0.28rem;
  border-radius: 4px;
}

.code {
  margin: 0.85rem 0 0;
  background: var(--code);
  color: var(--code-ink);
  border-radius: 8px;
  overflow: auto;
}

.code-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #22303b;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--code-mute);
}

.code pre {
  margin: 0;
  padding: 0.85rem 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre;
}

.code .c {
  color: var(--cmt);
}

.code .k {
  color: var(--key);
}

.code .s {
  color: var(--str);
}

.warn,
.halt {
  padding: 0.85rem 0.95rem;
  border-radius: 8px;
}

.warn {
  background: var(--note-bg);
  border: 1px solid #ecd7a4;
}

.halt {
  background: var(--halt-bg);
  border: 1px solid #f0c4c4;
}

.faq details + details {
  margin-top: 0.55rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::before {
  content: "+";
  display: inline-block;
  width: 1.1rem;
  font-family: var(--mono);
  color: var(--get);
}

.faq details[open] summary::before {
  content: "–";
}

.faq details p {
  margin: 0.55rem 0 0;
  color: #2b3c49;
}

.foot {
  background: var(--side);
  color: var(--side-ink);
  padding: 2rem 0 1.2rem;
}

.foot-grid {
  width: min(var(--wrap), calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.15fr;
  gap: 1.3rem;
}

.foot a {
  color: #c5d6e3;
}

.foot a:hover {
  color: #fff;
}

.foot h3 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
}

.foot ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foot li + li {
  margin-top: 0.32rem;
}

.foot .brand {
  color: #fff;
  margin-bottom: 0.65rem;
}

.foot .brand small {
  color: var(--side-mute);
}

.foot p {
  margin: 0;
  color: var(--side-mute);
  font-size: 0.9rem;
}

.legal {
  width: min(var(--wrap), calc(100% - 2rem));
  margin: 1.4rem auto 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--side-line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.2rem;
  color: var(--side-mute);
  font-size: 0.84rem;
}

[data-reveal] {
  opacity: 1;
  transform: none;
}

.motion-ok [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
}

.motion-ok [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .spec {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(20rem, 88vw);
    max-height: none;
    border-radius: 0;
    transform: translateX(-105%);
  }

  .spec.is-open {
    transform: none;
  }

  .spec-close,
  .icon-btn {
    display: inline-flex;
  }

  .nav {
    position: fixed;
    top: 3.7rem;
    right: 0.75rem;
    z-index: 45;
    display: none;
    min-width: 12rem;
    padding: 0.45rem;
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(18, 32, 44, 0.12);
  }

  .nav.is-open {
    display: block;
  }

  .nav ul {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics,
  .split,
  .foot-grid {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .mast-bar,
  .layout,
  .foot-grid,
  .legal {
    width: calc(100% - 1.2rem);
  }

  .hero,
  .block {
    padding: 1rem;
  }

  .figure figcaption {
    flex-direction: column;
  }

  .cards,
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .motion-ok [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
