:root {
  --paper: #eef0ec;
  --surface: #fffefb;
  --stage: #f5f6f2;
  --ink: #151816;
  --ink-soft: #343936;
  --muted: #69716b;
  --faint: #9ca49e;
  --rule: #d3d8d2;
  --rule-dark: #8b948d;
  --signal: #df3f32;
  --signal-dark: #a92720;
  --yellow: #f1d447;
  --foundation: #171817;
  --strategy: #cf3b32;
  --democratic: #2766aa;
  --state: #a66c00;
  --theory: #08766c;
  --autonomy: #5f7937;
  --font-display: "STSong", "Songti SC", "Noto Serif SC", "SimSun", serif;
  --font-body: "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans SC", "PingFang SC", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
}

button,
input,
output {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 1000;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Masthead */
.masthead {
  min-height: 142px;
  display: grid;
  grid-template-columns: 92px minmax(420px, 1fr) 230px 390px;
  border-top: 9px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
}

.edition {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-right: 1px solid var(--ink);
  background: var(--signal);
  color: #fff;
  padding: 17px 0 14px;
}

.edition span {
  font-size: 11px;
  font-weight: 800;
  writing-mode: vertical-rl;
}

.edition b {
  font-family: var(--font-mono);
  font-size: 21px;
  line-height: 1;
}

.masthead__identity {
  min-width: 0;
  align-self: center;
  padding: 18px 30px 20px;
}

.masthead__kicker {
  margin-bottom: 5px;
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.masthead h1 {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  text-wrap: balance;
}

.dek {
  max-width: 720px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-wrap: pretty;
}

.masthead__coordinates {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--rule);
  padding: 22px 24px;
}

.coordinate-range {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.coordinate-range i {
  height: 1px;
  position: relative;
  background: var(--ink);
}

.coordinate-range i::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  background: var(--signal);
}

.masthead__coordinates p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.masthead__coordinates p b {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
}

.masthead__actions {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr 44px;
  border-left: 1px solid var(--ink);
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.view-tab,
.method-button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: var(--surface);
  cursor: pointer;
}

.view-tab {
  display: grid;
  place-content: center;
  gap: 5px;
  border-right: 1px solid var(--rule);
  font-size: 13px;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease;
}

.view-tab:last-child {
  border-right: 0;
}

.view-tab span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.view-tab:hover {
  background: var(--paper);
}

.view-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.view-tab.is-active span {
  color: var(--yellow);
}

.method-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-top: 1px solid var(--ink);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.method-button span {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1;
}

.method-button:hover {
  background: var(--yellow);
}

/* Search and filters */
.control-strip {
  min-height: 60px;
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--ink);
}

.search-mark {
  position: absolute;
  left: 22px;
  top: 20px;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
}

.search-mark::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 1.5px;
  right: -5px;
  bottom: -3px;
  transform: rotate(45deg);
  background: var(--ink);
}

.search-field input {
  width: 100%;
  height: 59px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 68px 0 54px;
  font-size: 13px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-field:focus-within {
  background: #fff;
  box-shadow: inset 0 -3px 0 var(--signal);
}

.search-count {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
}

.category-filters {
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-dark) transparent;
}

.filter-button {
  flex: 1 0 92px;
  min-width: 92px;
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  cursor: pointer;
  padding: 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}

.filter-button::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  background: var(--filter-color, var(--ink));
  vertical-align: 1px;
}

.filter-button:hover {
  background: var(--paper);
  color: var(--ink);
}

.filter-button.is-active {
  background: var(--filter-color, var(--ink));
  color: #fff;
}

.filter-button.is-active::before {
  background: #fff;
}

.term-note {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--rule);
  background: #e2e6e1;
  color: #4f5751;
  font-size: 12px;
}

.term-note span {
  flex: 0 0 auto;
  color: var(--signal-dark);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.term-note p {
  min-width: 0;
}

.view {
  min-height: 640px;
}

/* Genealogy workspace */
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  height: 670px;
  min-height: 670px;
  overflow: hidden;
  background: var(--surface);
}

.map-shell {
  min-width: 0;
  height: 670px;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr) 62px;
  border-right: 1px solid var(--ink);
  background: var(--stage);
}

.map-toolbar {
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
}

.map-toolbar__focus {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  overflow: hidden;
}

.map-toolbar__focus i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--focus-color, var(--signal));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.map-toolbar__focus span,
.map-toolbar__focus small {
  flex: 0 0 auto;
  color: #abb2ac;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.map-toolbar__focus strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-toolbar__focus small::before {
  content: "/";
  margin-right: 10px;
  color: #666d68;
}

.map-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  border-left: 1px solid #4b514d;
}

.map-tools button {
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-right: 1px solid #4b514d;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.map-tools button:hover {
  background: #2b302d;
}

.focus-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
}

.focus-mode span {
  color: #aeb5af;
  font-size: 16px;
}

.focus-mode b {
  font-size: 10px;
}

.focus-mode.is-active {
  background: var(--yellow);
  color: var(--ink);
}

.focus-mode.is-active span {
  color: var(--ink);
}

.icon-button {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1;
}

.zoom-control {
  display: grid;
  grid-template-columns: 40px 54px 40px;
  border-right: 1px solid #4b514d;
}

.zoom-control button {
  min-width: 40px;
  border-right: 1px solid #4b514d;
  font-size: 19px;
}

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

.zoom-control output {
  display: grid;
  place-items: center;
  color: #c8cec9;
  font-family: var(--font-mono);
  font-size: 9px;
}

.map-scroll {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-dark) var(--stage);
}

.map-scroll.is-dragging {
  cursor: grabbing;
}

.map-scroll.is-dragging .genealogy-node {
  pointer-events: none;
}

.map-viewport {
  position: relative;
  width: 1540px;
  height: 620px;
  overflow: hidden;
}

.map-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1540px;
  height: 620px;
  overflow: hidden;
  transform-origin: 0 0;
  background: var(--stage);
}

.map-era-axis,
.map-lanes,
.genealogy-lines,
.genealogy-nodes {
  position: absolute;
  inset: 0;
}

.map-era-axis {
  z-index: 0;
}

.era-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #dce0da;
}

.era-tick::before {
  content: attr(data-year);
  position: absolute;
  top: 15px;
  left: 10px;
  color: #737b75;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.era-tick::after {
  content: "";
  position: absolute;
  left: -2px;
  top: 45px;
  width: 5px;
  height: 5px;
  background: #c5cbc5;
}

.map-lanes {
  z-index: 0;
  pointer-events: none;
}

.map-lane {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #cdd3cd;
}

.map-lane span {
  position: sticky;
  left: 14px;
  display: inline-block;
  margin: 8px 0 0 14px;
  border-left: 3px solid var(--lane-color, var(--ink));
  background: var(--stage);
  color: #616962;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.map-lane--strategy {
  --lane-color: var(--strategy);
  top: 48px;
  height: 292px;
}

.map-lane--state {
  --lane-color: var(--state);
  top: 340px;
  height: 140px;
}

.map-lane--theory {
  --lane-color: var(--theory);
  top: 480px;
  height: 140px;
}

.genealogy-lines {
  z-index: 1;
  width: 1540px;
  height: 620px;
  pointer-events: none;
  overflow: visible;
}

.genealogy-line {
  fill: none;
  stroke: #a8afa9;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
  transition: opacity 180ms ease, stroke 180ms ease, stroke-width 180ms ease;
}

.edge-group[data-kind="dash"] .genealogy-line {
  stroke-dasharray: 5 6;
}

.edge-terminal {
  fill: #a8afa9;
  opacity: 0.72;
  transition: opacity 180ms ease, fill 180ms ease, r 180ms ease;
}

.genealogy-label {
  opacity: 0;
  fill: var(--edge-color, var(--ink));
  stroke: var(--stage);
  stroke-width: 5px;
  paint-order: stroke fill;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 800;
  text-anchor: middle;
  transition: opacity 160ms ease;
}

.edge-group.is-highlighted .genealogy-line {
  stroke: var(--edge-color, var(--ink));
  stroke-width: 2.6;
  opacity: 1;
}

.edge-group.is-highlighted .edge-terminal {
  r: 3.4px;
  fill: var(--edge-color, var(--ink));
  opacity: 1;
}

.edge-group.is-highlighted .genealogy-label {
  opacity: 1;
}

.edge-group.is-highlighted[data-kind="dash"] .genealogy-line {
  animation: dash-flow 7s linear infinite;
}

.edge-group.is-muted {
  opacity: 0.1;
}

.genealogy-nodes {
  z-index: 2;
}

.genealogy-node {
  --node-color: var(--ink);
  position: absolute;
  width: var(--node-width);
  height: var(--node-height);
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-content: stretch;
  overflow: hidden;
  border: 1px solid #747c76;
  border-radius: 2px;
  background: rgba(255, 254, 251, 0.98);
  padding: 11px 12px 10px;
  box-shadow: 3px 3px 0 rgba(21, 24, 22, 0.08);
  text-align: left;
  cursor: pointer;
  transition: opacity 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  animation: node-arrive 420ms both;
  animation-delay: calc(var(--node-order, 0) * 32ms);
}

.genealogy-node::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: var(--node-color);
}

.genealogy-node::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-top: 8px solid transparent;
  border-right: 8px solid var(--node-color);
  border-bottom: 8px solid var(--node-color);
  opacity: 0;
  transition: opacity 160ms ease;
}

.genealogy-node:hover,
.genealogy-node.is-context {
  z-index: 3;
  border-color: var(--ink);
  box-shadow: 5px 5px 0 var(--node-color);
  transform: translate(-2px, -2px);
}

.genealogy-node.is-related::after {
  opacity: 0.72;
}

.genealogy-node.is-selected {
  z-index: 4;
  border: 2px solid var(--ink);
  background: #fff;
  padding: 10px 11px 9px;
  box-shadow: 6px 6px 0 var(--node-color);
  transform: translate(-3px, -3px);
}

.genealogy-node.is-deemphasized {
  opacity: 0.24;
}

.node-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--node-color);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.3;
}

.node-name {
  align-self: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.24;
  text-wrap: balance;
}

.node-type {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.map-footer {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr);
  border-top: 1px solid var(--ink);
  background: var(--surface);
}

.line-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-right: 1px solid var(--rule);
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.line-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.line-legend i {
  display: inline-block;
  width: 25px;
  height: 1px;
  background: var(--ink);
}

.line-legend__dash {
  height: 0 !important;
  border-top: 1px dashed var(--ink);
  background: transparent !important;
}

.era-navigator {
  min-width: 0;
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(52px, 1fr);
  align-items: stretch;
  overflow-x: auto;
}

.era-navigator::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 36px;
  height: 1px;
  background: var(--rule-dark);
  pointer-events: none;
}

.era-jump {
  position: relative;
  z-index: 1;
  min-width: 52px;
  min-height: 44px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
}

.era-jump i {
  width: 7px;
  height: 7px;
  border: 1px solid var(--ink);
  background: var(--surface);
  transform: rotate(45deg);
}

.era-jump:hover,
.era-jump.is-current {
  color: var(--ink);
}

.era-jump.is-current i {
  border-color: var(--signal);
  background: var(--signal);
  box-shadow: 0 0 0 3px var(--surface);
}

/* Inspector */
.inspector {
  min-width: 0;
  height: 670px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--rule-dark) transparent;
}

.inspector__content {
  min-height: 100%;
  background: var(--surface);
}

.inspector.is-changing .inspector__content {
  animation: inspector-enter 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.inspector__header {
  position: relative;
  min-height: 224px;
  overflow: hidden;
  border-top: 8px solid var(--node-color, var(--ink));
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
  padding: 20px 23px 18px;
}

.inspector__stamp {
  position: absolute;
  right: -5px;
  bottom: -34px;
  color: var(--node-color, var(--ink));
  font-family: var(--font-mono);
  font-size: 118px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.055;
  pointer-events: none;
}

.inspector__eyebrow {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--node-color, var(--ink));
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.inspector h2 {
  position: relative;
  z-index: 1;
  max-width: 300px;
  margin-top: 15px;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 800;
  line-height: 1.23;
  text-wrap: balance;
}

.inspector__en {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.inspector__meta-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 10px;
}

.inspector__meta-row b {
  color: var(--ink);
  font-weight: 800;
}

.inspector__meta-row i {
  width: 1px;
  height: 12px;
  background: var(--rule-dark);
}

.inspector__timebar {
  position: relative;
  z-index: 1;
  height: 18px;
  margin-top: 14px;
  border-top: 1px solid var(--rule-dark);
}

.inspector__timebar::before,
.inspector__timebar::after {
  position: absolute;
  top: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
}

.inspector__timebar::before {
  content: "1848";
  left: 0;
}

.inspector__timebar::after {
  content: "1991";
  right: 0;
}

.inspector__timebar span {
  position: absolute;
  left: var(--year-position, 0%);
  top: -4px;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--node-color, var(--ink));
}

.inspector__nav {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 42px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
}

.inspector__nav button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

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

.inspector__nav button:hover {
  background: var(--yellow);
  color: var(--ink);
}

.inspector__overview {
  background: var(--ink);
  color: #fff;
  padding: 21px 24px 23px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.75;
  text-wrap: pretty;
}

.inspector__overview::before {
  content: "核心判断";
  display: block;
  margin-bottom: 8px;
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
}

.inspector__section {
  scroll-margin-top: 42px;
  padding: 20px 24px 22px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.inspector__section-heading {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 9px;
}

.inspector__section-heading span {
  color: var(--node-color, var(--ink));
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
}

.inspector__section h3 {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.inspector__section p,
.inspector__section li {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.78;
  text-wrap: pretty;
}

.inspector__section ul {
  list-style: none;
}

.inspector__section li + li {
  margin-top: 6px;
}

.inspector__section li::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 2px;
  margin-right: 8px;
  background: var(--node-color, var(--ink));
  vertical-align: 4px;
}

.dimension-grid {
  border-top: 1px solid var(--rule);
}

.dimension-grid > div {
  display: grid;
  grid-template-columns: 76px 1fr;
  column-gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.dimension-grid > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.dimension-grid dt {
  color: var(--node-color, var(--ink));
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
}

.dimension-grid dd {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.boundary-note {
  background: var(--yellow);
}

.boundary-note .inspector__section-heading span,
.boundary-note p {
  color: var(--ink);
}

.related-links {
  border-top: 1px solid var(--rule);
}

.related-link {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.related-link:hover {
  background: var(--paper);
}

.related-link__arrow {
  color: var(--node-color, var(--ink));
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
}

.related-link__name {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.related-link__label {
  max-width: 112px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.citation-link {
  min-width: 36px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rule-dark);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  text-decoration: none;
}

.citation-link:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

/* Timeline and comparison */
.section-heading {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
  gap: 56px;
  padding: 42px 5vw 38px;
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
}

.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.section-heading h2,
.dialog-intro h2 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  line-height: 1.25;
  text-wrap: balance;
}

.section-heading__aside {
  align-self: end;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: end;
  gap: 20px;
}

.section-heading__aside strong {
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 400;
  line-height: 0.85;
}

.section-heading__aside p {
  max-width: 620px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.timeline {
  position: relative;
  background: var(--surface);
}

.timeline-item {
  --node-color: var(--ink);
  position: relative;
  display: grid;
  grid-template-columns: 145px minmax(220px, 0.72fr) minmax(360px, 1.28fr) 240px;
  min-height: 140px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  transition: background 160ms ease;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--node-color);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 200ms ease;
}

.timeline-item:hover {
  background: var(--paper);
}

.timeline-item:hover::before {
  transform: scaleY(1);
}

.timeline-item.is-muted {
  display: none;
}

.timeline-year,
.timeline-title,
.timeline-copy,
.timeline-links {
  padding: 24px;
}

.timeline-year,
.timeline-title,
.timeline-copy {
  border-right: 1px solid var(--rule);
}

.timeline-year {
  color: var(--node-color);
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
}

.timeline-title h3 {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.35;
}

.timeline-copy p {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.timeline-copy p + p {
  margin-top: 8px;
  color: var(--muted);
}

.timeline-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-node-link {
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.timeline-node-link::after {
  content: "→";
  float: right;
  color: var(--node-color);
}

.timeline-node-link:hover {
  color: var(--node-color);
  border-bottom-color: var(--node-color);
}

.comparison-wrap {
  max-height: 720px;
  overflow: auto;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--rule-dark) transparent;
}

.comparison-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 11px;
}

.comparison-table th,
.comparison-table td {
  padding: 18px 20px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.comparison-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.comparison-row {
  --node-color: var(--ink);
  transition: background 140ms ease;
}

.comparison-row:hover {
  background: var(--paper);
  box-shadow: inset 5px 0 0 var(--node-color);
}

.comparison-row.is-muted {
  display: none;
}

.comparison-name {
  width: 210px;
}

.comparison-name button {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.comparison-name button::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  background: var(--node-color);
  transform: rotate(45deg);
}

.comparison-name b {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.4;
}

.comparison-name small {
  display: block;
  margin: 5px 0 0 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.comparison-table td {
  color: var(--ink-soft);
  line-height: 1.7;
}

.page-footer {
  min-height: 66px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--ink);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

/* Method dialog */
.method-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  margin: auto;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
}

.method-dialog::backdrop {
  background: rgba(21, 24, 22, 0.72);
}

.dialog-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
  padding-left: 22px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.close-button {
  width: 50px;
  height: 49px;
  border: 0;
  border-left: 1px solid var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 25px;
  line-height: 1;
}

.close-button:hover {
  background: var(--signal);
  color: #fff;
}

.dialog-content {
  overflow-y: auto;
}

.dialog-intro {
  padding: 36px 42px;
  border-bottom: 1px solid var(--ink);
}

.dialog-intro p {
  max-width: 760px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--ink);
}

.method-grid section {
  padding: 28px 36px 32px;
}

.method-grid section + section {
  border-left: 1px solid var(--rule);
}

.method-grid h3,
.sources-section h3 {
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 20px;
}

.method-grid p,
.principles-list li {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
}

.method-grid p + p {
  margin-top: 12px;
}

.principles-list {
  list-style-position: inside;
}

.principles-list li + li {
  margin-top: 10px;
}

.sources-section {
  padding: 28px 36px 32px;
  border-bottom: 1px solid var(--rule);
}

.source-list {
  list-style-position: inside;
  columns: 2;
  column-gap: 40px;
}

.source-list li {
  break-inside: avoid;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.source-list a {
  color: var(--ink);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.source-list a:hover {
  color: var(--signal);
}

.source-caveat {
  padding: 22px 36px 28px;
  background: var(--yellow);
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.7;
}

[hidden] {
  display: none !important;
}

@keyframes node-arrive {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
}

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

@keyframes dash-flow {
  to {
    stroke-dashoffset: -44;
  }
}

@media (max-width: 1280px) {
  .masthead {
    grid-template-columns: 82px minmax(390px, 1fr) 190px 330px;
  }

  .masthead h1 {
    font-size: 43px;
  }

  .masthead__coordinates {
    padding-left: 17px;
    padding-right: 17px;
  }

  .map-toolbar__focus small {
    display: none;
  }

  .line-legend {
    gap: 12px;
    padding: 0 12px;
  }
}

@media (max-width: 1120px) {
  .masthead {
    grid-template-columns: 78px minmax(380px, 1fr) 330px;
  }

  .masthead__coordinates {
    display: none;
  }

  .map-layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .map-shell {
    height: auto;
    grid-template-rows: 54px 554px 62px;
    border-right: 0;
  }

  .inspector {
    height: auto;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
    border-top: 1px solid var(--ink);
  }

  .inspector__header,
  .inspector__overview,
  .inspector__section {
    padding-left: 5vw;
    padding-right: 5vw;
  }

  .inspector h2 {
    max-width: 720px;
  }

  .inspector__nav {
    position: relative;
  }

  .timeline-item {
    grid-template-columns: 125px minmax(190px, 0.65fr) minmax(330px, 1.35fr);
  }

  .timeline-links {
    grid-column: 2 / 4;
    flex-direction: row;
    flex-wrap: wrap;
    border-top: 1px solid var(--rule);
  }

  .timeline-node-link {
    flex: 1 1 180px;
  }
}

@media (max-width: 820px) {
  .masthead {
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 0;
  }

  .edition {
    grid-row: 1 / 2;
  }

  .masthead__identity {
    padding: 18px 21px 20px;
  }

  .masthead h1 {
    font-size: 39px;
  }

  .masthead__actions {
    grid-column: 1 / 3;
    grid-template-columns: minmax(0, 1fr) 140px;
    grid-template-rows: 52px;
    border-top: 1px solid var(--ink);
    border-left: 0;
  }

  .method-button {
    border-top: 0;
    border-left: 1px solid var(--ink);
  }

  .view-tab {
    grid-auto-flow: column;
    place-content: center;
    align-items: center;
    gap: 8px;
  }

  .control-strip {
    grid-template-columns: 1fr;
  }

  .search-field {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .term-note {
    align-items: flex-start;
  }

  .map-toolbar__focus span {
    display: none;
  }

  .focus-mode b {
    display: none;
  }

  .focus-mode {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .map-footer {
    grid-template-columns: 1fr;
  }

  .line-legend {
    display: none;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 34px 24px 30px;
  }

  .section-heading__aside {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  .section-heading__aside strong {
    font-size: 42px;
  }

  .timeline-item {
    grid-template-columns: 105px 1fr;
  }

  .timeline-year,
  .timeline-title {
    border-bottom: 1px solid var(--rule);
  }

  .timeline-copy,
  .timeline-links {
    grid-column: 1 / 3;
    border-right: 0;
  }

  .method-grid {
    grid-template-columns: 1fr;
  }

  .method-grid section + section {
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .source-list {
    columns: 1;
  }
}

@media (max-width: 560px) {
  .masthead {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .edition {
    padding-top: 13px;
  }

  .edition span {
    font-size: 9px;
  }

  .edition b {
    font-size: 17px;
  }

  .masthead__identity {
    padding: 15px 16px 17px;
  }

  .masthead__kicker {
    font-size: 7px;
  }

  .masthead h1 {
    font-size: 33px;
  }

  .dek {
    font-size: 10px;
  }

  .masthead__actions {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .view-tab {
    font-size: 11px;
  }

  .view-tab span {
    display: none;
  }

  .method-button {
    font-size: 10px;
  }

  .search-field input {
    padding-left: 48px;
  }

  .search-mark {
    left: 17px;
  }

  .term-note {
    gap: 10px;
    padding: 9px 15px;
    font-size: 10px;
  }

  .term-note span {
    max-width: 72px;
    line-height: 1.35;
  }

  .map-toolbar__focus {
    padding: 0 11px;
  }

  .map-toolbar__focus strong {
    max-width: 112px;
    font-size: 12px;
  }

  .zoom-control {
    grid-template-columns: 36px 44px 36px;
  }

  .zoom-control button {
    min-width: 36px;
  }

  .map-tools > .icon-button:first-of-type {
    display: none;
  }

  .map-shell {
    grid-template-rows: 54px 520px 62px;
  }

  .inspector__header {
    min-height: 218px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .inspector h2 {
    font-size: 26px;
  }

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

  .inspector__nav button {
    font-size: 9px;
  }

  .section-heading h2,
  .dialog-intro h2 {
    font-size: 29px;
  }

  .section-heading__aside {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .section-heading__aside strong {
    font-size: 34px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .timeline-year,
  .timeline-title,
  .timeline-copy,
  .timeline-links {
    grid-column: 1;
    border-right: 0;
    padding: 17px 18px;
  }

  .timeline-year {
    padding-bottom: 4px;
    border-bottom: 0;
  }

  .timeline-title {
    padding-top: 0;
  }

  .dialog-intro,
  .method-grid section,
  .sources-section {
    padding-left: 22px;
    padding-right: 22px;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .masthead__actions,
  .control-strip,
  .term-note,
  .map-toolbar,
  .map-footer,
  .inspector__nav,
  .page-footer {
    display: none !important;
  }

  .masthead {
    grid-template-columns: 72px 1fr;
    border-top-width: 4px;
  }

  .masthead__coordinates {
    display: none;
  }

  .map-layout {
    display: block;
    height: auto;
    overflow: visible;
  }

  .map-shell {
    display: block;
    height: 620px;
  }

  .map-scroll {
    overflow: visible;
  }

  .map-canvas {
    transform: scale(0.65) !important;
    transform-origin: top left;
  }

  .inspector {
    height: auto;
    overflow: visible;
    page-break-before: always;
  }
}
