:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-strong: #eef1f4;
  --ink: #171717;
  --muted: #60656d;
  --border: #e1e4e8;
  --primary: #2255cc;
  --primary-soft: #eef4ff;
  --success: #147a55;
  --success-soft: #edf8f3;
  --warning: #9a640d;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --code-bg: #15171a;
  --code-ink: #edf1f5;
  --header-height: 60px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.75;
}

a { color: inherit; }

button, input { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  width: min(100% - 36px, 1240px);
  height: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 730;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 7px;
  background: #fff;
  object-fit: cover;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-actions a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
  text-decoration: none;
}

.header-actions a:hover,
.header-actions a:focus-visible { color: var(--ink); }

.menu-button {
  display: none;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.docs-layout {
  display: grid;
  grid-template-columns: 228px minmax(0, 820px);
  gap: 60px;
  width: min(100% - 40px, 1120px);
  margin: 0 auto;
  padding: 38px 0 80px;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav-group + .nav-group { margin-top: 22px; }

.nav-label {
  margin: 0 9px 7px;
  color: #7a7f87;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar a {
  display: block;
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.sidebar a:hover,
.sidebar a:focus-visible {
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.sidebar a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 680;
}

main { min-width: 0; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs span::before { margin-right: 7px; content: "/"; }

.page-header {
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 720;
}

h1, h2, h3 {
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: 38px;
  font-weight: 760;
  line-height: 1.25;
}

.lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 26px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
}

.meta-item {
  min-width: 0;
  padding: 14px 16px;
  background: var(--bg);
}

.meta-item span,
.meta-item strong { display: block; }

.meta-item span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.meta-item strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-item code { font-size: 12px; }

.content-section {
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}

.content-section:last-of-type { border-bottom: 0; }

.content-section h2 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 740;
  line-height: 1.4;
}

.content-section h3 {
  margin: 30px 0 11px;
  font-size: 17px;
  font-weight: 720;
}

.content-section p { margin: 11px 0; }
.content-section > p:first-of-type { color: var(--muted); }

code {
  border-radius: 4px;
  background: var(--surface-strong);
  padding: 2px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.steps {
  margin: 24px 0 0;
  padding: 0;
  counter-reset: step;
  list-style: none;
}

.step {
  position: relative;
  min-height: 48px;
  padding: 0 0 30px 52px;
  counter-increment: step;
}

.step:last-child { padding-bottom: 0; }

.step::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  content: counter(step);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.step:not(:last-child)::after {
  position: absolute;
  top: 35px;
  bottom: 5px;
  left: 15px;
  width: 1px;
  background: var(--border);
  content: "";
}

.step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.step p {
  margin: 0;
  color: var(--muted);
}

.callout {
  margin: 22px 0;
  padding: 15px 17px;
  border: 1px solid #cbd8f7;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: var(--primary-soft);
}

.callout.success {
  border-color: #c7e5d7;
  border-left-color: var(--success);
  background: var(--success-soft);
}

.callout.warning {
  border-color: #efd9a8;
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.callout.danger {
  border-color: #f2c6c2;
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.callout strong { display: block; margin-bottom: 3px; }
.callout p { margin: 0; color: #4f555d; }

.code-block {
  margin: 18px 0 24px;
  overflow: hidden;
  border: 1px solid #282c31;
  border-radius: 8px;
  background: var(--code-bg);
}

.code-head {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #2d3137;
  color: #aeb5bf;
  font-size: 11px;
}

.copy-button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #41464f;
  border-radius: 5px;
  background: #212429;
  color: #d8dde4;
  cursor: pointer;
  font-size: 11px;
}

.copy-button:hover { background: #2a2e34; }

.code-block pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  color: var(--code-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 2;
}

.code-block pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.tool-card {
  display: block;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: #b7c5e7;
  background: var(--primary-soft);
  outline: none;
}

.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tool-card strong { font-size: 15px; }
.tool-card p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.recommended { background: var(--success-soft); color: var(--success); }
.tag.advanced { background: var(--warning-soft); color: var(--warning); }

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

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

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

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 650; }

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

.check-list li {
  position: relative;
  padding: 7px 0 7px 26px;
}

.check-list li::before {
  position: absolute;
  top: 11px;
  left: 2px;
  color: var(--success);
  content: "✓";
  font-weight: 800;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.link-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 660;
  text-decoration: none;
}

.link-button:hover { background: var(--surface); }
.link-button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.link-button.primary:hover { background: #1d49b0; }

.page-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 48px;
}

.page-nav a {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  text-decoration: none;
}

.page-nav a:last-child { text-align: right; }
.page-nav small { display: block; color: var(--muted); font-size: 11px; }
.page-nav strong { font-size: 13px; }

.site-footer {
  margin-top: 54px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.site-footer a { margin-right: 14px; text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

@media (max-width: 860px) {
  .menu-button { display: inline-flex; align-items: center; }
  .header-actions a { display: none; }
  .docs-layout { display: block; padding-top: 26px; }
  .sidebar {
    position: fixed;
    z-index: 25;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    height: calc(100dvh - var(--header-height));
    max-height: none;
    align-self: stretch;
    padding: 24px max(20px, calc((100vw - 760px) / 2));
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .sidebar.is-open { display: block; }
  .sidebar a { min-height: 38px; padding: 8px 10px; }
  body.menu-open { overflow: hidden; }
}

@media (max-width: 640px) {
  .header-inner { width: min(100% - 28px, 1240px); }
  .brand-subtitle { display: none; }
  .docs-layout { width: min(100% - 30px, 1120px); padding-bottom: 54px; }
  .breadcrumbs { margin-bottom: 18px; }
  h1 { font-size: 31px; }
  .lead { font-size: 16px; }
  .page-header { padding-bottom: 30px; }
  .meta-strip { grid-template-columns: 1fr; }
  .content-section { padding: 34px 0; }
  .content-section h2 { font-size: 22px; }
  .tool-grid, .page-nav { grid-template-columns: 1fr; }
  .page-nav a:last-child { text-align: left; }
  .step { padding-left: 45px; }
  .code-block pre { padding: 15px; font-size: 12px; }
  th, td { min-width: 128px; padding: 11px 12px; }
}

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