:root {
  color-scheme: dark;
  --bg: #050506;
  --panel: rgba(28, 28, 28, 0.82);
  --panel-soft: rgba(255, 255, 255, 0.055);
  --panel-line: rgba(255, 255, 255, 0.14);
  --text: #f4f4f4;
  --muted: #c5c5c5;
  --muted-2: #9a9a9a;
  --route-distance: #2bd4ff;
  --route-accessible: #ff9568;
  --route-comfort: #b72a88;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app-shell,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

#app-shell {
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

.loading-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 5, 6, 0.42);
  backdrop-filter: blur(4px);
  opacity: 1;
  transition: opacity 180ms ease;
}

.loading-modal[hidden] {
  display: none;
}

.loading-modal.is-hiding {
  pointer-events: none;
  opacity: 0;
}

.loading-modal__panel {
  display: grid;
  width: min(310px, calc(100vw - 36px));
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(28, 28, 28, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.loading-modal__spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(
    from 90deg,
    rgba(255, 255, 255, 0.08),
    var(--route-distance),
    var(--route-accessible),
    rgba(255, 255, 255, 0.08)
  );
  animation: loading-spin 900ms linear infinite;
}

.loading-modal__spinner::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 4px;
  border-radius: 50%;
  background: rgba(28, 28, 28, 0.96);
}

.loading-modal--error .loading-modal__spinner {
  animation: none;
  background: var(--route-accessible);
}

.loading-modal h2 {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.18;
}

.loading-modal p {
  margin: 0;
}

#loading-message {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.loading-modal__note {
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 0.64rem;
  line-height: 1.35;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.maplibregl-ctrl-attrib {
  background: rgba(5, 5, 6, 0.72) !important;
  color: #d1d1d1 !important;
}

.maplibregl-ctrl-attrib a {
  color: #f1f1f1 !important;
}

.panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  width: min(315px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow-x: hidden;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  transition: width 180ms ease, max-height 180ms ease;
}

.panel__body {
  padding: 18px 20px 16px;
  transition: padding 180ms ease;
}

.panel__topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
}

.panel__title {
  min-width: 0;
}

.panel__collapse-button {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.panel__collapse-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  transition: transform 180ms ease;
}

.panel__collapse-button:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.11);
}

.panel__collapse-button:focus-visible {
  outline: 2px solid rgba(43, 212, 255, 0.38);
  outline-offset: 2px;
}

.panel__collapsible {
  display: block;
}

.panel.is-collapsed {
  width: min(270px, calc(100vw - 36px));
  max-height: none;
  overflow: visible;
}

.panel.is-collapsed .panel__body {
  padding: 14px 14px 13px 16px;
}

.panel.is-collapsed .panel__topline {
  align-items: center;
}

.panel.is-collapsed .panel__intro,
.panel.is-collapsed .panel__collapsible {
  display: none;
}

.panel.is-collapsed .panel__collapse-button svg {
  transform: rotate(180deg);
}

.dictionary_quote_font {
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1rem;
}

.eyebrow {
  padding-top: 2rem;
  padding-bottom: 2rem;
  line-height: 1rem;
  color: var(--text);
  font-size: .82rem;
  font-weight: 200;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 1.72rem;
  line-height: 1.02;
  font-weight: 760;
}

.lede {
  max-width: 235px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.42;
}

.legend {
  margin-top: 16px;
}

.scenario__topline {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.legend__bar {
  height: 8px;
  margin-top: 9px;
  background: linear-gradient(
    90deg,
    #252536 0%,
    #6e2b92 24%,
    #ff1983 52%,
    #ff9568 76%,
    #fff8ef 100%
  );
  opacity: 0.9;
}

.legend__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.68rem;
}

.legend__heading {
  margin-bottom: 7px;
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 760;
}

.mesh-control {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: var(--panel-soft);
}

.mesh-control__toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 740;
  line-height: 1.2;
}

.mesh-control__slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 680;
  line-height: 1.2;
}

.mesh-control__slider output {
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 760;
}

.mesh-control__slider input {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  accent-color: var(--route-accessible);
}

.reachable-boundary-control {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: var(--panel-soft);
  transition: border-color 160ms ease, background 160ms ease;
}

.reachable-boundary-control[aria-busy="true"] {
  border-color: rgba(43, 212, 255, 0.32);
  background: rgba(43, 212, 255, 0.055);
}

.reachable-boundary-control__topline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.reachable-boundary-control__title {
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 760;
}

.reachable-boundary-control__description {
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.35;
}

.reachable-boundary-key {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--muted-2);
  font-size: 0.61rem;
  line-height: 1.2;
}

.reachable-boundary-key span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.reachable-boundary-key__line {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px solid var(--route-distance);
}

.reachable-boundary-key__line--distance {
  border-color: var(--route-distance);
}

.reachable-boundary-key__line--accessible {
  border-color: var(--route-accessible);
  border-top-style: dashed;
}

.reachable-boundary-key__line--comfort {
  border-color: var(--route-comfort);
  border-top-style: dotted;
}

.reachable-boundary-key__line--preview {
  border-top: 2px dashed rgba(244, 244, 244, 0.72);
}

.reachable-boundary-state {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--route-distance);
  font-size: 0.63rem;
  font-weight: 700;
  line-height: 1.3;
}

.reachable-boundary-state[hidden] {
  display: none;
}

.reachable-boundary-state__spinner {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid rgba(43, 212, 255, 0.22);
  border-top-color: var(--route-distance);
  border-radius: 50%;
  animation: loading-spin 720ms linear infinite;
}

.scenario-list {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.scenario {
  min-height: 0;
  padding: 9px 10px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: var(--panel-soft);
}

.scenario__name {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 740;
}

.scenario__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.scenario__dot--distance {
  color: var(--route-distance);
  background: var(--route-distance);
}

.scenario__dot--accessible {
  color: var(--route-accessible);
  background: var(--route-accessible);
}

.scenario__dot--comfort {
  color: var(--route-comfort);
  background: var(--route-comfort);
}

.scenario__details {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 4px;
}

.scenario__copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.scenario p,
.status {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.32;
}

.scenario .scenario__budget {
  color: var(--muted-2);
  font-size: 0.61rem;
}

.scenario strong {
  color: var(--text);
  font-size: 0.76rem;
  white-space: nowrap;
}

.toggle-switch {
  appearance: none;
  position: relative;
  width: 34px;
  height: 18px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35);
  transition: transform 160ms ease;
}

.toggle-switch:checked {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.36);
}

.scenario--distance .toggle-switch:checked {
  background: var(--route-distance);
}

.scenario--accessible .toggle-switch:checked {
  background: var(--route-accessible);
}

.scenario--comfort .toggle-switch:checked {
  background: var(--route-comfort);
}

.toggle-switch:checked::after {
  transform: translateX(16px);
}

.toggle-switch:focus-visible {
  outline: 2px solid rgba(43, 212, 255, 0.38);
  outline-offset: 2px;
}

#reachable-boundary-toggle:checked {
  background: linear-gradient(
    90deg,
    var(--route-distance),
    var(--route-comfort),
    var(--route-accessible)
  );
}

.status {
  min-height: 1rem;
  margin-top: 10px;
  color: var(--muted-2);
}

.panel__footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.fit-button,
.info-button,
.repo-link {
  display: inline-flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0;
  transition: background 160ms ease, border-color 160ms ease;
}

.repo-link {
  width: 100%;
  padding: 0;
  text-decoration: none;
}

.fit-button svg,
.info-button svg,
.repo-link svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.fit-button:hover,
.info-button:hover,
.repo-link:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.11);
}

.fit-button:focus-visible,
.info-button:focus-visible,
.repo-link:focus-visible {
  outline: 2px solid rgba(43, 212, 255, 0.38);
  outline-offset: 2px;
}

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 18px;
  overflow: hidden;
}

.info-modal[hidden] {
  display: none;
}

.info-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 6, 0.58);
  backdrop-filter: blur(5px);
}

.info-modal__panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(24, 24, 24, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.info-modal__panel:focus {
  outline: none;
}

.info-modal__panel:focus-visible {
  outline: 2px solid rgba(43, 212, 255, 0.38);
  outline-offset: 2px;
}

.info-modal__header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--panel-line);
}

.info-modal__kicker {
  margin: 0 0 5px;
  color: var(--muted-2);
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.info-modal h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.16rem;
  line-height: 1.08;
}

.info-modal__close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
}

.info-modal__close svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.info-modal__close:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.11);
}

.info-modal__content {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 18px;
  scrollbar-gutter: stable;
}

.info-modal__content p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.48;
}

.info-modal__content a {
  color: var(--text);
  text-decoration-color: rgba(43, 212, 255, 0.58);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.info-modal__content a:hover {
  color: var(--route-distance);
}

.info-modal__facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.info-modal__facts div {
  display: grid;
  grid-template-columns: minmax(78px, auto) 1fr;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: var(--panel-soft);
}

.info-modal__facts dt {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 760;
}

.info-modal__facts dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.info-modal__citation {
  margin: 0;
}

.info-modal__section {
  display: grid;
  gap: 8px;
}

.info-modal__section h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.2;
}

.info-diagram {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
}

.info-diagram svg {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
  color: var(--text);
  overflow: visible;
}

.info-diagram text {
  fill: var(--text);
  font-size: 12px;
  font-weight: 720;
}

.info-diagram figcaption {
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.35;
}

.info-diagram marker path {
  fill: var(--muted-2);
}

.diagram-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.11);
  stroke-width: 1;
}

.diagram-slope {
  fill: none;
  stroke: var(--route-accessible);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.4;
}

.diagram-terrain-fill {
  fill: rgba(255, 149, 104, 0.08);
  stroke: none;
}

.diagram-measure {
  marker-end: url("#arrow-head");
  stroke: var(--muted-2);
  stroke-dasharray: 4 4;
  stroke-width: 1.2;
}

.diagram-point,
.diagram-node {
  fill: var(--route-distance);
  stroke: rgba(5, 5, 6, 0.9);
  stroke-width: 2;
}

.diagram-point--end {
  fill: var(--route-accessible);
}

.diagram-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 620;
}

.diagram-end-label {
  fill: var(--text);
  font-size: 14px;
  font-weight: 820;
}

.diagram-chip {
  fill: rgba(255, 255, 255, 0.07);
  stroke: var(--panel-line);
}

.diagram-chip-text {
  fill: var(--text);
  font-size: 12px;
  font-weight: 720;
}

.diagram-route {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.diagram-route--distance {
  stroke: var(--route-distance);
}

.diagram-route--comfort {
  stroke: var(--route-comfort);
}

.diagram-route--accessible {
  stroke: var(--route-accessible);
}

.segment-hover-popup {
  pointer-events: none;
}

.segment-hover-popup .maplibregl-popup-content {
  min-width: 166px;
  max-width: 210px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(28, 28, 28, 0.88);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.32);
  color: var(--text);
  backdrop-filter: blur(12px);
}

.segment-hover-popup .maplibregl-popup-tip {
  border-top-color: rgba(28, 28, 28, 0.88);
}

.slope-popup {
  display: grid;
  gap: 6px;
}

.slope-popup__title {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.2;
}

.slope-popup__grid {
  display: grid;
  gap: 4px;
}

.slope-popup__row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: baseline;
}

.slope-popup__label {
  color: var(--muted-2);
  font-size: 0.64rem;
  line-height: 1.25;
}

.slope-popup__value {
  color: var(--text);
  font-size: 0.66rem;
  line-height: 1.25;
  text-align: right;
}

.pin {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 3px solid #060606;
  border-radius: 50%;
  background: #fff;
  color: #060606;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.46);
  font-size: 0.86rem;
  font-weight: 900;
}

@supports (height: 100dvh) {
  .panel {
    max-height: calc(100dvh - 36px);
  }

  .info-modal {
    min-height: 100dvh;
  }

  .info-modal__panel {
    height: min(760px, calc(100dvh - 36px));
    max-height: min(760px, calc(100dvh - 36px));
  }
}

@media (max-width: 720px) {
  .panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }

  .panel.is-collapsed {
    right: 10px;
    left: auto;
    width: min(280px, calc(100vw - 20px));
    max-height: none;
    overflow: visible;
  }

  .panel__body {
    padding: 16px;
  }

  .panel.is-collapsed .panel__body {
    padding: 13px 13px 12px 15px;
  }

  .panel__footer {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .fit-button,
  .info-button,
  .repo-link {
    min-height: 34px;
    padding: 0 6px;
    gap: 4px;
    font-size: 0.66rem;
  }

  .info-modal {
    align-items: flex-start;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    overflow-y: auto;
  }

  .info-modal__panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    max-height: none;
  }

  .info-modal__facts div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  @supports (height: 100dvh) {
    .panel {
      max-height: calc(100dvh - 20px);
    }

    .info-modal__panel {
      height: calc(100dvh - 20px);
    }
  }
}
