#fx-stage {
  position: absolute;
  inset: 0;
  z-index: 850;
  overflow: hidden;
  pointer-events: none;
}

#fx-stage *,
.leaflet-fx-pane,
.leaflet-fx-pane * {
  pointer-events: none !important;
}

.leaflet-fx-pane .fx-icon {
  border: 0;
  background: transparent;
}

.fx-icon {
  overflow: visible;
}

.fx-fly,
.fx-ghost {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--fx-color, var(--detect));
  will-change: transform, opacity;
}

.fx-ring,
.fx-ghost-ring {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 3px solid currentColor;
  border-radius: 50%;
  opacity: 0;
  animation: fx-ring 500ms ease-out forwards;
}

.fx-pop {
  position: relative;
  display: grid;
  place-items: center;
  animation: fx-pop 400ms cubic-bezier(.2, .8, .2, 1) both;
}

.fx-card {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 120px);
  padding: 8px 12px 8px 8px;
  transform: translateX(-50%);
  border: 1px solid color-mix(in srgb, var(--fx-color) 35%, transparent);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(23, 32, 27, .2);
  animation: fx-card-in 200ms ease both;
  pointer-events: none;
}

.fx-card-out {
  animation: fx-fade-out 300ms ease forwards;
}

.fx-card-icon {
  flex: 0 0 auto;
}

.fx-card-icon .symbol-marker {
  width: 28px;
  height: 28px;
  font-size: 15px;
  box-shadow: none;
}

.fx-card-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.15;
}

.fx-card-text strong {
  white-space: nowrap;
}

.fx-card-text span {
  /* Регион и районы переносятся на строки: список районов не должен обрезаться. */
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.fx-ghost {
  color: var(--clear);
  animation: fx-ghost-rise 700ms ease-out forwards;
}

.fx-ghost-ring {
  border-color: var(--clear);
  animation: fx-ghost-ring 700ms ease-out forwards;
}

/* Три мигания региона после посадки значка, до постоянной подсветки.
   Длительность и число повторов связаны с REGION_BLINK_MS в mapFx.js (3 × 450 мс). */
.leaflet-interactive.fx-region-blink {
  animation: fx-region-blink 450ms ease-in-out 3;
}

.fx-region-blink { --fx-blink-fill: #d98a1f; }
.fx-region-blink-danger { --fx-blink-fill: #d43d2f; }

.leaflet-interactive.fx-region-clear {
  animation: fx-region-clear .9s ease-out forwards;
}

.fx-kind-uav { --fx-color: var(--marker-detect); }
.fx-kind-uav.fx-status-danger { --fx-color: var(--marker-danger); }
.fx-kind-naval_drone { --fx-color: #0e6f86; }
.fx-kind-balloon { --fx-color: #0284c7; }
.fx-kind-pvo { --fx-color: #334c5f; }
.fx-kind-pvo_prepare { --fx-color: #8a6a14; }
.fx-kind-missile,
.fx-kind-aviation_missile { --fx-color: var(--marker-danger); }
.fx-kind-artillery { --fx-color: #c45a20; }
.fx-kind-flamingo { --fx-color: #db2777; }
.fx-status-clear { --fx-color: var(--marker-clear); }

@keyframes fx-ring {
  from { opacity: .9; transform: scale(.3); }
  to { opacity: 0; transform: scale(1.8); }
}

@keyframes fx-pop {
  0% { opacity: 0; transform: scale(.8); }
  70% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes fx-card-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fx-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fx-ghost-ring {
  from { opacity: .65; transform: scale(1); }
  to { opacity: 0; transform: scale(1.5); }
}

@keyframes fx-ghost-rise {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-28px); }
}

/* Регион в этот момент ещё не подсвечен (заливка прозрачная), поэтому мигание
   задаёт и fill, и fill-opacity; после анимации атрибуты Leaflet снова свои. */
@keyframes fx-region-blink {
  0%, 100% { fill: var(--fx-blink-fill, #d98a1f); fill-opacity: 0; }
  50% { fill: var(--fx-blink-fill, #d98a1f); fill-opacity: .55; }
}

@keyframes fx-region-clear {
  from { fill: #2f7d62; fill-opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-fly,
  .fx-ghost,
  .fx-ring,
  .fx-ghost-ring,
  .fx-pop,
  .fx-card {
    animation: fx-fade-out 180ms ease forwards;
  }

  .leaflet-interactive.fx-region-blink,
  .leaflet-interactive.fx-region-clear {
    animation-duration: 180ms;
    animation-iteration-count: 1;
  }
}

@media (max-width: 860px) {
  .fx-card {
    max-width: calc(100% - 120px);
  }

  .fx-card-text {
    max-width: min(72vw, 320px);
  }
}
