* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --paper: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --line: #d8dee8;
  --soft: #eef3f8;
  --accent: #1f6fb2;
  --accent-dark: #16527f;
  --success: #2f7d5b;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  line-height: 1.72;
}

a {
  color: var(--accent);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--text);
  padding: 8px 12px;
}

.layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  max-width: 1520px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  background: var(--paper);
}

.search-results {
  margin: 10px 0 14px;
}

.search-result {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  text-decoration: none;
  color: var(--text);
  margin-bottom: 8px;
}

.search-result small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.toc {
  display: grid;
  gap: 8px;
}

.nav-flat-title {
  margin: 18px 0 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: #0f2742;
  font-size: 15px;
  font-weight: 700;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section > .nav-link,
.nav-section > .nav-node {
  margin-left: 14px;
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  padding: 8px 10px;
  color: #0f2742;
  font-weight: 700;
}

summary.nav-section-title {
  cursor: pointer;
  list-style: none;
}

summary.nav-section-title::-webkit-details-marker {
  display: none;
}

summary.nav-section-title::after {
  content: ">";
  color: var(--muted);
  font-weight: 700;
}

details[open] > summary.nav-section-title::after {
  content: "v";
}

.nav-node {
  display: grid;
  gap: 2px;
}

.nav-node-title {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
}

.nav-node-title::-webkit-details-marker {
  display: none;
}

.nav-node-title .nav-link {
  flex: 1;
  min-width: 0;
}

.nav-node-title::after {
  content: ">";
  color: var(--muted);
  font-weight: 700;
  padding: 0 8px;
}

.nav-node[open] > summary.nav-node-title::after {
  content: "v";
}

.nav-children {
  display: grid;
  gap: 2px;
  margin: 2px 0 4px 16px;
  padding-left: 8px;
  border-left: 1px solid #e2e8f0;
}

.nav-link {
  display: block;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  line-height: 1.5;
}

.nav-link:hover,
.nav-link.active {
  background: #e5eef7;
  color: var(--accent-dark);
}

.empty-link-mark {
  margin-left: 4px;
  color: #000;
  font-weight: 700;
}

.nav-link.article-link {
  color: #475569;
  font-size: 14px;
}

.nav-link.part-link {
  color: #64748b;
  font-size: 13px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.content {
  min-width: 0;
  padding: 34px 46px 60px;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb span::before {
  content: "/";
  margin-right: 8px;
  color: #94a3b8;
}

.article {
  max-width: 1060px;
  margin-top: 18px;
  padding: 36px 46px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(15, 39, 66, 0.06);
  overflow-x: auto;
}

h1 {
  margin: 0 0 22px;
  color: #111827;
  font-size: 34px;
  line-height: 1.25;
}

h2 {
  margin: 36px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #172033;
  font-size: 23px;
}

h3 {
  margin: 24px 0 10px;
  color: #223047;
  font-size: 18px;
}

p,
li,
td,
th {
  font-size: 15px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 22px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  font-weight: 700;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #eef2f7;
}

pre {
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8fb;
}

pre code {
  padding: 0;
  background: transparent;
}

.hero-image {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.hero-image[src$=".png"],
.hero-image[src$=".svg"] {
  max-width: 100%;
  box-sizing: border-box;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 1060px;
  margin-top: 18px;
}

.pager-link {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--accent-dark);
  text-decoration: none;
}

.pager-link:last-child {
  justify-content: flex-end;
  text-align: right;
}

.pager-link.disabled {
  color: #94a3b8;
}

.footer {
  max-width: 980px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.support-submit-link {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: grid;
  min-width: 172px;
  padding: 13px 17px;
  border: 1px solid rgba(73, 181, 255, 0.55);
  border-radius: 12px;
  background: #08243a;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 15px 40px rgba(3, 26, 43, 0.24);
  gap: 3px;
}

.support-submit-link:hover {
  border-color: #6ed7ff;
  background: #0b3150;
  color: #fff;
}

.support-submit-link strong {
  font-size: 14px;
}

.support-submit-link span {
  color: #a8d9f5;
  font-size: 11px;
}

@media (max-width: 900px) {
  .support-submit-link { right: 12px; bottom: 12px; min-width: 150px; }
  .menu-button {
    display: inline-flex;
  }

  .layout {
    display: block;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 68px 0 auto 0;
    height: calc(100vh - 68px);
    z-index: 30;
  }

  .sidebar.open {
    display: block;
  }

  .content {
    padding: 24px 16px 42px;
  }

  .article {
    padding: 24px 18px;
  }

  h1 {
    font-size: 28px;
  }

  .pager {
    display: grid;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .sidebar,
  .breadcrumb,
  .pager,
  .footer {
    display: none;
  }

  .layout,
  .content,
  .article {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
