:root {
  color-scheme: light;
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface-alt: #f6f7fb;
  --surface-emphasis: #f4f6ff;
  --text: #182234;
  --muted: #647089;
  --line: rgba(171, 180, 208, 0.34);
  --line-strong: rgba(150, 161, 194, 0.42);
  --primary: #6677e8;
  --primary-strong: #4c5fd2;
  --primary-soft: rgba(235, 238, 255, 0.92);
  --primary-wash: rgba(102, 119, 232, 0.1);
  --accent: #6677e8;
  --accent-soft: rgba(235, 238, 255, 0.9);
  --warm-soft: rgba(243, 245, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --shadow: 0 28px 70px rgba(61, 72, 118, 0.1);
  --shadow-soft: 0 14px 32px rgba(61, 72, 118, 0.065);
  --shadow-glow: 0 18px 44px rgba(102, 119, 232, 0.12);
  --shadow-panel: 0 18px 40px rgba(79, 91, 148, 0.07);
  --radius: 8px;
  --sidebar-width: 296px;
  --font-sans:
    Inter, "Segoe UI Variable", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-display:
    "Segoe UI Variable Display", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-reading:
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  --font-mono:
    "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-reading);
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(230, 235, 255, 0.82) 0%, transparent 18%, transparent 82%, rgba(233, 238, 255, 0.74) 100%),
    linear-gradient(180deg, rgba(241, 244, 255, 0.85) 0%, rgba(238, 241, 248, 0.55) 36%, rgba(233, 238, 247, 0.72) 100%),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16) 0,
      rgba(255, 255, 255, 0.16) 1px,
      transparent 1px,
      transparent 34px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.12) 0,
      rgba(255, 255, 255, 0.12) 1px,
      transparent 1px,
      transparent 34px
    ),
    linear-gradient(180deg, #f8f9fd 0%, var(--bg) 220px),
    var(--bg);
  line-height: 1.75;
  font-size: 16px;
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a,
.top-link,
.entry-link,
.toc-list a,
.source-link,
.related-list a,
.sidebar-panel,
.doc-section,
.entry-card {
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

code {
  padding: 0.12rem 0.38rem;
  border: 1px solid #dbe3f0;
  border-radius: 6px;
  background: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.page-frame {
  min-height: 100vh;
  position: relative;
}

.page-frame::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0%, rgba(102, 119, 232, 0.06) 18%, transparent 42%, transparent 58%, rgba(102, 119, 232, 0.05) 82%, transparent 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.12));
  opacity: 0.7;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(170, 179, 206, 0.22);
  backdrop-filter: blur(28px) saturate(135%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(249, 250, 255, 0.56));
  box-shadow: 0 10px 28px rgba(61, 72, 118, 0.05);
}

.site-header::after {
  content: "";
  position: absolute;
  inset: auto 28px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(102, 119, 232, 0.35), transparent);
}

.site-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-brand strong {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.site-kicker {
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  font-family: var(--font-sans);
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.top-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(168, 178, 206, 0.34);
  border-radius: 999px;
  backdrop-filter: blur(18px) saturate(135%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42));
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  box-shadow: 0 10px 20px rgba(61, 72, 118, 0.045);
}

.top-link[aria-current="page"] {
  color: var(--primary);
  border-color: rgba(132, 147, 234, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(235, 238, 255, 0.9)),
    var(--primary-soft);
  box-shadow:
    inset 0 0 0 1px rgba(102, 119, 232, 0.08),
    0 12px 24px rgba(102, 119, 232, 0.1);
}

.top-link:hover {
  text-decoration: none;
  border-color: rgba(132, 147, 234, 0.48);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(102, 119, 232, 0.1);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(240px, var(--sidebar-width)) minmax(0, 1fr);
  gap: 34px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 38px 36px 56px;
}

.index-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 38px 36px 56px;
}

.doc-sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-panel {
  padding: 18px 18px 20px;
  border: 1px solid rgba(171, 180, 208, 0.32);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(130%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.5));
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  position: relative;
  overflow: hidden;
}

.sidebar-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(102, 119, 232, 0.66), rgba(102, 119, 232, 0.22));
  opacity: 0.95;
}

.sidebar-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.12) 100%);
  pointer-events: none;
}

.sidebar-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-family: var(--font-sans);
  font-weight: 600;
}

.sidebar-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.28;
  letter-spacing: 0;
  font-weight: 750;
}

.sidebar-summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  font-family: var(--font-reading);
}

.sidebar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.sidebar-meta span,
.hero-badge,
.hero-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(245, 247, 255, 0.92), rgba(235, 238, 255, 0.88));
  border: 1px solid rgba(102, 119, 232, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.source-link {
  display: inline-flex;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-strong);
  font-family: var(--font-sans);
}

.toc-list,
.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-item + .toc-item,
.related-list li + li {
  margin-top: 8px;
}

.toc-level-3 {
  margin-left: 14px;
}

.toc-list a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  font-family: var(--font-sans);
  font-weight: 500;
}

.toc-list a.is-active,
.toc-list a:hover {
  color: var(--primary);
  background: linear-gradient(90deg, rgba(235, 238, 255, 0.94), rgba(235, 238, 255, 0.54));
  box-shadow:
    inset 2px 0 0 var(--primary),
    0 8px 18px rgba(102, 119, 232, 0.08);
  text-decoration: none;
}

.related-list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.related-list span {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-sans);
}

.doc-main {
  min-width: 0;
}

.hero-band {
  padding: 28px 30px;
  border: 1px solid rgba(171, 180, 208, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, rgba(102, 119, 232, 0.14), rgba(102, 119, 232, 0.02) 44%, rgba(255, 255, 255, 0.5) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 252, 255, 0.8));
  backdrop-filter: blur(24px) saturate(130%);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(255, 255, 255, 0.36) inset;
  position: relative;
  overflow: hidden;
}

.index-hero {
  padding: 36px 40px;
  border: 1px solid rgba(171, 180, 208, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(112deg, rgba(102, 119, 232, 0.14), rgba(102, 119, 232, 0.03) 46%, rgba(255, 255, 255, 0.48) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 252, 255, 0.8));
  backdrop-filter: blur(24px) saturate(130%);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(255, 255, 255, 0.38) inset;
  position: relative;
  overflow: hidden;
}

.hero-band::before,
.index-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.54), transparent 36%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.2) 100%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 18px,
      rgba(255, 255, 255, 0.05) 18px,
      rgba(255, 255, 255, 0.05) 19px
    );
  pointer-events: none;
}

.hero-band::after,
.index-hero::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 260px;
  height: 4px;
  background: linear-gradient(90deg, rgba(102, 119, 232, 0.78), rgba(102, 119, 232, 0.18));
  pointer-events: none;
}

.index-hero-copy h1 {
  margin: 14px 0 0;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.12;
  font-family: var(--font-display);
  font-weight: 820;
  letter-spacing: 0;
}

.hero-content h1 {
  margin: 12px 0 0;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.18;
  letter-spacing: 0;
  font-family: var(--font-display);
  font-weight: 800;
}

.hero-lead {
  max-width: 900px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
  font-family: var(--font-reading);
  font-weight: 450;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.index-section {
  margin-top: 24px;
  padding: 34px;
  border: 1px solid rgba(171, 180, 208, 0.28);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(128%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.58));
  box-shadow:
    var(--shadow-panel),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  position: relative;
  overflow: hidden;
}

.index-section::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(102, 119, 232, 0.18), transparent);
}

.section-heading h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.24;
  font-family: var(--font-display);
  font-weight: 780;
}

.section-heading p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 900px;
  font-size: 16px;
  font-family: var(--font-reading);
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  padding: 24px;
  border: 1px solid rgba(171, 180, 208, 0.3);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(150%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(251, 253, 255, 0.58) 100%);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 72px;
  background: linear-gradient(180deg, rgba(102, 119, 232, 0.08), rgba(102, 119, 232, 0));
  pointer-events: none;
}

.entry-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 38%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.08) 100%);
  pointer-events: none;
}

.entry-card:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-soft),
    0 16px 36px rgba(102, 119, 232, 0.1);
}

.entry-card-top h2 {
  margin: 14px 0 0;
  font-size: 25px;
  line-height: 1.2;
  font-family: var(--font-display);
  font-weight: 780;
}

.entry-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.entry-summary {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 16px;
  font-family: var(--font-reading);
}

.entry-actions {
  margin-top: 22px;
}

.entry-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(132, 147, 234, 0.42);
  border-radius: 999px;
  backdrop-filter: blur(12px) saturate(155%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(235, 238, 255, 0.86));
  font-weight: 600;
  color: var(--primary-strong);
  box-shadow: 0 10px 22px rgba(102, 119, 232, 0.1);
  font-family: var(--font-sans);
}

.entry-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(102, 119, 232, 0.14);
}

.index-notes {
  background:
    linear-gradient(180deg, rgba(246, 247, 255, 0.76), rgba(255, 255, 255, 0.62)),
    var(--surface-alt);
}

.note-list {
  margin: 16px 0 0;
  padding-left: 20px;
  font-size: 16px;
}

.note-list li + li {
  margin-top: 8px;
}

.doc-content {
  margin-top: 24px;
}

.doc-section {
  padding: 30px;
  border: 1px solid rgba(171, 180, 208, 0.28);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(126%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(250, 252, 255, 0.6));
  box-shadow:
    var(--shadow-panel),
    inset 0 1px 0 rgba(255, 255, 255, 0.66);
  position: relative;
  overflow: hidden;
}

.doc-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(102, 119, 232, 0.82), rgba(102, 119, 232, 0.22), transparent 72%);
  opacity: 0.95;
}

.doc-section::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.06) 100%);
  pointer-events: none;
}

.doc-section + .doc-section {
  margin-top: 20px;
}

.doc-content h2,
.doc-content h3,
.doc-content h4 {
  scroll-margin-top: 110px;
}

.doc-content h2 {
  margin: 0 0 18px;
  font-size: clamp(30px, 3vw, 38px);
  line-height: 1.18;
  color: #0f1f34;
  font-family: var(--font-display);
  font-weight: 820;
  position: relative;
  padding-bottom: 10px;
}

.doc-content h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 92px;
  height: 2px;
  background: linear-gradient(90deg, rgba(102, 119, 232, 0.72), rgba(102, 119, 232, 0.1));
}

.doc-content h3 {
  margin: 26px 0 12px;
  font-size: 24px;
  line-height: 1.24;
  color: #16304e;
  font-family: var(--font-display);
  font-weight: 760;
}

.doc-content h4 {
  margin: 18px 0 8px;
  font-size: 19px;
  color: #16304e;
  font-family: var(--font-sans);
  font-weight: 700;
}

.doc-content p {
  margin: 0 0 15px;
  color: var(--text);
  max-width: 76ch;
  font-size: 16px;
  line-height: 1.9;
  font-family: var(--font-reading);
}

.doc-content ul,
.doc-content ol {
  margin: 0 0 16px;
  padding-left: 22px;
  max-width: 76ch;
  font-size: 16px;
  line-height: 1.9;
  font-family: var(--font-reading);
}

.doc-content li + li {
  margin-top: 6px;
}

.doc-content strong {
  color: var(--primary-strong);
}

.doc-content blockquote {
  margin: 18px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--primary);
  background: linear-gradient(180deg, rgba(247, 248, 255, 0.86), rgba(241, 244, 255, 0.62));
  border-radius: 0 8px 8px 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid rgba(171, 180, 208, 0.28);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(125%);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

thead {
  background: rgba(244, 246, 255, 0.88);
}

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

th {
  color: #18314f;
  font-weight: 700;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0;
}

td {
  font-family: var(--font-reading);
  font-size: 15px;
  line-height: 1.75;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.code-block,
.diagram-card pre {
  overflow-x: auto;
  margin: 18px 0 0;
  padding: 16px 18px;
  border: 1px solid rgba(41, 55, 79, 0.55);
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
}

.diagram-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(171, 180, 208, 0.28);
  border-radius: var(--radius);
  backdrop-filter: blur(12px) saturate(130%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(251, 253, 255, 0.62) 100%);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.diagram-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
  font-family: var(--font-sans);
  text-transform: uppercase;
}

.mermaid {
  overflow-x: auto;
}

.diagram-source {
  margin-top: 14px;
}

.diagram-source summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
}

::selection {
  background: rgba(102, 119, 232, 0.18);
  color: var(--text);
}

@media (max-width: 1100px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

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

  .doc-sidebar {
    position: static;
    order: 2;
  }

  .doc-main {
    order: 1;
  }

  .doc-sidebar {
    top: 0;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 14px 16px;
  }

  .site-brand strong {
    font-size: 24px;
  }

  .page-shell {
    padding: 16px;
    gap: 18px;
  }

  .index-shell {
    padding: 16px;
  }

  .hero-band,
  .index-hero,
  .index-section,
  .doc-section,
  .sidebar-panel {
    padding: 20px;
  }

  .entry-card {
    min-height: 0;
    padding: 20px;
  }

  .hero-content h1 {
    font-size: 28px;
  }

  .doc-content h2 {
    font-size: 28px;
  }

  .doc-content h3 {
    font-size: 22px;
  }

  .hero-lead {
    font-size: 16px;
  }

  .top-nav {
    justify-content: flex-start;
  }
}
