#panel-map { width: 760px; max-width: calc(100vw - 16px); }
#panel-map.resizing { user-select: none; }
#panel-map.resizing .map-canvas { pointer-events: none; }
.map-body { gap: 6px; font-family: var(--mono, monospace); }
.map-status { font-family: var(--mono, monospace); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.04em; }
.map-status.bad { color: var(--bad); }

.map-ctl { display: flex; align-items: center; gap: 6px; }
.map-ctl button { min-width: 64px; }
.map-ctl input { flex: 1; min-width: 0; text-transform: uppercase; }

.map-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.map-legend:empty { display: none; }
.map-src {
  min-height: 0;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.map-src[aria-pressed="false"] { opacity: 0.45; background: none; }

.map-canvas {
  position: relative;
  height: 520px;
  min-height: 200px;
  overflow: hidden;
  border-radius: 4px;
  background: #0d1217;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font-family: var(--sans, sans-serif);
}
.map-canvas.dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.7); }
.map-canvas .leaflet-container { background: #0d1217; }
.map-canvas .leaflet-control-attribution { background: rgba(13, 18, 23, 0.75); color: #8a96a2; font-size: 0.6rem; }
.map-canvas .leaflet-control-attribution a { color: #5b9bd5; }
.map-canvas .leaflet-bar a { background: #1b242d; color: var(--text); border-color: #2c3843; }
.map-canvas .leaflet-bar a:hover { background: #26313c; }
.map-canvas .leaflet-popup-content-wrapper, .map-canvas .leaflet-popup-tip { background: #161d24; color: var(--text); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6); }
.map-canvas .leaflet-popup-content { margin: 10px 12px; font-size: 0.74rem; line-height: 1.45; }
.map-canvas .leaflet-container a.leaflet-popup-close-button { color: #8a96a2; }

.map-obj, .map-qth { background: none; border: 0; }
.map-dot {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--c);
  border-radius: 50%;
  background: rgba(13, 18, 23, 0.85);
  box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent);
}
.map-glyph { font-size: 11px; line-height: 1; }
.map-arrow {
  position: absolute;
  inset: -9px;
  pointer-events: none;
}
.map-arrow::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-bottom: 6px solid var(--c);
  border-top: 0;
}
.map-obj.fresh .map-dot { animation: map-pulse 1.6s ease-out 2; }
.map-obj.old { opacity: 0.55; }
.map-obj.follow .map-dot { outline: 2px dashed #f0c040; outline-offset: 2px; }
@keyframes map-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 80%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

.map-label {
  position: absolute;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(13, 18, 23, 0.8);
  color: #f0c040;
  font-family: var(--mono, monospace);
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.map-label.qth { color: #fff; left: 20px; }

.map-qth-dot {
  position: absolute;
  inset: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #e8453c;
  box-shadow: 0 0 0 3px rgba(232, 69, 60, 0.35), 0 0 10px rgba(232, 69, 60, 0.7);
}
.map-ring { stroke: #f2a93b; stroke-width: 1; stroke-dasharray: 4 5; stroke-opacity: 0.7; }
.map-ring-label { color: #f2a93b; font-family: var(--mono, monospace); font-size: 0.6rem; text-align: center; text-shadow: 0 0 3px #000; background: none; border: 0; }

.map-pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.map-pop-head b { color: #f0c040; font-family: var(--mono, monospace); font-size: 0.82rem; }
.map-pop-src { padding: 0 6px; border-radius: 8px; background: color-mix(in srgb, var(--c) 25%, transparent); color: var(--c); font-size: 0.6rem; letter-spacing: 0.06em; }
.map-pop-cmt { color: #cfd8e0; }
.map-pop-dim { color: #8a96a2; }
.map-follow { margin-top: 6px; min-height: 0; padding: 2px 10px; font-size: 0.7rem; }

.map-list {
  max-height: 160px;
  overflow-y: auto;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.map-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 64px 64px;
  gap: 6px;
  align-items: baseline;
  width: 100%;
  min-height: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #8a96a2;
  font: inherit;
  font-size: 0.74rem;
  text-align: left;
  cursor: pointer;
}
.map-row:hover, .map-row:focus-visible { background: rgba(29, 95, 174, 0.18); outline: none; }
.map-row.follow { background: rgba(29, 95, 174, 0.32); }
.map-row-g { text-align: center; }
.map-row-name { overflow: hidden; color: #f0c040; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.map-row.fresh .map-row-name { color: #ffd966; text-shadow: 0 0 6px rgba(240, 192, 64, 0.5); }
.map-row-dist, .map-row-age { text-align: right; font-variant-numeric: tabular-nums; }
.map-empty { padding: 12px 8px; color: #5b656e; font-size: 0.72rem; text-align: center; }
.map-foot { color: #4a545e; font-size: 0.62rem; text-align: right; }

.map-grip {
  position: sticky;
  bottom: 0;
  float: right;
  width: 18px;
  height: 18px;
  margin: -18px 0 0;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 2;
  background:
    linear-gradient(135deg, transparent 50%, rgba(242, 169, 59, 0.75) 50%, rgba(242, 169, 59, 0.75) 58%, transparent 58%, transparent 70%, rgba(242, 169, 59, 0.75) 70%, rgba(242, 169, 59, 0.75) 78%, transparent 78%);
  border-bottom-right-radius: 8px;
}
.map-grip:hover { filter: brightness(1.4); }

@media (max-width: 760px) {
  #panel-map { width: auto; }
  .map-grip { display: none; }
}
