:root {
  --bg: #f6f8fb;
  --surface: #fff;
  --text: #1a2332;
  --text-muted: #5c6b7f;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --border: #e5e9f0;
  --warn-bg: #fff7ed;
  --warn-border: #fdba74;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}

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

a:hover {
  opacity: 0.9;
}

.shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.shell--with-toc {
  max-width: 72rem;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(11.5rem, 14rem) minmax(0, 1fr);
  gap: 2rem 2.5rem;
}

.toc-sidebar {
  position: sticky;
  top: 1.25rem;
  align-self: start;
  min-width: 0;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.article-main {
  min-width: 0;
  max-width: 44rem;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.92rem;
}

.site-nav .brand {
  color: #0f172a;
  font-weight: 800;
  text-decoration: none;
}

.site-nav .brand:hover {
  opacity: 1;
  color: var(--accent);
}

.site-nav .nav-cta {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.45rem 0.95rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.site-nav .nav-cta:hover {
  opacity: 1;
  filter: brightness(1.06);
}

.site-nav .nav-link {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav .nav-link:hover {
  opacity: 1;
  color: var(--accent);
}

header.page-head {
  margin-bottom: 1.75rem;
}

.doc-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: #0f172a;
}

.lead {
  font-size: 1.08rem;
  color: var(--text-muted);
}

.note-inline {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
  font-size: 0.95rem;
}

.note-inline strong {
  color: var(--text);
}

nav.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin: 0;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  line-height: 1.55;
}

nav.toc strong {
  display: block;
  margin-bottom: 0.65rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

nav.toc ol {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
}

nav.toc li {
  margin: 0.3rem 0;
}

nav.toc a {
  color: var(--text-muted);
  text-decoration: none;
}

nav.toc a:hover {
  color: var(--accent);
  opacity: 1;
}

article section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 1.25rem;
}

h2 {
  font-size: 1.28rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  color: #0f172a;
}

h3 {
  font-size: 1.08rem;
  margin: 1.35rem 0 0.5rem;
  color: #172033;
}

p {
  margin: 0 0 0.9rem;
}

ul,
ol {
  margin: 0 0 0.95rem;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.35rem;
}

.callout-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.25rem 0;
}

.callout-warn strong {
  color: #9a3412;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
}

pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.article-figure {
  margin: 1.4rem 0 1.7rem;
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article-figure figcaption {
  margin-top: 0.55rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.empty-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  color: var(--text-muted);
  margin: 0;
}

.article-list {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.article-card h2 {
  border: 0;
  padding: 0;
  margin-bottom: 0.45rem;
  font-size: 1.15rem;
}

.article-card h2 a {
  color: inherit;
  text-decoration: none;
}

.article-card h2 a:hover {
  color: var(--accent);
  text-decoration: underline;
  opacity: 1;
}

.article-card p {
  color: var(--text-muted);
  font-size: 0.98rem;
}

.article-card .doc-meta {
  margin-bottom: 0.35rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

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

th {
  color: #0f172a;
  background: #eef3f8;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  margin-top: 0;
  font-size: 1.02rem;
}

.social-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin: 2.25rem 0 0;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.social-share strong {
  margin-right: 0.15rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.social-share a {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.social-share a:hover {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

footer.page-foot {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.back-to-top {
  position: fixed;
  right: max(1rem, calc((100vw - 44rem) / 2 - 4rem));
  bottom: 1.25rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #0f172a;
  box-shadow: var(--shadow);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.back-to-top:hover,
.back-to-top:focus {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

body:has(.shell--with-toc) .back-to-top {
  right: max(1rem, calc((100vw - 72rem) / 2 + 1rem));
}

@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .toc-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  nav.toc {
    margin-bottom: 2rem;
  }

  .article-main {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .shell {
    padding-top: 1.25rem;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .back-to-top {
    right: 1rem;
    bottom: 1rem;
  }

  body:has(.shell--with-toc) .back-to-top {
    right: 1rem;
  }

  table {
    min-width: 20rem;
  }
}
