:root {
  color-scheme: light dark;
  --bg: #f6f7f8;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f4;
  --text: #172027;
  --muted: #65717b;
  --border: #d9e0e5;
  --accent: #0f766e;
  --accent-soft: #dff4f0;
  --danger: #a14335;
  --code: #f3f5f7;
  --header-h: 56px;
  --sidebar-w: 286px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121619;
    --sidebar: #171c20;
    --surface: #1b2025;
    --surface-2: #222a30;
    --text: #eef3f6;
    --muted: #aab4bc;
    --border: #334049;
    --accent: #5eead4;
    --accent-soft: rgba(94, 234, 212, 0.14);
    --danger: #f09a8a;
    --code: #11171b;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.68;
}
a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent), transparent 45%);
  text-underline-offset: 0.22em;
}
a:hover { color: var(--accent); }
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--header-h);
  background: color-mix(in srgb, var(--surface), transparent 8%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  padding: 0 22px;
  gap: 18px;
}
.brand { font-weight: 760; text-decoration: none; letter-spacing: 0; }
.top-nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.top-nav a { text-decoration: none; }
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--header-h));
}
.docs-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.sidebar-inner { padding: 20px 18px 28px; }
.sidebar-title {
  display: block;
  font-size: 18px;
  font-weight: 760;
  text-decoration: none;
}
.sidebar-subtitle {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 13px;
}
.sidebar-search {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
}
.sidebar-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.04em;
}
.sidebar-search input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.sidebar-search input::placeholder { color: var(--muted); }
.sidebar-search input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent), transparent 50%);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent), var(--border) 45%);
}
.docs-nav { display: grid; gap: 4px; font-size: 14px; }
.nav-heading {
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.04em;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}
.nav-link span { font-size: 12px; }
.nav-link:hover,
.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
}
.community-nav-group {
  border-radius: 6px;
}
.community-nav-group summary {
  cursor: pointer;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  list-style-position: inside;
}
.community-nav-group summary:hover { background: var(--surface-2); color: var(--text); }
.community-nav-group ul {
  display: grid;
  gap: 1px;
  margin: 2px 0 10px 16px;
  padding: 0;
  list-style: none;
}
.community-nav-group a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.community-nav-group a:hover,
.community-nav-group a.is-active {
  background: var(--accent-soft);
  color: var(--text);
}
[data-search-item][hidden],
[data-search-group][hidden] { display: none; }
.docs-content {
  width: min(100%, 1100px);
  padding: 38px clamp(24px, 5vw, 64px) 64px;
}
.doc-hero {
  padding: 8px 0 26px;
  border-bottom: 1px solid var(--border);
}
.doc-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}
.doc-hero p {
  max-width: 820px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 17px;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.stats span,
.entry-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}
.doc-panel {
  margin: 26px 0 34px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.doc-panel h2 { margin: 0 0 8px; font-size: 22px; }
.doc-panel p { margin: 0 0 14px; color: var(--muted); }
.category-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.category-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
}
.category-nav span { color: var(--muted); font-size: 13px; }
.wiki-section {
  margin: 0 0 42px;
  scroll-margin-top: calc(var(--header-h) + 18px);
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.section-title h2 { margin: 0; font-size: 26px; letter-spacing: 0; }
.section-title span { color: var(--muted); font-size: 14px; }
.wiki-entry-list {
  display: grid;
  gap: 0;
}
.wiki-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(160px, 0.28fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.wiki-entry h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}
.wiki-entry h3 a { text-decoration: none; }
.wiki-entry p {
  margin: 0;
  color: var(--muted);
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 2 / 3;
}
.entry-links {
  display: flex;
  gap: 10px;
  white-space: nowrap;
  font-size: 14px;
}
.back-link {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--muted);
}
.detail,
.comments {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 38px);
}
.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: end;
  margin-bottom: 22px;
}
.detail-header p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}
.detail-header h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
  letter-spacing: 0;
}
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 650;
}
.primary-link:hover { color: #fff; filter: brightness(0.96); }
.meta-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 18px;
  padding: 16px 0;
  margin: 0 0 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.detail section { margin-top: 24px; }
.detail h2,
.comments h2 { margin: 0 0 8px; font-size: 21px; }
.detail p,
.comments p { margin: 0; color: var(--muted); }
.source-list { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
.comments { margin-top: 20px; }
.site-footer {
  margin-left: var(--sidebar-w);
  border-top: 1px solid var(--border);
  padding: 22px clamp(24px, 5vw, 64px) 34px;
  color: var(--muted);
  font-size: 14px;
}
@media (max-width: 960px) {
  :root { --header-h: auto; }
  .site-header { position: static; }
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }
  .docs-layout { display: block; }
  .docs-sidebar {
    position: static;
    height: auto;
    max-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-inner { padding: 14px 16px 16px; }
  .docs-content { padding: 28px 16px 48px; }
  .site-footer { margin-left: 0; padding: 20px 16px 30px; }
  .category-nav { grid-template-columns: 1fr; }
  .wiki-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .entry-meta { grid-column: auto; }
  .entry-links { white-space: normal; }
  .detail-header { grid-template-columns: 1fr; }
  .primary-link { width: 100%; }
  .meta-list { grid-template-columns: 1fr; gap: 2px; }
}