/* Map popup (<dialog>). Full screen on phones. */
.popup {
  width: min(940px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 0; overflow-y: auto;
  background: #15171c; color: var(--fg);
  border: 1px solid var(--line); border-radius: 14px;
}
.popup::backdrop { background: rgba(0, 0, 0, 0.72); }

.popup-close {
  position: sticky; top: 10px; float: right; z-index: 2; margin: 10px 10px 0 0;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: #1f2229; border: 1px solid var(--line); border-radius: 10px;
}

.popup-body { display: flex; flex-wrap: wrap; gap: 20px; padding: 20px; }
.popup-map { flex: 1 1 420px; min-width: 0; }
.popup-info { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.popup-head { display: flex; align-items: center; gap: 12px; padding-right: 44px; }
.popup-icon {
  flex: none; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
  background: var(--card); border-radius: var(--radius);
}
.popup-icon svg { width: 44px; height: 44px; }
.popup-title { margin: 0; font-size: 22px; line-height: 1.3; }
.popup-price { display: flex; align-items: center; gap: 8px; }
.popup-price strong { font-size: 26px; }

.info-grid {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px;
  padding: 14px; background: var(--card); border-radius: var(--radius);
  overflow-wrap: anywhere;
}

/* map */
.map-view {
  position: relative; width: 100%; border-radius: var(--radius); overflow: hidden;
  background-color: #3a3125; background-repeat: no-repeat;
  border: 1px solid #4a3f30;
}
.map-missing {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  aspect-ratio: 80 / 60; border-radius: var(--radius); background: #2b241b; color: var(--muted);
}
.marker { position: absolute; width: 0; height: 0; }
.marker-ring {
  position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(245, 179, 1, 0.25); border: 2px solid rgba(245, 179, 1, 0.6);
  animation: pulse 1.6s ease-out infinite;
}
.marker-dot {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); border: 3px solid var(--bg);
}
.marker-label {
  position: absolute; left: 14px; top: -36px; white-space: nowrap;
  padding: 4px 8px; border-radius: 6px; background: var(--bg); color: var(--gold); font-size: 12px; font-weight: 600;
}
@keyframes pulse { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .marker-ring { animation: none; } }

.map-inset {
  position: absolute; right: 8px; bottom: 8px; width: 88px; height: 88px;
  background-size: 100% 100%;
  border: 1px solid #5a4c38; border-radius: 6px;
}
.inset-box { position: absolute; border: 1.5px solid var(--gold); }
.inset-name { position: absolute; left: 6px; bottom: 4px; font-size: 10px; color: #e8dcc8; text-shadow: 0 1px 2px #000; }

@media (max-width: 600px) {
  .popup { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: 0; }
  .popup-body { padding: 12px; }
}
