:root {
  --ink: #10211d;
  --paper: #fffdf8;
  --mint: #5eb3a6;
  --cyan: #1593c5;
  --yellow: #ffdd00;
  --pink: #ffa1a1;
  --amber: #f28705;
  --route: #dd2a1e;
  --accent: #13342f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, #ffe9bd 0%, transparent 36%),
    radial-gradient(circle at 100% 100%, #c7f3e9 0%, transparent 34%),
    var(--paper);
}

body.modal-open {
  overflow: hidden;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px;
}

.hero h1 {
  margin: 0 0 8px;
  letter-spacing: 0.4px;
}

.hero p {
  margin: 0 0 18px;
}

.map-card {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.map-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 440 / 410;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #202020;
  box-shadow: 0 14px 30px rgba(12, 41, 35, 0.18);
  background: white;
}

.base-map {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: pointer;
}

.info-panel {
  padding: 16px;
  border-radius: 14px;
  background: #ffffffde;
  border: 2px solid #1e2a28;
  box-shadow: 0 8px 22px rgba(16, 33, 29, 0.14);
}

.info-panel h2 {
  margin: 0 0 10px;
}

.info-panel p {
  margin: 0;
  line-height: 1.45;
}

.legend {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 2px solid #20202024;
}

.legend h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.legend-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #2222221f;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.legend-item:hover,
.legend-item:focus-visible {
  transform: translateY(-1px);
  border-color: #1f3933;
  box-shadow: 0 4px 10px rgba(16, 33, 29, 0.12);
  outline: none;
}

.legend-item.active {
  border-color: #111;
  box-shadow: 0 0 0 2px #11111114;
}

.swatch {
  width: 44px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid #00000020;
  flex: 0 0 auto;
}

.swatch-route {
  background: var(--route);
}

.swatch-mint {
  background: var(--mint);
}

.swatch-cyan {
  background: var(--cyan);
}

.swatch-yellow {
  background: var(--yellow);
}

.swatch-pink {
  background: var(--pink);
}

.swatch-amber {
  background: var(--amber);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(10, 20, 18, 0.55);
  padding: 18px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  width: min(540px, 100%);
  background: #fffdfb;
  border: 2px solid #1e2a28;
  border-radius: 14px;
  box-shadow: 0 16px 30px rgba(10, 20, 18, 0.32);
  padding: 18px;
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 220ms cubic-bezier(0.2, 0.85, 0.28, 1), opacity 220ms ease;
}

.modal.hidden .modal-card {
  transform: translateY(12px) scale(0.985);
  opacity: 0.94;
}

.modal-card h2 {
  margin: 0 0 8px;
}

.modal-card p {
  margin: 0;
  line-height: 1.45;
}

.modal-close {
  float: right;
  border: 1px solid #1f3933;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: #eef6f3;
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-card {
    transition: none;
  }
}

@media (max-width: 900px) {
  .map-card {
    grid-template-columns: 1fr;
  }
}
