:root {
  --paper: #faf5ec;
  --ink: #281940;
  --muted: #645573;
  --purple: #6235a3;
  --line: #d8cbdc;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  font: 16px/1.5 'Instrument Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
a { color: inherit; text-underline-offset: 4px; }
button, select {
  font: inherit;
  color: inherit;
  min-height: 42px;
  border: 1px solid #a991b7;
  border-radius: 4px;
  background: #fffaf5;
}
button { padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { background: #ebdff5; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 3px solid #9354c7; outline-offset: 3px; }
.shell { width: min(1400px, calc(100% - 64px)); margin-inline: auto; }
.mast {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
.brand { display: inline-flex; gap: 9px; align-items: center; text-decoration: none; font-weight: 750; }
.mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: var(--ink); color: #f2e6ff; font-size: 1.15rem; }
.dashboard {
  display: grid;
  grid-template-columns: minmax(255px, 1fr) minmax(0, 3fr);
  align-items: stretch;
  margin-top: 26px;
  border: 1px solid var(--line);
}
.sidebar { padding: clamp(18px, 2.3vw, 32px); background: #f2e9f5; }
.edition { font: .75rem/1.5 var(--mono); color: var(--purple); }
h1 { font: 400 clamp(2.5rem, 4.4vw, 5.1rem)/.98 'Instrument Serif', Georgia, serif; letter-spacing: -.055em; margin: 12px 0 16px; }
.hero p:last-child { color: var(--muted); font-size: .9rem; max-width: 30ch; }
h2 { font: 400 1.65rem/1.15 'Instrument Serif', Georgia, serif; letter-spacing: -.025em; }
.filters { display: grid; gap: 10px; margin-top: 23px; }
.filters label { font-size: .79rem; font-weight: 700; }
.filters select { display: block; width: 100%; margin-top: 3px; padding: 0 8px; font-weight: 500; }
#reset { justify-self: start; margin-top: 3px; }
.map-card { background: #251944; color: #f9eeff; min-width: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 13px 18px; }
.zoom, .pager { display: flex; align-items: center; gap: 5px; }
.zoom button { width: 38px; padding: 0; background: #352653; border-color: #8c77ad; color: #fff; }
.zoom button:hover:not(:disabled) { background: #594175; }
#map { display: block; width: 100%; height: auto; flex: 1; min-height: 0; background: #251944; border-block: 1px solid #564475; }
#map image { filter: grayscale(1) sepia(1) hue-rotate(220deg) saturate(2.6) brightness(1.28); }
#map .edge { stroke: #efd0ff; stroke-opacity: .48; stroke-width: 1.2; fill: none; cursor: pointer; }
#map .edge:hover { stroke-opacity: 1; stroke-width: 4; }
#map .selected { stroke: #f8df78; stroke-width: 3; fill: none; pointer-events: none; }
#map .node { fill: #fff3ff; stroke: #392753; stroke-width: 1; cursor: pointer; }
#map .hub { fill: #f8df78; stroke-width: 1.4; }
#map text { fill: #fff7ff; font: bold 12px var(--mono); paint-order: stroke; stroke: #251944; stroke-width: 4px; pointer-events: none; }
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; padding: 10px 18px; font-size: .75rem; color: #eadcf3; }
.legend i, .legend b { display: inline-block; background: #efd0ff; width: 14px; height: 2px; vertical-align: middle; margin-right: 4px; }
.legend b { width: 7px; height: 7px; border-radius: 50%; background: #f8df78; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin: 24px 0; }
.stats > div { padding: 12px 16px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats strong { display: block; font: 400 clamp(1.35rem, 3vw, 2.7rem)/1.2 'Instrument Serif', Georgia, serif; }
.stats small { color: var(--muted); display: block; font-size: .74rem; }
.stats span { font: .75rem/1.3 var(--mono); }
.analysis { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 16px; }
.panel { padding: 18px; border: 1px solid var(--line); }
.panel:not(.detail) { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail { background: #eee2f5; }
.panel p { color: var(--muted); font-size: .83rem; margin-top: 5px; }
.detail strong { display: block; color: var(--purple); font: 700 1.15rem var(--mono); margin-top: 10px; }
.detail dl { margin: 10px 0 0; }
.detail dt { color: var(--muted); font-size: .75rem; }
.detail dd { margin: 0 0 6px; overflow-wrap: anywhere; }
.chart { list-style: none; padding: 0; margin: 12px 0 0; }
.chart li { margin: 8px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font: .75rem/1.4 var(--mono); }
.track { margin-top: 3px; height: 6px; background: #e9deed; }
.track i { display: block; height: 100%; background: #804cb2; }
#distance-chart .track i { background: #a26043; }
.list { margin-top: 24px; border-block: 1px solid var(--line); }
.pager span { min-width: 58px; text-align: center; font: .75rem var(--mono); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 8px 16px; border-top: 1px solid var(--line); }
th { font-size: .78rem; color: var(--muted); }
td { font-size: .85rem; }
td b { font-family: var(--mono); }
td button { min-height: 36px; }
tr.active { background: #eee2f5; }
footer { padding: 26px 0 38px; max-width: 880px; }
footer p { color: var(--muted); margin: 8px 0; font-size: .84rem; }
@media (max-width: 880px) {
  .shell { width: calc(100% - 32px); }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .filters { margin-top: 0; }
  #map { flex: none; }
}
@media (max-width: 580px) {
  .sidebar, .analysis { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; align-items: end; }
  .stats > div { padding: 9px 6px; }
  .stats span, .stats small { font-size: .68rem; }
  .panel:not(.detail) { grid-template-columns: 1fr; }
  th, td { padding: 8px; }
}
