:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #f4f6fb;
  --surface-strong: #eef2ff;
  --text: #213547;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #3451b2;
  --primary-soft: #eef2ff;
  --accent: #5672cd;
  --code-bg: #1f2937;
  --code-text: #e5e7eb;
  --shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
  --header-width: clamp(256px, calc(208px + 6vw), 360px);
  --sidebar-toggle-size: 34px;
  --content-width: 1008px;
  --toc-width: 234px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #111827;
  --surface-soft: #1a2234;
  --surface-strong: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #2f3a4d;
  --primary: #8aa2ff;
  --primary-soft: rgba(138, 162, 255, 0.14);
  --accent: #a5b4fc;
  --code-bg: #0b1120;
  --code-text: #e5e7eb;
  --shadow: 0 22px 44px rgba(2, 6, 23, 0.42);
  --shadow-soft: 0 10px 24px rgba(2, 6, 23, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 93.75%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 1rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--header-width) 10px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}

.site-header {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.site-header-inner {
  display: grid;
  grid-template-columns: auto minmax(220px, 420px) auto;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  padding: 7px 20px;
}

.site-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.header-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.header-menu-link:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 88%, var(--surface));
  transform: translateY(-1px);
}

.doc-sidebar {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: 78px;
  align-self: start;
  height: calc(100vh - 78px);
  min-height: 0;
  padding: 20px 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, var(--primary) 2%) 0%, var(--surface) 100%);
  overflow-y: auto;
  overflow-x: visible;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.sidebar-resizer {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  width: 10px;
  min-width: 10px;
  min-height: calc(100vh - 78px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  transition: opacity 0.22s ease, width 0.22s ease, min-width 0.22s ease;
}

.sidebar-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: color-mix(in srgb, var(--border) 74%, transparent);
  transition: background 0.16s ease, box-shadow 0.16s ease, width 0.16s ease;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 4px;
  height: 44px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--primary) 12%, transparent) 0 20%,
      color-mix(in srgb, var(--border) 88%, transparent) 20% 80%,
      color-mix(in srgb, var(--primary) 12%, transparent) 80% 100%
    );
  opacity: 0.8;
  transition: background 0.16s ease, opacity 0.16s ease;
}

.sidebar-resizer:hover::before,
.sidebar-resizer:focus-visible::before,
body.sidebar-resizing .sidebar-resizer::before {
  width: 2px;
  background: color-mix(in srgb, var(--primary) 52%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
body.sidebar-resizing .sidebar-resizer::after {
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--primary) 28%, transparent) 0 20%,
      color-mix(in srgb, var(--primary) 58%, var(--border)) 20% 80%,
      color-mix(in srgb, var(--primary) 28%, transparent) 80% 100%
    );
  opacity: 1;
}

.sidebar-resizer:focus-visible {
  outline: none;
}

body.sidebar-resizing,
body.sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 0;
  border-bottom: 0;
}

.brand-link {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--accent) 68%, #1d4ed8));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
  font-size: 17px;
  font-weight: 700;
}

.brand-title,
.brand-subtitle {
  display: block;
}

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

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

.theme-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  opacity: 1;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.sidebar-toggle {
  position: fixed;
  top: 92px;
  left: calc(var(--header-width) + 5px);
  z-index: 30;
  display: grid;
  place-items: center;
  width: var(--sidebar-toggle-size);
  height: var(--sidebar-toggle-size);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: left 0.22s ease, color 0.16s ease, background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.sidebar-toggle:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 88%, var(--surface));
  transform: translateY(-1px);
}

.sidebar-toggle-icon::before {
  content: "";
  display: block;
  width: 9px;
  height: 9px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.22s ease;
}

body.sidebar-collapsed .sidebar-toggle-icon::before {
  transform: rotate(225deg);
}

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

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-soft);
}

.theme-toggle-icon {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: inset -6px -4px 0 var(--surface-soft);
}

[data-theme="dark"] .theme-toggle-icon {
  background: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.12);
}

.doc-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.doc-nav::before {
  content: "学习文档";
  padding: 0 8px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-link {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 36px;
  padding: 8px 12px 8px 22px;
  position: relative;
  border: 0;
  border-radius: 8px;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  background: transparent;
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  overflow: hidden;
  white-space: normal;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.doc-link::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: var(--primary);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.doc-link:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 78%, var(--surface));
}

.doc-link.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 72%, var(--surface));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.doc-link.active::before {
  opacity: 1;
}

.doc-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.doc-nav-group-title {
  position: relative;
  padding: 8px 10px;
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  list-style: none;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-nav-group-title::-webkit-details-marker {
  display: none;
}

.doc-nav-group-title::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-right: 4px;
}

.doc-nav-group[open] .doc-nav-group-title::after {
  transform: rotate(45deg);
}

.doc-nav-group-title:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 54%, transparent);
}

.doc-nav-group-active > .doc-nav-group-title {
  color: var(--primary);
  background: transparent;
  font-weight: 800;
}

.doc-nav-group-active > .doc-nav-group-title {
  padding-left: 10px;
}

.doc-nav-group-active > .doc-nav-group-title::after {
  color: var(--primary);
}

.doc-nav-group-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 8px;
}

.doc-nav-group-active .doc-nav-group-links {
  padding-left: 10px;
  border-left: 0;
}

.content-shell {
  grid-column: 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(648px, var(--content-width)) var(--toc-width);
  align-items: start; 
  gap: 26px;
  max-width: calc(var(--content-width) + var(--toc-width) + 26px);
  margin: 0 auto;
  padding: 12px clamp(20px, 2.5vw, 44px) 56px clamp(64px, 4vw, 80px);
}

.content-main {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.breadcrumb-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 12px 10px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb-nav a {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.breadcrumb-nav a:hover {
  color: inherit;
  text-decoration: none;
}

.breadcrumb-nav .breadcrumb-home {
  line-height: 1;
}

.breadcrumb-nav .breadcrumb-home svg {
  width: 14px;
  height: 14px;
  display: block;
}

.markdown-body {
  min-width: 0;
  padding: 40px 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow-wrap: break-word;
}

.back-to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    background 0.16s ease;
}

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

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

.article-index {
  grid-column: 2;
  position: sticky;
  top: 102px;
  width: var(--toc-width);
  max-height: calc(100vh - 126px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent), transparent 100%);
  scrollbar-width: thin;
}

.article-index-title {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc-nav {
  display: grid;
  gap: 4px;
}

.toc-group {
  border-radius: 8px;
}

.toc-group[open] {
  background: transparent;
}

.toc-summary {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
}

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

.toc-summary::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 2px;
  margin-right: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.toc-group[open] .toc-summary::before {
  transform: rotate(45deg);
}

.toc-link {
  display: block;
  flex: 1 1 auto;
  padding: 6px 7px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, font-weight 0.16s ease;
}

.toc-link:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 76%, transparent);
}

.toc-link.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 72%, var(--surface));
  font-weight: 600;
}

.toc-link-parent.active {
  font-weight: 700;
}

.toc-link-parent {
  color: var(--text);
  font-weight: 700;
}

.toc-link-single {
  padding-left: 24px;
}

.toc-link-child {
  margin-left: 22px;
  padding-left: 10px;
  font-size: 12px;
}

.search-container {
  position: relative;
  margin-bottom: 0;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  padding: 0;
}

body.page-doc .search-container {
  z-index: 25;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  z-index: 50;
}

body.page-doc .search-results {
  right: auto;
  width: min(520px, calc(100vw - 56px));
}

body.page-doc.sidebar-collapsed .app-shell {
  grid-template-columns: 0 0 minmax(0, 1fr);
}

body.page-doc.sidebar-collapsed .doc-sidebar {
  opacity: 0;
  transform: translateX(-18px);
  pointer-events: none;
}

body.page-doc.sidebar-collapsed .sidebar-resizer {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

.search-result-item {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background-color 0.2s;
}

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

.search-result-item:hover {
  background-color: var(--surface-soft);
}

.search-result-item.selected {
  background-color: var(--primary-soft);
  border-left: 3px solid var(--primary);
}

.search-result-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.search-result-title mark {
  background-color: var(--primary-soft);
  color: var(--primary);
  border-radius: 2px;
  padding: 0 2px;
}

mark.search-highlight {
  background-color: #ffeb3b;
  color: #000;
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 600;
}

[data-theme="dark"] mark.search-highlight {
  background-color: #ffd600;
  color: #000;
}

.search-result-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topbar,
.sidebar,
.home-link,
.current-title,
.icon-button {
  display: none;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  line-height: 1.28;
  letter-spacing: 0;
}

.markdown-body h1 {
  margin: 0 0 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 2rem;
  font-weight: 700;
}

.markdown-body h2 {
  margin-top: 42px;
  padding-top: 2px;
  font-size: 1.55rem;
  font-weight: 700;
}

.markdown-body h3 {
  margin-top: 30px;
  font-size: 1.2rem;
  font-weight: 600;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body table,
.markdown-body pre {
  margin: 14px 0;
  font-size: 1rem;
}

.markdown-body a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body code {
  padding: 2px 6px;
  border-radius: 6px;
  color: #111827;
  background: #eceff1;
  box-shadow: inset 0 0 0 1px #dde3e8;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
  font-weight: 500;
}

.markdown-body .code-block {
  position: relative;
  margin: 14px 0;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.markdown-body .code-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.markdown-body .code-toolbar::before {
  content: "";
  flex: 0 0 auto;
  width: 34px;
  height: 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 5px 5px, #ef4444 0 4px, transparent 4.5px),
    radial-gradient(circle at 17px 5px, #f59e0b 0 4px, transparent 4.5px),
    radial-gradient(circle at 29px 5px, #22c55e 0 4px, transparent 4.5px);
}

.markdown-body .code-language {
  margin-right: auto;
  padding: 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.42);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: auto;
}

.markdown-body .copy-code-button {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 6px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.34);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
  pointer-events: auto;
}

.markdown-body .copy-code-button::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.7px solid currentColor;
  border-radius: 3px;
  box-shadow: 3px -3px 0 -1px var(--code-bg), 3px -3px 0 0 currentColor;
}

.markdown-body .copy-code-button:hover {
  border-color: rgba(203, 213, 225, 0.42);
  color: #f8fafc;
  background: rgba(30, 41, 59, 0.78);
}

.markdown-body .copy-code-button.copied {
  border-color: rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.markdown-body .copy-code-button.copied::after {
  content: "已复制";
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  padding: 4px 7px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 6px;
  color: #bbf7d0;
  background: rgba(15, 23, 42, 0.92);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
  pointer-events: none;
  animation: copy-tip-fade 0.9s ease forwards;
}

@keyframes copy-tip-fade {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(4px);
  }

  18%,
  70% {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(4px);
  }
}

.markdown-body pre {
  overflow-x: auto;
  position: relative;
  margin: 0;
  padding: 46px 16px 14px;
  background: transparent;
}

.markdown-body > pre {
  margin: 14px 0;
  border-radius: 8px;
  background: var(--code-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.markdown-body pre code {
  padding: 0;
  color: var(--code-text);
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  tab-size: 4;
}

.markdown-body pre code.hljs {
  display: block;
  overflow-x: visible;
  background: transparent;
}

.markdown-body .hljs-keyword,
.markdown-body .hljs-selector-tag,
.markdown-body .hljs-built_in,
.markdown-body .hljs-name,
.markdown-body .hljs-tag {
  font-weight: 700;
}

.markdown-body blockquote {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--primary-soft) 78%, var(--surface));
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--surface-strong);
  font-weight: 700;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.error-box {
  padding: 16px;
  border: 1px solid color-mix(in srgb, #ef4444 42%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, #ef4444 12%, var(--surface));
  color: color-mix(in srgb, #ef4444 82%, var(--text));
}

@media (min-width: 1600px) {
  :root {
    --content-width: 1152px;
    --toc-width: 288px;
  }

  .content-shell {
    gap: 36px;
    max-width: calc(var(--content-width) + var(--toc-width) + 36px);
  }
}

@media (max-width: 980px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .sidebar-resizer {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .site-header {
    position: static;
    border-right: 0;
  }

  .site-header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding: 16px 14px;
  }

  .brand {
    min-width: 0;
  }

  .search-container {
    grid-column: 1 / -1;
    max-width: none;
    margin-left: 0;
  }

  .theme-toggle {
    position: static;
  }

  .doc-nav {
    display: grid;
    width: 100%;
    gap: 10px;
    overflow: visible;
    padding-bottom: 0;
  }

  .doc-sidebar {
    display: block;
    position: static;
    height: auto;
    padding: 14px 14px 0;
    border-right: 0;
    background: transparent;
    overflow: visible;
  }

  .doc-nav::-webkit-scrollbar {
    display: none;
  }

  .doc-nav::before,
  .doc-more-toggle {
    display: none;
  }

  .doc-more {
    width: 100%;
  }

  .doc-more-menu {
    display: grid !important;
    gap: 8px;
    width: 100%;
  }

  .doc-nav-group,
  .doc-more {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
  }

  .doc-nav-group-title,
  .doc-more-toggle {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 14px;
  }

  .doc-nav-group-links {
    gap: 6px;
    padding: 0 10px 10px;
  }

  .doc-link,
  .doc-more-link {
    width: 100%;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  .content-shell {
    display: block;
    overflow: hidden;
    padding: 18px 12px 40px;
  }

  .breadcrumb-nav {
    gap: 6px;
    margin: 8px 0 12px 5px;
    padding: 0;
  }

  .markdown-body {
    width: 100%;
    max-width: none;
    overflow-x: hidden;
    padding: 24px 16px;
  }

  .markdown-body * {
    max-width: 100%;
  }

  .article-index {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
  }

  .markdown-body h1 {
    font-size: 24px;
  }

  .hero-section {
    padding: 40px 18px 30px;
    margin-bottom: 28px;
  }

  .hero-title {
    font-size: 34px !important;
  }

  .hero-subtitle {
    font-size: 16px !important;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-btn {
    width: 100%;
  }

  .features-section {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 36px;
  }

  .feature-item {
    padding: 22px 18px;
  }

  .doc-card-grid {
    grid-template-columns: 1fr;
  }

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

}

/* 首页特化样式：隐藏左右侧栏并居中内容 */
body.page-home .app-shell {
  display: block;
}

body.page-home .sidebar-resizer {
  display: none;
}

body.page-home .brand {
  flex: 0 0 auto;
  min-width: 0;
}

body.page-home .doc-nav {
  display: none;
}

body.page-home .content-shell {
  display: block;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 14px 48px;
}

body.page-home .markdown-body {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

body.page-home .markdown-body a,
body.page-home .markdown-body a:hover {
  text-decoration: none;
}


@media (max-width: 640px) {
  .site-header-inner {
    padding: 14px 12px;
  }

  .site-header-actions {
    gap: 8px;
  }

  .header-menu-link {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .content-shell {
    padding: 14px 10px 32px;
  }

  .markdown-body {
    padding: 20px 14px;
    border-radius: 10px;
  }

  .hero-section {
    padding: 28px 12px 18px;
  }

  .hero-title {
    font-size: 28px !important;
  }

  .hero-subtitle {
    font-size: 15px !important;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-btn {
    width: min(220px, 100%);
  }

  .features-section {
    gap: 14px;
  }

  .feature-item {
    padding: 22px 18px;
  }
}

/* 阶段分组导航 */
.doc-nav-home {
  font-weight: 700;
  margin-bottom: 4px;
}

.doc-nav-phase {
  margin-top: 10px;
}

.doc-nav-phase-title {
  padding: 4px 9px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.doc-nav-phase-links {
  display: grid;
  gap: 4px;
}

/* 首页英雄区域 */
.hero-section {
  position: relative;
  isolation: isolate;
  text-align: center;
  max-width: 860px;
  margin: 0 auto 52px;
  padding: 56px 28px 24px;
  background: transparent;
}

.hero-section::before {
  content: "";
  position: absolute;
  inset: 10px 5% auto;
  height: 220px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 58%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%);
  filter: blur(22px);
  opacity: 0.95;
  z-index: -1;
  pointer-events: none;
}

.hero-title {
  font-size: clamp(38px, 5vw, 52px) !important;
  font-weight: 800 !important;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: 18px !important;
  border-bottom: none !important;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 64%, var(--accent)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 17px !important;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 28px !important;
  line-height: 1.75 !important;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none !important;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.hero-btn.primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 78%, var(--accent)));
  color: #fff !important;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--primary) 24%, transparent);
}

.hero-btn.primary:hover {
  box-shadow: 0 18px 34px color-mix(in srgb, var(--primary) 28%, transparent);
  transform: translateY(-2px);
}

.hero-btn.secondary {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text) !important;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.hero-btn.secondary:hover {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface));
  transform: translateY(-2px);
}

/* 首页特性区域 */
.features-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin: 0 auto 56px;
}

.feature-item {
  padding: 24px 22px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-item:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.feature-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 14px;
  font-size: 20px;
  background: color-mix(in srgb, var(--primary-soft) 84%, var(--surface));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.feature-item h3 {
  font-size: 18px !important;
  font-weight: 700 !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}

.feature-item p {
  color: var(--muted);
  font-size: 14px !important;
  margin: 0 !important;
  line-height: 1.5 !important;
}

/* 首页教程目录 */
.content-shell-hub .markdown-body {
  max-width: 920px;
}

.doc-catalog {
  margin-top: 28px;
}

.doc-catalog-phase {
  margin-bottom: 28px;
}

.doc-catalog-phase h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.doc-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.doc-card:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--primary) 10%, rgba(15, 23, 42, 0.08));
  text-decoration: none;
}

.doc-card-order {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.doc-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.doc-card-desc {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 篇间导航与小结 */
.article-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.article-summary-box {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.article-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.article-nav-link,
.article-nav-link:visited,
.article-nav-link:focus,
.article-nav-link:hover {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.article-nav-link:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  transform: translateY(-1px);
  text-decoration: none;
}

.markdown-body .article-nav-link,
.markdown-body .article-nav-link:visited,
.markdown-body .article-nav-link:focus,
.markdown-body .article-nav-link:hover {
  text-decoration: none;
}

.article-nav-disabled {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.article-nav-home {
  font-weight: 600;
}
