:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202124;
  background: #dfe7e7;
  font-synthesis: none;
  --surface: #ffffff;
  --surface-subtle: #f7f9fa;
  --text: #202124;
  --muted: #687176;
  --line: #e3e7e9;
  --blue: #1769e0;
  --blue-soft: #e8f0fe;
  --teal: #087f78;
  --shadow: 0 2px 8px rgba(28, 39, 44, 0.16), 0 1px 2px rgba(28, 39, 44, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 105, 224, 0.32);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  isolation: isolate;
}

.map {
  z-index: 0;
  background: #dfe7e7;
}

.side-rail {
  position: absolute;
  z-index: 720;
  inset: 0 auto 0 0;
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 5px rgba(28, 39, 44, 0.1);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: var(--teal);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 17px;
  font-weight: 500;
}

.rail-actions {
  width: 100%;
  display: grid;
  gap: 2px;
  margin-top: 20px;
}

.rail-button {
  width: 100%;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 2px;
  color: #596368;
  background: transparent;
  border: 0;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font-size: 10px;
}

.rail-button:hover,
.rail-button.is-active {
  color: #0b57b7;
  background: var(--blue-soft);
}

.rail-button svg {
  width: 19px;
  height: 19px;
}

.rail-about {
  margin-top: auto;
}

.topbar {
  position: absolute;
  z-index: 700;
  top: 14px;
  right: 76px;
  left: 88px;
  min-width: 0;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: #4c565b;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.icon-button:hover {
  background: #f0f3f4;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.search-form {
  width: min(340px, 42vw);
  flex: 0 1 340px;
  min-width: 0;
  height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  overflow: hidden;
  background: var(--surface);
  border-radius: 5px;
  box-shadow: var(--shadow);
}

.search-form input {
  min-width: 0;
  height: 100%;
  padding: 0 12px 0 17px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
}

.map-chips {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.map-chips::-webkit-scrollbar {
  display: none;
}

.map-chip {
  min-height: 34px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  color: #485257;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(201, 208, 212, 0.94);
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(28, 39, 44, 0.12);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
}

.map-chip:hover,
.map-chip.is-active {
  color: #0b57b7;
  background: var(--blue-soft);
  border-color: #b8cceb;
}

.map-chip svg {
  width: 15px;
  height: 15px;
}

.search-form input::placeholder {
  color: #737b80;
}

.search-button {
  width: 40px;
  height: 40px;
  color: var(--blue);
  border-radius: 50%;
}

.place-panel {
  position: absolute;
  z-index: 650;
  top: 76px;
  left: 88px;
  width: min(390px, calc(100% - 32px));
  max-height: calc(100% - 100px);
  padding: 22px 24px 16px;
  overflow: auto;
  background: var(--surface);
  border-radius: 6px;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, opacity 180ms ease;
}

.place-panel.is-hidden {
  pointer-events: none;
  opacity: 0;
  transform: translateX(calc(-100% - 32px));
}

.panel-handle {
  display: none;
}

.place-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.place-heading h1 {
  margin: 3px 0 5px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0;
}

.panel-title-wrap {
  min-width: 0;
}

.panel-title-wrap h1,
.panel-title-wrap p {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.coordinates {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.panel-close {
  flex: 0 0 auto;
  margin: -9px -12px 0 0;
  border-radius: 50%;
}

.place-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 22px -6px 18px;
}

.place-action {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-size: 12px;
}

.action-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #c6d5ed;
  border-radius: 50%;
}

.place-action:hover .action-icon,
.place-action[aria-pressed="true"] .action-icon {
  background: var(--blue-soft);
  border-color: #9db8e3;
}

.place-action svg {
  width: 18px;
  height: 18px;
}

.panel-section {
  padding: 17px 0;
  border-top: 1px solid var(--line);
}

.panel-view {
  margin-top: 18px;
}

.source-note {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  color: #315f5a;
  background: #edf7f5;
  border-left: 3px solid var(--teal);
  font-size: 12px;
  font-weight: 500;
}

.source-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.view-status {
  margin: 14px 2px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.view-status.is-error {
  color: #a2342d;
}

.result-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.result-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 3px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.result-item:hover,
.result-item.is-active {
  color: #0b57b7;
  background: var(--blue-soft);
}

.result-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--teal);
}

.result-icon svg {
  width: 17px;
  height: 17px;
}

.result-copy {
  min-width: 0;
}

.result-title,
.result-meta {
  display: block;
  overflow-wrap: anywhere;
}

.result-title {
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

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

.result-tag {
  min-width: 42px;
  padding: 3px 6px;
  color: #486067;
  background: #eef2f3;
  border-radius: 3px;
  text-align: center;
  font-size: 10px;
  white-space: nowrap;
}

.route-form {
  margin-top: 13px;
}

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

.mode-button,
.filter-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  color: #596368;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
}

.mode-button:hover,
.mode-button.is-active,
.filter-button:hover,
.filter-button.is-active {
  color: #0b57b7;
  background: var(--blue-soft);
  border-bottom-color: var(--blue);
}

.mode-button svg {
  width: 16px;
  height: 16px;
}

.route-fields {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 14px 0 12px;
  padding-right: 40px;
}

.route-field-row {
  min-width: 0;
  height: 42px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 7px;
  padding-left: 10px;
  background: var(--surface-subtle);
  border: 1px solid #d9dfe2;
  border-radius: 4px;
}

.route-field-row:focus-within {
  border-color: #7aa7df;
  box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.12);
}

.route-field-row input {
  min-width: 0;
  height: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.endpoint-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.start-dot {
  background: var(--teal);
}

.end-dot {
  background: var(--blue);
}

.field-icon-button,
.swap-button {
  display: grid;
  place-items: center;
  padding: 0;
  color: #5b666b;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.field-icon-button {
  width: 38px;
  height: 38px;
}

.field-icon-button:hover,
.swap-button:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.field-icon-button svg,
.swap-button svg {
  width: 17px;
  height: 17px;
}

.swap-button {
  position: absolute;
  top: 23px;
  right: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.primary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  color: #ffffff;
  background: var(--blue);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.primary-button:hover {
  background: #0b57b7;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.primary-button svg {
  width: 16px;
  height: 16px;
}

.route-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 13px 0 4px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.route-stat {
  min-width: 0;
  padding: 0 10px;
}

.route-stat + .route-stat {
  border-left: 1px solid var(--line);
}

.route-stat strong,
.route-stat span {
  display: block;
}

.route-stat strong {
  color: var(--text);
  font-size: 19px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.route-stat span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.route-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-step {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.route-step svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--blue);
}

.route-step-distance {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.transit-toolbar {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.transit-search {
  min-width: 0;
  height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid #d9dfe2;
  border-radius: 4px;
}

.transit-search:focus-within {
  border-color: #7aa7df;
  box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.12);
}

.transit-search input {
  min-width: 0;
  height: 100%;
  padding: 0 4px 0 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.transit-toolbar .primary-button {
  justify-self: start;
}

.about-copy {
  color: #4f595e;
  font-size: 13px;
  line-height: 1.65;
}

.about-copy p {
  margin: 13px 2px 0;
}

.pick-banner {
  position: absolute;
  z-index: 760;
  top: 76px;
  left: 50%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px 7px 12px;
  color: #ffffff;
  background: #25373a;
  border-radius: 4px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 12px;
}

.pick-banner svg {
  width: 16px;
  height: 16px;
}

.pick-banner button {
  min-height: 28px;
  padding: 4px 9px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.endpoint-marker {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(27, 39, 44, 0.35);
  font-size: 10px;
  font-weight: 500;
}

.endpoint-marker.is-start {
  background: var(--teal);
}

.endpoint-marker.is-end {
  background: var(--blue);
}

.leaflet-tooltip.transit-label {
  color: #2e3b40;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dce2e4;
  border-radius: 3px;
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 500;
}

.leaflet-tooltip.transit-label::before {
  display: none;
}

.saved-list {
  display: grid;
  gap: 1px;
  margin: 16px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.saved-place {
  display: grid;
  gap: 4px;
  padding: 12px 4px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.saved-place:last-child {
  border-bottom: 0;
}

.saved-place:hover {
  color: #0b57b7;
  background: var(--blue-soft);
}

.saved-place small,
.saved-empty {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.saved-empty {
  margin: 0;
  padding: 17px 4px;
  line-height: 1.55;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2,
.location-section h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
}

.location-section {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
}

.location-section > svg {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  color: var(--teal);
}

.location-section p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.panel-footer a {
  color: var(--muted);
}

.map-tools {
  position: absolute;
  z-index: 650;
  top: 84px;
  right: 16px;
  display: grid;
  overflow: hidden;
  background: var(--surface);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.map-status {
  position: absolute;
  z-index: 620;
  bottom: 26px;
  left: 88px;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  color: #465156;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--teal);
  border-radius: 50%;
}

.status-separator {
  width: 1px;
  height: 13px;
  background: var(--line);
}

.map-tool + .map-tool {
  border-top: 1px solid var(--line);
}

.toast {
  position: absolute;
  z-index: 800;
  left: 50%;
  bottom: 28px;
  max-width: min(440px, calc(100% - 32px));
  padding: 11px 16px;
  color: #ffffff;
  background: #283236;
  border-radius: 4px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: 13px;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.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;
}

.leaflet-control-zoom {
  margin-top: 16px !important;
  margin-right: 16px !important;
  border: 0 !important;
  border-radius: 4px !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  width: 40px !important;
  height: 40px !important;
  color: #4c565b !important;
  border-color: var(--line) !important;
  line-height: 40px !important;
  font-size: 22px !important;
}

.leaflet-control-zoom a:first-child {
  border-radius: 4px 4px 0 0 !important;
}

.leaflet-control-zoom a:last-child {
  border-radius: 0 0 4px 4px !important;
}

.leaflet-control-attribution {
  padding: 4px 7px !important;
  color: #4f595e;
  background: rgba(255, 255, 255, 0.92) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: #075e8a;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--text);
  background: var(--surface);
}

.leaflet-popup-content-wrapper {
  border-radius: 5px;
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-size: 13px;
}

.popup-title {
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
}

.popup-coordinates {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.map-error {
  position: absolute;
  z-index: 900;
  inset: 50% auto auto 50%;
  width: min(420px, calc(100% - 32px));
  padding: 18px;
  color: #5d1c1c;
  background: #fff6f5;
  border: 1px solid #edc6c2;
  border-radius: 6px;
  transform: translate(-50%, -50%);
  text-align: center;
}

@media (max-width: 680px) {
  .side-rail {
    inset: auto 0 0;
    width: 100%;
    height: 64px;
    flex-direction: row;
    justify-content: center;
    padding: 4px 10px;
    border-top: 1px solid var(--line);
    border-right: 0;
    box-shadow: 0 -1px 5px rgba(28, 39, 44, 0.1);
  }

  .brand-mark,
  .rail-about {
    display: none;
  }

  .rail-actions {
    width: min(100%, 420px);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    margin: 0;
  }

  .rail-button {
    min-height: 54px;
  }

  .topbar {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    height: auto;
    display: grid;
    gap: 8px;
  }

  .search-form {
    width: 100%;
    max-width: none;
  }

  .place-panel {
    top: auto;
    right: 8px;
    bottom: 72px;
    left: 8px;
    width: auto;
    max-height: min(59vh, 520px);
    padding: 16px 18px 12px;
    border-radius: 6px;
    transform-origin: bottom;
  }

  .place-panel.is-hidden {
    opacity: 0;
    transform: translateY(calc(100% + 16px));
  }

  .panel-handle {
    display: block;
    width: 34px;
    height: 4px;
    margin: -7px auto 10px;
    background: #d2d7da;
    border-radius: 2px;
  }

  .place-heading h1 {
    font-size: 23px;
  }

  .place-actions {
    margin-top: 16px;
    margin-bottom: 12px;
  }

  .panel-section {
    padding: 13px 0;
  }

  .location-section,
  .panel-footer {
    display: none;
  }

  .map-tools {
    top: 108px;
    right: 10px;
  }

  .pick-banner {
    top: 108px;
    max-width: calc(100% - 92px);
  }

  .map-status {
    display: none;
  }

  .leaflet-control-zoom {
    margin-top: 108px !important;
    margin-right: 10px !important;
  }

  .leaflet-control-attribution {
    margin-bottom: 64px !important;
    max-width: calc(100% - 16px);
    white-space: normal;
    line-height: 1.25;
  }

  .toast {
    bottom: 82px;
  }
}

@media (max-width: 390px) {
  .search-form input {
    padding-left: 12px;
    font-size: 14px;
  }

  .place-panel {
    max-height: min(57vh, 480px);
  }

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

  .result-item {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .result-tag {
    grid-column: 2;
    justify-self: start;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
