:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-strong: #eef1f4;
  --text: #172027;
  --muted: #66727d;
  --border: #dfe4e8;
  --border-strong: #cbd3d9;
  --header: #11181d;
  --header-text: #f7fafb;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e7f5f2;
  --gold: #b96d12;
  --gold-soft: #fff5df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --code-bg: #151d22;
  --code-text: #e8eef2;
  --shadow: 0 10px 28px rgba(20, 32, 40, 0.08);
  --topbar-height: 64px;
  --sidebar-width: 272px;
  --toc-width: 176px;
  --content-width: 820px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101619;
  --surface: #161e22;
  --surface-strong: #202a2f;
  --text: #edf2f4;
  --muted: #a2adb4;
  --border: #2d393f;
  --border-strong: #3c4a51;
  --header: #090d0f;
  --header-text: #f7fafb;
  --accent: #54bfb3;
  --accent-strong: #75d0c7;
  --accent-soft: #17312f;
  --gold: #e3a348;
  --gold-soft: #352a19;
  --danger: #ff8e86;
  --danger-soft: #38201f;
  --code-bg: #070a0c;
  --code-text: #e8eef2;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0;
  transition: background-color 160ms ease, color 160ms ease;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 200;
  left: 16px;
  top: -52px;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: top 120ms ease;
}

.skip-link:focus {
  top: 10px;
}

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  height: var(--topbar-height);
  background: var(--header);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1600px);
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

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

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 700;
}

.brand-copy small {
  color: #9eabb2;
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.version-label {
  color: #a8b4ba;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.09);
}

.icon-button svg,
.download-button svg,
.search-box svg,
.back-to-top svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-dark {
  display: none;
}

html[data-theme="dark"] .theme-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-icon-dark {
  display: block;
}

.download-button,
.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
}

.download-button {
  padding: 0 14px;
  background: #f2b84b;
  color: #161a1d;
}

.download-button:hover {
  background: #ffd06f;
}

.mobile-menu-button {
  display: none;
}

.page-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
  max-width: 1600px;
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
}

.sidebar,
.page-toc {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  height: calc(100vh - var(--topbar-height));
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 20px 16px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.search-box {
  position: relative;
  display: flex;
  height: 42px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.search-box svg {
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box kbd {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font: 11px/1.5 Consolas, monospace;
  white-space: nowrap;
}

.search-summary {
  min-height: 22px;
  margin: 6px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.doc-nav {
  padding-bottom: 18px;
}

.nav-label {
  margin: 16px 10px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.doc-nav a {
  display: block;
  min-height: 38px;
  margin: 2px 0;
  padding: 7px 10px;
  border-left: 3px solid transparent;
  border-radius: 0 5px 5px 0;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.doc-nav a:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.doc-nav a.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.doc-nav a.search-hidden,
.nav-label.search-hidden {
  display: none;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1f9d68;
  box-shadow: 0 0 0 3px color-mix(in srgb, #1f9d68 18%, transparent);
}

.content {
  min-width: 0;
}

.content-inner {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 52px 34px 80px;
}

.doc-section {
  padding: 10px 0 64px;
  border-bottom: 1px solid var(--border);
}

.doc-section.search-hidden {
  display: none;
}

.intro-section {
  padding-top: 12px;
}

.intro-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.intro-brand img {
  flex: 0 0 auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.3;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(30px, 5vw, 44px);
}

h2 {
  margin-bottom: 0;
  font-size: 27px;
}

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

p {
  margin: 10px 0;
}

.lead {
  max-width: 720px;
  margin: 24px 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 30px;
}

.primary-action,
.secondary-action {
  min-width: 118px;
  padding: 0 17px;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action {
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
}

.secondary-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.notice {
  position: relative;
  margin: 22px 0;
  padding: 14px 16px 14px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent-soft);
}

.notice strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.notice p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.notice-warning {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}

.notice-danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.notice-success {
  border-left-color: #1f8f62;
  background: color-mix(in srgb, #1f8f62 10%, var(--bg));
}

.meta-grid,
.metric-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 28px 0 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.meta-grid div,
.metric-preview div {
  min-width: 0;
  padding: 17px 14px;
  border-right: 1px solid var(--border);
}

.meta-grid div:last-child,
.metric-preview div:last-child {
  border-right: 0;
}

.meta-grid span,
.metric-preview span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meta-grid strong,
.metric-preview strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 42px 0 24px;
}

.section-number {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--gold);
  font: 700 13px/1 Consolas, monospace;
}

ol,
ul {
  padding-left: 24px;
}

li {
  margin: 8px 0;
  padding-left: 4px;
}

li::marker {
  color: var(--accent);
  font-weight: 700;
}

.step-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.step-list li:last-child {
  border-bottom: 0;
}

.step-list li > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.step-list strong {
  display: block;
}

.step-list p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.check-list {
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding: 8px 8px 8px 34px;
  border-bottom: 1px solid var(--border);
}

.check-list li::before {
  position: absolute;
  left: 6px;
  top: 10px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  content: "✓";
  font-size: 12px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
}

code {
  border-radius: 3px;
  background: var(--surface-strong);
  color: var(--text);
  font: 0.91em/1.5 "Cascadia Code", Consolas, monospace;
}

p code,
li code,
td code {
  padding: 2px 5px;
}

pre {
  position: relative;
  margin: 16px 0;
  overflow: auto;
  border: 1px solid #28343a;
  border-radius: 6px;
  background: var(--code-bg);
  scrollbar-width: thin;
}

pre code {
  display: block;
  min-width: max-content;
  padding: 18px 56px 18px 18px;
  background: transparent;
  color: var(--code-text);
  font-size: 13px;
  line-height: 1.75;
}

.copy-button {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid #3c4a51;
  border-radius: 4px;
  background: #202a2f;
  color: #d8e0e4;
  cursor: pointer;
  font-size: 12px;
}

.copy-button:hover {
  border-color: #65757d;
  background: #2b373d;
}

.copy-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

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

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

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

.interface-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr) 26px minmax(0, 1fr);
  align-items: center;
  margin: 24px 0;
}

.interface-map > div {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.interface-map span {
  display: block;
  color: var(--gold);
  font: 700 12px/1 Consolas, monospace;
}

.interface-map strong,
.interface-map small {
  display: block;
}

.interface-map strong {
  margin-top: 12px;
  font-size: 14px;
}

.interface-map small {
  margin-top: 3px;
  color: var(--muted);
}

.interface-map i {
  height: 1px;
  background: var(--border-strong);
}

.panel-preview {
  margin: 22px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.preview-header,
.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-header {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.preview-header b,
.preview-actions span {
  color: #168057;
  font-size: 12px;
}

.panel-preview label {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-preview input {
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.preview-actions {
  margin-top: 14px;
}

.preview-actions button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  opacity: 1;
}

.port-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.port-strip div {
  padding: 15px 16px;
}

.port-strip div + div {
  border-left: 1px solid var(--border);
}

.port-strip span,
.port-strip code {
  display: block;
}

.port-strip span {
  color: var(--muted);
  font-size: 12px;
}

.port-strip code {
  margin-top: 4px;
  background: transparent;
  font-size: 14px;
}

.metric-preview {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.metric-preview strong {
  color: var(--accent);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.faq-list {
  border-top: 1px solid var(--border);
}

.faq-list details {
  border-bottom: 1px solid var(--border);
}

.faq-list summary {
  position: relative;
  padding: 16px 40px 16px 4px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  content: "+";
  font-weight: 400;
  line-height: 16px;
  text-align: center;
  transform: translateY(-50%);
}

.faq-list details[open] summary::after {
  content: "−";
}

.faq-list details > div {
  padding: 0 40px 16px 4px;
  color: var(--muted);
}

.faq-list details > div p:first-child {
  margin-top: 0;
}

.hash-block {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.hash-block span,
.hash-block code {
  display: block;
}

.hash-block span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.hash-block code {
  overflow-wrap: anywhere;
  background: transparent;
  font-size: 12px;
}

.empty-search {
  padding: 80px 0;
  text-align: center;
}

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

.empty-search button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 32px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.site-footer strong {
  color: var(--text);
  font-size: 14px;
}

.site-footer p {
  margin: 2px 0 0;
}

.site-footer > div:last-child {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.page-toc {
  padding: 32px 18px;
}

.page-toc-inner {
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.page-toc p {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.page-toc a {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.page-toc a:hover,
.page-toc a.active {
  color: var(--accent);
}

.back-to-top {
  position: fixed;
  z-index: 60;
  right: 22px;
  bottom: 22px;
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.back-to-top:hover {
  background: var(--surface);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.mobile-overlay {
  display: none;
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .page-toc {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar-inner {
    padding: 0 12px;
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .brand {
    margin-right: auto;
    margin-left: 4px;
  }

  .brand img {
    width: 32px;
    height: 32px;
  }

  .version-label {
    display: none;
  }

  .download-button {
    width: 38px;
    padding: 0;
  }

  .download-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .page-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 90;
    top: var(--topbar-height);
    left: 0;
    width: min(86vw, 310px);
    height: calc(100vh - var(--topbar-height));
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-overlay {
    position: fixed;
    z-index: 80;
    inset: var(--topbar-height) 0 0;
    display: block;
    background: rgba(5, 10, 13, 0.5);
  }

  .content-inner {
    padding: 30px 20px 64px;
  }

  .intro-brand {
    align-items: flex-start;
  }

  .intro-brand img {
    width: 58px;
    height: 58px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 24px;
  }

  .lead {
    font-size: 16px;
  }

  .meta-grid,
  .metric-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-grid div:nth-child(2),
  .metric-preview div:nth-child(2) {
    border-right: 0;
  }

  .meta-grid div:nth-child(-n+2),
  .metric-preview div:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }

  .interface-map {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .interface-map i {
    width: 1px;
    height: 14px;
    margin-left: 22px;
  }

  .interface-map > div {
    min-height: 94px;
  }

  .panel-preview label {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .site-footer {
    flex-direction: column;
  }

  .site-footer > div:last-child {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .brand-copy small {
    display: none;
  }

  .brand-copy strong {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 2px;
  }

  .content-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .doc-section {
    padding-bottom: 48px;
  }

  .section-heading {
    margin-top: 30px;
  }

  .section-number {
    width: 38px;
    height: 38px;
  }

  .port-strip {
    grid-template-columns: 1fr;
  }

  .port-strip div + div {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .sidebar,
  .page-toc,
  .back-to-top,
  .copy-button,
  .intro-actions {
    display: none !important;
  }

  .page-shell {
    display: block;
  }

  .content-inner {
    width: 100%;
    padding: 0;
  }

  .doc-section {
    break-inside: avoid;
  }
}
