*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #222;
  overflow: hidden;
}

/* ── Top bar ──────────────────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: rgba(26, 127, 193, 0.97);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#topbar-left { display: flex; flex-direction: column; gap: 1px; }
#app-title { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 0.3px; }
#app-tagline { color: rgba(255,255,255,0.7); font-size: 10px; }
#topbar-right { display: flex; align-items: center; gap: 10px; }

/* ── Map ──────────────────────────────────────────────────────────────── */
#map {
  position: fixed;
  top: 52px; left: 0; right: 0; bottom: 40px;
}

/* ── Legend ───────────────────────────────────────────────────────────── */
#legend {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255,255,255,0.93);
  border-radius: 8px;
  padding: 7px 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 12px;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

/* ── Spot panel (WhimTrav mapInfoPanel pattern) ───────────────────────── */
#spotPanel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 100;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  width: 300px;
  display: none;
  max-height: calc(100vh - 140px);
  overflow: hidden;
  flex-direction: column;
}
#spotPanel.visible {
  display: flex;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #eee;
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}
.panel-title {
  font-weight: 700;
  font-size: 15px;
  color: #111;
  flex: 1;
  padding-right: 8px;
  line-height: 1.3;
}
.panel-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #999;
  padding: 0;
  line-height: 1;
}
.panel-close:hover { color: #e53935; }

.panel-content {
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
}

.panel-actions {
  padding: 10px 14px 14px;
  flex-shrink: 0;
  border-top: 1px solid #eee;
}

/* Panel sub-elements */
.panel-sub {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
  margin-bottom: 10px;
}
.water-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
  margin-bottom: 12px;
}
.conditions-block {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.conditions-score-wrap { text-align: center; flex-shrink: 0; }
.conditions-score {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.conditions-lbl {
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}
.conditions-detail {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
}
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.species-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.species-chip {
  background: #e8f4fd;
  color: #1565C0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
}
.btn-directions {
  width: 100%;
  background: #1a7fc1;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn-directions:hover { background: #1565C0; }

/* Mobile: panel becomes bottom sheet */
@media (max-width: 600px) {
  #spotPanel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 55vh;
  }
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: rgba(255,255,255,0.35); }
.btn-ghost {
  background: none;
  color: rgba(255,255,255,0.85);
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-ghost:hover { color: #fff; }

#user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
}

/* ── Download banner ──────────────────────────────────────────────────── */
#download-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: rgba(20, 20, 40, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 200;
  padding: 0 16px;
}
#download-banner span {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  white-space: nowrap;
}
.store-badge img { display: block; }

/* ── Utility ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* MapLibre nav controls — keep above panel on mobile */
.maplibregl-ctrl-bottom-right {
  bottom: 8px !important;
  right: 8px !important;
}
@media (max-width: 600px) {
  .maplibregl-ctrl-bottom-right {
    bottom: 8px !important;
    right: 8px !important;
  }
}
