:root {
  --bg: #0d1514;
  --bg-soft: #162422;
  --panel: rgba(15, 25, 24, 0.82);
  --panel-strong: rgba(11, 18, 17, 0.94);
  --line: rgba(222, 194, 131, 0.22);
  --text: #f2ead7;
  --muted: #b9ad92;
  --gold: #e1b96d;
  --copper: #d98452;
  --moss: #91b285;
  --rose: #d56d7c;
  --sky: #9bc4d8;
  --lavender: #c2a5ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(213, 109, 124, 0.18), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(155, 196, 216, 0.16), transparent 22%),
    radial-gradient(circle at bottom right, rgba(225, 185, 109, 0.15), transparent 28%),
    linear-gradient(180deg, #0a1110 0%, #13201e 55%, #0f1716 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 100%);
}

.page-shell {
  width: min(1560px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(420px, 1fr);
  gap: 24px;
  padding: 28px;
  margin-bottom: 20px;
}

.eyebrow,
.panel-kicker,
.stat-label,
.chip,
.edge-type,
.mini-label,
.status-label,
.segmented-label,
.tooltip-type {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.72rem;
}

h1,
h2,
h3,
h4,
.node-name {
  font-family: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 0.95;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5.3rem);
  font-weight: 600;
}

h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
}

h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 500;
}

.hero-text,
.detail-panel p,
.footnote p,
.edge-list li,
.path-card p,
.tooltip-copy {
  line-height: 1.55;
  color: var(--text);
}

.hero-text {
  max-width: 70ch;
  color: #efe4cc;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.stat-card {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(225, 185, 109, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.1));
}

.stat-label {
  margin: 0 0 6px;
  font-size: 0.7rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
}

.stat-subtext {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 22px;
}

.atlas-panel,
.detail-panel,
.engine-panel,
.search-panel {
  width: 100%;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(340px, 1.25fr);
  gap: 28px;
  align-items: end;
}

.search-panel-copy p:last-child,
.search-feedback {
  color: var(--muted);
}

.search-panel-copy p:last-child {
  max-width: 52ch;
  margin-bottom: 0;
  line-height: 1.5;
}

.search-control-wrap {
  display: grid;
  gap: 8px;
}

.search-control {
  width: 100%;
}

.search-control input {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.055);
}

.search-feedback {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.84rem;
}

.atlas-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 12px;
}

.atlas-intro {
  max-width: 50ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

#map-section {
  scroll-margin-top: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.control {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.control span {
  font-size: 0.8rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select,
.action-button,
.inline-action,
.segmented-option {
  border: 1px solid rgba(225, 185, 109, 0.24);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
}

input,
select {
  border-radius: 14px;
  padding: 12px 14px;
}

input:focus,
select:focus,
.action-button:hover,
.action-button:focus-visible,
.segmented-option:hover,
.segmented-option:focus-visible,
.inline-action:hover,
.inline-action:focus-visible {
  border-color: rgba(225, 185, 109, 0.7);
  background: rgba(255, 255, 255, 0.07);
}

.mode-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
}

.segmented-option {
  border-radius: 18px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.segmented-option[data-active="true"] {
  border-color: rgba(225, 185, 109, 0.8);
  background: linear-gradient(180deg, rgba(225, 185, 109, 0.18), rgba(255, 255, 255, 0.04));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.segmented-label,
.segmented-note {
  display: block;
}

.segmented-label {
  font-size: 0.7rem;
  color: var(--gold);
  margin-bottom: 5px;
}

.segmented-note {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
}

.mode-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.action-button,
.inline-action {
  border-radius: 999px;
  padding: 11px 15px;
  cursor: pointer;
}

.action-button[data-active="true"],
.inline-action {
  border-color: rgba(145, 178, 133, 0.65);
}

.action-button-ghost {
  border-color: rgba(155, 196, 216, 0.3);
}

.status-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-label {
  font-size: 0.64rem;
  color: var(--muted);
}

.status-value {
  font-size: 0.84rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tour-lab {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.tour-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.tour-intro,
.tour-copy {
  color: var(--muted);
}

.tour-intro {
  max-width: 56ch;
  margin: 0;
}

.tour-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tour-card,
.tour-stage {
  color: var(--text);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12)),
    rgba(255, 255, 255, 0.03);
}

.tour-card {
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.tour-card[data-active="true"] {
  border-color: rgba(225, 185, 109, 0.72);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.tour-card[data-tour-id="hard-problem"],
.tour-stage[data-tour-id="hard-problem"] {
  background:
    radial-gradient(circle at top right, rgba(194, 165, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(42, 31, 58, 0.34), rgba(8, 12, 18, 0.28)),
    rgba(255, 255, 255, 0.03);
}

.tour-card[data-tour-id="ai-panic"],
.tour-stage[data-tour-id="ai-panic"] {
  background:
    radial-gradient(circle at top right, rgba(124, 207, 196, 0.18), transparent 36%),
    linear-gradient(180deg, rgba(17, 48, 50, 0.34), rgba(9, 16, 16, 0.28)),
    rgba(255, 255, 255, 0.03);
}

.tour-card[data-tour-id="identity-meltdown"],
.tour-stage[data-tour-id="identity-meltdown"] {
  background:
    radial-gradient(circle at top right, rgba(213, 109, 124, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(53, 27, 32, 0.34), rgba(11, 12, 16, 0.28)),
    rgba(255, 255, 255, 0.03);
}

.tour-card h4,
.tour-stage h4 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--text);
}

.tour-subtitle {
  margin: 0 0 10px;
  color: var(--gold);
}

.tour-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tour-meta span,
.tour-progress-label,
.tour-step-node {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
}

.tour-stage {
  padding: 18px;
}

.tour-placard,
.tour-auto-box,
.tour-epilogue {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.tour-placard {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.tour-placard-header,
.tour-auto-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.tour-placard-title {
  margin: 0;
  font-family: "Fraunces", "Iowan Old Style", serif;
  font-size: 1rem;
}

.tour-stage-chip,
.tour-auto-note {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.76rem;
}

.tour-stage-header,
.tour-stage-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.tour-close {
  border: 1px solid rgba(213, 109, 124, 0.28);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(213, 109, 124, 0.08);
  color: var(--text);
  cursor: pointer;
}

.tour-close:disabled,
.inline-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tour-progress {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.tour-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.tour-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--moss));
}

.tour-stage-body {
  display: grid;
  gap: 14px;
}

.tour-auto-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.tour-auto-box[hidden] {
  display: none;
}

.tour-auto-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.tour-auto-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--sky), var(--gold));
  animation: tour-countdown linear forwards;
}

.tour-step-title {
  margin: 0 0 8px;
  font-family: "Fraunces", "Iowan Old Style", serif;
  font-size: 1.3rem;
}

.tour-step-node {
  margin-bottom: 10px;
  color: var(--text);
}

.tour-epilogue {
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  color: var(--muted);
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.atlas-frame {
  position: relative;
  min-height: 780px;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(225, 185, 109, 0.15);
  background:
    radial-gradient(circle at top, rgba(225, 185, 109, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.1));
}

.map-toolbar {
  position: relative;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(225, 185, 109, 0.12);
  background: rgba(8, 15, 14, 0.82);
  backdrop-filter: blur(10px);
}

.map-toolbar-label {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.map-tool-button,
.zoom-value {
  min-height: 40px;
  border-radius: 12px;
}

.map-tool-button {
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.map-tool-button:hover,
.map-tool-button:focus-visible {
  border-color: rgba(225, 185, 109, 0.62);
  background: rgba(225, 185, 109, 0.1);
}

.map-tool-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.map-tool-button-accent {
  border-color: rgba(145, 178, 133, 0.46);
}

.zoom-value {
  display: inline-grid;
  min-width: 58px;
  place-items: center;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.atlas-scroll {
  position: relative;
  width: 100%;
  min-height: 720px;
  max-height: 720px;
  overflow: auto;
  border-radius: 0 0 26px 26px;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 185, 109, 0.45) rgba(255, 255, 255, 0.03);
}

.atlas-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.atlas-scroll::-webkit-scrollbar-thumb {
  background: rgba(225, 185, 109, 0.34);
  border-radius: 999px;
}

.graph-canvas {
  position: relative;
  min-height: 720px;
}

.graph-surface {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: top left;
}

#graph-svg,
.graph-layer {
  position: absolute;
  inset: 0;
}

.graph-layer {
  pointer-events: none;
}

.layout-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.layout-label[data-kind="row"] {
  transform: translate(0, -50%);
  text-align: left;
}

.layout-rule {
  position: absolute;
  border-color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.layout-rule[style*="height"] {
  border-left: 1px dashed rgba(255, 255, 255, 0.06);
}

.layout-rule[style*="width"] {
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.node-card {
  position: absolute;
  z-index: 2;
  width: 164px;
  min-height: 86px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 17px;
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(19, 32, 30, 0.96), rgba(10, 18, 17, 0.96));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.25);
  transition:
    transform 180ms ease,
    width 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease,
    filter 180ms ease;
  animation: float-in 600ms ease both;
}

.node-card:hover,
.node-card:focus-visible {
  transform: translate(-50%, calc(-50% - 4px));
  border-color: rgba(225, 185, 109, 0.5);
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.35);
}

.node-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.node-card[data-expanded="true"] {
  z-index: 5;
  width: 224px;
  min-height: 238px;
  padding: 15px 16px 17px;
  border-radius: 22px;
}

.node-card[data-active="true"] {
  z-index: 6;
  border-color: rgba(225, 185, 109, 0.82);
  box-shadow: 0 0 0 1px rgba(225, 185, 109, 0.25), 0 22px 46px rgba(0, 0, 0, 0.42);
}

.node-card[data-root="true"] {
  border-color: rgba(225, 185, 109, 0.56);
}

.node-card[data-muted="true"] {
  opacity: 0.18;
  filter: saturate(0.45);
}

.node-card[data-in-path="true"] {
  border-color: rgba(145, 178, 133, 0.86);
  box-shadow: 0 0 0 1px rgba(145, 178, 133, 0.35), 0 20px 40px rgba(0, 0, 0, 0.36);
}

.node-card[data-tour-stop="true"] {
  box-shadow: 0 0 0 1px rgba(155, 196, 216, 0.18), 0 18px 38px rgba(0, 0, 0, 0.28);
}

.node-accent {
  width: 42px;
  height: 3px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.node-name {
  margin: 0 0 7px;
  font-size: 1.04rem;
  line-height: 1.06;
}

.node-card-heading .mini-label {
  margin: 0;
}

.node-card[data-expanded="true"] .node-name {
  font-size: 1.22rem;
}

.node-expanded-body {
  display: none;
}

.node-card[data-expanded="true"] .node-expanded-body {
  display: block;
  margin-top: 12px;
}

.node-root-badge {
  display: inline-flex;
  margin-top: 9px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(225, 185, 109, 0.1);
  color: var(--gold);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.node-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.node-footer {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.node-distance,
.node-tradition {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.76rem;
}

.node-tradition {
  color: var(--muted);
}

.edge-line {
  fill: none;
  stroke-width: 2.25;
  opacity: 0.42;
  pointer-events: stroke;
  transition: opacity 180ms ease, stroke-width 180ms ease, filter 180ms ease;
}

.edge-line[data-muted="true"] {
  opacity: 0.06;
}

.edge-line[data-hovered="true"] {
  opacity: 0.92;
  stroke-width: 4.6;
}

.edge-line[data-active="true"] {
  opacity: 0.96;
  stroke-width: 3.9;
  filter: drop-shadow(0 0 8px rgba(225, 185, 109, 0.16));
}

.edge-line[data-tracing="true"] {
  stroke-dasharray: 14 10;
  animation: route-flow 1.2s linear infinite;
}

.edge-tooltip {
  position: absolute;
  transform: translate(0, -100%);
  z-index: 4;
  width: min(320px, calc(100% - 24px));
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(225, 185, 109, 0.2);
  background: rgba(8, 13, 13, 0.96);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}

.tooltip-type {
  font-size: 0.66rem;
  margin-bottom: 4px;
}

.tooltip-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.tooltip-copy {
  font-size: 0.9rem;
}

.path-strip {
  margin-top: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.path-summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
}

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

.path-summary-note {
  color: var(--muted);
  font-size: 0.84rem;
}

.path-strip[open] .path-summary-note {
  color: var(--text);
}

.path-strip-body {
  padding: 0 18px 18px;
}

.path-list {
  display: grid;
  gap: 12px;
}

.path-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.path-card:hover,
.path-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(145, 178, 133, 0.55);
  background: rgba(145, 178, 133, 0.08);
}

.path-card[data-active="true"] {
  border-color: rgba(145, 178, 133, 0.85);
  background: rgba(145, 178, 133, 0.1);
}

.path-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.path-route {
  color: var(--text);
  line-height: 1.5;
}

.detail-panel {
  position: static;
  min-height: auto;
  background: var(--panel-strong);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 16px;
}

.detail-column {
  height: 760px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.08)),
    rgba(255, 255, 255, 0.018);
}

.detail-primary {
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 185, 109, 0.35) transparent;
}

.detail-primary:has(.tour-note-box) {
  overflow-y: auto;
}

.detail-relations {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 196, 216, 0.42) transparent;
}

.detail-primary::-webkit-scrollbar,
.detail-relations::-webkit-scrollbar {
  width: 9px;
}

.detail-primary::-webkit-scrollbar-thumb,
.detail-relations::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(225, 185, 109, 0.28);
}

.detail-placeholder {
  padding-top: 8px;
}

.detail-head {
  margin-bottom: 18px;
}

.detail-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.detail-map-link {
  flex-shrink: 0;
}

.detail-title {
  display: grid;
  gap: 10px;
}

.detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.metric-pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.85rem;
}

.quote-block {
  margin: 18px 0 22px;
  padding: 16px 18px;
  border-left: 3px solid var(--gold);
  background: rgba(225, 185, 109, 0.08);
  border-radius: 0 16px 16px 0;
  font-family: "Fraunces", "Iowan Old Style", serif;
  font-size: 1.08rem;
}

.core-idea {
  line-height: 1.62;
}

.relations-header {
  position: sticky;
  top: -20px;
  z-index: 2;
  margin: -20px -20px 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(11, 18, 17, 0.96);
  backdrop-filter: blur(9px);
}

.relations-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.route-box,
.edge-box,
.tour-note-box {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 16px;
}

.route-box h3,
.edge-box h3 {
  margin-bottom: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.route-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.route-node {
  border: 1px solid rgba(225, 185, 109, 0.14);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(225, 185, 109, 0.08);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.route-node:hover,
.route-node:focus-visible {
  border-color: rgba(225, 185, 109, 0.68);
  background: rgba(225, 185, 109, 0.16);
}

.route-node[aria-current="true"] {
  border-color: rgba(145, 178, 133, 0.62);
  background: rgba(145, 178, 133, 0.12);
}

.route-instruction {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.edge-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 12px;
}

.edge-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.16);
}

.edge-type {
  display: inline-flex;
  margin-bottom: 6px;
  font-size: 0.68rem;
}

.edge-people {
  font-weight: 700;
  margin-bottom: 4px;
}

.footnote-inline {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.mini-label {
  font-size: 0.68rem;
  color: var(--muted);
}

.tour-annotation-voice {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-style: italic;
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px));
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes route-flow {
  from {
    stroke-dashoffset: 0;
  }

  to {
    stroke-dashoffset: -48;
  }
}

@keyframes tour-countdown {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 1180px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .search-panel,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-column {
    height: auto;
  }

  .detail-relations {
    max-height: 560px;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100vw - 16px, 1460px);
    padding-top: 16px;
  }

  .hero,
  .panel {
    border-radius: 22px;
    padding: 18px;
  }

  .panel-header,
  .atlas-heading,
  .detail-heading-row,
  .mode-bar,
  .section-header,
  .tour-header,
  .tour-placard-header,
  .tour-auto-header,
  .tour-stage-header,
  .tour-stage-actions {
    align-items: start;
    flex-direction: column;
  }

  .controls,
  .control,
  .search-control-wrap,
  .segmented-control,
  .mode-actions,
  .tour-list,
  .path-summary {
    width: 100%;
  }

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

  .tour-list {
    grid-template-columns: 1fr;
  }

  .mode-actions {
    display: grid;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-panel {
    gap: 18px;
  }

  .map-toolbar {
    justify-content: flex-start;
  }

  .map-toolbar-label {
    width: 100%;
  }

  .atlas-frame {
    min-height: 860px;
  }

  .atlas-scroll,
  .graph-canvas {
    min-height: 800px;
  }

  .atlas-scroll {
    max-height: 800px;
  }

  .node-card {
    width: 154px;
  }

  .node-card[data-expanded="true"] {
    width: 208px;
  }

  .status-ribbon {
    display: grid;
    grid-template-columns: 1fr;
  }

  .path-summary {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .map-tool-button {
    flex: 1 1 calc(50% - 8px);
  }

  .zoom-value {
    flex: 1 1 58px;
  }
}

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

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