:root {
  --ink: #12202b;
  --navy: #0b3954;
  --red: #b3261e;
  --amber: #f2a900;
  --green: #1b7a3a;
  --bg: #ffffff;
  --muted: #4a5a66;
  --focus: #0050d0;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  overflow: hidden;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 3000; background: #fff; padding: 8px 12px; }
.skip:focus { left: 8px; top: 8px; }

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

.top {
  position: fixed; z-index: 1000; top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
  background: var(--navy); color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.top h1 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.tagline { margin: 0; font-size: .9rem; }
.disclaimer { margin: 2px 0 0; font-size: .78rem; color: #ffe9a8; }

.legend {
  position: fixed; z-index: 900; left: 10px; bottom: calc(env(safe-area-inset-bottom) + 96px);
  background: rgba(255,255,255,.95); border-radius: 8px; padding: 6px 10px;
  font-size: .85rem; box-shadow: 0 1px 5px rgba(0,0,0,.35);
}
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend-note { margin: 2px 0 0; font-size: .75rem; color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #333; display: inline-block; }
.dot.flooded, .pin.flooded { background: var(--red); }
.dot.caution, .pin.caution { background: var(--amber); }
.dot.clear, .pin.clear { background: var(--green); }

.pin-wrap { background: none; border: 0; }
.pin {
  display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6);
}

.crosshair { position: fixed; z-index: 800; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #000; box-shadow: 0 0 0 2px #fff; }
.crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.crosshair::after { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }
.crosshair[hidden] { display: none; }

.report-btn {
  position: fixed; z-index: 1000; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px);
  min-height: 60px; font-size: 1.3rem; font-weight: 700;
  background: var(--red); color: #fff; border: 3px solid #fff; border-radius: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,.45); cursor: pointer;
}
@media (min-width: 700px) {
  .report-btn { left: 50%; right: auto; width: 360px; margin-left: -180px; }
}
.report-btn:active { filter: brightness(.9); }

.sheet {
  position: fixed; z-index: 1500; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 16px);
  box-shadow: 0 -4px 16px rgba(0,0,0,.4);
}
.sheet[hidden] { display: none; }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; width: 520px; margin-left: -260px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { margin: 0; font-size: 1.25rem; }
.icon-btn { min-width: 44px; min-height: 44px; font-size: 1.8rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink); }
fieldset { border: 0; padding: 0; margin: 10px 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.where-text { margin: 0 0 6px; font-size: .9rem; color: var(--muted); }

.status-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-opt { position: relative; display: block; cursor: pointer; }
.status-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.status-opt span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 72px; padding: 6px; border-radius: 12px; border: 3px solid transparent; color: #fff;
}
.status-opt small { font-size: .72rem; }
.status-opt.flooded span { background: var(--red); }
.status-opt.caution span { background: var(--amber); color: #1a1200; }
.status-opt.clear span { background: var(--green); }
.status-opt input:checked + span { border-color: #000; box-shadow: 0 0 0 3px #fff inset; outline: 3px solid #000; }
.status-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.status-opt input:not(:checked) + span { opacity: .8; }

.field { margin: 10px 0; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
textarea { width: 100%; font: inherit; padding: 8px; border: 2px solid #5b6b76; border-radius: 8px; resize: vertical; }
input[type=file] { width: 100%; font: inherit; }
.count { text-align: right; font-size: .75rem; color: var(--muted); }
.photo-preview { margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.photo-preview img { max-width: 120px; max-height: 90px; border-radius: 6px; }

button.primary, button.secondary { font: inherit; border-radius: 10px; cursor: pointer; min-height: 48px; padding: 8px 14px; }
button.primary { width: 100%; background: var(--navy); color: #fff; border: 0; font-size: 1.1rem; font-weight: 700; min-height: 56px; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.secondary { background: #fff; color: var(--navy); border: 2px solid var(--navy); font-weight: 600; }
.form-error { background: #fde7e5; color: #8a1a13; border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-weight: 600; }

.toast {
  position: fixed; z-index: 2000; left: 50%; transform: translateX(-50%); top: 110px; max-width: 90vw;
  background: #12202b; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.toast[hidden] { display: none; }
.toast.error { background: #8a1a13; }

.credit { display: none; }

/* popup */
.pp { min-width: 200px; max-width: 250px; font-size: .95rem; }
.pp .badge { display: inline-block; padding: 2px 10px; border-radius: 12px; color: #fff; font-weight: 700; }
.pp .badge.flooded { background: var(--red); }
.pp .badge.caution { background: var(--amber); color: #1a1200; }
.pp .badge.clear { background: var(--green); }
.pp p { margin: 6px 0; }
.pp .depth small { color: var(--muted); }
.pp .note { overflow-wrap: anywhere; }
.pp .when { color: var(--muted); font-size: .85rem; }
.pp img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 6px; display: block; }
.pp .votes { display: flex; gap: 6px; }
.pp .votes button { flex: 1; min-height: 44px; font: inherit; font-weight: 600; border-radius: 8px; border: 2px solid var(--navy); background: #fff; color: var(--navy); cursor: pointer; }
.pp .votes button:disabled { opacity: .6; cursor: default; }
.pp .vote-msg { font-size: .8rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
