:root {
  color-scheme: light;
  --brand: #2157d5;
  --brand-dark: #173c91;
  --brand-soft: #edf3ff;
  --ink: #18233a;
  --muted: #667085;
  --line: #dfe5ee;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --warning: #fff8dc;
  --warning-line: #eab308;
  --sidebar-width: 288px;
  --shadow: 0 18px 45px rgba(22, 41, 82, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC",
    "Source Han Sans SC", Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}

body.lightbox-open,
body.sidebar-open {
  overflow: hidden;
}

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

a:hover {
  color: var(--brand-dark);
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 10px;
  left: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

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

.sidebar {
  position: fixed;
  z-index: 60;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  border-right: 1px solid #d9e0ec;
  background: var(--surface);
  box-shadow: 8px 0 28px rgba(36, 55, 94, 0.05);
}

.sidebar-collapse-toggle {
  display: none;
}

.sidebar-brand {
  position: sticky;
  z-index: 2;
  top: 0;
  display: block;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  text-decoration: none;
  backdrop-filter: blur(8px);
}

.brand-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.brand-title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
}

.sidebar-search {
  position: relative;
  padding: 16px 16px 12px;
}

.search-label {
  display: block;
  margin-bottom: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.search-input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #cfd7e5;
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(33, 87, 213, 0.13);
}

.search-results {
  position: absolute;
  z-index: 4;
  top: calc(100% - 8px);
  right: 16px;
  left: 16px;
  max-height: min(420px, 56vh);
  overflow-y: auto;
  border: 1px solid #cfd7e5;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-results[hidden] {
  display: none;
}

.search-result {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f5;
  color: var(--ink);
  text-decoration: none;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover,
.search-result:focus {
  background: var(--brand-soft);
}

.search-result strong {
  display: block;
  font-size: 14px;
  line-height: 1.5;
}

.search-result span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.search-result-snippet {
  display: -webkit-box;
  overflow: hidden;
  margin: 6px 0 0;
  color: #4b5870;
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.search-snippet-highlight {
  border-radius: 2px;
  background: #fff0a8;
  color: #4a3800;
  font-weight: 700;
}

.search-highlight {
  padding: 0.05em 0.14em;
  border-radius: 3px;
  background: #ffdf67;
  box-shadow: 0 0 0 2px rgba(255, 201, 31, 0.24);
  color: inherit;
}

.search-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.chapter-tree {
  padding: 2px 10px 28px;
}

.nav-chapter {
  margin: 3px 0;
}

.nav-chapter summary {
  position: relative;
  padding: 9px 30px 9px 10px;
  border-radius: 8px;
  color: #344054;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  list-style: none;
}

.nav-chapter summary::-webkit-details-marker {
  display: none;
}

.nav-chapter summary::after {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #98a2b3;
  content: "›";
  font-size: 19px;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform 160ms ease;
}

.nav-chapter:not([open]) summary::after {
  transform: rotate(0);
}

.nav-chapter summary:hover {
  background: #f3f6fb;
}

.nav-sections {
  margin: 0;
  padding: 2px 0 7px;
  list-style: none;
}

.nav-sections a {
  display: block;
  margin: 2px 4px 2px 12px;
  padding: 7px 10px 7px 13px;
  border-left: 2px solid #d7deea;
  border-radius: 0 7px 7px 0;
  color: #667085;
  font-size: 13.5px;
  line-height: 1.5;
  text-decoration: none;
}

.nav-sections a:hover {
  border-left-color: #a9bdea;
  background: #f6f8fc;
  color: var(--brand);
}

.nav-sections a.active,
.nav-sections a[aria-current="page"] {
  border-left-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.mobile-header {
  display: none;
}

.drawer-overlay {
  display: none;
}

.page-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 38px 44px 64px;
}

.content-wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

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

.breadcrumbs a {
  color: var(--muted);
}

.article-card,
.home-card {
  overflow: hidden;
  border: 1px solid #e1e6ef;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article-header {
  padding: 36px 42px 28px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 95% 10%, rgba(72, 118, 226, 0.15), transparent 30%),
    linear-gradient(135deg, #f7faff 0%, #eef4ff 100%);
}

.chapter-label {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.article-header h1 {
  margin: 0;
  color: #15244b;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.page-range {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.article-body {
  padding: 32px 42px 42px;
}

.article-body h2 {
  margin: 36px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: #182f66;
  font-size: 24px;
  line-height: 1.45;
}

.article-body h3 {
  scroll-margin-top: 20px;
  margin: 34px 0 13px;
  color: #1c3f91;
  font-size: 20px;
  line-height: 1.5;
}

.article-body p {
  margin: 0 0 16px;
  color: #27354f;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.in-page-toc {
  margin: 0 0 30px;
  padding: 18px 20px;
  border: 1px solid #dbe4f2;
  border-radius: 11px;
  background: #f7faff;
}

.in-page-toc strong {
  display: block;
  margin-bottom: 7px;
  color: #263e74;
  font-size: 14px;
}

.in-page-toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 22px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.in-page-toc li {
  color: #7b8495;
  font-size: 13.5px;
}

.in-page-toc a {
  text-decoration: none;
}

.source-page {
  display: inline-flex;
  align-items: center;
  margin: 16px 0 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f8;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.manual-figure {
  margin: 20px 0 28px;
}

.inline-icon {
  display: inline-block;
  width: auto;
  height: 1.35em;
  max-width: 3em;
  margin: 0 0.12em;
  vertical-align: -0.28em;
  object-fit: contain;
}

.manual-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(26, 47, 91, 0.12);
  cursor: zoom-in;
}

.manual-figure img:focus {
  outline: 3px solid rgba(33, 87, 213, 0.34);
  outline-offset: 3px;
}

.manual-figure figcaption {
  margin-top: 8px;
  color: #7b8495;
  font-size: 12.5px;
  text-align: center;
}

.callout {
  position: relative;
  margin: 22px 0;
  padding: 15px 18px 15px 46px;
  border: 1px solid #f0d675;
  border-left: 4px solid var(--warning-line);
  border-radius: 9px;
  background: var(--warning);
  color: #5f4a05;
  font-style: normal;
}

.callout::before {
  position: absolute;
  top: 14px;
  left: 17px;
  content: "!";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dba900;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.section-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.page-link {
  display: flex;
  min-height: 74px;
  flex-direction: column;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid #d9e1ed;
  border-radius: 10px;
  background: #fafcff;
  color: var(--ink);
  text-decoration: none;
}

.page-link.next {
  text-align: right;
}

.page-link:hover {
  border-color: #9fb6ee;
  background: var(--brand-soft);
}

.page-link small {
  color: var(--muted);
  font-size: 12px;
}

.page-link strong {
  margin-top: 2px;
  color: var(--brand-dark);
  font-size: 14px;
  line-height: 1.5;
}

.pagination-spacer {
  min-height: 1px;
}

.hero {
  padding: 58px 54px 48px;
  background:
    radial-gradient(circle at 92% 18%, rgba(94, 139, 245, 0.28), transparent 28%),
    linear-gradient(135deg, #142b67 0%, #2157d5 58%, #4d7ee9 100%);
  color: #fff;
}

.hero-eyebrow {
  margin: 0 0 10px;
  color: #cbd9ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.hero-title {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hero-logo {
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(5, 18, 50, 0.28));
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(30px, 3.5vw, 36px);
  line-height: 1.28;
  white-space: nowrap;
}

.hero p {
  max-width: 700px;
  margin: 18px 0 0;
  color: #edf3ff;
  font-size: 17px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-stat {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.27);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.home-content {
  padding: 36px 42px 46px;
}

.guide-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 38px;
}

.guide-step {
  padding: 18px;
  border: 1px solid #dfe6f1;
  border-radius: 12px;
  background: #f9fbff;
}

.guide-step b {
  display: inline-grid;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
}

.guide-step p {
  margin: 0;
  color: #475467;
  font-size: 14px;
  line-height: 1.65;
}

.catalog-title {
  margin: 0 0 20px;
  color: #15244b;
  font-size: 27px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.catalog-chapter {
  padding: 18px 20px;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #fff;
}

.catalog-chapter h2 {
  margin: 0 0 10px;
  color: #1b376f;
  font-size: 18px;
  line-height: 1.55;
}

.catalog-chapter ol {
  margin: 0;
  padding-left: 24px;
}

.catalog-chapter li {
  padding: 2px 0;
  color: #667085;
  font-size: 14px;
}

.catalog-chapter a {
  text-decoration: none;
}

.site-footer {
  margin-top: 24px;
  color: #7b8495;
  font-size: 12px;
  text-align: center;
}

.lightbox {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  padding: 46px;
  place-items: center;
  background: rgba(6, 12, 27, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  display: block;
  max-width: min(96vw, 1600px);
  max-height: 88vh;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.4);
  cursor: zoom-out;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.26);
  color: #fff;
  cursor: pointer;
  font-size: 27px;
  line-height: 1;
}

.lightbox-caption {
  position: absolute;
  right: 20px;
  bottom: 12px;
  left: 20px;
  margin: 0;
  color: #d9e2f2;
  font-size: 13px;
  text-align: center;
}

@media (min-width: 769px) {
  .sidebar,
  .page-shell,
  .sidebar-collapse-toggle {
    transition:
      transform 220ms ease,
      margin-left 220ms ease,
      left 220ms ease;
  }

  .sidebar-collapse-toggle {
    position: fixed;
    z-index: 70;
    top: 24px;
    left: calc(var(--sidebar-width) - 15px);
    display: grid;
    width: 30px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid #d7deea;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 5px 16px rgba(22, 41, 82, 0.1);
    color: #68758d;
    cursor: pointer;
    font-size: 23px;
    line-height: 1;
    backdrop-filter: blur(8px);
  }

  .sidebar-collapse-toggle:hover,
  .sidebar-collapse-toggle:focus-visible {
    border-color: #b9c7df;
    color: var(--brand);
  }

  .sidebar-collapse-toggle:focus-visible {
    outline: 3px solid rgba(33, 87, 213, 0.16);
    outline-offset: 2px;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(calc(var(--sidebar-width) * -1));
  }

  body.sidebar-collapsed .page-shell {
    margin-left: 0;
  }

  body.sidebar-collapsed .sidebar-collapse-toggle {
    left: 12px;
  }
}

@media (min-width: 981px) and (max-width: 1200px) {
  .hero-title {
    gap: 14px;
  }

  .hero-logo {
    width: 76px;
    height: 76px;
  }

  .hero h1 {
    font-size: 26px;
  }
}

@media (max-width: 980px) {
  .page-shell {
    padding-right: 28px;
    padding-left: 28px;
  }

  .article-header,
  .article-body,
  .home-content {
    padding-right: 30px;
    padding-left: 30px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .mobile-header {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
  }

  .mobile-title {
    overflow: hidden;
    max-width: calc(100vw - 78px);
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-toggle {
    display: inline-grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 1px solid #d7deea;
    border-radius: 9px;
    background: #fff;
    color: var(--brand-dark);
    cursor: pointer;
    font-size: 22px;
  }

  .sidebar {
    width: min(86vw, 320px);
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }

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

  .drawer-overlay {
    position: fixed;
    z-index: 55;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(6, 12, 27, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  body.sidebar-open .drawer-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .page-shell {
    min-height: auto;
    margin-left: 0;
    padding: 20px 12px 42px;
  }

  .article-card,
  .home-card {
    border-radius: 12px;
  }

  .article-header {
    padding: 27px 22px 22px;
  }

  .article-header h1 {
    font-size: 28px;
  }

  .article-body,
  .home-content {
    padding: 24px 20px 30px;
  }

  .article-body h3 {
    font-size: 19px;
  }

  .hero {
    padding: 38px 24px 34px;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(16px, 4.6vw, 30px);
  }

  .hero-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .hero-logo {
    width: 76px;
    height: 76px;
  }

  .guide-box {
    grid-template-columns: 1fr;
  }

  .in-page-toc ol {
    grid-template-columns: 1fr;
  }

  .section-pagination {
    grid-template-columns: 1fr;
  }

  .page-link.next {
    text-align: left;
  }

  .lightbox {
    padding: 44px 10px;
  }

  .lightbox-image {
    max-width: 96vw;
    max-height: 82vh;
  }
}

@media print {
  @page {
    margin: 16mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .sidebar,
  .sidebar-collapse-toggle,
  .mobile-header,
  .drawer-overlay,
  .breadcrumbs,
  .section-pagination,
  .in-page-toc,
  .lightbox,
  .site-footer {
    display: none !important;
  }

  .page-shell {
    margin: 0;
    padding: 0;
  }

  .content-wrap {
    max-width: none;
  }

  .article-card {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .article-header,
  .article-body {
    padding-right: 0;
    padding-left: 0;
  }

  .article-header {
    background: #fff;
  }

  .manual-figure {
    break-inside: avoid;
  }

  .manual-figure img {
    max-height: 230mm;
    box-shadow: none;
  }

  .callout {
    break-inside: avoid;
  }
}
