* { box-sizing: border-box; }
html, body, #app, #map { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { font-family: system-ui, -apple-system, Segoe UI, sans-serif; background: #dde6ef; }
#map { position: relative; cursor: grab; touch-action: none; user-select: none; }
#map.dragging { cursor: grabbing; }
.tile {
  position: absolute;
  width: 256px;
  height: 256px;
  image-rendering: auto;
  background: #cbd5df;
}
.marker {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 3px solid white;
  border-radius: 50%;
  background: #0b63ff;
  box-shadow: 0 2px 12px rgb(0 0 0 / 45%);
  z-index: 2;
  pointer-events: none;
}
.record-marker,
.cluster-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 3px solid white;
  border-radius: 999px;
  box-shadow: 0 3px 12px rgb(0 0 0 / 45%);
  z-index: 4;
}
.record-marker {
  width: 22px;
  height: 22px;
  background: #e11d48;
}
.cluster-marker {
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  border: 3px solid white;
  cursor: zoom-in;
  display: grid;
  place-items: center;
  appearance: none;
  background: #f97316;
  color: white;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
}
.record-marker { cursor: pointer; }
.record-marker:hover { filter: brightness(1.06); }
#hud {
  position: fixed;
  left: 14px;
  bottom: 14px;
  display: grid;
  gap: 3px;
  max-width: min(420px, calc(100vw - 28px));
  padding: 10px 12px;
  border-radius: 12px;
  background: rgb(255 255 255 / 86%);
  color: #172033;
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
  backdrop-filter: blur(8px);
  font-size: 13px;
  z-index: 5;
}
#hud strong { font-size: 14px; }
#popup {
  position: fixed;
  left: 18px;
  top: 18px;
  width: min(420px, calc(100vw - 36px));
  height: min(320px, calc(100vh - 36px));
  min-width: 220px;
  min-height: 180px;
  display: none;
  grid-template-rows: auto 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 12px 34px rgb(0 0 0 / 30%);
  backdrop-filter: blur(8px);
  z-index: 10;
  resize: both;
  overflow: auto;
}
#popup.open { display: grid; }
#popup-title {
  padding-right: 34px;
  font-weight: 700;
  color: #172033;
}
#popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #172033;
  color: white;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
#popup-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #f1f5f9;
  border-radius: 10px;
}
