:root {
  --bg: #151a1f;
  --panel: #1d232a;
  --panel-deep: #171c21;
  --panel-soft: #222932;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f7f4;
  --muted: #a8b1ad;
  --dim: #7d8784;
  --accent: #63d471;
  --radius: 8px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(29, 35, 42, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  color: #e7eee9;
  font-size: 18px;
  font-weight: 760;
}

.back-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.header-title {
  justify-self: center;
  color: var(--muted);
  font-size: 14px;
}

.home-link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: #d6ded9;
  font-size: 13px;
  font-weight: 700;
}

.knowledge-app {
  display: grid;
  grid-template-columns: 266px minmax(0, 1fr);
  min-height: 100vh;
  padding-top: 58px;
}

.domain-sidebar {
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  border-right: 1px solid var(--line-strong);
  background: #1c2229;
  scrollbar-width: thin;
}

.domain-tree {
  padding: 18px 10px 28px;
}

.tree-group + .tree-group {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tree-group-title {
  margin: 0 10px 8px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 760;
}

.tree-section + .tree-section {
  margin-top: 8px;
}

.tree-section-head {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 7px;
  color: #c7d0cb;
}

.tree-section-head:hover,
.tree-section-head.is-active,
.tree-section.is-open > .tree-section-head {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 64%, white);
}

.section-number {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 70%, #2d4035);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.tree-section-head strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--dim);
  font-size: 22px;
  transform: rotate(0deg);
}

.tree-section.is-open .chevron {
  transform: rotate(90deg);
}

.tree-children {
  display: none;
  padding: 4px 0 4px 40px;
}

.tree-section.is-open .tree-children {
  display: grid;
  gap: 2px;
}

.tree-child {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: #9fa9a6;
  font-size: 13px;
  line-height: 1.3;
}

.tree-child:hover,
.tree-child.is-active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: color-mix(in srgb, var(--accent) 70%, white);
}

.domain-main {
  position: relative;
  min-width: 0;
  min-height: calc(100vh - 58px);
  overflow: hidden;
  background: #151a1f;
  --module-illustration: url("assets/illustrations/m00.webp");
}

.domain-hero {
  position: relative;
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 70px 24px 36px;
}

.domain-hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(21, 26, 31, 0.34), rgba(21, 26, 31, 0.97)),
    linear-gradient(90deg, rgba(21, 26, 31, 0.45), rgba(21, 26, 31, 0.74)),
    var(--module-illustration) center 50% / cover no-repeat;
  opacity: 0.78;
}

.domain-hero-content {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 56px minmax(0, auto);
  justify-content: center;
  align-items: center;
  gap: 18px;
  text-align: left;
}

.domain-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 70%, #22302a);
  color: white;
}

.domain-icon svg {
  width: 32px;
  height: 32px;
}

.domain-hero h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.05;
  font-weight: 850;
}

.domain-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

#sectionDescription {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 720px;
  margin-top: 18px;
  text-align: center;
  font-size: 18px;
}

.subsection-grid {
  position: relative;
  z-index: 2;
  width: min(960px, calc(100% - 48px));
  margin: -18px auto 80px;
}

.subsection-card,
.detail-card {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(35, 42, 51, 0.92);
}

.subsection-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 14px 18px;
}

.subsection-card:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, white);
  background: rgba(41, 49, 59, 0.96);
}

.subsection-number {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 70%, #2d4035);
  color: white;
  font-size: 14px;
  font-weight: 860;
}

.subsection-card strong,
.subsection-card small {
  display: block;
  overflow-wrap: anywhere;
}

.subsection-card strong {
  font-size: 16px;
  line-height: 1.25;
}

.subsection-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.card-arrow {
  color: var(--muted);
  font-size: 26px;
}

.detail-card {
  grid-column: 1 / -1;
  padding: 26px;
}

.detail-card h2,
.related-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.detail-card p {
  margin: 12px 0 0;
  color: #cbd4cf;
  font-size: 16px;
  line-height: 1.75;
}

.detail-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.detail-points div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.detail-points strong,
.detail-points span {
  display: block;
}

.detail-points span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.related-title {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.markdown-article {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(35, 42, 51, 0.94);
  padding: clamp(22px, 4vw, 44px);
}

.source-path {
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: color-mix(in srgb, var(--accent) 72%, white);
  font-size: 12px;
  font-weight: 780;
  overflow-wrap: anywhere;
}

.module-figure {
  margin: 0 0 30px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line-strong) 80%, white);
  border-radius: var(--radius);
  background: #eee6d7;
  aspect-ratio: 16 / 9;
}

.module-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.markdown-article h1,
.markdown-article h2,
.markdown-article h3 {
  color: var(--text);
  line-height: 1.25;
  scroll-margin-top: 78px;
}

.markdown-article h1 {
  margin: 0 0 22px;
  font-size: clamp(30px, 4vw, 44px);
}

.markdown-article h2 {
  margin: 38px 0 14px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: clamp(23px, 2.4vw, 30px);
}

.markdown-article h1 + h2 {
  margin-top: 18px;
}

.markdown-article h3 {
  margin: 26px 0 10px;
  font-size: 19px;
}

.markdown-article p,
.markdown-article li {
  color: #cdd6d1;
  font-size: 16px;
  line-height: 1.85;
}

.markdown-article p {
  margin: 0 0 14px;
}

.markdown-article ul,
.markdown-article ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.markdown-article li + li {
  margin-top: 7px;
}

.markdown-article blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255, 255, 255, 0.045);
}

.markdown-article blockquote p:last-child {
  margin-bottom: 0;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .header-title {
    display: none;
  }

  .knowledge-app {
    grid-template-columns: 1fr;
  }

  .domain-sidebar {
    position: relative;
    top: auto;
    height: auto;
    max-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .domain-tree {
    padding: 14px 12px;
  }

  .domain-hero {
    min-height: 330px;
  }

  .subsection-grid {
    width: calc(100% - 32px);
    margin-bottom: 48px;
  }

  .detail-points {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .site-header {
    height: 56px;
    padding: 0 12px;
  }

  .brand {
    font-size: 17px;
  }

  .home-link {
    display: none;
  }

  .knowledge-app {
    padding-top: 56px;
  }

  .domain-sidebar {
    max-height: 286px;
  }

  .tree-section-head {
    grid-template-columns: 26px minmax(0, 1fr) 18px;
  }

  .domain-hero {
    min-height: 290px;
    padding: 42px 16px 34px;
  }

  .domain-hero-content {
    grid-template-columns: 48px minmax(0, auto);
    gap: 14px;
  }

  .domain-icon {
    width: 48px;
    height: 48px;
  }

  .domain-hero h1 {
    font-size: 32px;
  }

  #sectionDescription {
    font-size: 16px;
  }

  .subsection-card {
    grid-template-columns: 44px minmax(0, 1fr) 16px;
    padding: 13px 14px;
  }
}
