.map-shell {
  position: relative;
  height: calc(100vh - 72px);
  min-height: 620px;
  overflow: hidden;
  background: #d8ddd8;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #d6dbd5;
}

#map .leaflet-tile-pane {
  filter: grayscale(1) saturate(.15) contrast(.9) brightness(.96);
}

#map .leaflet-control-zoom {
  border: 0;
  box-shadow: var(--shadow);
}

#map .leaflet-control-zoom a {
  background: #151a16;
  color: var(--text);
  border-color: var(--line);
}

#map .leaflet-control-attribution {
  background: rgba(255,255,255,.83);
  color: #555;
}

.route-browser {
  position: absolute;
  z-index: 500;
  top: 24px;
  left: 24px;
  width: min(390px, calc(100% - 48px));
  max-height: calc(100% - 48px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.browser-heading h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1;
  letter-spacing: -.035em;
}

.browser-heading > p:last-child {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.route-card {
  position: absolute;
  z-index: 520;
  right: 24px;
  bottom: 24px;
  width: min(420px, calc(100% - 48px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(17, 21, 18, .97);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.route-card.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.route-card-close {
  position: absolute;
  top: 13px;
  right: 15px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.route-type-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(217,39,46,.12);
  color: #ef6166;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.route-card h2 {
  margin: 0 42px 5px 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.route-location {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.route-stats {
  display: flex;
  gap: 28px;
  margin: 22px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.route-stats span {
  display: grid;
}

.route-stats strong {
  font-size: 19px;
}

.route-stats small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
}

#route-card-description {
  color: #c9d0c9;
  font-size: 13px;
  line-height: 1.6;
}

.route-card-actions {
  display: flex;
  gap: 9px;
  margin-top: 22px;
}

.map-legend {
  position: absolute;
  z-index: 400;
  left: 440px;
  bottom: 22px;
  display: flex;
  gap: 18px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(16,19,17,.82);
  backdrop-filter: blur(8px);
  color: #d8ddd8;
  font-size: 10px;
}

.map-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  display: inline-block;
  width: 24px;
  height: 4px;
  border-radius: 99px;
}

.legend-normal { background: var(--route); }
.legend-active { background: var(--route-active); }

.route-tooltip {
  padding: 3px 5px;
  border: 0 !important;
  border-radius: 7px !important;
  background: #131713 !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 11px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22) !important;
}

.route-tooltip::before {
  border-top-color: #131713 !important;
}


.route-card {
  overflow: hidden;
}

.route-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #7f1419);
}

.route-card-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.route-card-accent {
  width: 26px;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
}

.route-card-kicker .route-type-badge {
  margin-bottom: 0;
}

.button-primary {
  box-shadow: 0 8px 22px rgba(217,39,46,.20);
}

.button-primary:hover {
  background: #ec3a41;
}

.route-browser::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  width: 72px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 999px 999px;
}


.route-card-media {
  position: relative;
  display: block;
  margin: -26px -26px 20px;
  overflow: hidden;
  aspect-ratio: 16 / 8.2;
  background: #0a0c0a;
  border-bottom: 1px solid var(--line);
}

.route-card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .25s ease, opacity .25s ease;
}

.route-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(12,14,12,.28), rgba(12,14,12,.02));
}

.route-card-media:hover img {
  transform: scale(1.025);
  opacity: .92;
}

.route-card-play {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(217,39,46,.94);
  color: #fff;
  font-size: 18px;
  padding-left: 3px;
  box-shadow: 0 10px 30px rgba(0,0,0,.32);
}
