html, body { margin: 0; padding: 0; height: 100%; font-family: system-ui, sans-serif; }
#map { height: 100dvh; width: 100%; }
.legend {
  background: rgba(255,255,255,0.95);
  padding: 10px 12px;
  border-radius: 6px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  font-size: 13px;
  line-height: 1.6;
}
.legend .swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid #333;
}
.label-tooltip {
  background: rgba(255,255,255,0.85);
  border: 1px solid #555;
  border-radius: 3px;
  padding: 1px 5px;
  font-weight: 600;
  font-size: 11px;
  box-shadow: none;
}
.label-tooltip:before { display: none; }
.hover-tooltip {
  background: rgba(0,0,0,0.85);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  white-space: pre;          /* respect \n only, no auto-wrap */
  max-width: none;
}
/* Hide Leaflet's default tooltip arrow border (the thin line under the tip) */
.hover-tooltip:before,
.leaflet-tooltip-top.hover-tooltip:before {
  border: none !important;
}
.leaflet-interactive:focus { outline: none; }
.user-location-dot {
  width: 12px;
  height: 12px;
  background: #1a73e8;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(26,115,232,0.5);
}
/* Heavy rain warning banner */
#rain-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;        /* above Leaflet controls (which use 1000) */
  background: #b03020;
  color: #fff;
  padding: 10px 44px 10px 14px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  display: none;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
#rain-banner.visible { display: block; }
/* When banner is showing, nudge Leaflet's top control corners down so they aren't hidden behind it */
body.banner-visible .leaflet-top { margin-top: 56px; }
#rain-banner-text { display: block; }
#rain-banner .close-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  border-radius: 4px;
}
#rain-banner .close-btn:hover { background: rgba(0,0,0,0.2); }
/* Rain layer toggle in the legend */
.legend .toggle-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #ccc;
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend .toggle-row label { cursor: pointer; user-select: none; }
.legend .toggle-row .rain-time {
  font-size: 11px;
  color: #555;
  margin-left: auto;
}
/* Toggle switch — visually replaces the native checkbox */
.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch .slider {
  position: absolute;
  inset: 0;
  background: #bbb;
  border-radius: 18px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.switch .slider:before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.switch input:checked + .slider { background: #1a73e8; }
.switch input:checked + .slider:before { transform: translateX(14px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 2px rgba(26,115,232,0.4); }
/* Basemap switcher (bottom-left) */
.basemap-switch {
  width: 70px;
  height: 70px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.2);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.basemap-switch:hover { border-color: rgba(0,0,0,0.4); }
.basemap-switch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.basemap-switch .label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 0;
  pointer-events: none;
}
/* Info button (top-right of map) */
.info-btn {
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: bold;
  font-size: 18px;
  color: #1a73e8;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.info-btn:hover { background: #f5f5f5; }
/* Credits modal */
#credits-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#credits-backdrop.visible { display: flex; }
#credits-modal {
  background: #fff;
  border-radius: 8px;
  max-width: 420px;
  width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 14px;
  line-height: 1.55;
  position: relative;
}
#credits-modal h2 { margin: 0 0 12px; font-size: 17px; }
#credits-modal .row { margin-bottom: 14px; }
#credits-modal .row:last-child { margin-bottom: 0; }
#credits-modal .label { font-weight: 600; }
#credits-modal a { color: #1a73e8; text-decoration: none; }
#credits-modal a:hover { text-decoration: underline; }
#credits-modal .app-badges { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
#credits-modal .app-badge {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  background: #fafafa;
}
#credits-modal .app-badge:hover { background: #f0f0f0; text-decoration: none; }
#credits-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: #555;
  cursor: pointer;
  border-radius: 4px;
}
#credits-close:hover { background: #eee; }
/* Server error modal — uses the same backdrop / modal frame as credits, with a red accent */
#error-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#error-backdrop.visible { display: flex; }
#error-modal {
  background: #fff;
  border-top: 6px solid #b03020;
  border-radius: 8px;
  max-width: 420px;
  width: 100%;
  padding: 18px 22px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 14px;
  line-height: 1.55;
  position: relative;
}
#error-modal h2 {
  margin: 0 0 10px;
  font-size: 17px;
  color: #b03020;
}
#error-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: #555;
  cursor: pointer;
  border-radius: 4px;
}
#error-close:hover { background: #eee; }
