:root {
  --page-bg: #eef3f8;
  --page-glow: rgba(47, 126, 214, 0.12);
  --rail-blue: #2d80d5;
  --rail-blue-deep: #1f6cbc;
  --rail-dark: #151b23;
  --rail-dark-soft: #202833;
  --rail-text: #eef4fb;
  --rail-muted: rgba(238, 244, 251, 0.76);
  --rail-border: rgba(255, 255, 255, 0.1);
  --surface: #ffffff;
  --line: #dde7f1;
  --line-strong: #d2deeb;
  --text: #1a2c47;
  --muted: #65758b;
  --accent: #1f73d2;
  --accent-soft: #ebf4ff;
  --accent-deep: #124f9f;
  --shadow: 0 24px 64px rgba(15, 23, 42, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top center, var(--page-glow), transparent 38%),
    linear-gradient(180deg, #f5f8fc 0%, var(--page-bg) 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  min-height: 100vh;
}

.site-rail,
.toc-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  scrollbar-gutter: stable;
}

.site-rail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 20px 22px;
  color: var(--rail-text);
  background:
    linear-gradient(
      180deg,
      var(--rail-blue-deep) 0 188px,
      var(--rail-dark) 188px 100%
    );
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.rail-brand,
.title-group h2,
.toc-head h2,
.empty-state h3 {
  margin: 0;
}

.rail-brand {
  display: grid;
  gap: 14px;
}

.rail-eyebrow,
.page-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.rail-eyebrow {
  color: #d7e9ff;
}

.page-eyebrow {
  color: var(--accent);
}

.rail-brand h1 {
  font-size: 2.28rem;
  line-height: 1.06;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.rail-copy,
.rail-tip,
.current-meta,
.toc-status,
.toc-empty,
.empty-state p {
  margin: 0;
  line-height: 1.8;
}

.rail-copy {
  max-width: 14ch;
  font-size: 16px;
  color: rgba(245, 249, 255, 0.88);
}

.rail-tip {
  color: var(--rail-muted);
}

.rail-section {
  display: grid;
  gap: 12px;
}

.rail-section-title {
  margin: 0;
  color: rgba(238, 244, 251, 0.92);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rail-section-muted {
  padding: 16px;
  border: 1px solid var(--rail-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rail-tip code,
.empty-state code {
  padding: 0.08em 0.42em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
}

.doc-list {
  display: grid;
  gap: 10px;
}

.doc-item {
  width: 100%;
  padding: 15px 15px 14px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.doc-item:hover {
  transform: translateY(-1px);
  border-color: rgba(173, 214, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
}

.doc-item.is-active {
  border-color: rgba(153, 205, 255, 0.38);
  background: rgba(70, 132, 199, 0.24);
}

.doc-item-title,
.doc-item-meta,
.doc-item-source {
  display: block;
}

.doc-item-title {
  font-size: 15px;
  line-height: 1.55;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc-item-meta {
  margin-top: 7px;
  color: rgba(238, 244, 251, 0.7);
  font-size: 12px;
}

.doc-item-source {
  margin-top: 7px;
  color: #a4d0ff;
  font-size: 12px;
}

.rail-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--rail-border);
  color: rgba(238, 244, 251, 0.66);
  font-size: 12px;
}

.content-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 28px;
  min-width: 0;
  padding: 34px 38px 40px;
}

.content-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.title-group {
  min-width: 0;
}

.title-group h2 {
  font-size: 2.62rem;
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.current-meta {
  margin-top: 10px;
  font-size: 15px;
  color: var(--muted);
}

.bar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 115, 210, 0.12);
  background: linear-gradient(180deg, #2f84e1 0%, #1668c5 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(31, 115, 210, 0.2);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.primary-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(31, 115, 210, 0.24);
}

.primary-link.is-disabled {
  opacity: 0.58;
  pointer-events: none;
}

.frame-shell {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.doc-content {
  min-height: 60vh;
}

.empty-state {
  min-height: 52vh;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.empty-state.is-hidden {
  display: none;
}

.toc-rail {
  padding: 28px 18px 22px;
  background: rgba(248, 251, 254, 0.92);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.toc-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
}

.toc-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.toc-head h2 {
  font-size: 2.14rem;
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.toc-status,
.toc-empty {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.toc-nav {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 6px;
}

.toc-empty.is-hidden {
  display: none;
}

.outline-node {
  display: grid;
  gap: 4px;
}

.outline-node[data-level="1"] + .outline-node[data-level="1"] {
  margin-top: 10px;
}

.outline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.outline-link {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #425267;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.outline-link:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
  transform: translateX(2px);
}

.outline-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(31, 115, 210, 0.08);
}

.outline-node[data-level="1"] > .outline-row > .outline-link {
  color: #17263d;
  font-weight: 700;
}

.outline-node[data-level="2"] > .outline-row > .outline-link {
  font-weight: 600;
}

.outline-children {
  display: grid;
  gap: 4px;
  margin-left: 16px;
  padding-left: 14px;
  border-left: 1px solid #d8e2ee;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 252px minmax(0, 1fr) 272px;
  }

  .content-shell {
    padding-inline: 28px;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .toc-rail {
    display: none;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-rail,
  .toc-rail {
    position: static;
    height: auto;
  }

  .site-rail {
    background:
      linear-gradient(
        180deg,
        var(--rail-blue-deep) 0 170px,
        var(--rail-dark) 170px 100%
      );
  }

  .content-shell {
    padding: 22px 18px 28px;
  }

  .content-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .bar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .rail-brand h1,
  .title-group h2 {
    font-size: 1.82rem;
  }

  .content-shell {
    gap: 20px;
    padding: 18px 14px 24px;
  }

  .primary-link {
    width: 100%;
  }
}
