:root {
  --bg: #101a2e;
  --panel: #1a2740;
  --text: #eef2fa;
  --muted: #9fb0cc;
  --accent: #4da3ff;
  --green: #3ddc84;
  --yellow: #ffd23f;
  --red: #ff5d5d;
  --bar-h: 52px;
  /* POI palette — placeholder until the brand epic; swap hexes here */
  --poi: #ffc94d;          /* marker core: warm gold vs. the purples */
  --poi-ring: #e8f4fb;     /* marker ring + photo frame: ice blue from the paths */
  --poi-ink: #2a1f4d;      /* label pill + accents: deep indigo from the trees */
  --poi-label-text: #fdf6e3;
}

* { box-sizing: border-box; }
/* Element display rules (e.g. #finding's flex) otherwise beat the UA [hidden] style. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 26, 46, 0.92);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

#title-block { display: flex; flex-direction: column; user-select: none; }
#app-title { font-size: 17px; margin: 0; letter-spacing: 0.02em; }
#site-name { font-size: 11px; color: var(--muted); }

#map {
  position: fixed;
  inset: 0;
  background: #0b1322;
  z-index: 1;
}

#banner {
  position: fixed;
  top: calc(var(--bar-h) + env(safe-area-inset-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 92vw;
  background: rgba(255, 93, 93, 0.95);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 1100;
  text-align: center;
}
#banner.info { background: rgba(77, 163, 255, 0.95); }

#recenter {
  position: fixed;
  right: 14px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid #2c3d61;
  background: var(--panel);
  color: var(--accent);
  font-size: 22px;
  z-index: 1000;
  cursor: pointer;
}

/* --- position dot --- */
.dot-wrap { position: relative; }
.dot-core {
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  background: var(--accent);
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}
.dot-pulse {
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  70% { transform: scale(3); opacity: 0; }
  100% { transform: scale(3); opacity: 0; }
}
.dot-marker { transition: transform 0.3s linear; }
.leaflet-zoom-anim .dot-marker { transition: none; }
.dot-marker.stale { opacity: 0.4; }
.dot-marker.stale .dot-pulse { animation: none; opacity: 0; }
.dot-arrow {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  margin: -26px 0 0 -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid var(--accent);
  transform-origin: 8px 26px;
  display: none;
}
.dot-marker.clamped .dot-arrow { display: block; }
.dot-marker.clamped .dot-pulse { display: none; }

/* --- POI markers --- */
.poi-pin {
  position: absolute;
  left: 50%; top: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--poi);
  border: 2.5px solid var(--poi-ring);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.poi-name {
  position: absolute;
  left: 50%; top: 10px;
  transform: translateX(-50%);
  background: var(--poi-ink);
  color: var(--poi-label-text);
  border: 1px solid var(--poi);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

/* --- overlays --- */
#start-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}
.card {
  max-width: 340px;
  text-align: center;
}
.card h2 { font-size: 26px; margin: 0 0 12px; }
.card p { color: var(--muted); font-size: 15px; line-height: 1.5; }
.card .hint { font-size: 13px; }
.primary {
  margin-top: 12px;
  background: var(--accent);
  color: #06121f;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 14px 48px;
  cursor: pointer;
}
.error { color: var(--red); }

#finding {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid #2c3d61;
  border-radius: 12px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  z-index: 1200;
}
.spinner {
  width: 16px; height: 16px;
  border: 2.5px solid #2c3d61;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- bottom panels --- */
#poi-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(26, 39, 64, 0.97);
  border-radius: 16px 16px 0 0;
  padding: 8px 18px calc(16px + env(safe-area-inset-bottom));
  z-index: 1500;
  max-height: 60vh;
  overflow-y: auto;
}
.panel-grip {
  width: 40px; height: 4px;
  background: #3a4d73;
  border-radius: 2px;
  margin: 2px auto 8px;
}
#poi-panel h3 { margin: 0 0 10px; font-size: 15px; }

.panel-close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 12px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.panel-close:active { color: var(--text); }

/* --- POI sheet --- */
#poi-panel { border-top: 2px solid var(--poi); }
#poi-gallery { max-width: min(100%, 45vh); margin: 0 auto; }
#poi-panel h3 { margin-top: 12px; padding-right: 32px; }
#poi-blurb {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
#poi-photos {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 3px solid var(--poi-ring);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  cursor: pointer;
}
#poi-photos img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}
#poi-photos img.active { opacity: 1; }
#poi-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 4px;
}
.poi-dot-btn {
  width: 8px; height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #3a4d73;
  cursor: pointer;
}
.poi-dot-btn.active { background: var(--poi); }

.leaflet-container { background: #0b1322; font: inherit; }
