:root {
  --bg: #0b2545;
  --bg-2: #12355e;
  --ink: #0e1b2b;
  --muted: #5b6b7d;
  --line: #dbe3ec;
  --card: #ffffff;
  --cam: #1f7ae0;
  --dwr: #7c3aed;
  --water: #0f9d8f;
  --rain: #6b4bd6;
  --canal: #1f8fd6;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(9, 26, 48, .18);
  --header-h: 58px;
  --chips-h: 46px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Noto Sans Thai", "IBM Plex Sans Thai", system-ui, -apple-system,
    "Segoe UI", Sarabun, sans-serif;
  color: var(--ink);
  background: #eef3f8;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

/* ── header ─────────────────────────────────────────────────────────── */
.fm-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: #fff;
  background: linear-gradient(135deg, #0b2545 0%, #123f6b 70%, #12617a 100%);
  padding-top: env(safe-area-inset-top);
  height: calc(var(--header-h) + env(safe-area-inset-top));
}

.fm-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.fm-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .14);
  font-size: 20px;
  line-height: 1;
  flex: none;
}

.fm-brand-text { min-width: 0; }
.fm-brand h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.fm-brand p {
  margin: 1px 0 0;
  font-size: 11px;
  opacity: .78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fm-status { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; opacity: .9; white-space: nowrap; }
.fm-alert { color: #ffd166; font-weight: 700; }

/* ── layer chips ────────────────────────────────────────────────────── */
.fm-chips {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  height: var(--chips-h);
  z-index: 1100;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.fm-chips::-webkit-scrollbar { display: none; }

.fm-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.fm-chip:hover { border-color: #b9c7d8; }
.fm-chip[aria-pressed="true"] {
  color: #fff;
  background: var(--bg-2);
  border-color: var(--bg-2);
}
.fm-chip.-strong {
  color: #fff;
  background: #0f9d8f;
  border-color: #0f9d8f;
}
.fm-chip:focus-visible, .fm-tabs button:focus-visible, .fm-list button:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

.fm-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.fm-chip[aria-pressed="true"] .fm-dot { background: #fff; }
.fm-dot.-cam { background: var(--cam); }
.fm-dot.-dwr { background: var(--cam); }
.fm-dot.-water { background: var(--water); }
.fm-dot.-rain { background: var(--rain); }
.fm-dot.-canal { background: var(--canal); }
.fm-dot.-radar { background: #16a34a; }
.fm-dot.-sat { background: #7c8798; }
.fm-dot.-traffic {
  background: linear-gradient(90deg, #22c55e 0 33%, #facc15 33% 66%, #ef4444 66% 100%);
}
.fm-chip[aria-pressed="true"] .fm-dot { background: #fff; }

/* ── map ────────────────────────────────────────────────────────────── */
.fm-main {
  position: fixed;
  inset: calc(var(--header-h) + var(--chips-h) + env(safe-area-inset-top)) 0 0 0;
  display: flex;
}

#map { flex: 1 1 auto; background: #dfe8f2; min-height: 0; }

.leaflet-container { font: inherit; }
.leaflet-control-zoom a { width: 34px; height: 34px; line-height: 34px; }
.leaflet-bar { box-shadow: var(--shadow); border: 0; }
.leaflet-control-attribution { font-size: 10px; }

/* ── sheet / panel ──────────────────────────────────────────────────── */
.fm-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  max-height: 30vh;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 30px rgba(9, 26, 48, .18);
  transition: max-height .22s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.fm-sheet[data-open="true"] { max-height: 78vh; }

.fm-grab {
  width: 100%;
  height: 22px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.fm-grab span {
  display: block;
  width: 42px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: #c6d2e0;
}

.fm-tabs { display: flex; gap: 4px; padding: 0 12px 8px; }
.fm-tabs button {
  flex: 1;
  white-space: nowrap;
  border: 0;
  background: transparent;
  padding: 8px 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.fm-tabs button[aria-selected="true"] { color: var(--bg); border-bottom-color: var(--bg); }

.fm-sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.fm-tab-panel { padding: 0 12px 16px; }

.fm-radius {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.fm-seg { display: flex; gap: 4px; flex-wrap: wrap; }
.fm-seg button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.fm-seg button[aria-pressed="true"] { background: var(--bg-2); border-color: var(--bg-2); color: #fff; }

.fm-hint { font-size: 12.5px; color: var(--muted); padding: 6px 0 10px; line-height: 1.5; }
.fm-rid-summary {
  margin: 0 0 8px;
  padding: 7px 9px;
  border-radius: 9px;
  background: #eef7f5;
  color: #0b5f57;
  font-size: 11.5px;
  line-height: 1.45;
}

.fm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.fm-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.fm-list button:hover { background: #eef5fb; border-color: #b9d4ec; }

.fm-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e6eef7;
  font-size: 16px;
}
.fm-ico.-cam { background: #e3efff; color: var(--cam); }
.fm-ico.-water { background: #dff6f2; color: var(--water); }

.fm-row { flex: 1; min-width: 0; }
.fm-row strong { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.fm-row small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.fm-row .-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--water); }
.fm-row .-val.-crit { color: var(--danger); }

.fm-badge {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}
.fm-badge.-ok { background: #dcfce7; color: #15803d; }
.fm-badge.-stale { background: #fef3c7; color: #a16207; }
.fm-badge.-frozen { background: #fee2e2; color: #b91c1c; }

.fm-note {
  font-size: 12.5px;
  line-height: 1.6;
  color: #334155;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 10px;
}

.fm-fineprint { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.6; }

/* ── popup ──────────────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }

.fm-pop { width: 268px; }
.fm-pop h3 { margin: 0 0 2px; font-size: 14px; line-height: 1.35; padding-right: 18px; }
.fm-pop .fm-pop-sub { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }

.fm-pop-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #e2e8f0;
  display: block;
}

.fm-pop-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.fm-pop button.fm-mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.fm-pop-graph { width: 100%; height: 56px; display: block; margin-top: 8px; }

.fm-pop .fm-kv { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.fm-pop .fm-kv b { font-variant-numeric: tabular-nums; }
.fm-pop .fm-kv.-wrap { flex-direction: column; align-items: flex-start; gap: 2px; }
.fm-pop .fm-kv.-wrap b { text-align: left; font-weight: 600; line-height: 1.45; }

/* ── radar panel ────────────────────────────────────────────────────── */
.fm-radar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  width: min(320px, calc(100% - 20px));
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.fm-radar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.fm-radar-head button {
  border: 0;
  background: #f1f5f9;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 15px;
  cursor: pointer;
  margin-left: 4px;
}
#fm-radar-img { width: 100%; max-height: 56vh; object-fit: contain; display: block; background: #0b1a30; min-height: 120px; }
.fm-radar-note { margin: 0; padding: 8px 10px; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ── toast ──────────────────────────────────────────────────────────── */
.fm-toast {
  position: absolute;
  left: 50%;
  bottom: calc(30vh + 16px);
  transform: translateX(-50%);
  z-index: 1300;
  max-width: min(420px, 92%);
  padding: 10px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  text-align: center;
}

.fm-noscript { padding: 80px 20px; text-align: center; }

/* “my location” marker */
.fm-me {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 157, 143, .22);
}
.fm-me span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0f9d8f;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(15, 157, 143, .45);
}

#map.-picking, #map.-picking .leaflet-interactive { cursor: crosshair !important; }

/* source links (not nested inside a button) */
.fm-src {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}
.fm-src:hover { background: #eef5fb; border-color: #b9d4ec; }
.fm-src:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* ── desktop ────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  .fm-main { flex-direction: row-reverse; }
  .fm-sheet {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 372px;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border-right: 1px solid var(--line);
    box-shadow: none;
    flex: none;
  }
  .fm-sheet[data-open="true"] { max-height: none; }
  .fm-grab { display: none; }
  .fm-tabs { padding-top: 10px; }
  .fm-sheet-body { flex: 1; }
  .fm-toast { bottom: 28px; }
  .fm-modal { max-height: none; }
  .fm-brand h1 { font-size: 17px; }
  .fm-brand p { font-size: 11.5px; }
}

@media (max-width: 899px) {
  .fm-sheet { max-height: 30vh; }
  .leaflet-bottom { bottom: 31vh; }
  .leaflet-control-attribution { max-width: 62vw; }
}

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

/* Older / very small phones */
@media (max-width: 380px) {
  .fm-brand p { display: none; }
  .fm-chip { height: 30px; padding: 0 10px; font-size: 12.5px; }
}

/* ── search ─────────────────────────────────────────────────────────── */
.fm-search-wrap { position: relative; z-index: 30; padding: 0 12px 6px; }

.fm-search { position: relative; display: flex; align-items: center; }
.fm-search-ico {
  position: absolute;
  left: 11px;
  font-size: 16px;
  color: var(--muted);
  pointer-events: none;
}
.fm-search input {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f7fafc;
  padding: 0 34px 0 32px;
  font-size: 13.5px;
  color: var(--ink);
}
.fm-search input:focus {
  outline: 3px solid #f59e0b;
  outline-offset: 1px;
  background: #fff;
}
.fm-search input::-webkit-search-cancel-button { display: none; }
#fm-q-clear {
  position: absolute;
  right: 5px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #e8eef5;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.fm-results {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(100% - 2px);
  max-height: 44vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 4px;
}
.fm-results button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 9px 8px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.fm-results button:hover, .fm-results button[aria-selected="true"] { background: #eef5fb; }
.fm-results .-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.fm-results .-credit { padding: 6px 8px 3px; font-size: 10.5px; color: var(--muted); }

/* ── AI summary card ────────────────────────────────────────────────── */
.fm-ai-stack {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}
.fm-ai-stack > * { pointer-events: auto; }
.fm-summary {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.fm-summary-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}
.fm-ai-badge {
  flex: none;
  margin-top: 1px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #04211f;
  background: linear-gradient(135deg, #7ff0e0, #23b5a4);
}
.fm-summary-text {
  flex: 1;
  font-size: 12.5px;
  line-height: 1.5;
  color: #1e293b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fm-summary[data-open="true"] .fm-summary-text { -webkit-line-clamp: unset; }
.fm-summary-caret { flex: none; color: var(--muted); font-size: 12px; transition: transform .18s; }
.fm-summary[data-open="true"] .fm-summary-caret { transform: rotate(180deg); }
.fm-summary-time {
  margin: 6px 0 0;
  padding: 0;
  color: #7c8a9a;
  font-size: 10px;
  line-height: 1.35;
}
.fm-summary-time.-pending::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border: 2px solid #bfdbfe;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: fm-spin .8s linear infinite;
  vertical-align: -1px;
}
@keyframes fm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .fm-summary-time.-pending::before { animation: none; }
}
.fm-ai-badge.-pending { position: relative; padding-right: 13px; }
.fm-ai-badge.-pending::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 4px;
  width: 7px;
  height: 7px;
  border: 1.5px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fm-spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .fm-ai-badge.-pending::after { animation: none; }
}
.fm-summary-warning {
  margin: 0;
  padding: 6px 12px;
  border-top: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 7px;
}
.fm-summary-warning a { color: inherit; text-decoration: underline; }
.fm-summary-warning .fm-tmd-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fm-tmd-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .45px;
  line-height: 1.25;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
  animation: fm-tmd-badge-pulse 2.4s ease-out infinite;
}
.fm-tmd-badge.-new {
  background: linear-gradient(135deg, #dc2626, #f97316);
}
.fm-tmd-badge.-update {
  background: linear-gradient(135deg, #0369a1, #06b6d4);
}
@keyframes fm-tmd-badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); }
  55% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.fm-tmd-badge.-update { animation-name: fm-tmd-badge-pulse-blue; }
@keyframes fm-tmd-badge-pulse-blue {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, .5); }
  55% { box-shadow: 0 0 0 5px rgba(6, 182, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .fm-tmd-badge { animation: none; }
}
.fm-summary-tmd { color: #0e7490; }
.fm-summary-body { padding: 0 12px 10px 12px; }
.fm-summary-body ul { margin: 0 0 8px; padding-left: 18px; }
.fm-summary-body li { font-size: 12px; line-height: 1.6; color: #334155; }
.fm-creditline { margin: 0 0 6px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.fm-fineprint a { color: #0b63d6; font-weight: 600; text-decoration: underline; }

/* ── map symbols ────────────────────────────────────────────────────── */
.fm-pin {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--cam);
  color: #fff;
  box-shadow: 0 2px 7px rgba(9, 26, 48, .38);
  transition: transform .12s ease;
}
.fm-pin svg { width: 14px; height: 14px; fill: currentColor; display: block; }
.fm-pin:hover { transform: scale(1.12); }
.fm-pin.-cam { border-radius: 9px; background: var(--cam); }
.fm-pin.-cam.-dwr { background: var(--cam); }
.fm-pin.-cam.-dwr-stale { background: #94a3b8; }
.fm-pin.-water {
  border-radius: 50% 50% 50% 5px;
  transform: rotate(-45deg);
  background: var(--water);
}
.fm-pin.-water svg { transform: rotate(45deg); }
.fm-pin.-water.-crit { background: #dc2626; animation: fm-pulse 1.8s ease-out infinite; }
.fm-pin.-rain { background: var(--rain); border-radius: 50%; }
.fm-pin.-rain.-unknown { width: 16px; height: 16px; background: #e2e8f0; color: #64748b; border-style: dashed; }
.fm-pin.-rain.-none { width: 16px; height: 16px; background: #cbd5e1; color: #334155; }
.fm-pin.-rain.-light { width: 18px; height: 18px; background: #7dd3fc; color: #083344; }
.fm-pin.-rain.-mod { width: 20px; height: 20px; background: #3b82f6; color: #fff; }
.fm-pin.-rain.-heavy { width: 21px; height: 21px; background: #f59e0b; color: #422006; }
.fm-pin.-rain.-vheavy { width: 22px; height: 22px; background: #dc2626; color: #fff; }
.fm-pin.-place {
  border-radius: 50% 50% 50% 5px;
  transform: rotate(-45deg);
  background: #0f172a;
}
.fm-pin.-place svg { transform: rotate(45deg); }
.fm-pin.-stale { background: #94a3b8; }
.fm-pin.-plus::after {
  content: "+";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 12px;
  height: 12px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: #0e7490;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(9, 26, 48, .35);
}

@keyframes fm-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* ── flood tab + legend ─────────────────────────────────────────────── */
.fm-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  vertical-align: 1px;
}
.fm-flood-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 10px;
  font-size: 12px;
  color: var(--muted);
}
.fm-linkbtn {
  border: 0;
  background: transparent;
  color: #0b63d6;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 2px;
}
.fm-sub { margin: 14px 0 6px; font-size: 12px; font-weight: 800; color: #334155; }
.fm-legend { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fm-legend li { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #334155; }
.fm-legend .fm-pin { width: 22px; height: 22px; }
.fm-legend .fm-pin svg { width: 12px; height: 12px; }

@media (max-width: 899px) {
  .fm-ai-stack { top: 8px; left: 8px; right: 8px; }
  .fm-tabs button { font-size: 12.5px; padding: 8px 1px; }
  .fm-results { max-height: 34vh; }
}

/* ── search extras / place focus ────────────────────────────────────── */
.fm-list .fm-pin { width: 26px; height: 26px; flex: none; }
.fm-list .fm-pin svg { width: 13px; height: 13px; }

.fm-anchor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #eef7f5;
  border: 1px solid #cfe9e4;
  color: #0b5e56;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 700;
}
.fm-anchor button {
  border: 0;
  background: #fff;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.fm-results-empty { padding: 12px 10px; font-size: 12.5px; color: var(--muted); }

.fm-place-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.fm-place-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 10px;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}
.fm-place-row:hover { background: #eef5fb; }
.fm-place-row .fm-row strong { font-size: 12.5px; }
.fm-place-row .fm-row small { font-size: 11px; color: var(--muted); }

.fm-radar { z-index: 1010; }

@media (max-width: 899px) {
  .fm-summary-text { font-size: 12px; }
  .fm-list .fm-pin { width: 24px; height: 24px; }
}

/* the sheet is a real column on desktop, so the floating stack starts after it */
@media (min-width: 900px) {
  .fm-ai-stack { left: 384px; max-width: 430px; }
}
.fm-count[hidden] { display: none !important; }
.fm-ai-badge.-pending { background: #e2e8f0; color: #475569; }
.fm-pin.-place.-approx { background: #64748b; border-style: dashed; }

/* ── wind layer ─────────────────────────────────────────────────────── */
.fm-dot.-wind { background: #0891b2; }

.fm-wind {
  position: absolute;
  left: 10px;
  bottom: calc(30vh + 12px);
  z-index: 1000;
  width: min(330px, calc(100% - 76px));
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 9px 11px 8px;
}
.fm-wind-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fm-wind-head strong { font-size: 12.5px; }
.fm-wind-head button {
  border: 0;
  background: #f1f5f9;
  border-radius: 7px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.fm-wind-time {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #0e7490;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
#fm-wind-range { width: 100%; margin: 2px 0 4px; accent-color: #0891b2; }
.fm-wind-legend { display: flex; flex-wrap: wrap; gap: 2px; font-size: 9px; color: var(--muted); }
.fm-layer-wind-wrap { padding: 0 10px 8px 34px; }
.fm-layer-wind-wrap .fm-wind-legend { margin-top: -2px; }
.fm-wind-legend-note { margin: 3px 0 0; font-size: 9.5px; color: var(--muted); line-height: 1.35; }
.fm-wind-legend-note:empty { display: none; }
.fm-wind-legend span {
  flex: 1;
  text-align: center;
  padding: 2px 0;
  border-radius: 3px;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.fm-wind-note { margin: 5px 0 0; font-size: 10px; color: var(--muted); line-height: 1.4; }

.fm-wind-arrow {
  display: block;
  width: 22px;
  height: 22px;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 1px 2px rgba(9, 26, 48, .45));
}
.fm-wind-arrow svg { width: 22px; height: 22px; fill: currentColor; display: block; }

@media (min-width: 900px) {
  .fm-wind { left: 384px; bottom: 56px; }
}

/* long title: keep the header on one line on phones */
@media (max-width: 899px) {
  .fm-brand p { display: none; }
  .fm-brand h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 58vw;
  }
  .fm-status { font-size: 9.5px; max-width: 46vw; }
  #fm-updated { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 900px) {
  .fm-wind { bottom: 56px; }
}
.fm-age { opacity: .85; }
@media (max-width: 899px) {
  .fm-age { display: none; }
  .fm-brand h1 { max-width: 56vw; font-size: 13.5px; }
}

/* wind panel v2 */
.fm-wind-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.fm-wind-label { flex: none; width: 30px; font-size: 10.5px; color: var(--muted); }
.fm-seg-sm { display: flex; gap: 4px; flex-wrap: wrap; }
.fm-seg-sm button {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.fm-seg-sm button[aria-pressed="true"] { background: #0891b2; border-color: #0891b2; color: #fff; }
.fm-wind-hint { margin: 3px 0 0; font-size: 10px; line-height: 1.45; color: var(--muted); }
.fm-wind-time { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; }
.fm-wind-play {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: #0891b2;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.fm-wind-play:hover { background: #0e7490; }
.fm-wind-canvas { position: absolute; inset: 0; z-index: 450; pointer-events: none; }

@media (max-width: 899px) {
  .fm-wind { padding: 8px 10px 7px; }
  .fm-wind-hint#fm-wind-level-note { display: none; }
}

/* wind panel: compact by default, expandable */
.fm-wind-actions { display: flex; align-items: center; gap: 4px; }
.fm-wind-caret {
  border: 0;
  background: #f1f5f9;
  border-radius: 7px;
  width: 26px;
  height: 26px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: transform .18s ease;
}
.fm-wind[data-expanded="true"] .fm-wind-caret { transform: rotate(180deg); }
.fm-wind[data-expanded="false"] #fm-wind-body { display: none; }
.fm-wind[data-expanded="false"] { padding-bottom: 8px; }
.fm-wind[data-expanded="false"] .fm-wind-time { margin: 6px 0 2px; }
.fm-wind-caret { width: auto; padding: 0 8px; font-size: 10.5px; font-weight: 700; color: #475569; display: inline-flex; align-items: center; gap: 2px; }
.fm-wind-head strong { flex: 1; min-width: 0; }
.fm-wind-actions { flex: none; }
.fm-wind-caret { white-space: nowrap; flex: none; }
#fm-wind-expand-label { white-space: nowrap; }
.fm-wind-head .fm-wind-caret {
  width: auto;
  min-width: 0;
  height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.fm-wind-head .fm-wind-caret span { flex: none; }
.fm-wind-head .fm-wind-caret { font-size: 11px; font-weight: 700; color: #475569; }

/* ── wind: floating square button at top-right ───────────────────────── */
.fm-wind {
  position: absolute;
  top: 10px;
  right: 10px;
  left: auto;
  bottom: auto;
  width: auto;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.fm-wind-fab {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: #0891b2;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(8, 145, 178, .35);
  transition: background .15s, box-shadow .15s, transform .15s;
}
.fm-wind-fab:hover { background: #0e7490; transform: translateY(-1px); }
.fm-wind-fab:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.fm-wind-fab[aria-expanded="true"] {
  background: #0e7490;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, .25), 0 6px 18px rgba(8, 145, 178, .4);
}
.fm-wind-fab svg { width: 22px; height: 22px; fill: currentColor; }
.fm-wind-panel {
  width: min(320px, calc(100vw - 24px));
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 9px 11px 8px;
}
.fm-radar { top: 64px; }
.fm-visitors { font-size: 10px; opacity: .85; white-space: nowrap; }
@media (max-width: 899px) {
  .fm-ai-stack { right: 62px; }
}

/* ── rain radar overlay control ─────────────────────────────────────── */
.fm-dot.-rainradar { background: #0b63d6; }
.fm-rain {
  position: absolute;
  left: 10px;
  bottom: calc(30vh + 12px);
  z-index: 1000;
  width: min(300px, calc(100% - 76px));
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 5px 8px;
  align-items: center;
}
.fm-rain-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: #0b63d6;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.fm-rain-play:hover { background: #0b57bd; }
.fm-rain-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fm-rain-info span {
  font-size: 12.5px;
  font-weight: 800;
  color: #0b4ea2;
  font-variant-numeric: tabular-nums;
}
.fm-rain-info small { font-size: 9.5px; color: var(--muted); line-height: 1.3; }
.fm-rain-close {
  border: 0;
  background: #f1f5f9;
  border-radius: 7px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
#fm-rain-range { grid-column: 1 / -1; width: 100%; margin: 1px 0 0; accent-color: #0b63d6; }

@media (min-width: 900px) {
  .fm-rain { left: 384px; bottom: 40px; }
}

/* ── colour legend popover (hidden until tapped) ────────────────────── */
.fm-legend-btn {
  position: absolute;
  left: 12px;
  bottom: calc(30vh + 46px);
  z-index: 1000;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: #0e7490;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.fm-legend-btn:hover { background: #eef7f8; }
.fm-legend-btn[aria-expanded="true"] { background: #0e7490; color: #fff; border-color: #0e7490; }
.fm-rainradar-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 9.5px;
  color: var(--muted);
}
.fm-rr-label { padding: 0 3px 0 2px; font-weight: 800; white-space: nowrap; }
@media (max-width: 359px) { .fm-rr-label { display: none; } }
.fm-rr-src {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  padding: 4px 7px;
  background: #f1f5f9;
  color: #334155;
  font-size: 9.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.fm-rr-src b { font-weight: 700; color: #0e7490; }
.fm-rr-src[aria-pressed="true"] { background: #0e7490; color: #fff; }
.fm-rr-src[aria-pressed="true"] b { color: #d9fbff; }
.fm-rr-play {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #0e7490;
  font-size: 10px;
  cursor: pointer;
}
.fm-rr-play[aria-pressed="true"] { background: #0e7490; color: #fff; border-color: #0e7490; }
.fm-legend-card {
  position: absolute;
  left: 12px;
  bottom: calc(30vh + 86px);
  z-index: 1001;
  width: 244px;
  max-height: 46vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
}
.fm-legend-card h4 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .02em;
}
.fm-legend-section + .fm-legend-section {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.fm-legend-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #334155; margin: 3px 0; }
.fm-legend-swatch { flex: none; width: 30px; height: 12px; border-radius: 3px; }
.fm-legend-note { margin: 7px 0 0; font-size: 9.5px; color: var(--muted); line-height: 1.4; }
.fm-rain-scale {
  margin: 10px 0 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.fm-rain-scale h4 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.fm-rain-scale.-inline {
  margin: 2px 4px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.fm-rain-scale.-inline .fm-legend-note { display: none; }
.fm-rain-scale.-inline .fm-legend-row { font-size: 10.5px; margin: 2px 0; }

@media (min-width: 900px) {
  .fm-legend-btn { left: 384px; bottom: 60px; }
  .fm-legend-card { left: 384px; bottom: 102px; }
}
.fm-status-sub { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.fm-status-sub .fm-age:empty { display: none; }
.fm-refresh {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  flex: none;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #e0f2fe;
  cursor: pointer;
  touch-action: manipulation;
}
.fm-refresh:hover { background: rgba(255, 255, 255, .22); }
.fm-refresh:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fm-refresh[hidden] { display: none; }
.fm-refresh:disabled { cursor: default; opacity: .8; }
.fm-refresh-ico { width: 15px; height: 15px; display: block; }
.fm-refresh.is-busy .fm-refresh-ico { animation: fm-refresh-spin .8s linear infinite; }
@keyframes fm-refresh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .fm-refresh.is-busy .fm-refresh-ico { animation: none; }
}

/* language switch (first item in the layer bar) */
.fm-lang {
  flex: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.fm-lang a {
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-decoration: none;
}
.fm-lang a.is-on { background: var(--bg-2); color: #fff; }

/* phones: the bottom sheet shows only the search bar until tapped */
@media (max-width: 899px) {
  .fm-sheet { max-height: 66px; }
  .fm-sheet[data-open="true"] { max-height: 78vh; }
  .fm-sheet[data-open="false"] .fm-grab,
  .fm-sheet[data-open="false"] .fm-tabs,
  .fm-sheet[data-open="false"] .fm-sheet-body { display: none; }
  .fm-sheet[data-open="false"] .fm-search-wrap { padding-top: 10px; }
  .fm-sheet[data-open="false"] { border-radius: 14px 14px 0 0; }
  .leaflet-bottom { bottom: 76px; }
  .fm-legend-btn { bottom: 128px; }
  .fm-legend-card { bottom: 168px; }
  .fm-toast { bottom: 140px; }
}

/* hourly rain forecast + condition icon */
.fm-wind-fcst {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: #334155;
}
.fm-wind-fcst-icon { flex: none; width: 26px; height: 26px; color: #0e7490; display: grid; place-items: center; }
.fm-wind-fcst-icon svg { width: 24px; height: 24px; }

/* ── community photos ───────────────────────────────────────────────── */
.fm-chip.-photo { border-color: #0e7490; color: #0e7490; background: #ecfeff; }
.fm-chip.-photo:hover { background: #cffafe; }

.fm-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px;
  margin-bottom: 4px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #0e7490, #0891b2);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(8, 145, 178, .3);
}
.fm-photo-btn:hover { filter: brightness(1.06); }
.fm-photo-ico { font-size: 18px; }

.fm-photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fm-photo-card {
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
}
.fm-photo-card:hover { border-color: #b9d4ec; }
.fm-photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dbe3ec;
}
.fm-photo-meta { padding: 6px 8px 7px; }
.fm-photo-meta strong {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-photo-meta small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.fm-photo-meta .-ttl { color: #b45309; font-weight: 700; }

/* modal */
.fm-photo-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(6, 18, 32, .62);
  backdrop-filter: blur(3px);
}
.fm-photo-dialog {
  width: min(440px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .4);
  padding: 14px 16px 16px;
}
#fm-photo-modal.is-thanks .fm-photo-dialog { display: none; }
.fm-photo-thanks {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.fm-photo-thanks[hidden] { display: none; }
.fm-photo-thanks-card {
  width: min(420px, 94vw);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px 20px 18px;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .4);
}
.fm-photo-thanks-heart {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f766e 0%, #16a34a 100%);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .28);
}
.fm-photo-thanks-card h2 {
  margin: 0 0 10px;
  color: #0b2545;
  font-size: 20px;
  line-height: 1.35;
}
.fm-photo-thanks-card #fm-photo-thanks-text {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.75;
}
.fm-photo-thanks-note {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 10.5px;
  line-height: 1.5;
}
.fm-photo-thanks-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}
.fm-photo-thanks-actions .fm-btn-primary,
.fm-photo-thanks-actions .fm-btn { width: 100%; }
.fm-photo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fm-photo-head strong { font-size: 15px; }
.fm-photo-head button {
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: #f1f5f9; font-size: 15px; cursor: pointer;
}
.fm-photo-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0b1a2c;
  min-height: 180px;
  display: grid;
  place-items: center;
}
#fm-photo-canvas { display: none; width: 100%; height: auto; touch-action: none; }
#fm-photo-canvas.is-ready { display: block; }
.fm-photo-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; min-height: 180px;
  border: 0; background: transparent; color: #cfe1ef;
  font-size: 12.5px; cursor: pointer;
}
.fm-photo-cam { font-size: 30px; }
.fm-photo-tools { display: flex; gap: 8px; margin-top: 8px; }
.fm-photo-tools button, .fm-photo-change {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.fm-photo-tools button[aria-pressed="true"] { background: #0e7490; border-color: #0e7490; color: #fff; }
.fm-photo-hint { margin: 6px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.fm-photo-field { display: block; margin-top: 10px; font-size: 11px; color: var(--muted); }
.fm-photo-field span { display: block; margin-bottom: 3px; }
.fm-photo-field input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
}
.fm-photo-field input:focus { outline: 3px solid #f59e0b; outline-offset: 1px; }
.fm-photo-loc {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px; font-size: 11.5px; color: var(--muted);
}
#fm-photo-loc {
  flex: 1 1 120px;
  order: 2;
  color: #0e7490;
  font-weight: 700;
  text-align: left;
}
.fm-photo-loc button { order: 3; }
.fm-photo-consent {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 11px; font-size: 11.5px; line-height: 1.45; color: #334155;
}
.fm-photo-consent input { margin-top: 2px; }
.fm-photo-actions { display: flex; align-items: center; gap: 10px; margin-top: 13px; }
.fm-btn-primary {
  padding: 10px 18px;
  border: 0; border-radius: 10px;
  background: #0891b2; color: #fff;
  font-size: 13px; font-weight: 800;
  cursor: pointer;
}
.fm-btn-primary:disabled { opacity: .6; cursor: default; }
.fm-photo-status { font-size: 11.5px; color: #b45309; }

/* make the hidden attribute win over component display rules */
[hidden] { display: none !important; }
@media (max-width: 899px) {
  .fm-tabs button { font-size: 11.5px; white-space: nowrap; padding: 8px 1px; }
}

/* in-app camera */
#fm-photo-video {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: cover;
  background: #000;
  border-radius: 12px;
}
.fm-photo-preview { position: relative; }
.fm-photo-shutter {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(0, 0, 0, .15);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.fm-photo-shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transform: scale(.82);
}
.fm-photo-tools { flex-wrap: wrap; }
.fm-photo-tools button { min-width: 92px; font-size: 11.5px; }

/* smaller rain markers to avoid clutter */
.fm-pin.-sm { width: 20px; height: 20px; border-width: 1.5px; }
.fm-pin.-sm svg { width: 11px; height: 11px; }

.fm-photo-retry {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .7);
  background: rgba(8, 145, 178, .92);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* camera permission help */
.fm-photo-help {
  margin-top: 10px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: #78350f;
}
.fm-photo-help summary { cursor: pointer; font-weight: 800; }
.fm-photo-help ol { margin: 6px 0 6px 18px; padding: 0; }
.fm-photo-help li { margin: 3px 0; line-height: 1.45; }
.fm-photo-help button {
  margin-top: 4px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: #b45309;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* watermarked preview before publishing */
.fm-photo-preview-img {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: #0b1a2c;
}
.fm-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.fm-photo-actions { flex-wrap: wrap; }

.fm-photo-loc button {
  margin-left: 0;
  border: 1px solid #0891b2;
  background: #ecfeff;
  color: #0e7490;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}
.fm-photo-loc button:first-of-type { margin-left: auto; }
.fm-photo-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 4px;
  font-size: 12px;
  color: #334155;
}
.fm-pin.-photo { background: #f59e0b; border-radius: 9px; }

/* camera/photo preview: let the media define the height so there is no
   empty dark band below landscape photos or the watermarked preview */
.fm-photo-preview {
  position: relative;
  height: auto;
  min-height: 180px;
  display: block;
  background: #0b1a2c;
}
#fm-photo-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(46vh, 380px);
  object-fit: cover;
  border-radius: 0;
}
#fm-photo-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(46vh, 380px);
  margin: 0 auto;
  object-fit: contain;
}
.fm-photo-preview-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(46vh, 380px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 0;
}
.fm-photo-placeholder {
  position: absolute;
  inset: 0;
  min-height: 0;
  border-radius: 0;
}

/* prominent "see photos on the map" button */
.fm-photo-mapbtn {
  width: 100%;
  margin: 2px 0 6px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #0891b2;
  background: #ecfeff;
  color: #0e7490;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.fm-photo-mapbtn:hover { background: #cffafe; }
.fm-photo-mapbtn[aria-pressed="true"] { background: #0e7490; color: #fff; border-color: #0e7490; }

/* camera switcher (shown only when the device exposes more than one rear camera) */
.fm-photo-switchcam {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  border: 1px solid rgba(235, 246, 252, 0.45);
  background: rgba(8, 22, 38, 0.72);
  color: #eaf7fb;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.fm-photo-switchcam:hover { background: rgba(8, 22, 38, 0.9); }

/* discreet owner login */
.fm-admin-link { color: #64748b; opacity: .5; text-decoration: none; font-size: 10px; }
.fm-admin-link:hover, .fm-admin-link:focus-visible { opacity: 1; }

.fm-admin-link.-head {
  margin-left: 7px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 11px;
  text-decoration: none;
  vertical-align: middle;
}
.fm-admin-dot {
  display: inline-block;
  min-width: 14px;
  height: 14px;
  margin-left: 3px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  vertical-align: 1px;
}

/* photo review: let the captured/watermarked image scroll instead of cropping */
.fm-photo-dialog {
  max-height: 92dvh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.fm-photo-preview.is-review {
  height: auto;
  max-height: min(58vh, 460px);
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: #07131f;
}
.fm-photo-preview.is-review #fm-photo-canvas,
.fm-photo-preview.is-review .fm-photo-preview-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
}
.fm-photo-confirmbox {
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  background: #f0f9ff;
}
.fm-photo-confirmbox .fm-photo-hint {
  margin: 0 0 6px;
  color: #0c4a6e;
  font-weight: 700;
}
.fm-photo-confirmbox .fm-photo-consent { margin-top: 0; }
.fm-photo-credit {
  margin: 0 0 6px;
  color: #0e7490;
  font-size: 12px;
  font-weight: 800;
}
.fm-photo-meta .-cap {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: #475569;
  font-size: 10px;
}
.fm-pop-caption {
  margin: 3px 0 0;
  max-height: 3.9em;
  overflow: hidden;
  color: #475569;
  font-size: 11.5px;
  line-height: 1.45;
}

/* confirm step: hide edit-only fields so the photo, consent and buttons fit */
.fm-photo-dialog.is-preview .fm-photo-field,
.fm-photo-dialog.is-preview #fm-photo-exif-hint,
.fm-photo-dialog.is-preview #fm-photo-blur-hint,
.fm-photo-dialog.is-preview #fm-photo-help,
.fm-photo-dialog.is-preview #fm-photo-loc-help,
.fm-photo-dialog.is-preview #fm-photo-tools { display: none; }

/* in-app browser notice (LINE / Facebook / Instagram) */
.fm-photo-inappbar {
  margin: 0 0 9px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
}
.fm-photo-inappbar p {
  margin: 0;
  color: #92400e;
  font-size: 11px;
  line-height: 1.45;
}
.fm-photo-inapp-actions { display: flex; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.fm-photo-inapp-actions .fm-btn-primary,
.fm-photo-inapp-actions .fm-btn { padding: 7px 11px; font-size: 11.5px; }

/* photo-as-marker on the map (deep link from a photo page) */
.fm-photo-pin { background: transparent; border: 0; }
.leaflet-container .leaflet-marker-pane .fm-photo-pin img,
.fm-photo-pin img {
  width: 56px;
  height: 56px;
  max-width: none;
  max-height: none;
  object-fit: cover;
  border-radius: 13px;
  border: 3px solid #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  display: block;
}
.fm-photo-pin::after {
  content: "📷";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.fm-photo-meta .-when { color: #64748b; font-size: 10px; }

/* TMD radar loop controls */
.fm-radar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.fm-radar-tools label { font-size: 10.5px; }
.fm-radar-tools select {
  flex: 1 1 90px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}
.fm-radar-tools button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.fm-radar-tools button[aria-pressed="true"] { background: #0e7490; color: #fff; }
.fm-radar-frame {
  margin-left: auto;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fm-radar-stage { position: relative; }

/* ── accessibility: skip link, focus, reduced motion ─────────────────── */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.fm-skip {
  position: fixed;
  top: -100px;
  left: 8px;
  z-index: 5000;
  padding: 10px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.fm-skip:focus { top: 8px; }
:focus-visible {
  outline: 3px solid #0e7490;
  outline-offset: 2px;
}
.fm-header :focus-visible,
.fm-chips :focus-visible {
  outline-color: #7ff0e0;
}
.fm-sheet:focus-visible { outline: 3px solid #0e7490; outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* main basin flow labels and arrows (data: SCCCRN) */
.fm-dot.-flow { background: #ef4444; }
.fm-flow-wrap, .fm-flow-arrow-wrap { background: transparent; border: 0; }
.fm-flow-label {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
  padding: 3px 8px;
  border: 1.5px solid rgba(255, 255, 255, .92);
  border-radius: 999px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .12);
  backdrop-filter: blur(5px);
}
.fm-flow-label.-sadao { background: #0369a1; }
.fm-flow-label.-khuanlang { background: #6d28d9; }
.fm-flow-label.-khohong { background: #0f766e; }
.fm-flow-label.-lake { background: #b45309; }
.fm-flow-arrow {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  transform: rotate(var(--rot, 0deg));
  transform-origin: center;
}
.fm-flow-arrow-chip {
  display: block;
  color: #ef4444;
  font-size: 13px;
  line-height: 14px;
  text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff;
  transform: rotate(var(--rot));
  transform-origin: center;
}
.fm-flow-dest { margin: 5px 0 0; color: #0e7490; font-size: 12px; font-weight: 800; }

@keyframes fm-flow-dash {
  to { stroke-dashoffset: -32; }
}
.fm-flow-river-anim {
  animation: fm-flow-dash 1.8s linear infinite;
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, .65));
}
.fm-flow-stream-anim {
  animation: fm-flow-dash 2.6s linear infinite;
  filter: drop-shadow(0 0 1.5px rgba(56, 189, 248, .5));
}
@media (prefers-reduced-motion: reduce) {
  .fm-flow-river-anim { animation: none; }
  .fm-flow-stream-anim { animation: none; }
}

/* visitor stats popover */
.fm-visitors-wrap { position: relative; display: inline-flex; }
.fm-visitors {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 10px;
  opacity: .85;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.fm-visitors:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.fm-visitors-caret { margin-left: 3px; font-size: 8px; opacity: .75; }
.fm-vstats {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1500;
  width: 216px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  background: #0b2545;
  color: #eaf4fb;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
  font-size: 11px;
  white-space: normal;
}
.fm-vstats-head { margin-bottom: 5px; color: #7ff0e0; font-size: 11.5px; font-weight: 800; }
.fm-vstats-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.fm-vstats-row:first-of-type { border-top: 0; }
.fm-vstats-row b { color: #fff; font-variant-numeric: tabular-nums; }
.fm-vstats-row.-total { margin-top: 3px; border-top-color: rgba(127, 240, 224, .4); color: #7ff0e0; }
.fm-vstats-row.-total b { color: #7ff0e0; }
.fm-vstats-note { margin: 7px 0 0; color: #9fb6c9; font-size: 9.5px; line-height: 1.4; }

/* ── redesigned layer bar + layers sheet ────────────────────────────── */
.fm-lang.-head {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .28);
  border-radius: 999px;
}
.fm-lang.-head a { padding: 2px 6px; font-size: 9.5px; color: #dbeafe; }
.fm-lang.-head a.is-on { background: #fff; color: var(--bg); }

.fm-quickbar { gap: 6px; padding: 0 10px; overflow: hidden; }
.fm-chip.fm-quick {
  flex: 1 1 0;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  gap: 5px;
  justify-content: center;
  border-radius: 10px;
  font-size: 12.5px;
  white-space: nowrap;
}
.fm-chip.fm-quick.-layers {
  flex: 1.4 1 0;
  color: var(--bg);
  background: #eef6ff;
  border-color: #cfe3f7;
  font-weight: 800;
}
.fm-chip.fm-quick.-layers:hover { background: #e2f0ff; border-color: #b9d7f2; }
.fm-quick-ico { font-size: 13px; line-height: 1; }
.fm-layers-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bg-2);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.fm-layers {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fm-layers-scrim { position: absolute; inset: 0; background: rgba(6, 17, 32, .32); }
.fm-layers-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: min(84vh, 660px);
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(9, 26, 48, .28);
  overflow: hidden;
}
.fm-layers-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.fm-layers-head strong { font-size: 16px; }
.fm-layers-hint { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.fm-layers-close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #eef3f8;
  color: #334155;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.fm-layers-close:hover { background: #e2eaf2; }
.fm-layers-body { overflow-y: auto; overscroll-behavior: contain; padding: 2px 12px 10px; }
.fm-layers-group { padding-top: 6px; }
.fm-layers-group h3 {
  margin: 8px 8px 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .35px;
  text-transform: uppercase;
}
.fm-chip.fm-layer-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: 46px;
  margin: 0 0 4px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: #f5f8fb;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.fm-chip.fm-layer-row:hover { background: #eaf1f8; }
.fm-layer-label { flex: 1; min-width: 0; text-align: left; }
.fm-layer-row .fm-dot { width: 10px; height: 10px; }
.fm-switch {
  position: relative;
  flex: none;
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: #cbd7e3;
  transition: background .15s;
}
.fm-switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  transition: transform .15s;
}
.fm-layer-row[aria-pressed="true"] { background: #e8f6f4; color: #0b5e56; }
.fm-layer-row[aria-pressed="true"] .fm-switch { background: #0f9d8f; }
.fm-layer-row[aria-pressed="true"] .fm-switch::after { transform: translateX(15px); }
.fm-layer-go { flex: none; color: #9fb0c2; font-size: 20px; font-weight: 700; line-height: 1; }
.fm-layers-foot {
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}
.fm-layers-foot .fm-btn { flex: 1; height: 40px; padding: 0; }
@media (min-width: 900px) {
  .fm-layers { align-items: center; }
  .fm-layers-dialog { border-radius: 18px; max-height: 80vh; }
}

/* keep the layer colour visible on active rows */
.fm-layer-row[aria-pressed="true"] .fm-dot.-cam { background: var(--cam); }
.fm-layer-row[aria-pressed="true"] .fm-dot.-water { background: var(--water); }
.fm-layer-row[aria-pressed="true"] .fm-dot.-rain { background: var(--rain); }
.fm-layer-row[aria-pressed="true"] .fm-dot.-canal { background: var(--canal); }
.fm-layer-row[aria-pressed="true"] .fm-dot.-radar { background: #16a34a; }
.fm-layer-row[aria-pressed="true"] .fm-dot.-sat { background: #7c8798; }
.fm-layer-row[aria-pressed="true"] .fm-dot.-traffic {
  background: linear-gradient(90deg, #22c55e 0 33%, #facc15 33% 66%, #ef4444 66% 100%);
}
.fm-traffic-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin: 2px 2px 6px;
  font-size: 10.5px;
  color: #475569;
}
.fm-traffic-legend span { display: inline-flex; align-items: center; gap: 4px; }
.fm-traffic-legend i {
  display: inline-block;
  width: 16px;
  height: 4px;
  border-radius: 999px;
}
.fm-traffic-note {
  margin: 0 2px;
  color: #64748b;
  font-size: 10px;
  line-height: 1.45;
}
.fm-chip.fm-layer-row[aria-pressed="true"]:hover { background: #def0ed; }
.fm-layers-close:focus-visible,
.fm-layers-foot .fm-btn:focus-visible {
  outline: 3px solid #0ea5e9;
  outline-offset: 2px;
}
.fm-layers-dialog:focus { outline: none; }
@media (min-width: 900px) {
  .fm-chip.fm-quick { flex: 0 0 auto; min-width: 104px; }
  .fm-chip.fm-quick.-layers { flex: 0 0 auto; min-width: 168px; }
}
.fm-dot.-me { background: #0f766e; }
.fm-dot.-photo { background: #f59e0b; }

/* ── share-weather-photo floating action ─────────────────────────────── */
.fm-photo-fab {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 96px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .1px;
  transform: translateX(-50%);
  box-shadow: 0 8px 20px rgba(234, 88, 12, .35);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.fm-photo-fab:hover { transform: translate(-50%, -1px); box-shadow: 0 10px 24px rgba(234, 88, 12, .44); }
.fm-photo-fab:active { transform: translate(-50%, 0); }
.fm-photo-fab:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, .4), 0 8px 20px rgba(234, 88, 12, .35);
}
.fm-photo-fab-ico { width: 15px; height: 15px; flex: none; fill: currentColor; }
@media (min-width: 900px) {
  .fm-photo-fab { left: calc(50% + 186px); bottom: 24px; }
}
@media (max-width: 380px) {
  .fm-photo-fab { height: 32px; padding: 0 9px; font-size: 11px; gap: 4px; }
  .fm-photo-fab-ico { width: 14px; height: 14px; }
}

.fm-photo-head-tools { display: flex; align-items: center; gap: 6px; }
.fm-photo-head .fm-photo-seeall {
  width: auto;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  background: #ecfeff;
  color: #0e7490;
  font-size: 11.5px;
  font-weight: 800;
}
.fm-photo-head .fm-photo-seeall:hover { background: #cffafe; }

/* community-photo marker: tiny photo preview + orange camera badge */
.fm-photo-thumb-wrap { background: transparent; border: 0; }
.fm-photo-thumb {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: #f59e0b;
  box-shadow: 0 2px 7px rgba(9, 26, 48, .35);
  transition: transform .12s ease;
}
.fm-photo-thumb:hover { transform: scale(1.08); }
.fm-photo-thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  border-radius: 8px;
}
.fm-photo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
}
.fm-photo-fallback svg { width: 18px; height: 18px; fill: currentColor; }
.fm-photo-thumb:not(.-fail) .fm-photo-fallback { display: none; }
.fm-photo-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 1px 3px rgba(9, 26, 48, .4);
}
.fm-photo-badge svg { width: 9px; height: 9px; fill: #fff; display: block; }

/* GISTDA flood extent */
.fm-dot.-flood { background: #2563eb; }
.fm-gistda-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-size: 12px;
  color: #334155;
}
.fm-gistda-row b { color: #0b3b8c; font-variant-numeric: tabular-nums; }
.fm-summary-gistda {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #bfdbfe;
  color: #1d4ed8;
  font-weight: 700;
}
.fm-layer-row[aria-pressed="true"] .fm-dot.-flood { background: #2563eb; }
.fm-layer-src { color: #94a3b8; font-size: 10.5px; font-weight: 600; white-space: nowrap; }

/* full-screen nudge for Facebook/Messenger/Line in-app browsers */
.fm-inapp-gate {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 14, 26, .86);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.fm-inapp-card {
  width: min(430px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px 20px 18px;
  border-radius: 18px;
  border: 1px solid rgba(127, 240, 224, .35);
  background: linear-gradient(160deg, #0b2545, #071a30);
  color: #eaf6ff;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.fm-inapp-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(127, 240, 224, .12);
  font-size: 28px;
}
.fm-inapp-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.35;
}
.fm-inapp-card p {
  margin: 0 0 14px;
  color: #cfe1ef;
  font-size: 12.5px;
  line-height: 1.55;
}
.fm-inapp-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fm-inapp-actions .fm-btn-primary,
.fm-inapp-actions .fm-btn {
  width: 100%;
  text-align: center;
  text-decoration: none;
}
.fm-inapp-hint {
  margin: 12px 0 0 !important;
  color: #9fc4d8 !important;
  font-size: 11px !important;
}

/* optional PWA install block in the Info tab */
.fm-install {
  margin: 12px 0;
  padding: 11px 12px;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  background: #f0f9ff;
}
.fm-install .fm-sub { margin-top: 0; }
.fm-install .fm-note { margin-bottom: 8px; }
.fm-install #fm-install-btn { width: 100%; }
.fm-install #fm-install-chrome {
  display: block;
  width: 100%;
  margin-top: 8px;
  text-align: center;
  text-decoration: none;
}

/* site-controlled install nudge (Chrome may also show its own prompt) */
.fm-install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(144px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2300;
  width: min(520px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(4, 14, 26, .28);
}
.fm-install-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: none;
}
.fm-install-banner-text { flex: 1; min-width: 0; }
.fm-install-banner-text strong {
  display: block;
  color: #0b2545;
  font-size: 12.5px;
  line-height: 1.35;
}
.fm-install-banner-text span {
  display: block;
  color: #64748b;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-install-banner .fm-btn-primary {
  flex: none;
  padding: 7px 12px;
  font-size: 11.5px;
}
.fm-install-banner-close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
@media (min-width: 900px) {
  .fm-install-banner { display: none !important; }
}

/* paired floating actions: weather photo + CCTV near me */
.fm-fab-pair {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 999;
  width: min(330px, calc(100vw - 16px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: calc(100vw - 16px);
  transform: translateX(-50%);
}
.fm-fab-pair .fm-photo-fab {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
}
.fm-fab-pair .fm-photo-fab-label { white-space: nowrap; }
.fm-fab-pair .fm-photo-fab:hover { transform: translateY(-1px); }
.fm-fab-pair .fm-photo-fab:active { transform: none; }
.fm-cam-near-fab {
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
  box-shadow: 0 8px 20px rgba(8, 145, 178, .38);
}
.fm-fab-pair .fm-cam-near-fab:hover {
  box-shadow: 0 10px 24px rgba(8, 145, 178, .5);
}
.fm-fab-pair .fm-cam-near-fab:active {
  box-shadow: 0 6px 16px rgba(8, 145, 178, .4);
}
.fm-fab-pair .fm-cam-near-fab:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 6px rgba(8, 145, 178, .35), 0 8px 20px rgba(8, 145, 178, .38);
}
@media (min-width: 900px) {
  .fm-fab-pair { left: calc(50% + 186px); bottom: 24px; }
}
@media (max-width: 380px) {
  .fm-fab-pair { gap: 6px; }
}

/* CCTV-near mode header in the Near tab */
.fm-cam-near-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: 11.5px;
}
.fm-cam-near-head strong { font-size: 12px; }
.fm-cam-near-head span { color: #0369a1; }
.fm-cam-near-head .fm-linkbtn { margin-left: auto; flex: none; }
@media (max-width: 899px) {
  /* keep the 3 km circle visible above the CCTV-near list */
  .fm-sheet.-camnear[data-open="true"] { max-height: 48vh; }
}

/* do not let the install nudge cover the open list sheet */
body.fm-sheet-open .fm-install-banner { display: none !important; }
.fm-fab-pair .fm-photo-fab:disabled { opacity: .72; cursor: default; }

/* return-to-Hat-Yai floating button, shown only when the map is far away */
.fm-home-fab {
  position: absolute;
  left: 12px;
  bottom: 140px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #cfe3f7;
  border-radius: 999px;
  background: #fff;
  color: #0b2545;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(4, 14, 26, .22);
  cursor: pointer;
}
.fm-home-fab svg { width: 16px; height: 16px; fill: #0e7490; flex: none; }
.fm-home-fab:hover { background: #f0f9ff; }
.fm-home-fab:focus-visible { outline: 3px solid #0891b2; outline-offset: 2px; }
body.fm-far-home .fm-install-banner { display: none !important; }
@media (min-width: 900px) {
  .fm-home-fab { left: 384px; bottom: 96px; }
}
@media (max-width: 380px) {
  .fm-home-fab { bottom: 136px; font-size: 11px; padding: 0 10px; }
}
@media (max-width: 899px) {
  /* keep the home pill above the open CCTV-near sheet */
  body.fm-camnear-open .fm-home-fab { bottom: calc(48vh + 12px); }
}
