:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --paper: #ffffff;
  --ink: #050505;
  --muted: #5f6368;
  --faint: #9a9a9a;
  --line: #d8d8d8;
  --line-dark: #111111;
  --soft: #efefec;
  --accent: #ff7a1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-dark);
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 900;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
}

.topnav a.active {
  color: var(--ink);
  font-weight: 900;
}

.topicons {
  margin-left: auto;
  display: flex;
  gap: 16px;
  color: var(--ink);
  font-size: 18px;
}

.layout {
  min-height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.directory {
  background: var(--bg);
  border-right: 1px solid var(--line-dark);
}

.directoryHeader {
  height: 54px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.tree {
  padding: 14px 0;
  font-size: 14px;
}

.tree a {
  min-height: 32px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
}

.tree a strong {
  color: var(--ink);
}

.tree a.indent {
  padding-left: 34px;
}

.tree a.indent2 {
  padding-left: 58px;
}

.tree a.active {
  color: var(--ink);
  background: #ddddda;
}

.page {
  min-width: 0;
}

.pathbar {
  height: 60px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-dark);
}

.pathText {
  margin-right: 4px;
  font-size: 18px;
  font-weight: 900;
}

.tag {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-dark);
  background: var(--paper);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.tag.muted {
  border-color: var(--line);
  color: var(--muted);
}

.hero {
  padding: 34px 32px 8px;
  background: var(--paper);
}

.hero h1 {
  max-width: 1400px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(32px, 3vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.authors {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.affiliation {
  margin-top: 8px;
  color: var(--faint);
  font-size: 12px;
}

.badges {
  margin-top: 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badges span,
.tabs button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-dark);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.tabs {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tabs button {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
  text-transform: none;
  cursor: pointer;
}

.tabs button.active {
  background: var(--ink);
  color: #ffffff;
}

.workbench {
  padding: 8px 32px 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  background: var(--paper);
}

.comingSoonPanel {
  margin: 0;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  background: #f7f7f4;
}

.comingSoonPanel h2 {
  margin: 2px 0 0;
  font-family: var(--sans);
  font-size: 1.35rem;
  line-height: 1.1;
}

.comingSoonPanel p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
}

.controlPanel,
.viewer,
.dataSection {
  border: 1px solid var(--line);
  background: var(--paper);
}

.panelTitle,
.panelHeader,
.mapToolbar {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.panelTitle strong,
.panelHeader strong {
  color: var(--ink);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.field span,
.sectionLabel {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  padding: 0 8px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}

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

#originMap {
  width: 100%;
  height: 150px;
  margin-top: 10px;
  display: block;
  border: 1px solid var(--line);
  background: #fbfaf5;
}

.originPoint {
  cursor: pointer;
  transition:
    r 120ms ease,
    opacity 120ms ease,
    fill 120ms ease;
}

.originPoint:hover,
.originPoint.active {
  r: 5;
  fill: var(--accent);
  opacity: 1;
}

.originMeta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.outlineButton {
  width: calc(100% - 24px);
  min-height: 34px;
  margin: 12px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.stats {
  padding: 0 12px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.stats strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.viewer {
  min-width: 0;
  height: 760px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.viewerHeader {
  height: 74px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

#eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

#routeTitle {
  margin-top: 4px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 24px;
  line-height: 1.16;
}

#revealButton {
  min-height: 38px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  padding: 0 13px;
  background: var(--ink);
  color: #ffffff;
  cursor: pointer;
}

.viewerBody {
  min-height: 0;
  height: 644px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
}

.mapShell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fbfaf5;
}

.mapToolbar {
  justify-content: flex-start;
}

.mapStage {
  min-height: 0;
  height: 602px;
  overflow: hidden;
  background: #fbfaf5;
}

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

.routePanel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
}

.candidateList {
  min-height: 0;
  overflow: auto;
}

.candidate {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.candidate:hover,
.candidate.active {
  background: #f4f4f1;
}

.candidate.answerVisible {
  background: #fff3e8;
}

.candidateTop {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.candidateName {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 900;
}

.swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--route-color, var(--accent));
}

.rankPill {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-right: 0;
}

.metric {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  white-space: nowrap;
}

.answerBar {
  min-height: 42px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

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

.dataSection {
  margin: 16px 32px 40px;
  padding-bottom: 14px;
}

.sectionHeader {
  min-height: 52px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.sectionHeader h2 {
  font-size: 16px;
}

.sectionHeader p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sampleStrip {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.card {
  min-width: 0;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
}

.card:hover,
.card.active {
  border-color: var(--line-dark);
  background: #f8f8f5;
}

.card img {
  width: 88px;
  height: 100%;
  min-height: 88px;
  object-fit: cover;
  display: block;
  background: #fbfaf5;
  border-right: 1px solid var(--line);
}

.cardBody {
  min-width: 0;
  padding: 9px;
}

.cardBody h3 {
  margin: 0 0 7px;
  font-size: 13px;
  line-height: 1.3;
}

.meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 0 6px;
  margin: 0 4px 4px 0;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

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

  .directory {
    display: none;
  }

  .viewerBody {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(480px, 56vh) auto;
  }

  .routePanel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
