/* Live client world map + heartbeat markers. */
.map-card { overflow: hidden; }
.map-card-head { align-items: center; }
.map-card.is-collapsed .map-card-head { border-bottom: 0; }
.map-card-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.6rem; flex-wrap: wrap;
}
.map-toggle { flex: none; }
.map-toggle .icon { transition: transform 180ms ease; }
.map-toggle[aria-expanded="true"] .icon { transform: rotate(90deg); }
.map-body[hidden] { display: none; }
.map-card:not(.is-collapsed) .map-body { animation: map-reveal 180ms ease-out; }
.map-live {
  display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--text-muted);
}
.map-live strong { color: var(--text); font-variant-numeric: tabular-nums; }
.map-live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
  animation: map-live-pulse 1.8s ease-in-out infinite;
}
.map-body { display: grid; gap: 0.75rem; }
.world-map {
  position: relative; width: 100%; aspect-ratio: 1000 / 480;
  min-height: 220px; border-radius: var(--radius-md);
  background: radial-gradient(circle at 50% 45%, var(--bg-subtle), var(--bg-subtle) 55%, transparent 100%);
  overflow: visible;
}
.world-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.world-country {
  fill: var(--bg-subtle); stroke: var(--border); stroke-width: 0.8;
  transition: fill 260ms ease, stroke 260ms ease;
}
.world-country.is-active { fill: var(--success-soft); stroke: var(--success); }
.world-markers { position: absolute; inset: 0; pointer-events: none; }
.map-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-faint); font-size: 0.82rem;
}
.map-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 0.45rem; color: var(--text-faint); font-size: 0.84rem;
  background: color-mix(in srgb, var(--bg-surface) 55%, transparent);
}
.map-empty[hidden] { display: none; }
.map-empty .icon { width: 28px; height: 28px; opacity: 0.65; }
.map-point {
  position: absolute; width: 16px; height: 16px; padding: 0; border: 0;
  transform: translate(-50%, -50%); background: transparent; cursor: pointer;
  pointer-events: auto; z-index: 1;
}
.map-point:focus-visible { outline: none; }
.map-point:focus-visible .map-dot { box-shadow: 0 0 0 3px var(--bg-surface), 0 0 0 5px var(--focus); }
.map-dot {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px;
  margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 2px var(--bg-surface);
  z-index: 2;
}
.map-ping,
.map-point::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--success); opacity: 0; pointer-events: none;
  animation: map-heartbeat 2.4s ease-out infinite;
  animation-delay: var(--beat-delay, 0s);
}
.map-point::before { animation-delay: calc(var(--beat-delay, 0s) + 0.45s); }
.map-point.beat-1 { --beat-delay: 0.16s; }
.map-point.beat-2 { --beat-delay: 0.32s; }
.map-point.beat-3 { --beat-delay: 0.48s; }
.map-point.beat-4 { --beat-delay: 0.64s; }
.map-point.beat-5 { --beat-delay: 0.8s; }
.map-count {
  position: absolute; left: 10px; top: -10px; z-index: 3;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--text); color: var(--bg-surface);
  font-size: 0.62rem; font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 2px var(--bg-surface);
}
.map-point:hover, .map-point:focus, .map-point:focus-within { z-index: 6; }
.map-tooltip {
  position: absolute; left: 50%; bottom: calc(100% + 12px);
  transform: translate(-50%, 4px); width: max-content; max-width: 270px;
  display: grid; gap: 0.35rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text);
  box-shadow: var(--shadow-2); text-align: left; font-size: 0.76rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms;
}
.map-point:hover .map-tooltip,
.map-point:focus .map-tooltip,
.map-point:focus-within .map-tooltip {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.map-point.tip-right .map-tooltip { left: 0; transform: translate(0, 4px); }
.map-point.tip-left .map-tooltip { left: auto; right: 0; transform: translate(0, 4px); }
.map-point.tip-right:hover .map-tooltip,
.map-point.tip-right:focus .map-tooltip,
.map-point.tip-left:hover .map-tooltip,
.map-point.tip-left:focus .map-tooltip { transform: translate(0, 0); }
.map-point.tip-below .map-tooltip { top: calc(100% + 12px); bottom: auto; }
.map-tooltip-head {
  display: flex; align-items: center; gap: 0.4rem;
  padding-bottom: 0.3rem; border-bottom: 1px solid var(--border);
}
.map-tooltip-head strong { font-size: 0.8rem; }
.map-tooltip-head > span:last-child {
  margin-left: auto; color: var(--success); font-weight: 800;
}
.map-client { display: grid; gap: 0.05rem; }
.map-client strong { font-size: 0.74rem; }
.map-client span { color: var(--text-muted); font-size: 0.68rem; }
.map-client-more { color: var(--text-faint); font-size: 0.68rem; }
.map-foot { min-height: 1rem; color: var(--text-faint); font-size: 0.72rem; }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.map-legend-item {
  display: inline-flex; align-items: center; gap: 0.38rem;
  padding: 0.28rem 0.5rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-subtle); color: var(--text-muted); cursor: pointer;
  font-size: 0.74rem;
}
.map-legend-item:hover, .map-legend-item:focus-visible {
  border-color: var(--border-strong); color: var(--text);
}
.map-legend-item strong { color: var(--text); font-variant-numeric: tabular-nums; }

@keyframes map-heartbeat {
  0% { transform: scale(0.5); opacity: 0.7; }
  14% { transform: scale(0.8); opacity: 0.45; }
  28% { transform: scale(1); opacity: 0.3; }
  70%, 100% { transform: scale(2.9); opacity: 0; }
}
@keyframes map-live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--success-soft); }
  50% { box-shadow: 0 0 0 6px var(--success-soft); }
}
@keyframes map-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .world-map { min-height: 190px; }
  .map-card-head { align-items: flex-start; }
  .map-card-actions { justify-content: flex-start; }
  .map-toggle [data-map-toggle-label] { display: none; }
  .map-tooltip { max-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .map-ping, .map-point::before, .map-live-dot { animation: none; }
  .map-ping, .map-point::before { display: none; }
  .map-card:not(.is-collapsed) .map-body { animation: none; }
  .map-toggle .icon { transition: none; }
}
