*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: #f8f7f4;
  color: #2c2c2c;
  min-height: 100vh;
}

/* Page layout */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}

.page__header {
  margin-bottom: 20px;
}

.page__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.page__subtitle {
  font-size: 1rem;
  color: #666;
  line-height: 1.6;
}

.page__footer {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #ddd;
  font-size: 0.875rem;
  color: #888;
  line-height: 1.7;
}

.page__footer a {
  color: #3b82f6;
  text-decoration: none;
}

.page__footer a:hover {
  text-decoration: underline;
}

/* Map container */
.map-container {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  border: 1px solid #ddd;
}

#map {
  width: 100%;
  height: 520px;
}

/* Loading overlay — scoped to map container */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: sans-serif;
}

.loading-overlay__spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.loading-overlay__text {
  color: #555;
  font-size: 14px;
}

.loading-overlay--hidden {
  display: none;
}

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

/* Numbered markers */
.marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #3b82f6;
  border: 2px solid #1d4ed8;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.marker-icon__number {
  transform: rotate(45deg);
  color: #fff;
  font-family: sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.marker-icon--emoji .marker-icon__number {
  transform: rotate(45deg);
  font-size: 16px;
}

/* Popup card */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  width: 220px !important;
}

.leaflet-popup-tip-container {
  margin-top: -1px;
}

.popup-card {
  border-top: 4px solid var(--marker-color, #3b82f6);
  padding: 14px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.popup-card__title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
  line-height: 1.3;
}

.popup-card__title a {
  color: var(--marker-color, #3b82f6);
  text-decoration: none;
}

.popup-card__title a:hover {
  text-decoration: underline;
}

.popup-card__details {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.popup-card__details p {
  margin: 4px 0 0;
}

.popup-card__details ol,
.popup-card__details ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.popup-card__details li + li {
  margin-top: 3px;
}

/* Animated route decoration */
.route-decoration {
  position: relative;
  height: 24px;
  margin: 18px 0 16px;
  display: flex;
  align-items: center;
}

.route-decoration__line {
  position: absolute;
  inset: 50% 0 auto;
  height: 2px;
  background-image: repeating-linear-gradient(
    90deg,
    #3b82f6 0px, #3b82f6 8px,
    transparent 8px, transparent 18px
  );
  background-size: 26px 2px;
  animation: march 600ms linear infinite;
  opacity: 0.45;
}

@keyframes march {
  from { background-position: 0 0; }
  to   { background-position: 26px 0; }
}

.route-decoration__stops {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.route-decoration__stop {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #3b82f6;
  opacity: 0.7;
}

.route-decoration__stop--first,
.route-decoration__stop--last {
  width: 12px;
  height: 12px;
  opacity: 1;
  border-width: 2.5px;
}

.route-decoration__stop--first { background: #22c55e; border-color: #15803d; }
.route-decoration__stop--last  { background: #ef4444; border-color: #b91c1c; }

/* Route badge */
.route-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #555;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.route-badge__dot {
  color: #cbd5e1;
}

.route-badge--hidden {
  visibility: hidden;
}

/* Error banner */
.error-banner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}
