:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: rgba(13, 25, 44, 0.78);
  --bg-elevated: rgba(16, 31, 54, 0.96);
  --border: rgba(160, 182, 214, 0.18);
  --text: #edf3ff;
  --text-muted: #9eb2d1;
  --primary: #6ea8fe;
  --primary-strong: #8ab8ff;
  --chip: rgba(110, 168, 254, 0.12);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --code: #09101a;
}

body.light {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-soft: rgba(255, 255, 255, 0.84);
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --border: rgba(32, 52, 81, 0.12);
  --text: #122033;
  --text-muted: #5a6f8c;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --chip: rgba(37, 99, 235, 0.1);
  --shadow: 0 20px 42px rgba(18, 32, 51, 0.12);
  --code: #eef3fa;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(87, 133, 204, 0.18), transparent 28%),
    linear-gradient(180deg, #091321 0%, var(--bg) 30%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

body.light {
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.12), transparent 26%),
    linear-gradient(180deg, #eef4ff 0%, var(--bg) 40%, var(--bg) 100%);
}

a {
  color: var(--primary-strong);
}

code,
pre {
  font-family:
    "SFMono-Regular", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.site-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-soft);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary-strong);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
}

.hero-text {
  margin: 16px 0 0;
  max-width: 760px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: white;
  border-color: transparent;
}

.button-secondary {
  background: transparent;
  color: var(--text);
}

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

.stat-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.stat-label {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
}

.stat-detail {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 270px;
  gap: 20px;
  margin-top: 24px;
}

.panel {
  min-height: 720px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-soft);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel-section + .panel-section {
  margin-top: 22px;
}

.panel-left,
.panel-right {
  padding: 20px;
}

.panel-center {
  padding: 24px 28px 36px;
}

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

.search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.chip.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  border-color: transparent;
  color: white;
}

.doc-list-meta {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.doc-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc-group-subtitle {
  margin-top: -4px;
  color: var(--text-muted);
  font-size: 12px;
}

.doc-card {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.doc-card:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.45);
}

.doc-card.active {
  border-color: rgba(110, 168, 254, 0.7);
  box-shadow: inset 0 0 0 1px rgba(110, 168, 254, 0.24);
}

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

.doc-card-meta {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.doc-card-excerpt {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.article-head {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.article-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.15;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.article-meta .badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--chip);
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.article-action-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--bg-elevated);
}

.article-body {
  min-height: 500px;
  font-size: 16px;
  line-height: 1.85;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  line-height: 1.3;
  margin-top: 1.8em;
  margin-bottom: 0.7em;
  scroll-margin-top: 96px;
}

.markdown-body p,
.markdown-body li,
.markdown-body blockquote {
  color: var(--text);
}

.markdown-body blockquote {
  margin: 1.2em 0;
  padding: 0.9em 1em;
  border-left: 4px solid var(--primary);
  border-radius: 0 12px 12px 0;
  background: rgba(110, 168, 254, 0.08);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  overflow: hidden;
  border-radius: 16px;
  display: block;
  overflow-x: auto;
}

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

.markdown-body th {
  background: rgba(110, 168, 254, 0.08);
}

.markdown-body pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 16px;
  background: var(--code);
  border: 1px solid var(--border);
}

.markdown-body code {
  background: rgba(110, 168, 254, 0.12);
  padding: 0.15em 0.35em;
  border-radius: 6px;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-link {
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition:
    color 0.18s ease,
    background 0.18s ease;
}

.toc-link:hover,
.toc-link.active {
  color: var(--text);
  background: var(--chip);
}

.toc-depth-1 {
  font-weight: 700;
}

.toc-depth-2 {
  padding-left: 18px;
}

.toc-depth-3,
.toc-depth-4,
.toc-depth-5,
.toc-depth-6 {
  padding-left: 28px;
}

.note-list {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

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

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .panel-right {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .site-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 12px;
  }

  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 22px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100vw - 12px, 100%);
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .panel-left,
  .panel-right,
  .panel-center {
    padding: 16px;
  }

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