:root {
  --bg: #f3efe6;
  --panel: rgba(255, 251, 245, 0.88);
  --panel-strong: rgba(255, 250, 243, 0.96);
  --line: rgba(43, 35, 28, 0.12);
  --line-strong: rgba(43, 35, 28, 0.18);
  --text: #1f1a17;
  --muted: #62574d;
  --accent: #0f6e65;
  --accent-strong: #0a4d48;
  --accent-soft: rgba(15, 110, 101, 0.12);
  --highlight: #ef9a3d;
  --highlight-soft: rgba(239, 154, 61, 0.16);
  --shadow: 0 24px 70px rgba(57, 44, 29, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    linear-gradient(160deg, #f9f6ef 0%, #eee5d6 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

.ambient--one {
  top: -80px;
  left: -60px;
  width: 320px;
  height: 320px;
  background: rgba(239, 154, 61, 0.22);
}

.ambient--two {
  right: -120px;
  bottom: -90px;
  width: 360px;
  height: 360px;
  background: rgba(15, 110, 101, 0.18);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.panel--controls {
  background: var(--panel-strong);
  padding: 28px;
}

.panel--map {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  min-height: calc(100vh - 40px);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.85), rgba(255, 248, 239, 0.7));
}

.eyebrow,
.topbar-note,
.helper-note,
.results__empty,
.leg-card__meta,
.notice-list li,
.stops-card__header p,
.lede,
.status-chip,
.waypoint-list li {
  color: var(--muted);
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

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

h1 {
  margin-top: 14px;
  font-size: clamp(2.4rem, 4vw, 3.7rem);
  line-height: 0.92;
}

.lede {
  margin-top: 14px;
  line-height: 1.5;
}

.route-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
}

.autosuggest {
  display: none;
}

.autosuggest.is-open {
  display: block;
}

.autosuggest__list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 30px rgba(57, 44, 29, 0.1);
}

.autosuggest__option {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 13px;
  background: rgba(245, 241, 235, 0.76);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.autosuggest__option:hover,
.autosuggest__option:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(15, 110, 101, 0.28);
  background: rgba(255, 255, 255, 0.98);
}

.autosuggest__title {
  display: block;
  color: var(--text);
  font-weight: 700;
}

.autosuggest__meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.field span,
.stops-card__header h2,
.results h2,
.results h3 {
  font-size: 0.95rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  transform: translateY(-1px);
}

.stops-card,
.results,
.leg-card,
.metric,
.notice-panel,
.waypoint-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.52);
}

.stops-card {
  padding: 18px;
}

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

.stops-card__header p {
  margin-top: 4px;
  font-size: 0.9rem;
}

.stops-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.stops-list__empty {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--muted);
  text-align: center;
}

.stop-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.stop-item__hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.stop-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stop-item__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.stop-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.65;
  cursor: progress;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #f8f4ed;
  font-weight: 700;
  box-shadow: 0 16px 30px rgba(15, 110, 101, 0.24);
}

.button--secondary,
.button--ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--line);
}

.button--ghost {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.helper-note {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  line-height: 1.45;
}

.results {
  margin-top: 18px;
  padding: 20px;
}

.results__empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  text-align: center;
}

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

.metric {
  padding: 16px;
}

.metric__label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric__value {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.results-section {
  margin-top: 18px;
}

.results-section h3 {
  margin-bottom: 10px;
}

.waypoint-panel,
.notice-panel,
.directions-panel,
.leg-card {
  padding: 16px;
}

.waypoint-list,
.notice-list,
.direction-steps,
.legs-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.waypoint-list li,
.notice-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
}

.waypoint-list strong,
.leg-card__title {
  color: var(--text);
}

.legs-list {
  margin-top: 0;
}

.leg-card {
  display: grid;
  gap: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.leg-card__title {
  font-weight: 700;
}

.leg-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.92rem;
}

.directions-panel {
  display: grid;
  gap: 14px;
}

.direction-leg {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.direction-leg__header {
  display: grid;
  gap: 6px;
}

.direction-leg__title,
.direction-step__instruction {
  color: var(--text);
}

.direction-leg__title {
  font-weight: 700;
}

.direction-leg__summary,
.direction-step__meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.direction-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(43, 35, 28, 0.08);
  background: rgba(247, 243, 236, 0.92);
}

.direction-step__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.direction-step__body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.direction-step__instruction {
  line-height: 1.45;
}

.leg-card__stack {
  display: grid;
  gap: 8px;
}

.leg-card__flag,
.notice-card {
  width: 100%;
  padding: 12px 14px;
  appearance: none;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(239, 154, 61, 0.16), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(239, 154, 61, 0.24);
}

.leg-card__flag {
  font-size: 0.92rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.notice-card {
  display: grid;
  gap: 8px;
  text-align: left;
}

.leg-card__flag:hover,
.leg-card__flag:focus-visible,
.notice-card:hover,
.notice-card:focus-visible,
.leg-card__flag.is-active,
.notice-card.is-active {
  outline: none;
  border-color: rgba(15, 110, 101, 0.3);
  box-shadow: 0 0 0 3px rgba(15, 110, 101, 0.14);
  transform: translateY(-1px);
}

.notice-card__badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 110, 101, 0.12);
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notice-card__title {
  color: var(--text);
  font-weight: 700;
}

.notice-card__meta,
.notice-card__hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.map-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.status-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--highlight);
  box-shadow: 0 0 0 8px rgba(239, 154, 61, 0.14);
}

.status-chip[data-state="ready"] .status-chip__dot {
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(15, 110, 101, 0.14);
}

.status-chip[data-state="error"] .status-chip__dot {
  background: #b4493c;
  box-shadow: 0 0 0 8px rgba(180, 73, 60, 0.15);
}

.topbar-note {
  font-size: 0.86rem;
  text-align: right;
}

.map {
  width: 100%;
  height: 100%;
}

.map-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.map-context-menu {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 10px;
  min-width: 220px;
  max-width: min(280px, calc(100% - 24px));
  padding: 14px;
  border: 1px solid rgba(43, 35, 28, 0.16);
  border-radius: 20px;
  background: rgba(255, 251, 245, 0.97);
  box-shadow: 0 22px 40px rgba(57, 44, 29, 0.18);
  backdrop-filter: blur(18px);
}

.map-context-menu[hidden] {
  display: none;
}

.map-context-menu__label {
  color: var(--text);
  font-weight: 700;
}

.map-context-menu__meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.map-context-menu__action {
  border: 1px solid rgba(15, 110, 101, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(15, 110, 101, 0.12), rgba(255, 255, 255, 0.94));
  color: var(--accent-strong);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.map-context-menu__action:hover,
.map-context-menu__action:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(15, 110, 101, 0.34);
  background: linear-gradient(135deg, rgba(15, 110, 101, 0.18), rgba(255, 255, 255, 0.98));
}

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

  .panel--map {
    position: static;
    top: auto;
    height: auto;
    min-height: 62vh;
  }

  .map-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
    gap: 12px;
  }

  .panel--controls {
    padding: 20px;
  }

  .stops-card__header,
  .stop-item__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
