@import url('tokens.css');

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--mesh-gradient);
  background-attachment: fixed;
  color: var(--mist-100);
  font-family: var(--font-body);
  overscroll-behavior: none;
}

/* Consistent keyboard-focus indicator across every interactive
   element — matters for anyone navigating by keyboard, and there
   was previously no :focus-visible styling at all anywhere in the app. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--river-400);
  outline-offset: 2px;
}

@keyframes radar-sweep {
  0% { box-shadow: 0 0 0 0 rgba(var(--risk-extreme-rgb), 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(var(--risk-extreme-rgb), 0); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Homepage scroll region ---------- */
.home-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: calc(88px + var(--safe-bottom));
}

.home-section {
  padding: var(--sp-6) var(--sp-4);
  margin: 0 auto;
}
@media (min-width: 640px) {
  .home-section {
    width: 85%;
    max-width: 1400px;
  }
  .home-intro {
    width: 100%;
    max-width: none;
  }
}
.home-section-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--river-300);
  margin: 0 0 var(--sp-2);
}
.news-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 640px) {
  .news-card-grid { grid-template-columns: repeat(3, 1fr); }
}
.news-card {
  background: var(--ink-900);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  text-align: left;
}
.news-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.news-card-body { padding: var(--sp-4); }
.news-card-date { font-size: var(--fs-xs); color: var(--slate-500); font-family: var(--font-mono); }
.news-card h3 { font-family: var(--font-display); font-size: var(--fs-base); margin: var(--sp-1) 0 var(--sp-2); }
.news-card p { font-size: var(--fs-sm); color: var(--mist-300); margin: 0; line-height: 1.5; }
.home-donate { text-align: center; }
.home-donate .muted { max-width: 480px; margin: 0 auto var(--sp-4); }
.home-donate .btn-primary { margin: 0 auto; }

.home-footer {
  background: linear-gradient(155deg, #0a1418 0%, #0f2a31 60%, #0d3a3f 100%);
  padding: var(--sp-8) var(--sp-4) calc(var(--sp-6) + var(--safe-bottom));
  text-align: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.home-footer-inner { max-width: 560px; margin: 0 auto; }
.home-footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: white;
  margin-bottom: var(--sp-2);
}
.home-footer-brand img { filter: brightness(0) invert(1); }
.home-footer-tagline { color: rgba(255,255,255,0.6); font-size: var(--fs-sm); margin: 0 0 var(--sp-5); }

.home-footer-emergency {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
}
.home-footer-emergency-label { width: 100%; font-size: var(--fs-xs); color: rgba(255,255,255,0.5); }
.home-footer-emergency a {
  display: flex;
  flex-direction: column;
  color: white;
  font-weight: 700;
  font-size: var(--fs-base);
  text-decoration: none;
}
.home-footer-emergency a small { color: rgba(255,255,255,0.55); font-size: var(--fs-xs); font-weight: 400; }
.home-footer-emergency a:hover { color: var(--river-300); }
.home-footer-emergency button {
  background: none;
  border: none;
  color: var(--river-300);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.home-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.home-footer-links a, .home-footer-links button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: var(--fs-sm);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.home-footer-links a:hover, .home-footer-links button:hover { color: white; text-decoration: underline; }
.home-footer-copy { font-size: var(--fs-xs); color: rgba(255,255,255,0.45); margin: 0 0 4px; }
.home-footer-credit { font-size: var(--fs-xs); color: rgba(255,255,255,0.35); margin: 0; }
.home-section h2 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  margin: 0 0 var(--sp-4);
}

.home-intro {
  position: relative;
  max-width: none;
  padding-top: calc(96px + env(safe-area-inset-top));
  padding-bottom: var(--sp-6);
  padding-left: var(--sp-4);
  padding-right: var(--sp-4);
  text-align: center;
  overflow: hidden;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
@media (min-width: 640px) {
  .home-intro {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: calc(64px + env(safe-area-inset-top));
    padding-bottom: var(--sp-6);
  }
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
}

/* Hero background — two real illustrated scenes (village rooftop rescue,
   flooded city street), each with its own mobile/desktop image picked
   automatically via <picture>, crossfading into each other every few
   seconds. Sits behind the text (z-index), with a soft scrim on top so
   the heading stays readable regardless of which scene is showing. */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 3s ease;
}
.hero-bg-slide.active { opacity: 1; }
.hero-bg-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (prefers-reduced-motion: reduce) {
  .hero-bg-slide { transition: none; }
}

.home-intro > *:not(.hero-bg) {
  position: relative;
  z-index: 1;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  background: var(--glass-3);
  backdrop-filter: blur(10px);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-float);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--mist-100);
}
.hero-pill-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--river-400);
  flex-shrink: 0;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-3);
  color: var(--river-500);
}
.hero-subtitle {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--river-400);
  margin: 0 0 var(--sp-3);
}
.home-intro-sub {
  color: var(--mist-300);
  font-size: var(--fs-sm);
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto var(--sp-5);
}
.home-stat-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-5);
  margin: 0 auto var(--sp-4);
  padding: 0;
}
.home-stat {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5) 0 0;
  border-right: 1px solid var(--hairline-strong);
}
.home-stat:last-child { border-right: none; padding-right: 0; }
.home-stat-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.home-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--river-400);
  flex-shrink: 0;
}
.home-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.1;
  color: var(--mist-100);
}
.home-stat span {
  font-size: var(--fs-xs);
  color: var(--mist-300);
  white-space: nowrap;
}
@media (max-width: 480px) {
  .home-stat-row { gap: var(--sp-3); }
  .home-stat { padding-right: var(--sp-3); }
  .home-stat span { white-space: normal; }
}

/* ── Dual "I need help" / "I'm helping" CTA cards ─────────────────────── */
.home-dual-cta { padding-top: 0; }
.dual-cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  max-width: 640px;
  margin: 0 auto;
}
.dual-cta-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--hairline-strong);
  background: var(--surface-raised);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.dual-cta-card:hover, .dual-cta-card:focus-visible { transform: translateY(-2px); }
.dual-cta-icon {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  flex-shrink: 0;
}
.dual-cta-need { border-color: rgba(var(--risk-extreme-rgb), 0.3); }
.dual-cta-need .dual-cta-icon { background: rgba(var(--risk-extreme-rgb), 0.1); color: var(--risk-extreme); }
.dual-cta-need:hover { border-color: var(--risk-extreme); }
.dual-cta-give { border-color: rgba(var(--risk-low-rgb), 0.3); }
.dual-cta-give .dual-cta-icon { background: rgba(var(--risk-low-rgb), 0.1); color: var(--risk-low); }
.dual-cta-give:hover { border-color: var(--risk-low); }
.dual-cta-label {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--mist-100);
}
.dual-cta-count { font-size: var(--fs-xs); color: var(--mist-300); }
.dual-cta-count strong { color: var(--mist-100); font-size: var(--fs-md); }
@media (max-width: 480px) {
  .dual-cta-grid { gap: var(--sp-2); }
  .dual-cta-card { padding: var(--sp-4) var(--sp-2); }
  .dual-cta-icon { width: 44px; height: 44px; }
}

.home-intro-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-width: 320px;
  margin: 0 auto;
}
.hero-btn-primary, .hero-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.btn-secondary.hero-btn-secondary {
  background: var(--ink-900);
  border-color: var(--hairline-strong);
}
[data-theme="dark"] .btn-secondary.hero-btn-secondary { background: rgba(255,255,255,0.92); color: var(--ink-950); }
@media (min-width: 480px) {
  .hero-actions { flex-direction: row; max-width: none; justify-content: center; }
  .hero-actions .btn-primary, .hero-actions .btn-secondary { width: auto; padding-left: var(--sp-6); padding-right: var(--sp-6); }
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: var(--sp-4);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--mist-100);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-base);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s var(--ease-settle), border-color 0.18s var(--ease-settle);
  box-sizing: border-box;
}
.btn-secondary:hover { background: var(--surface-tint-2); border-color: var(--hairline-strong); }

.home-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
.home-step {
  position: relative;
  background: var(--gradient-card), var(--glass-1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease-settle), border-color 0.2s var(--ease-settle), box-shadow 0.2s var(--ease-settle);
}
.home-step:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--river-300-rgb), 0.35);
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(var(--river-400-rgb), 0.12);
}
.home-step-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(var(--river-400-rgb), 0.16);
  color: var(--river-300);
  margin-bottom: var(--sp-2);
}
.home-step h3 {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  margin: 0 0 4px;
}
.home-step p {
  font-size: var(--fs-xs);
  color: var(--mist-300);
  line-height: 1.5;
  margin: 0;
}

/* True desktop: use the width instead of wasting it — 4 steps in one
   row, connecting line goes horizontal between icons instead of
   vertical between stacked cards. */
@media (min-width: 900px) {
  .home-steps { grid-template-columns: repeat(4, 1fr); }
}

.map-frame {
  position: relative;
  height: 480px;
  max-height: 60vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
}
@media (min-width: 900px) {
  /* The map benefits from the same 85% fluid width as everything else
     now — this used to need its own override to break out of a fixed
     720px text column, but that column no longer exists. */
  .home-map .map-frame { height: 620px; max-height: 70vh; }
}

.home-tracker .report-list {
  background: var(--glass-1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-4);
  box-shadow: var(--shadow-card);
}
@media (min-width: 900px) {
  .home-tracker .report-list {
    columns: 2;
    column-gap: var(--sp-5);
  }
  .home-tracker .report-list-row { break-inside: avoid; }
}

/* ---------- Map ---------- */
#map {
  position: absolute;
  inset: 0;
}
.map-load-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  text-align: center;
  padding: var(--sp-4);
  color: var(--mist-300);
  background: var(--glass-1);
}
.map-load-error svg { color: var(--risk-moderate); }
.map-load-error p { margin: 0; font-size: var(--fs-sm); }
.map-load-error button {
  margin-top: var(--sp-1);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--glass-2);
  color: var(--mist-100);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.map-load-error button:hover { background: var(--glass-3); }

.required-mark {
  color: var(--risk-high, #e05252);
  font-weight: 700;
}

.back-to-top {
  position: absolute;
  left: var(--sp-3);
  bottom: calc(88px + var(--safe-bottom));
  z-index: 400;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--glass-3);
  backdrop-filter: blur(10px);
  color: var(--mist-100);
  box-shadow: var(--shadow-float);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease-settle), transform 0.2s var(--ease-settle);
}
.back-to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:active { transform: scale(0.9); }
.back-to-top:hover { background: var(--glass-2); }

/* Global fatal-error banner — see app.js's window error/unhandledrejection
   listeners. Deliberately loud (solid, not glass) and pinned above
   everything else in the stacking context — this is the one UI element
   in the app that should never be subtle. */
.fatal-banner {
  position: fixed;
  top: calc(72px + env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 2000;
  display: flex;
  justify-content: center;
  padding: 0 var(--sp-4);
  pointer-events: none;
}
.fatal-banner-card {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  max-width: 480px;
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  background: linear-gradient(155deg, #d84c44, var(--risk-extreme) 70%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 28px rgba(var(--risk-extreme-rgb), 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
  color: white;
  animation: rise-in 0.3s var(--ease-settle);
}
.fatal-banner-icon { flex-shrink: 0; margin-top: 1px; opacity: 0.95; }
.fatal-banner-text { flex: 1; font-size: var(--fs-sm); line-height: 1.45; }
.fatal-banner-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.fatal-banner-actions #ffFatalRefresh {
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-weight: 600;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: background 0.15s var(--ease-settle);
  white-space: nowrap;
}
.fatal-banner-actions #ffFatalRefresh:hover { background: rgba(255, 255, 255, 0.28); }
.fatal-banner-actions #ffFatalDismiss {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  flex-shrink: 0;
}
.fatal-banner-actions #ffFatalDismiss:hover { background: rgba(255, 255, 255, 0.15); color: white; }
@media (min-width: 640px) {
  .fatal-banner-card { flex-wrap: nowrap; }
}



/* ---------- Top bar ---------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(var(--sp-3), env(safe-area-inset-top)) var(--sp-4) var(--sp-3);
  background: linear-gradient(to bottom, rgba(var(--page-bg-rgb), 0.85), rgba(var(--page-bg-rgb), 0.5) 60%, rgba(var(--page-bg-rgb), 0));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
}
.brand-icon {
  display: block;
  border-radius: 6px;
  flex-shrink: 0;
}
.brand-mark {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand-mark::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--risk-moderate);
  box-shadow: 0 0 8px var(--risk-moderate);
  vertical-align: middle;
}
.city-pill {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--river-300);
  background: rgba(var(--river-400-rgb), 0.15);
  border: 1px solid rgba(var(--river-400-rgb), 0.4);
  border-radius: 999px;
  padding: 2px 10px;
}
.city-select {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--river-300);
  background: rgba(var(--river-400-rgb), 0.15);
  border: 1px solid rgba(var(--river-400-rgb), 0.4);
  border-radius: 999px;
  padding: 2px 10px;
  appearance: none;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  backdrop-filter: blur(10px);
  color: var(--mist-100);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s var(--ease-settle), border-color 0.18s var(--ease-settle), transform 0.18s var(--ease-settle);
}
.icon-btn:hover {
  background: rgba(var(--river-400-rgb), 0.25);
  border-color: rgba(var(--river-400-rgb), 0.5);
}
.icon-btn:active { transform: scale(0.92); }
/* Desktop horizontal nav — Home/Live Map/Report Flood/etc, matches the
   reference layout. Hidden below 900px, same breakpoint the existing
   pill-nav already used, so there's one consistent "this is desktop now"
   threshold across the app rather than two competing ones. */
.topbar-nav {
  display: none;
  align-items: center;
  gap: var(--sp-5);
}
@media (min-width: 900px) {
  .topbar-nav {
    display: flex;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}
.topbar-nav-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--mist-300);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: color 0.15s var(--ease-settle);
}
.topbar-nav-link:hover { color: var(--mist-100); }
.topbar-nav-link.active {
  color: var(--mist-100);
  font-weight: 600;
}
.topbar-nav-link.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--river-400);
  border-radius: 2px;
}

.lang-badge {
  display: none;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--glass-2);
  border: 1px solid var(--hairline-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--mist-100);
}
@media (min-width: 640px) {
  .lang-badge { display: inline-flex; }
}

.btn-report-pill {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4);
  border-radius: 999px;
  border: none;
  background: var(--gradient-primary);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(var(--river-500-rgb), 0.35);
  transition: transform 0.15s var(--ease-settle), box-shadow 0.15s var(--ease-settle);
}
.btn-report-pill:hover { box-shadow: 0 6px 20px rgba(var(--river-500-rgb), 0.5); }
.btn-report-pill:active { transform: scale(0.96); }
@media (min-width: 640px) {
  .btn-report-pill { display: inline-flex; }
}

/* Hero scroll hint — mouse outline with a dot that bounces down inside
   it, matches the reference exactly. */
.hero-scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  color: var(--mist-300);
  font-size: var(--fs-xs);
  text-decoration: none;
  transition: color 0.15s var(--ease-settle);
}
.hero-scroll-hint:hover { color: var(--mist-100); }
.hero-scroll-dot { animation: scroll-hint-bounce 1.8s ease-in-out infinite; }
@keyframes scroll-hint-bounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(8px); opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-scroll-dot { animation: none; }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Mobile: collapse Search/Legend/Helplines into a hamburger menu so the
   header doesn't turn into a row of 5 cramped icons on a narrow phone —
   theme toggle stays visible (used often), hamburger sits right next
   to it at the corner. */
.topbar-hamburger { display: none; }
@media (max-width: 639px) {
  .topbar-extra { display: none; }
  .topbar-hamburger { display: grid; }
}

.mobile-menu-panel {
  display: none;
  position: absolute;
  top: calc(56px + env(safe-area-inset-top));
  right: var(--sp-4);
  z-index: 490;
  min-width: 220px;
  flex-direction: column;
  background: var(--glass-3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  padding: var(--sp-2);
  animation: rise-in 0.2s var(--ease-settle);
}
.mobile-menu-panel.open { display: flex; }
.mobile-menu-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--mist-100);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease-settle);
}
.mobile-menu-row:hover { background: rgba(var(--overlay-rgb), 0.05); }
.mobile-menu-row svg { flex-shrink: 0; color: var(--slate-500); }
.mobile-menu-social {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  margin-top: var(--sp-1);
  border-top: 1px solid var(--hairline);
}
.mobile-menu-social a {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(var(--overlay-rgb), 0.06);
  color: var(--mist-300);
  transition: background 0.15s var(--ease-settle), color 0.15s var(--ease-settle);
}
.mobile-menu-social a:hover { background: rgba(var(--river-400-rgb), 0.15); color: var(--river-300); }

/* ---------- Search ---------- */
.search-overlay {
  position: absolute;
  inset: 0;
  z-index: 800;
  background: rgba(var(--page-bg-rgb), 0.97);
  display: none;
  flex-direction: column;
  padding: max(var(--sp-4), env(safe-area-inset-top)) var(--sp-4);
}
.search-overlay.open { display: flex; }
.search-box {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.search-box input {
  flex: 1;
  background: var(--surface-tint-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--mist-100);
  padding: var(--sp-3);
  font-size: var(--fs-base);
}
.search-box button {
  background: none;
  border: none;
  color: var(--mist-300);
  font-size: var(--fs-lg);
  cursor: pointer;
}
.search-results {
  overflow-y: auto;
}
.search-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.15s var(--ease-settle), padding-left 0.15s var(--ease-settle);
}
.search-result-row:hover { background: rgba(var(--overlay-rgb),0.03); padding-left: 4px; }

/* ---------- Heatmap legend ---------- */
.legend-card {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  right: var(--sp-4);
  z-index: 480;
  background: var(--glass-3);
  backdrop-filter: blur(12px);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-xs);
  max-width: 180px;
  box-shadow: var(--shadow-float);
  animation: rise-in 0.22s var(--ease-settle);
}
.legend-card strong {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px 0;
}
.legend-swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

/* Confidence ring marker — the signature element */
.conf-marker {
  position: relative;
  width: 36px; height: 36px;
}
.conf-marker svg { transform: rotate(-90deg); }
.conf-marker .ring-bg { stroke: rgba(255,255,255,0.12); }
.conf-marker .ring-fill {
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s var(--ease-settle);
  filter: drop-shadow(0 0 3px currentColor);
}
.conf-marker .core {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
}
.cluster-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--risk-high, #e05252);
  color: white;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--ink-900, #0a1418);
}
/* Reserved for emergency-flagged reports — a radar-sweep pulse ring,
   not decoration for its own sake: this app's one genuinely novel
   metaphor (a live flood radar) earns exactly one animated moment,
   used only where it means something (an active emergency), never
   on ordinary reports where constant motion would just be noise. */
.conf-marker.is-emergency .core {
  animation: radar-sweep 1.8s ease-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .conf-marker.is-emergency .core { animation: none; }
}

/* ---------- Map live-count legend ---------- */
.map-legend {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline-strong);
  background: var(--glass-3);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-float);
  font-size: var(--fs-xs);
  color: var(--mist-200);
}
.map-legend-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-legend-row strong { color: var(--mist-100); }
.map-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.map-legend-dot-need { background: var(--risk-extreme); }
.map-legend-dot-help { background: var(--risk-low); }

/* ---------- Floating report button ---------- */
.locate-btn {
  position: absolute;
  right: var(--sp-3);
  bottom: calc(88px + var(--sp-3));
  z-index: 20;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--glass-3);
  backdrop-filter: blur(10px);
  color: var(--mist-100);
  box-shadow: var(--shadow-float);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-settle), color 0.2s var(--ease-settle);
}
.locate-btn:active { transform: scale(0.92); }
.locate-btn.active { color: var(--river-300); border-color: var(--river-400); }

.fab-report {
  position: absolute;
  right: var(--sp-3);
  bottom: var(--sp-3);
  z-index: 20;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(155deg, var(--risk-high), var(--risk-extreme));
  box-shadow: 0 6px 24px rgba(var(--risk-extreme-rgb), 0.45);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-settle), box-shadow 0.2s var(--ease-settle);
}
.fab-report:active { transform: scale(0.92); }
.fab-report:hover { box-shadow: 0 8px 28px rgba(var(--risk-extreme-rgb), 0.6); transform: translateY(-1px); }

.queue-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink-950);
  border: 2px solid var(--river-400);
  color: var(--river-300);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 500;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: var(--glass-3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--hairline-strong);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
}
@media (min-width: 640px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - var(--sp-6)));
    bottom: var(--sp-4);
    border-radius: 999px;
    border: 1px solid var(--hairline-strong);
    border-top: 1px solid var(--hairline-strong);
    box-shadow: var(--shadow-float);
    overflow: hidden;
  }
}

/* True desktop: a bottom tab bar (even a tidied-up floating one) is a
   mobile-app pattern that doesn't belong on a wide screen with a mouse
   and a header already in view. Fold navigation into the header itself
   as inline pill-links instead — the standard desktop web convention —
   rather than pretending a phone's bottom nav scales up. */
@media (min-width: 900px) {
  .bottom-nav { display: none; }
}
.nav-item {
  position: relative;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--slate-500);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  padding: var(--sp-2) 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.18s var(--ease-settle), transform 0.12s var(--ease-settle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:active { transform: scale(0.93); }
.nav-item::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 28px; height: 2px;
  background: var(--river-400);
  border-radius: 0 0 3px 3px;
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.22s var(--ease-settle);
}
.nav-item.active::before { transform: translateX(-50%) scaleX(1); }
.nav-item.active { color: var(--river-300); }
.nav-item:hover { color: var(--mist-300); }
.nav-item.active:hover { color: var(--river-300); }

/* ---------- Report wizard ---------- */
.sheet-wizard { max-width: 640px; padding-left: var(--sp-3); padding-right: var(--sp-3); }
.sheet.sheet-wizard { background: var(--ink-900); }
@media (min-width: 640px) { .sheet-wizard { width: min(640px, calc(100vw - var(--sp-6))) !important; } }

.report-form-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  margin: 0 0 var(--sp-4);
}

.form-section {
  background: var(--ink-900);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}
[data-theme="dark"] .form-section { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); }
.form-section-primary {
  border-color: rgba(var(--river-400-rgb), 0.35);
  box-shadow: 0 4px 16px rgba(var(--river-400-rgb), 0.12);
}
.form-section h3 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: var(--fs-base);
  margin: 0 0 var(--sp-2);
}
.form-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(var(--river-400-rgb), 0.14);
  color: var(--river-400);
  font-size: var(--fs-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.form-section-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
@media (max-width: 420px) {
  .form-section-row { grid-template-columns: 1fr; }
}

.category-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--hairline-strong);
  background: var(--ink-900);
}
.category-summary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
}
.category-summary-label { flex: 1; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-base); }
.change-category-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--river-400);
  background: var(--ink-900);
  color: var(--river-500);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
}
.change-category-btn:hover { background: rgba(var(--river-400-rgb), 0.08); }

.form-section-hint {
  font-size: var(--fs-xs);
  color: var(--slate-500);
  margin: 0 0 var(--sp-2);
}
.location-map-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}
.manual-pin-map {
  display: none;
  height: 220px;
}
.manual-pin-map.open { display: block; }
.location-adjust-btn {
  position: absolute;
  right: var(--sp-2);
  bottom: var(--sp-2);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  background: var(--ink-900);
  color: var(--river-500);
  font-size: var(--fs-xs);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
  cursor: pointer;
}
.location-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.location-info-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.location-info-text .gps-readout { font-size: var(--fs-sm); font-weight: 600; }
.location-area-name { font-size: var(--fs-xs); color: var(--slate-500); }
.location-info-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }
.location-info-actions .icon-btn { width: 34px; height: 34px; }
.location-info-actions .icon-btn.selected { background: rgba(var(--river-400-rgb), 0.14); color: var(--river-500); border-color: var(--river-400); }

.pill-btn.severity-low { background: rgba(var(--risk-low-rgb), 0.08); color: var(--risk-low); border: 1px solid rgba(var(--risk-low-rgb), 0.3); }
.pill-btn.severity-moderate { background: rgba(var(--risk-moderate-rgb), 0.08); color: var(--risk-moderate); border: 1px solid rgba(var(--risk-moderate-rgb), 0.3); }
.pill-btn.severity-high { background: rgba(var(--risk-high-rgb), 0.08); color: var(--risk-high); border: 1px solid rgba(var(--risk-high-rgb), 0.3); }
.pill-btn.severity-critical { background: rgba(var(--risk-extreme-rgb), 0.08); color: var(--risk-extreme); border: 1px solid rgba(var(--risk-extreme-rgb), 0.3); }
.pill-btn.severity-low.selected { background: rgba(var(--risk-low-rgb), 0.16); color: var(--risk-low); border: 2px solid var(--risk-low); }
.pill-btn.severity-moderate.selected { background: rgba(var(--risk-moderate-rgb), 0.16); color: var(--risk-moderate); border: 2px solid var(--risk-moderate); }
.pill-btn.severity-high.selected { background: rgba(var(--risk-high-rgb), 0.16); color: var(--risk-high); border: 2px solid var(--risk-high); }
.pill-btn.severity-critical.selected { background: rgba(var(--risk-extreme-rgb), 0.16); color: var(--risk-extreme); border: 2px solid var(--risk-extreme); }

.btn-primary.report-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  height: 56px;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(var(--river-500-rgb), 0.25);
}
.report-submit-btn svg { flex-shrink: 0; }
@media (max-width: 639px) {
  .report-submit-btn {
    position: sticky;
    bottom: var(--sp-2);
    z-index: 5;
  }
}

.wizard-stepper {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1);
  margin: 0 0 var(--sp-5);
  overflow-x: auto;
  padding-bottom: 2px;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s var(--ease-settle), transform 0.12s var(--ease-settle);
}
.wizard-step:hover { opacity: 0.75; }
.wizard-step:active { transform: scale(0.96); }
.wizard-step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  color: var(--slate-500);
  font-size: var(--fs-xs);
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.2s var(--ease-settle), border-color 0.2s var(--ease-settle), color 0.2s var(--ease-settle);
}
.wizard-step-text { display: flex; flex-direction: column; text-align: left; white-space: nowrap; }
.wizard-step-text strong { font-size: var(--fs-xs); color: var(--slate-500); font-weight: 600; }
.wizard-step-text small { font-size: var(--fs-2xs); color: var(--slate-500); opacity: 0.7; }
.wizard-step-line { width: 20px; height: 2px; background: var(--hairline-strong); margin-top: 13px; flex-shrink: 0; }

.wizard-step.done .wizard-step-dot { background: var(--river-500); border-color: var(--river-500); color: white; }
.wizard-step.done .wizard-step-text strong { color: var(--mist-100); }
.wizard-step.active .wizard-step-dot {
  border-color: transparent;
  color: white;
  background: var(--gradient-primary);
  box-shadow: 0 2px 10px rgba(var(--river-500-rgb), 0.45);
}
.wizard-step.active .wizard-step-text strong { color: var(--mist-100); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; animation: rise-in 0.25s var(--ease-settle); }
.wizard-panel h2 { font-family: var(--font-display); font-size: var(--fs-lg); margin: 0 0 4px; }
.wizard-panel > .muted { font-size: var(--fs-sm); margin: 0 0 var(--sp-4); }

.wizard-tip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--river-300);
  background: rgba(var(--river-400-rgb), 0.08);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin: var(--sp-2) 0 0;
}
.wizard-tip svg { flex-shrink: 0; }

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.wizard-actions .btn-primary, .wizard-actions .btn-secondary { width: auto; padding-left: var(--sp-5); padding-right: var(--sp-5); }
.wizard-actions .btn-primary:disabled { opacity: 0.4; }

.btn-secondary.wizard-back {
  background: none;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  color: var(--mist-100);
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
}

.wizard-location-actions { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.location-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--ink-900);
  color: var(--mist-300);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease-settle), border-color 0.15s var(--ease-settle), color 0.15s var(--ease-settle), transform 0.12s var(--ease-settle);
}
.location-btn.selected { border-color: var(--river-400); color: var(--river-300); background: rgba(var(--river-400-rgb), 0.1); }
.location-btn:hover { border-color: var(--hairline-strong); }
.location-btn:active { transform: scale(0.96); }

.pill-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
#severityPills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  background: var(--form-surface-light);
  border-radius: 14px;
}
#severityPills .pill-btn {
  padding: 8px 2px;
  font-size: 11px;
  border-radius: 9px;
  text-align: center;
}
.pill-btn {
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--ink-900);
  color: var(--mist-300);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease-settle), border-color 0.15s var(--ease-settle), color 0.15s var(--ease-settle), transform 0.12s var(--ease-settle);
}
.pill-btn:hover { border-color: var(--hairline-strong); }
.pill-btn:active { transform: scale(0.95); }
.pill-btn.selected { background: var(--river-500); border-color: var(--river-500); color: white; }
.pill-btn-danger.selected { background: var(--risk-extreme); border-color: var(--risk-extreme); }

.wizard-next-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--mist-300);
  background: rgba(var(--river-400-rgb), 0.06);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin: var(--sp-3) 0 0;
}
.wizard-next-info svg { color: var(--river-300); vertical-align: -2px; margin-right: 4px; }

.review-summary {
  background: var(--glass-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-sm);
}
.review-row:last-child { border-bottom: none; }
.review-row-label { color: var(--slate-500); font-size: var(--fs-xs); flex-shrink: 0; }
.review-row-value { text-align: right; color: var(--mist-100); }
.review-edit-link {
  background: none;
  border: none;
  color: var(--river-300);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s var(--ease-settle);
}
.review-edit-link:hover { opacity: 0.7; text-decoration: underline; }
.review-edit-link:active { opacity: 0.5; }


.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 15, 0.6);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 950;
  background: linear-gradient(180deg, var(--surface-tint-2) 0%, var(--ink-900) 12%, var(--ink-900) 100%);
  border: 1px solid var(--hairline);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-6) + var(--safe-bottom));
  max-height: 86vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.34s var(--ease-settle);
}
.sheet.open { transform: translateY(0); }

/* Tablet/desktop: a mobile-style edge-to-edge bottom sheet looks broken
   on a wide viewport (a form stretched across 1440px, or shrunk to a
   sliver by max-width alone leaving it off-center) — cap it and float
   it centered like a real modal instead. Mobile phones stay exactly as
   designed; this only kicks in once there's room to spare. */
@media (min-width: 640px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: var(--sp-5);
    width: min(480px, calc(100vw - var(--sp-6)));
    max-height: min(86vh, 720px);
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--hairline);
    transform: translate(-50%, calc(100% + var(--sp-5)));
  }
  .sheet.open { transform: translate(-50%, 0); }
}
.sheet-handle {
  width: 40px; height: 4px;
  background: rgba(var(--overlay-rgb),0.15);
  border-radius: 2px;
  margin: 0 auto var(--sp-4);
}
.sheet h2 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-4);
}

.category-search-wrap { position: relative; margin-bottom: var(--sp-3); }
.category-search-wrap input { padding-right: 40px; }
.category-search-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-500);
  pointer-events: none;
  transition: transform 0.2s var(--ease-settle);
}
.category-search-wrap:focus-within .category-search-chevron { transform: translateY(-50%) rotate(180deg); color: var(--river-500); }
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: var(--sp-4);
}
.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--ink-900);
  color: var(--mist-300);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: transform 0.15s var(--ease-settle), border-color 0.15s var(--ease-settle),
              background 0.15s var(--ease-settle), color 0.15s var(--ease-settle);
}
.category-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-chip:active { transform: scale(0.95); }
.category-chip.selected {
  border-color: var(--river-400);
  background: rgba(var(--river-400-rgb), 0.18);
  color: var(--mist-100);
  transform: translateY(-1px);
}
.category-chip:hover:not(.selected) {
  border-color: var(--hairline-strong);
  background: var(--ink-800);
}

.toggle-row {
  display: flex;
  align-items: center;
}
.toggle-row-card { display: flex; flex-direction: column; }
.toggle-row-card h3 { margin-bottom: var(--sp-2); }
.toggle-label-stacked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--mist-300);
  cursor: pointer;
}
.toggle-label input[type=checkbox] {
  width: 20px; height: 20px;
  accent-color: var(--river-500);
}

.photo-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 96px;
  padding: var(--sp-3);
  background: var(--form-surface-light);
  border: 1.5px dashed rgba(var(--overlay-rgb),0.15);
  border-radius: var(--radius-sm);
  color: var(--slate-500);
  font-size: var(--fs-sm);
  text-align: center;
  cursor: pointer;
}
.photo-picker svg { flex-shrink: 0; width: 24px; height: 24px; }
.photo-picker.has-photo {
  border-style: solid;
  border-color: var(--river-400);
}
.photo-picker:hover:not(.has-photo) {
  border-color: rgba(var(--overlay-rgb),0.3);
  color: var(--mist-300);
}
.photo-thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--hairline);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.photo-thumb-add {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed rgba(var(--overlay-rgb),0.2);
  background: var(--form-surface-light);
  color: var(--slate-500);
  font-size: 10px;
  cursor: pointer;
}

.field-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
}
.field-group { margin-bottom: var(--sp-4); }

textarea, input[type=text], input[type=number], input[type=tel], input[type=email], input[type=date], select {
  width: 100%;
  background: var(--surface-tint-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--mist-100);
  padding: var(--sp-3);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  transition: border-color 0.15s var(--ease-settle), box-shadow 0.15s var(--ease-settle);
}
.sheet-wizard textarea, .sheet-wizard input[type=text], .sheet-wizard input[type=number], .sheet-wizard select {
  background-color: var(--form-surface-light);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b8288' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 18px;
  padding-right: calc(var(--sp-3) * 2 + 18px);
}
textarea:focus, input[type=text]:focus, input[type=number]:focus, input[type=tel]:focus, input[type=email]:focus, input[type=date]:focus, select:focus {
  border-color: var(--river-400);
  box-shadow: 0 0 0 3px rgba(var(--river-300-rgb), 0.15);
}
textarea { resize: none; min-height: 72px; }

.gps-readout {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--river-300);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-top: var(--sp-1);
  color: var(--slate-500);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-btn:hover { color: var(--river-300); }

.helpline-row {
  display: block;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-sm);
  color: var(--mist-100);
}
.helpline-row:last-child { border-bottom: none; }
.helpline-row strong { color: var(--river-300); font-family: var(--font-mono); }

/* Manual pin-drop fallback — GPS fails indoors, underground, or in
   low-signal conditions near the exact infrastructure that causes
   flooding, so reporting can never depend on geolocation alone. */
.btn-primary {
  width: 100%;
  padding: var(--sp-4);
  border: none;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  box-shadow: 0 4px 18px rgba(var(--river-400-rgb), 0.35);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background 0.18s var(--ease-settle), transform 0.15s var(--ease-settle), opacity 0.18s var(--ease-settle), box-shadow 0.18s var(--ease-settle);
}
.btn-primary:disabled { opacity: 0.5; box-shadow: none; }
.btn-primary.report-submit-btn:disabled {
  opacity: 1;
  background: var(--slate-500);
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 24px rgba(var(--river-400-rgb), 0.5); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }

/* ---------- Community Hub (shelters, missing persons, safe check,
   updates, donations, boats) — reuses the same glass/river language as
   the rest of the app rather than introducing new visual patterns. ---------- */
.chip-row {
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  background: linear-gradient(155deg, var(--surface-tint-1), var(--surface-tint-2));
  border: 1px solid var(--hairline);
  color: var(--mist-300);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease-settle), color 0.15s var(--ease-settle), border-color 0.15s var(--ease-settle);
}
.chip:hover { border-color: var(--hairline-strong); }
.chip.active, .chip.hub-tab.active {
  background: var(--river-500);
  border-color: var(--river-500);
  color: white;
}

.list-card {
  background: var(--glass-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
}
.list-card strong {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  color: var(--mist-100);
}
.list-card .link-btn { margin-top: var(--sp-2); display: inline-block; }

/* ---------- Weather banner ---------- */
.weather-banner {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--glass-2);
  backdrop-filter: blur(10px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  box-shadow: var(--shadow-float);
  animation: rise-in 0.22s var(--ease-settle);
  transition: border-color 0.25s var(--ease-settle);
}
.weather-banner .wx-temp { font-weight: 600; color: var(--river-300); letter-spacing: 0.02em; }
.weather-banner .wx-rain { color: var(--mist-300); }
.weather-banner.wx-alert { border-color: rgba(var(--risk-high-rgb), 0.5); }
.weather-banner.wx-alert .wx-rain { color: var(--risk-high); }

/* ---------- Report detail sheet ---------- */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
/* The confidence score is this app's central trust metric — it earns
   the display type scale and mono numerals, not inline text sized
   the same as everything else around it. */
.confidence-readout {
  display: flex;
  align-items: baseline;
  font-family: var(--font-display);
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px currentColor);
}
.confidence-readout-value {
  font-size: var(--fs-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.confidence-readout-unit {
  font-size: var(--fs-lg);
  font-weight: 600;
  opacity: 0.75;
  margin-left: 1px;
}

.detail-actions {
  display: flex;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}
.detail-actions button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: linear-gradient(155deg, var(--surface-tint-1), var(--surface-tint-2));
  border: 1px solid var(--hairline);
  color: var(--mist-100);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease-settle), border-color 0.15s var(--ease-settle), transform 0.12s var(--ease-settle);
}
.detail-actions button:active { transform: scale(0.96); }
.detail-actions .btn-confirm:active { background: rgba(var(--river-400-rgb),0.25); }
.detail-actions .btn-dispute:active { background: rgba(var(--risk-extreme-rgb),0.25); }
.detail-actions .btn-confirm:hover { background: rgba(var(--river-400-rgb),0.15); border-color: rgba(var(--river-400-rgb),0.4); }
.detail-actions .btn-dispute:hover { background: rgba(var(--risk-extreme-rgb),0.15); border-color: rgba(var(--risk-extreme-rgb),0.4); }
.detail-actions .btn-share:hover { background: rgba(var(--overlay-rgb),0.08); }
.detail-actions .btn-share { flex: 0 0 48px; }

.btn-flag-comment {
  background: none;
  border: none;
  color: var(--slate-500);
  font-size: var(--fs-xs);
  cursor: pointer;
  text-decoration: underline;
}
.btn-flag-comment:hover { color: var(--risk-high); }

.timeline-list, .comment-list {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: var(--sp-3);
}
.timeline-entry {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid rgba(var(--overlay-rgb),0.05);
  font-size: var(--fs-sm);
}
.timeline-time {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--slate-500);
  flex-shrink: 0;
}
.comment-entry {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid rgba(var(--overlay-rgb),0.05);
  font-size: var(--fs-sm);
}
.comment-entry strong { color: var(--river-300); font-size: var(--fs-xs); }
.comment-entry p { margin: 2px 0 0; }

.comment-composer {
  display: flex;
  gap: var(--sp-2);
}
.comment-composer input {
  flex: 1;
  background: var(--surface-tint-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--mist-100);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-body);
}
.comment-composer button {
  padding: var(--sp-2) var(--sp-4);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--river-500);
  color: white;
  cursor: pointer;
}
.comment-composer button:hover { background: var(--river-400); }

/* ---------- Report list (Feed / Alerts tabs) ---------- */
.report-list {
  max-height: 70vh;
  overflow-y: auto;
}
.report-list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.15s var(--ease-settle), padding-left 0.15s var(--ease-settle);
}
.report-list-row:hover { background: rgba(var(--overlay-rgb),0.03); padding-left: 4px; }
.report-list-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.risk-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.risk-dot.risk-verylow { background: var(--risk-verylow); color: var(--risk-verylow); }
.risk-dot.risk-moderate { background: var(--risk-moderate); color: var(--risk-moderate); }
.risk-dot.risk-high { background: var(--risk-high); color: var(--risk-high); }

.badge {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(var(--river-300-rgb), 0.14);
  color: var(--river-300);
  box-shadow: inset 0 0 0 1px rgba(var(--river-300-rgb), 0.25);
}
.badge.very_low, .badge.verified, .badge.highly_verified { background: rgba(var(--river-400-rgb),0.18); color: var(--river-300); box-shadow: inset 0 0 0 1px rgba(var(--river-400-rgb),0.3); }
.badge.low, .badge.likely { background: rgba(var(--risk-moderate-rgb),0.18); color: var(--risk-moderate); box-shadow: inset 0 0 0 1px rgba(var(--risk-moderate-rgb),0.3); }
.badge.moderate { background: rgba(var(--risk-moderate-rgb),0.18); color: var(--risk-moderate); box-shadow: inset 0 0 0 1px rgba(var(--risk-moderate-rgb),0.3); }
.badge.high, .badge.possible_false { background: rgba(var(--risk-high-rgb),0.18); color: var(--risk-high); box-shadow: inset 0 0 0 1px rgba(var(--risk-high-rgb),0.3); }
.badge.extreme { background: rgba(var(--risk-extreme-rgb),0.18); color: var(--risk-extreme); box-shadow: inset 0 0 0 1px rgba(var(--risk-extreme-rgb),0.3); }

.toast {
  position: absolute;
  top: calc(72px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: min(88vw, 420px);
  background: var(--glass-3);
  backdrop-filter: blur(10px);
  border: 1px solid var(--hairline-strong);
  border-left: 3px solid var(--river-400);
  color: var(--mist-100);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  z-index: 1000;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease-settle), transform 0.28s var(--ease-settle);
}
.toast-icon { flex-shrink: 0; }
.toast-success { border-left-color: var(--river-400); }
.toast-success .toast-icon { color: var(--river-300); }
.toast-error { border-left-color: var(--risk-extreme); }
.toast-error .toast-icon { color: var(--risk-extreme); }
.toast-info .toast-icon { color: var(--mist-300); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(6px); }

.muted { color: var(--slate-500); }
.loading-state {
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.loading-state::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--river-400);
  animation: loading-blink 1.1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes loading-blink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-state::before { animation: none; opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, .toast { transition: none; }
}
