:root {
  --paper: #f5f6f1;
  --paper-deep: #eaeee7;
  --surface: #ffffff;
  --ink: #18211d;
  --muted: #607066;
  --soft: #8a9a90;
  --line: #d8dfd8;
  --line-strong: #bdcabe;
  --accent: #0f7a56;
  --accent-deep: #07543c;
  --signal: #b85c38;
  --blue: #315f8f;
  --shadow: 0 18px 44px rgba(24, 33, 29, 0.08);
  --soft-shadow: 0 10px 34px rgba(24, 33, 29, 0.055);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 8px;
  --topbar-height: 68px;
  --font-sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-serif: Georgia, Cambria, "Noto Serif SC", "Songti SC", serif;
  color-scheme: light;
  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html.solve-scroll {
  scroll-snap-type: y mandatory;
  scroll-padding-top: calc(var(--topbar-height) + 10px);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(24, 33, 29, 0.035) 1px, transparent 1px) 0 0 / 100% 34px,
    var(--paper);
}

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

a[href] {
  cursor: pointer;
}

button,
input {
  font: inherit;
}

.atlas-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 360px) auto;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 241, 0.9);
  backdrop-filter: blur(18px);
}

.reading-progress {
  position: sticky;
  top: var(--topbar-height);
  z-index: 29;
  height: 2px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent-deep), rgba(184, 92, 56, 0.72));
  transition: transform 120ms linear;
}

.atlas-brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.atlas-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  background: transparent;
}

.atlas-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.atlas-brand strong,
.atlas-brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.mode-nav {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.mode-nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.mode-nav a.active,
.mode-nav a:hover {
  background: var(--ink);
  color: #fff;
}

.jump-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 12px;
}

.jump-search span,
.eyebrow {
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jump-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.atlas-shell {
  min-height: calc(100vh - var(--topbar-height));
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 326px;
  align-items: start;
}

.tree-pane,
.relation-pane {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow: auto;
  padding: 22px 18px;
}

.tree-pane {
  border-right: 1px solid rgba(216, 223, 216, 0.62);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.34)),
    rgba(255, 255, 255, 0.52);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.relation-pane {
  border-left: 1px solid rgba(216, 223, 216, 0.62);
  background:
    linear-gradient(270deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.62);
}

.pane-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.pane-heading strong {
  color: var(--muted);
  font-size: 12px;
}

.tree-toggle {
  display: none;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-deep);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

.tree-root {
  display: grid;
  gap: 8px;
}

.tree-group {
  border-bottom: 1px solid var(--line);
  padding: 0 0 12px;
}

.tree-group summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  list-style-position: outside;
}

.tree-section {
  margin: 12px 0 0 17px;
}

.tree-section-title {
  margin: 0 0 5px;
  color: #718177;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

.tree-link {
  display: block;
  border-left: 2px solid transparent;
  padding: 7px 8px 7px 12px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.35;
}

.tree-link:hover,
.tree-link.active {
  border-left-color: var(--accent);
  background: #edf4ef;
  color: var(--accent-deep);
}

.main-view {
  min-width: 0;
  padding: clamp(24px, 4.5vw, 58px);
  outline: 0;
}

.main-view > * {
  animation: view-enter 220ms var(--ease) both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-shell {
  max-width: 850px;
  margin: 0 auto;
  min-width: 0;
}

.article-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 750;
}

.pill.accent {
  border-color: rgba(15, 122, 86, 0.28);
  background: #e9f4ee;
  color: var(--accent-deep);
}

.pill.signal {
  border-color: rgba(184, 92, 56, 0.28);
  background: #fff0e9;
  color: #873d23;
}

.article-shell h1 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.03;
  letter-spacing: 0;
}

.lead {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.markdown {
  padding-top: 10px;
}

.markdown h2,
.markdown h3 {
  font-family: var(--font-serif);
  letter-spacing: 0;
}

.markdown h2 {
  margin: 42px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 29px;
}

.markdown h3 {
  margin: 30px 0 12px;
  font-size: 23px;
}

.markdown p,
.markdown li {
  color: #283630;
  font-size: 17px;
  line-height: 1.82;
}

.markdown p {
  max-width: 68ch;
}

.markdown a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown code {
  border-radius: 5px;
  background: #e9efeb;
  color: var(--accent-deep);
  padding: 2px 5px;
}

.knowledge-layer {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  margin: 0 0 28px;
}

.knowledge-layer-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-layer-row > span {
  color: var(--soft);
  font-size: 11px;
  font-weight: 820;
}

.knowledge-layer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.knowledge-layer-links a {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  padding: 3px 9px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.knowledge-layer-links a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(119, 200, 145, 0.9);
  box-shadow: 0 0 0 3px rgba(119, 200, 145, 0.14);
}

.knowledge-layer-links a:hover {
  border-color: rgba(15, 122, 86, 0.28);
  color: var(--accent-deep);
}

.code-block,
.diagram-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 22px rgba(24, 33, 29, 0.04);
  margin: 18px 0;
}

.diagram-block {
  background: rgba(250, 252, 248, 0.82);
}

.code-block figcaption,
.diagram-block figcaption {
  min-height: 34px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: #718177;
  font-size: 12px;
  font-weight: 720;
  padding: 0 14px;
}

.markdown pre {
  overflow-x: auto;
  margin: 0;
  background: #f7f9f5;
  color: #23302a;
  padding: 14px 16px;
  line-height: 1.7;
  font-size: 13px;
}

.markdown pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.diagram-block figcaption {
  color: #718177;
}

.mermaid {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 18px;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
  font-family: var(--font-sans);
}

.mermaid-fallback {
  display: block;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.markdown table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.82);
}

.markdown th,
.markdown td {
  min-width: 160px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.65;
}

.markdown th {
  background: var(--paper-deep);
}

.markdown blockquote {
  margin: 20px 0;
  border-left: 3px solid var(--signal);
  background: rgba(255, 255, 255, 0.62);
  padding: 10px 0 10px 16px;
  color: var(--muted);
}

.markdown details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  padding: 12px 14px;
  margin: 14px 0;
}

.markdown summary {
  cursor: pointer;
  color: var(--accent-deep);
  font-weight: 800;
}

.rail-block {
  border-bottom: 1px solid var(--line);
  padding: 0 0 18px;
  margin: 0 0 18px;
}

.rail-block h2 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}

.toc-list,
.relation-list,
.stat-list {
  display: grid;
  gap: 9px;
}

.rail-block-related .relation-list {
  max-height: clamp(250px, 34vh, 330px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.rail-block-related .relation-card {
  gap: 5px;
  border-color: rgba(15, 122, 86, 0.13);
  background: rgba(248, 251, 247, 0.82);
  padding: 8px 10px;
}

.rail-helper {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.relation-card-meta {
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 780;
  line-height: 1.2;
}

.rail-block-related .relation-card strong {
  font-size: 13.5px;
  line-height: 1.25;
}

.rail-block-related .relation-card small {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.rail-graph-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  color: var(--accent-deep);
  font-size: 12.5px;
  font-weight: 800;
}

.rail-graph-link:hover {
  color: #075f43;
}

.rail-block-next {
  padding-bottom: 20px;
}

.next-read-card {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(15, 122, 86, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(233, 244, 238, 0.9), rgba(255, 255, 255, 0.78)),
    rgba(255, 255, 255, 0.84);
  padding: 12px 13px;
  box-shadow: 0 10px 24px rgba(24, 33, 29, 0.06);
}

.next-read-card span {
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 860;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.next-read-card strong {
  color: var(--ink);
  line-height: 1.35;
}

.next-read-card small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.next-read-card:hover {
  border-color: rgba(15, 122, 86, 0.36);
  transform: translateY(-1px);
}

.toc-list a {
  display: block;
  border-left: 2px solid transparent;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.toc-list a.level-3 {
  margin-left: 12px;
}

.toc-list a:hover {
  border-left-color: var(--accent);
  color: var(--accent-deep);
}

.toc-list a.active {
  border-left-color: var(--signal);
  background: rgba(255, 240, 233, 0.58);
  color: #873d23;
}

.relation-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  transition:
    border-color 160ms var(--ease),
    background-color 160ms var(--ease),
    box-shadow 160ms var(--ease),
    transform 160ms var(--ease);
}

.relation-card:hover {
  border-color: rgba(15, 122, 86, 0.28);
  box-shadow: var(--soft-shadow);
  transform: translateY(-1px);
}

.relation-card strong {
  line-height: 1.35;
}

.relation-card small {
  color: var(--muted);
  line-height: 1.55;
}

.stat-list span,
.stat-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.stat-list a {
  border-left: 2px solid transparent;
  padding: 5px 8px;
}

.stat-list a:hover {
  border-left-color: var(--accent);
  color: var(--accent-deep);
}

.stat-list strong {
  color: var(--ink);
}

.rail-block-continue .relation-card {
  border-color: rgba(184, 92, 56, 0.18);
  background: rgba(255, 250, 246, 0.76);
}

.rail-disclosure {
  border: 0;
}

.rail-disclosure summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.rail-disclosure summary::-webkit-details-marker {
  display: none;
}

.rail-disclosure summary::after {
  content: "+";
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent-deep);
}

.rail-disclosure[open] summary::after {
  content: "-";
}

.rail-disclosure summary strong {
  margin-left: auto;
  color: var(--soft);
  font-size: 12px;
}

.relation-list-related {
  padding-top: 8px;
}

.search-view {
  max-width: 960px;
  margin: 0 auto;
}

.search-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 22px;
}

.search-heading h1 {
  margin: 8px 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.05;
}

.search-heading p {
  max-width: 64ch;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.search-card {
  min-height: 178px;
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid rgba(216, 223, 216, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 22px rgba(24, 33, 29, 0.035);
  padding: 14px;
  transition:
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease),
    transform 160ms var(--ease);
}

.search-card:hover {
  border-color: rgba(15, 122, 86, 0.3);
  box-shadow: var(--soft-shadow);
  transform: translateY(-2px);
}

.search-card strong {
  font-size: 18px;
  line-height: 1.35;
}

.search-card small {
  color: var(--muted);
  line-height: 1.55;
}

.search-card em {
  align-self: end;
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.graph-route {
  grid-template-columns: 1fr;
}

.graph-route .main-view {
  min-height: calc(100svh - var(--topbar-height));
  padding: 0;
}

.graph-route .tree-pane,
.graph-route .relation-pane {
  display: none;
}

.graph-view {
  max-width: 1180px;
  margin: 0 auto;
}

.graph-view {
  max-width: none;
}

.graph-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

#graphCanvas {
  cursor: pointer;
}

.graph-back {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 780;
}

.graph-back:hover {
  background: var(--accent-deep);
}

.graph-board {
  position: relative;
  min-height: calc(100svh - var(--topbar-height));
  height: calc(100svh - var(--topbar-height));
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(15, 122, 86, 0.06), transparent 42%),
    linear-gradient(rgba(24, 33, 29, 0.04) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(24, 33, 29, 0.04) 1px, transparent 1px) 0 0 / 34px 34px,
    rgba(251, 252, 248, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.graph-board::before,
.graph-board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.graph-board::before {
  background:
    linear-gradient(180deg, rgba(245, 246, 241, 0.5), transparent 18%, transparent 82%, rgba(245, 246, 241, 0.48)),
    linear-gradient(90deg, rgba(245, 246, 241, 0.6), transparent 18%, transparent 84%, rgba(245, 246, 241, 0.6));
}

.graph-board::after {
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(24, 33, 29, 0.025);
}

/* 左上主路径:直接坐在画布上,无卡片白底,用留白建立层级 */
.graph-map-header {
  position: absolute;
  top: clamp(20px, 3vw, 40px);
  left: clamp(20px, 3.2vw, 46px);
  z-index: 4;
  width: min(360px, calc(100vw - 92px));
  display: grid;
  gap: 18px;
  pointer-events: none;
}

.graph-map-header > * {
  pointer-events: auto;
}

.graph-back {
  justify-self: start;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 780;
  box-shadow: 0 10px 28px rgba(24, 33, 29, 0.16);
}

.graph-back:hover {
  background: var(--accent-deep);
}

.graph-map-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(251, 252, 248, 0.9);
}

/* 关系清单:每条是一句人话 note + 目标概念名,像印在画布上 */
.graph-relations {
  display: grid;
  gap: 4px;
}

.graph-relation-list {
  display: grid;
  gap: 2px;
}

.graph-relations button {
  width: 100%;
  display: grid;
  gap: 3px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px 8px 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.graph-relations button:hover {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(233, 244, 238, 0.72), transparent);
}

.graph-relation-note {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.graph-relation-target {
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.graph-relation-target::before {
  content: "→ ";
  color: var(--soft);
}

/* 主路径动作:紧跟关系清单之下,单个动态按钮显示"下一步动作" */
.graph-scope-toggle {
  justify-self: start;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(24, 33, 29, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 0 15px 0 10px;
  margin-left: 12px;
  font-size: 13px;
  font-weight: 840;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(24, 33, 29, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.62);
  transition:
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.graph-scope-toggle::before {
  content: "→";
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(233, 244, 238, 0.92);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(15, 122, 86, 0.12);
}

.graph-scope-toggle:hover {
  border-color: rgba(15, 122, 86, 0.32);
  background: rgba(248, 251, 247, 0.92);
  color: var(--accent-deep);
  box-shadow: 0 14px 32px rgba(24, 33, 29, 0.11), inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.graph-scope-toggle:active {
  box-shadow: 0 7px 18px rgba(24, 33, 29, 0.08), inset 0 0 0 1px rgba(15, 122, 86, 0.12);
  transform: translateY(0);
}

.graph-relations-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#graphCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#graphCanvas.dragging {
  cursor: grabbing;
}

/* 右下辅助:视图控制组(局部/全局 + 缩放)是有存在感的动作,计数是彩蛋级只读 */
.graph-viewbar {
  position: absolute;
  right: clamp(18px, 3vw, 42px);
  bottom: clamp(18px, 3vw, 30px);
  z-index: 3;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.graph-zoom {
  display: inline-grid;
  grid-template-columns: 34px 50px 34px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(24, 33, 29, 0.1);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.graph-zoom button {
  min-width: 0;
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 780;
  line-height: 1;
}

.graph-zoom button:last-child {
  border-right: 0;
}

.graph-zoom button:hover {
  background: #edf4ef;
  color: var(--accent-deep);
}

.graph-zoom button:active {
  background: var(--ink);
  color: #fff;
}

.graph-count {
  margin: 2px 4px 0;
  color: var(--soft);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.graph-count span {
  color: var(--muted);
  font-weight: 820;
}

.graph-tooltip {
  position: absolute;
  z-index: 5;
  width: min(300px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 11px 12px;
  box-shadow: 0 18px 42px rgba(24, 33, 29, 0.12);
  pointer-events: none;
  backdrop-filter: blur(16px);
}

.graph-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.graph-tooltip small {
  display: block;
  margin-bottom: 4px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-tooltip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.solve-route {
  grid-template-columns: minmax(0, 1fr) 326px;
}

.solve-route .tree-pane {
  display: none;
}

.solve-route .main-view {
  grid-column: 1;
}

.solve-route .relation-pane {
  grid-column: 2;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 16px 14px 18px;
}

.solve-route .rail-block {
  margin: 0 0 12px;
  padding: 0 0 12px;
}

.solve-route .rail-block h2 {
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.solve-stack {
  display: block;
}

.solve-mobile-case-nav {
  display: none;
}

/* Cases snap crisply one at a time: no gap or big bottom padding
   between them, so there's no loose "dead zone" the reader has to drag
   through before the next page grabs. min-height keeps each page a
   full viewport so it never feels cramped. */
.solve-case {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) clamp(16px, 3vw, 32px) clamp(24px, 4vh, 48px);
  scroll-margin-top: calc(var(--topbar-height) + 14px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: calc(100svh - var(--topbar-height));
}

.solve-goal {
  max-width: 720px;
  margin: 0 auto clamp(24px, 4vw, 44px);
  text-align: center;
}

.solve-goal h1 {
  margin: 8px 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.08;
}

.solve-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.6;
}

.solve-path {
  position: relative;
}

.solve-road {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
}

.solve-road-base {
  stroke: url(#solveRoadGradient);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.solve-nodes {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  z-index: 1;
}

.solve-node {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  scroll-margin-top: 120px;
}

/* Left/right nodes never overlap horizontally (they sit in separate
   columns with a wide central channel), so consecutive nodes can
   interleave vertically. Pulling each node up over its predecessor
   shortens the vertical stride, fitting more nodes per screen while
   keeping the left/right zig-zag readable. */
.solve-node + .solve-node {
  margin-top: clamp(-96px, -6vh, -44px);
}

.solve-node-body {
  max-width: 420px;
  padding: 4px 2px;
  position: relative;
  z-index: 3;
}

.solve-node-left .solve-node-body {
  grid-column: 1;
  justify-self: end;
  padding-right: 170px;
}

.solve-node-right .solve-node-body {
  grid-column: 2;
  justify-self: start;
  padding-left: 170px;
}

.solve-pin {
  position: absolute;
  top: 50%;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--accent);
  box-shadow: var(--soft-shadow);
  z-index: 4;
}

.solve-node-left .solve-pin {
  left: calc(50% - 150px);
  transform: translate(-50%, -50%);
}

.solve-node-right .solve-pin {
  left: calc(50% + 150px);
  transform: translate(-50%, -50%);
}

.solve-index {
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--soft);
}

.solve-question {
  margin: 4px 0 12px;
  font-size: clamp(17px, 2.4vw, 22px);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.solve-reading {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.solve-objects {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 122, 86, 0.05);
  border: 1px dashed rgba(15, 122, 86, 0.3);
}

.solve-objects-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
}

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

.solve-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.solve-tag-go {
  font-size: 11px;
  opacity: 0.7;
}

.solve-tag:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.solve-tag:hover .solve-tag-go {
  opacity: 1;
}

/* The road does not stop here: it weaves past a roadside signpost (top
   anchor) then keeps descending off the bottom edge (bottom anchor),
   so the page reads as "the path continues, keep scrolling". */
.solve-continue {
  position: relative;
  min-height: 340px;
  margin-top: 24px;
}

.solve-continue-anchor {
  position: absolute;
  width: 1px;
  height: 1px;
}

/* Beside the signpost — road bends toward the pin, not through the card. */
.solve-continue-anchor-top {
  top: 70px;
  left: calc(50% + 150px);
}

/* Off the bottom edge — the curve leaves the viewport still going down. */
.solve-continue-anchor-bottom {
  bottom: 0;
  left: calc(50% - 60px);
}

.solve-next {
  position: absolute;
  top: 30px;
  right: calc(50% + 40px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 340px;
  padding: 18px 22px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  appearance: none;
  font: inherit;
  cursor: pointer;
}

.solve-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(7, 84, 60, 0.16);
}

.solve-next-eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.solve-next-title {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.2;
  color: var(--ink);
}

.solve-next-subtitle {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.solve-continue-cue {
  position: absolute;
  bottom: 18px;
  left: calc(50% - 60px);
  transform: translateX(-50%);
  font-size: 22px;
  color: var(--accent);
  animation: solveCue 1.8s ease-in-out infinite;
}

@keyframes solveCue {
  0%,
  100% {
    transform: translate(-50%, 0);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, 6px);
    opacity: 1;
  }
}

.solve-rail-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.22;
  color: var(--ink);
}

.solve-rail-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12.2px;
  line-height: 1.42;
}

.solve-rail-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(46vh, 390px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.solve-rail-step {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s ease;
}

.solve-rail-step:hover {
  background: rgba(15, 122, 86, 0.08);
}

.solve-rail-index {
  flex: none;
  padding-top: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.solve-rail-question {
  font-size: 12px;
  line-height: 1.28;
}

.solve-rail-cases {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.solve-rail-case {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.25;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.solve-rail-case:hover {
  border-color: var(--accent);
  background: rgba(15, 122, 86, 0.06);
}

.solve-rail-case.is-active {
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.solve-rail-case-tag {
  font-size: 11px;
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(15, 122, 86, 0.08);
}

@media (max-width: 720px) {
  .solve-case {
    padding: 64px 16px 34px;
  }

  .solve-goal {
    margin-bottom: 30px;
    text-align: left;
  }

  .solve-goal h1 {
    font-size: clamp(28px, 9vw, 36px);
    line-height: 1.12;
  }

  .solve-road-base {
    stroke-width: 8;
  }

  .solve-node + .solve-node {
    margin-top: 32px;
  }

  .solve-node,
  .solve-node-left .solve-node-body,
  .solve-node-right .solve-node-body {
    display: block;
    grid-column: 1;
    padding-left: 38px;
    padding-right: 0;
    max-width: none;
  }

  .solve-node-body {
    padding-top: 0;
  }

  .solve-node-left .solve-pin,
  .solve-node-right .solve-pin {
    left: 10px;
    right: auto;
    top: 14px;
    transform: translate(-50%, 0);
  }

  .solve-question {
    margin-bottom: 10px;
    font-size: 18px;
  }

  .solve-reading {
    margin-bottom: 12px;
  }

  .solve-objects {
    padding: 12px;
    border-radius: 10px;
  }

  .solve-tag {
    min-height: 34px;
    padding: 6px 12px;
  }

  .solve-continue {
    min-height: 260px;
    margin-top: 34px;
  }

  .solve-continue-anchor-top {
    top: 46px;
    left: 10px;
  }

  .solve-continue-anchor-bottom {
    left: 10px;
  }

  .solve-next {
    position: relative;
    top: auto;
    right: auto;
    margin-left: 38px;
    max-width: none;
    padding: 16px;
  }

  .solve-continue-cue {
    left: 10px;
  }
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .atlas-topbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .jump-search {
    grid-column: 1 / -1;
  }

  .atlas-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .relation-pane {
    grid-column: 1 / -1;
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .solve-route {
    grid-template-columns: minmax(0, 1fr);
  }

  .solve-route .main-view,
  .solve-route .relation-pane {
    grid-column: 1;
  }
}

@media (max-width: 760px) {
  html.solve-scroll {
    scroll-snap-type: none;
    scroll-padding-top: 0;
  }

  .atlas-topbar,
  .atlas-shell,
  .graph-map-header {
    grid-template-columns: 1fr;
  }

  .atlas-topbar {
    min-height: 0;
    gap: 7px;
    padding: 7px 16px 8px;
  }

  .atlas-brand {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
  }

  .atlas-mark {
    width: 28px;
    height: 28px;
  }

  .atlas-brand strong {
    font-size: 14px;
  }

  .atlas-brand small {
    display: none;
    margin-top: 0;
    font-size: 11px;
  }

  .mode-nav {
    width: 100%;
    grid-auto-flow: initial;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    padding: 3px;
  }

  .mode-nav a {
    min-width: 0;
    min-height: 36px;
    overflow: hidden;
    padding: 0 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .jump-search {
    min-height: 36px;
    padding: 0 10px;
  }

  .tree-pane,
  .relation-pane {
    position: static;
    height: auto;
    border-right: 0;
  }

  .tree-pane {
    border-bottom: 1px solid var(--line);
    padding: 9px 16px;
  }

  .tree-pane .pane-heading {
    margin-bottom: 0;
  }

  .tree-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .tree-pane:not(.is-open) > .tree-root {
    display: none !important;
    margin-top: 14px;
  }

  .tree-pane.is-open .tree-root {
    display: grid;
  }

  .tree-pane.is-open .pane-heading {
    margin-bottom: 8px;
  }

  .rail-block-related .relation-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .toc-list a,
  .stat-list a,
  .relation-card,
  .solve-rail-step,
  .solve-rail-case {
    min-height: 40px;
  }

  .main-view {
    min-width: 0;
    padding: 24px 16px 38px;
  }

  .article-shell,
  .markdown,
  .lead {
    max-width: 100%;
    min-width: 0;
  }

  .knowledge-layer-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .article-shell h1 {
    font-size: clamp(32px, 10vw, 40px);
    line-height: 1.08;
  }

  .graph-board,
  .graph-fallback {
    min-height: calc(100svh - var(--topbar-height));
    height: calc(100svh - var(--topbar-height));
  }

  .graph-map-header {
    width: min(320px, calc(100vw - 24px));
    left: 12px;
    top: 12px;
    gap: 10px;
  }

  .graph-map-header h1 {
    font-size: clamp(24px, 8vw, 32px);
  }

  .graph-back {
    min-height: 40px;
  }

  .graph-relations {
    display: none;
  }

  .graph-scope-toggle {
    position: absolute;
    right: 12px;
    bottom: 64px;
    min-height: 42px;
    margin-left: 0;
    padding-right: 13px;
    box-shadow: 0 14px 32px rgba(24, 33, 29, 0.13);
  }

  .graph-viewbar {
    right: 12px;
    bottom: 12px;
  }

  .graph-zoom {
    grid-template-columns: 36px 52px 36px;
  }

  .graph-zoom button {
    min-height: 36px;
  }

  .solve-route .main-view {
    padding-top: 0;
  }

  .solve-mobile-case-nav {
    position: sticky;
    top: var(--topbar-height);
    z-index: 8;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 16px 9px;
    border-bottom: 1px solid rgba(216, 223, 216, 0.76);
    background: rgba(245, 246, 241, 0.92);
    backdrop-filter: blur(14px);
    scrollbar-width: none;
  }

  .solve-mobile-case-nav::-webkit-scrollbar {
    display: none;
  }

  .solve-mobile-case-button {
    flex: 0 0 auto;
    min-height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--muted);
    padding: 0 13px;
    font-size: 13px;
    font-weight: 800;
  }

  .solve-mobile-case-button.is-active {
    border-color: rgba(15, 122, 86, 0.34);
    background: var(--ink);
    color: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .main-view > *,
  .relation-card,
  .search-card {
    animation: none;
    transition: none;
  }
}
