.leaflet-container {
  font-family: var(--font);
  background: #cbd5e1;
}

html.peich-locate #map,
html.peich-locate #map .leaflet-container {
  cursor: crosshair !important;
}

[data-theme="dark"] .leaflet-container {
  background: #1e293b;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
}

.leaflet-popup-content {
  margin: 0.75rem 0.9rem;
  color: var(--text);
  font-size: 0.8125rem;
  line-height: 1.45;
  min-width: 180px;
}

.leaflet-popup-tip {
  background: var(--bg-elevated);
}

.popup-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.popup-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.popup-btn {
  margin-top: 0.5rem;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.78rem;
}

.popup-btn-audio {
  background: #0e5c61;
  margin-top: 0.65rem;
}

.popup-btn-detail {
  background: var(--accent);
}

.marker-pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.marker-pin.marker-active,
.marker-transit.marker-active,
.marker-route-step.marker-active {
  animation: marker-blink 1.1s ease-in-out infinite;
  z-index: 1000 !important;
}

@keyframes marker-blink {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55), 0 4px 12px rgba(0, 0, 0, 0.25);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0), 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

.leaflet-marker-icon.radar-ring-host {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
}

.leaflet-marker-icon.marker-route-step-host,
.leaflet-div-icon.marker-route-step-host {
  display: block !important;
  background: transparent !important;
  border: none !important;
}

.marker-route-step {
  position: relative;
  display: block;
  width: 34px;
  height: 42px;
  color: var(--step-color, #14b8a6);
  filter: drop-shadow(0 3px 7px rgba(15, 23, 42, 0.32));
  pointer-events: none;
}

.marker-route-step svg {
  display: block;
  width: 34px;
  height: 42px;
}

.radar-ring {
  width: 88px;
  height: 88px;
  margin: 0;
  border-radius: 50%;
  border: 2px solid var(--radar-color, #2563eb);
  box-shadow: 0 0 12px color-mix(in srgb, var(--radar-color, #2563eb) 45%, transparent);
  animation: radar-pulse 2.1s ease-out infinite;
  opacity: 0;
  transform-origin: center center;
}

@keyframes radar-pulse {
  0% {
    transform: scale(0.35);
    opacity: 0.85;
  }
  70%, 100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

.marker-pin svg {
  transform: rotate(45deg);
  width: 14px;
  height: 14px;
  fill: white;
}

.marker-transit {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: white;
}

.route-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaflet-control-zoom a {
  border-radius: 10px !important;
}

.leaflet-control-attribution {
  font-size: 10px;
  background: var(--bg-elevated) !important;
  color: var(--text-muted) !important;
}

.map-flag {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 500;
  width: 64px;
  height: 44px;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

.map-flag img {
  display: block;
  width: 64px !important;
  height: 44px !important;
  max-width: 64px !important;
  max-height: 44px !important;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

@media (min-width: 900px) {
  .map-flag {
    top: 1rem;
    left: 1rem;
  }
}

.map-info-btn {
  position: absolute;
  bottom: 1rem;
  left: 0.75rem;
  z-index: 500;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-elevated);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: visible;
  isolation: isolate;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.map-info-btn::before,
.map-info-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #ef4444;
  box-shadow: 0 0 10px color-mix(in srgb, #ef4444 40%, transparent);
  pointer-events: none;
  z-index: -1;
  animation: map-phone-radar 2.1s ease-out infinite;
}

.map-info-btn::after {
  animation-delay: 1.05s;
}

@keyframes map-phone-radar {
  0% {
    transform: scale(1);
    opacity: 0.82;
  }
  70%, 100% {
    transform: scale(2.35);
    opacity: 0;
  }
}

.map-info-btn[hidden] {
  display: none !important;
}

.map-info-btn:hover,
.map-info-btn.is-on {
  background: #0e5c61;
  border-color: #0e5c61;
  color: #fff;
  box-shadow: 0 8px 24px rgba(14, 92, 97, 0.35);
}

.map-info-btn.is-on::before,
.map-info-btn.is-on::after,
.map-info-btn.is-on svg {
  animation: none;
}

.map-info-btn:active {
  transform: scale(0.96);
}

.map-info-btn svg {
  flex-shrink: 0;
  transform-origin: center center;
  animation: phone-ring 1.35s ease-in-out infinite;
}

@keyframes phone-ring {
  0%, 42%, 100% {
    transform: rotate(0deg);
  }
  4% {
    transform: rotate(-16deg);
  }
  8% {
    transform: rotate(16deg);
  }
  12% {
    transform: rotate(-16deg);
  }
  16% {
    transform: rotate(16deg);
  }
  20% {
    transform: rotate(-10deg);
  }
  24% {
    transform: rotate(10deg);
  }
  28% {
    transform: rotate(-5deg);
  }
  32% {
    transform: rotate(5deg);
  }
  36% {
    transform: rotate(0deg);
  }
  52% {
    transform: rotate(-14deg);
  }
  56% {
    transform: rotate(14deg);
  }
  60% {
    transform: rotate(-14deg);
  }
  64% {
    transform: rotate(14deg);
  }
  68% {
    transform: rotate(0deg);
  }
}

.map-info-panel {
  position: absolute;
  bottom: calc(1rem + 52px);
  left: 0.75rem;
  z-index: 501;
  width: min(340px, calc(100% - 1.5rem));
  max-height: min(56vh, 460px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.map-info-panel[hidden] {
  display: none !important;
}

.map-info-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, #0e5c61 8%, var(--bg-elevated));
}

.map-info-panel-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.map-info-close {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.map-info-panel-body {
  padding: 0.75rem 0.85rem 0.9rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.map-info-panel-body .phone-section-hint {
  margin: 0 0 0.75rem;
}

.map-info-panel-body .phone-cards {
  grid-template-columns: 1fr;
}

.map-info-panel-body .phone-card-number {
  font-size: 1.25rem;
}

.map-info-loading {
  margin: 0;
  padding: 0.5rem 0;
}

@media (min-width: 900px) {
  .map-info-btn {
    bottom: 1.25rem;
    left: 1rem;
  }

  .map-info-panel {
    bottom: calc(1.25rem + 52px);
    left: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-info-btn::before,
  .map-info-btn::after,
  .map-info-btn svg {
    animation: none !important;
  }
}
