/* ==========================================================================
   Fish AI Map
   Left rail + full-bleed map. Mobile: rail becomes a bottom sheet.
   Density is compact but never below a 44px touch target.
   ========================================================================== */

:root {
  /* surfaces — warm-neutral paper, not cold grey */
  --paper: #f7f8f9;
  --raised: #ffffff;
  --sunken: #eceff2;
  --ink: #0e1c2b;
  --ink-2: #46586d;
  --mute: #7c8b9c;
  --mute-2: #a7b3c0;
  --line: #e6eaee;
  --line-2: #d3dae1;
  --hair: #f0f3f5;

  /* brand — deep water */
  --deep: #0e1c2b;
  --deep-2: #20364f;
  --on-deep: #ffffff;

  /* accent — clean water blue */
  --aqua: #0b7fc4;
  --aqua-ink: #075c8f;
  --aqua-soft: #e8f3fb;

  /* tiers */
  --great: #12996a;
  --great-soft: #e4f6ef;
  --great-ink: #0a6647;
  --good: #d98207;
  --good-soft: #fdf1dd;
  --good-ink: #8a5304;
  --fair: #c94a4a;
  --fair-soft: #fceceb;
  --fair-ink: #96302c;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  --sh-1: 0 1px 2px rgba(14, 28, 43, 0.05);
  --sh-2: 0 4px 14px -4px rgba(14, 28, 43, 0.12);
  --sh-3: 0 18px 44px -12px rgba(14, 28, 43, 0.28);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.22s;

  --sans: "Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono Variable", "Geist Mono", ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;

  --rail: 372px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b111a;
    --raised: #121b27;
    --sunken: #070c13;
    --ink: #eef2f6;
    --ink-2: #b9c5d2;
    --mute: #8394a5;
    --mute-2: #5a6878;
    --line: #222e3d;
    --line-2: #31404f;
    --hair: #18222f;
    --deep: #eef2f6;
    --deep-2: #ffffff;
    --on-deep: #0b111a;
    --aqua: #3aa8e8;
    --aqua-ink: #7fcbf3;
    --aqua-soft: #102636;
    --great-soft: #0b2a1f;
    --great-ink: #46cd9b;
    --good-soft: #2b2210;
    --good-ink: #eab35c;
    --fair-soft: #2b1615;
    --fair-ink: #ef8a85;
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; height: 100%; }

body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex-shrink: 0; }
button { font-family: inherit; color: inherit; }

.kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

/* ---------- shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  height: 100dvh;
}

/* ---------- rail ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--raised);
  border-right: 1px solid var(--line);
  z-index: 20;
  padding-left: env(safe-area-inset-left);
}

/* header ------------------------------------------------ */
.sb-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 16px;
  padding-top: calc(20px + env(safe-area-inset-top));
  flex-shrink: 0;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--deep);
  color: var(--on-deep);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: var(--sh-1);
}
.brand-mark .icon { width: 21px; height: 21px; }
.brand-text { flex: 1; min-width: 0; }
.brand-name { font-weight: 640; font-size: 15px; letter-spacing: -0.015em; line-height: 1.2; }
.brand-sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); margin-top: 1px; }

.auth-row { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.btn-mini {
  min-height: 32px; padding: 0 12px;
  font-size: 12.5px; font-weight: 540;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  background: var(--raised);
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-mini:hover { background: var(--sunken); border-color: var(--mute-2); }
.btn-mini.primary { background: var(--deep); color: var(--on-deep); border-color: var(--deep); }
.btn-mini.primary:hover { background: var(--deep-2); }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  min-height: 32px; padding: 0 4px 0 10px;
  border-radius: var(--r-full);
  background: var(--aqua-soft); color: var(--aqua-ink);
  font-size: 12.5px; font-weight: 580;
}
.user-chip .icon { width: 14px; height: 14px; }
.user-chip .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 92px; }

.icon-btn {
  width: 30px; height: 30px; min-width: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  border: none; background: transparent; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.icon-btn:hover { background: rgba(14, 28, 43, 0.08); }
.icon-btn .icon { width: 15px; height: 15px; }

/* form ------------------------------------------------ */
.sb-form { padding: 0 20px 18px; flex-shrink: 0; }

.field { margin-bottom: 13px; position: relative; }
.field > label { display: block; margin-bottom: 6px; }

.input, select.input {
  width: 100%;
  min-height: var(--tap);
  font-family: var(--sans);
  font-size: 16px;             /* 16px prevents iOS focus-zoom */
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 13px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input::placeholder { color: var(--mute-2); }
.input:hover, select.input:hover { border-color: var(--mute-2); }
.input:focus, select.input:focus {
  border-color: var(--aqua);
  background: var(--raised);
  box-shadow: 0 0 0 3.5px var(--aqua-soft);
}
select.input {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%237c8b9c' stroke-width='1.7' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 34px;
}

.input-icon { position: relative; }
.input-icon .icon-lead {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--mute); width: 15px; height: 15px; pointer-events: none;
}
.input-icon .input { padding-left: 36px; }

/* species picker button */
.species-pick {
  display: flex; align-items: center; gap: 11px;
  width: 100%; min-height: 58px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  cursor: pointer; text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.species-pick:hover { border-color: var(--aqua); background: var(--raised); }
.species-pick img, .species-pick .ph {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--sunken); flex-shrink: 0;
}
.species-pick .ph { display: grid; place-items: center; color: var(--mute-2); }
.species-pick .ph .icon { width: 20px; height: 20px; }
.species-pick .sp-name { flex: 1; font-size: 14.5px; font-weight: 580; letter-spacing: -0.01em; }
.species-pick .sp-none { flex: 1; font-size: 14.5px; color: var(--mute); }
.species-pick .sp-swap { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--aqua-ink); }

.locate-line { display: flex; justify-content: flex-end; margin-top: 7px; }
.link-btn {
  background: none; border: none; padding: 0;
  min-height: 30px;
  color: var(--aqua-ink); font-size: 12.5px; font-weight: 520;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn .icon { width: 13px; height: 13px; }

.btn-primary {
  width: 100%; min-height: 48px; margin-top: 4px;
  background: var(--deep); color: var(--on-deep);
  border: none; border-radius: var(--r-md);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--sh-1);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn-primary:hover { background: var(--deep-2); }
.btn-primary:active { transform: scale(0.988); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary .icon { width: 16px; height: 16px; }

/* suggestions ------------------------------------------------ */
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0;
  margin-top: 5px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  z-index: 60;
  max-height: 250px; overflow-y: auto;
  overflow: hidden auto;
}
.suggestions[hidden] { display: none; }
.suggestion {
  display: block; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--hair);
  padding: 10px 13px; min-height: var(--tap); cursor: pointer;
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion:focus { background: var(--aqua-soft); outline: none; }
.suggestion-main { display: block; font-size: 13.5px; font-weight: 560; }
.suggestion-sub { display: block; font-size: 11.5px; color: var(--mute); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- results ---------- */
.sb-results { flex: 1; overflow-y: auto; min-height: 0; border-top: 1px solid var(--line); }

.results-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 20px 10px;
  position: sticky; top: 0; z-index: 6;
  /* Solid, not a gradient — cards were visibly scrolling through it. */
  background: var(--raised);
  box-shadow: 0 6px 8px -6px rgba(14, 28, 43, 0.12);
}
.results-head h2 { margin: 0; font-size: 13px; font-weight: 620; letter-spacing: -0.01em; }
.results-head .meta { font-family: var(--mono); font-size: 10px; color: var(--mute); white-space: nowrap; }

/* Shared conditions — stated once for the whole search, not per card */
.conditions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 20px 13px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.cond {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 540; color: var(--mute);
  background: var(--sunken);
  border-radius: var(--r-full);
  padding: 4px 10px;
}
.cond .icon { width: 12px; height: 12px; opacity: 0.75; }
.cond em {
  font-style: normal; font-size: 10px; font-weight: 500;
  opacity: 0.72; margin-left: 1px;
}
.cond.on { background: var(--great-soft); color: var(--great-ink); }
.cond.on .icon { opacity: 1; }

/* spot card ------------------------------------------------ */
.spot-card {
  position: relative;
  padding: 13px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--hair);
  transition: background var(--dur) var(--ease);
}
.spot-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent; transition: background var(--dur) var(--ease);
}
.spot-card:hover { background: var(--paper); }
.spot-card.active { background: var(--aqua-soft); }
.spot-card.active::before { background: var(--aqua); }

.sc-top { display: flex; align-items: baseline; gap: 9px; }
.sc-rank {
  font-family: var(--mono); font-size: 10px; color: var(--mute-2);
  width: 15px; flex-shrink: 0; padding-top: 2px;
}
.sc-name {
  flex: 1; min-width: 0;
  font-size: 14.5px; font-weight: 620; letter-spacing: -0.015em; line-height: 1.25;
}
/* numeric rating, e.g. 4.8 */
.sc-score {
  display: flex; flex-direction: column; align-items: flex-end;
  flex-shrink: 0; line-height: 1;
}
.sc-score b {
  font-family: var(--mono);
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.sc-score i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mute); margin-top: 3px;
}
.sc-score.great b { color: var(--great); }
.sc-score.good b { color: var(--good); }
.sc-score.fair b { color: var(--fair); }

.rating-pill {
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: var(--r-full);
  background: var(--sunken); color: var(--ink);
}
.rating-pill.great { background: var(--great-soft); color: var(--great-ink); }
.rating-pill.good { background: var(--good-soft); color: var(--good-ink); }
.rating-pill.fair { background: var(--fair-soft); color: var(--fair-ink); }

.sc-sub {
  display: flex; align-items: center; gap: 7px;
  margin: 3px 0 0 24px;
  font-size: 12px; color: var(--mute);
}
.sc-sub .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--mute-2); flex-shrink: 0; }
.tier-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.tier-dot.great { background: var(--great); }
.tier-dot.good { background: var(--good); }
.tier-dot.fair { background: var(--fair); }

.sc-why {
  margin: 7px 0 0 24px;
  font-size: 12.5px; color: var(--ink-2); line-height: 1.4;
  display: flex; gap: 7px; align-items: flex-start;
}
.sc-why .icon { width: 13px; height: 13px; color: var(--aqua); margin-top: 2px; flex-shrink: 0; }

.sc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0 24px; }
.chip {
  font-size: 11px; color: var(--ink-2);
  background: var(--sunken);
  border-radius: var(--r-full);
  padding: 2.5px 8px;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.chip .icon { width: 11px; height: 11px; color: var(--mute); }
.chip.reports { background: var(--aqua-soft); color: var(--aqua-ink); }
.chip.reports .icon { color: var(--aqua-ink); }

/* actions only appear on the active card — keeps the list calm */
.sc-actions {
  display: none;
  gap: 7px; margin: 11px 0 2px 24px;
}
.spot-card.active .sc-actions { display: flex; }
.chip-btn {
  min-height: 34px; padding: 0 12px;
  font-size: 12px; font-weight: 550;
  border: 1px solid var(--line-2); background: var(--raised);
  border-radius: var(--r-full); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip-btn:hover { background: var(--sunken); border-color: var(--mute-2); }
.chip-btn.accent { background: var(--deep); color: var(--on-deep); border-color: var(--deep); }
.chip-btn.accent:hover { background: var(--deep-2); }
.chip-btn .icon { width: 13px; height: 13px; }

.list-note {
  margin: 16px 20px;
  padding: 16px 18px;
  font-size: 13px; color: var(--ink-2); line-height: 1.55;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.list-note strong { color: var(--ink); font-weight: 600; }
.list-credit {
  padding: 14px 20px 26px;
  font-family: var(--mono); font-size: 9.5px; color: var(--mute-2); line-height: 1.6;
}

/* ---------- map ---------- */
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 1; background: var(--sunken); }

.map-overlay-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: center;
  padding: 14px 14px 0;
  padding-top: calc(14px + env(safe-area-inset-top));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-2);
  border-radius: var(--r-full);
  padding: 9px 15px;
  font-size: 12.5px; color: var(--ink-2);
  max-width: 92%;
  animation: drop var(--dur) var(--ease);
}
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }
.toast .icon { width: 14px; height: 14px; color: var(--aqua); flex-shrink: 0; }
.toast[hidden] { display: none; }

.legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 10;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  padding: 9px 12px;
  font-size: 10.5px; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 5px;
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.great { background: var(--great); }
.dot.good { background: var(--good); }
.dot.fair { background: var(--fair); }

.loading-overlay {
  position: absolute; inset: 0; z-index: 15;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  display: none; align-items: center; justify-content: center;
}
.loading-overlay.visible { display: flex; }
.loading-card {
  background: var(--raised);
  border: 1px solid var(--line);
  box-shadow: var(--sh-3);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  display: flex; align-items: center; gap: 13px;
  font-size: 13.5px; color: var(--ink-2); max-width: 84%;
}
.spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid var(--line-2); border-top-color: var(--aqua);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- markers ---------- */
.fish-marker { background: none; border: none; }
.fm-wrap {
  /* Column layout: rating sits ABOVE the pin. It used to be pinned to the
     top-right corner, where it covered the fish glyph and its neighbours. */
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 100%;
  transition: transform var(--dur) var(--ease);
  filter: drop-shadow(0 3px 5px rgba(14, 28, 43, 0.32));
}
.fm-drop { display: block; flex: none; }
.fm-fish {
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  width: 58%; height: 58%;
  color: #fff;
  display: grid; place-items: center;
  /* Explicit stacking: without it the teardrop SVG can paint over the glyph. */
  z-index: 2;
  pointer-events: none;
}
.fm-fish-svg { width: 100%; height: 100%; }
.fm-rate {
  flex: none;
  margin-bottom: -4px;
  height: 17px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: #fff;
  color: var(--pin);
  border: 1.5px solid var(--pin);
  font-family: var(--mono);
  font-size: 10px; font-weight: 700; line-height: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
  position: relative;
  z-index: 3;
}
.fm-wrap.is-top { filter: drop-shadow(0 4px 8px rgba(14, 28, 43, 0.42)); }

/* Cluster badge: shown where several pins would otherwise overlap. */
.fish-cluster { background: none; border: none; }
.fc-wrap {
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--pin);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(14, 28, 43, 0.35);
  cursor: pointer;
  transition: transform var(--dur) var(--ease);
  position: relative;
}
/* Soft halo so a cluster reads as "several", not one big pin */
.fc-wrap::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--pin) 22%, transparent);
  z-index: -1;
}
.fish-cluster:hover { z-index: 1000 !important; }
.fish-cluster:hover .fc-wrap { transform: scale(1.1); }
.fc-count {
  font-family: var(--mono);
  font-size: 13px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fish-marker:hover { z-index: 1000 !important; }
.fish-marker:hover .fm-wrap { transform: scale(1.12); }
.fish-marker.is-active .fm-wrap { transform: scale(1.2); }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(14, 28, 43, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  width: 100%; max-width: 440px; max-height: 88dvh;
  display: flex; flex-direction: column;
  animation: pop 0.24s var(--ease);
  overflow: hidden;
}
@keyframes pop { from { transform: translateY(12px) scale(0.99); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 640; flex: 1; letter-spacing: -0.015em; }
.modal-body { padding: 18px; overflow-y: auto; }

.tabs { display: flex; gap: 4px; background: var(--sunken); padding: 3px; border-radius: var(--r-md); margin-bottom: 16px; }
.tab {
  flex: 1; min-height: 38px; border: none; background: none;
  border-radius: var(--r-sm); font-size: 13.5px; font-weight: 580;
  color: var(--mute); cursor: pointer; transition: all var(--dur) var(--ease);
}
.tab.on { background: var(--raised); color: var(--ink); box-shadow: var(--sh-1); }

.form-msg { font-size: 12.5px; padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 13px; line-height: 1.45; }
.form-msg.err { background: var(--fair-soft); color: var(--fair-ink); }
.form-msg[hidden] { display: none; }
.auth-lede { margin: 0 0 14px; font-size: 13.5px; line-height: 1.5; color: var(--mute); }

.note-box {
  font-size: 11.5px; color: var(--mute); line-height: 1.5;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 11px 13px; margin-top: 14px;
  display: flex; gap: 8px; align-items: flex-start;
}
.note-box .icon { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; color: var(--mute-2); }

/* 1-5 picker, numeric to match the ratings shown everywhere else */
.rate-input { display: flex; gap: 6px; }
.rate-num {
  flex: 1;
  min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid var(--line-2); background: var(--paper);
  border-radius: var(--r-md); cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.rate-num b {
  font-family: var(--mono); font-size: 15px; font-weight: 700; line-height: 1;
}
.rate-num i {
  font-style: normal; font-size: 10.5px; color: var(--mute);
  letter-spacing: 0.02em;
}
.rate-num:hover { border-color: var(--aqua); background: var(--raised); }
.rate-num.on {
  background: var(--deep); border-color: var(--deep); color: var(--on-deep);
}
.rate-num.on i { color: var(--on-deep); opacity: 0.72; }

textarea.input { min-height: 82px; resize: vertical; line-height: 1.5; }

.photo-drop {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--tap);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  padding: 11px 13px; cursor: pointer;
  color: var(--mute); font-size: 13.5px;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.photo-drop:hover { border-color: var(--aqua); color: var(--aqua-ink); background: var(--aqua-soft); }
.photo-drop .icon { width: 17px; height: 17px; }
.photo-preview { margin-top: 10px; position: relative; display: inline-block; }
.photo-preview img { max-width: 100%; max-height: 180px; border-radius: var(--r-md); display: block; }
.photo-preview .icon-btn { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.6); color: #fff; }
.photo-preview .icon-btn:hover { background: rgba(0,0,0,0.78); }

.review { padding: 13px 0; border-bottom: 1px solid var(--hair); }
.review:last-child { border-bottom: none; }
.review-top { display: flex; align-items: center; gap: 9px; }
.review-author { font-weight: 600; font-size: 13.5px; flex: 1; }
.review-date { font-family: var(--mono); font-size: 10px; color: var(--mute-2); }
.review-species { font-size: 12.5px; color: var(--aqua-ink); margin-top: 4px; font-weight: 560; }
.review-note { font-size: 13px; color: var(--ink-2); margin-top: 5px; line-height: 1.5; }
.review img.review-photo { margin-top: 9px; max-width: 100%; border-radius: var(--r-md); display: block; }

.species-list { display: flex; flex-direction: column; gap: 2px; }
.species-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 10px;
  border: none; background: none; border-radius: var(--r-md);
  cursor: pointer; text-align: left; width: 100%;
  transition: background var(--dur) var(--ease);
}
.species-row:hover, .species-row:focus { background: var(--aqua-soft); outline: none; }
.species-row.on { background: var(--aqua-soft); box-shadow: inset 0 0 0 1px var(--aqua); }
.species-row img, .species-row .ph {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--sunken); flex-shrink: 0;
}
.species-row .ph { display: grid; place-items: center; color: var(--mute-2); }
.species-row .ph .icon { width: 21px; height: 21px; }
.species-row .info { flex: 1; min-width: 0; }
.species-row .nm { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.species-row .meta { font-size: 11.5px; color: var(--mute); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- offline ---------- */
.offline-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 30;
  display: none;
  background: var(--good-soft); color: var(--good-ink);
  border-top: 1px solid var(--good);
  font-size: 12px; text-align: center; padding: 8px 14px;
}
.offline-bar.visible { display: block; }

/* ==========================================================================
   Mobile — rail becomes a bottom sheet
   ========================================================================== */
.sheet-handle { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; position: relative; }
  .map-wrap { position: absolute; inset: 0; }

  .sidebar {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    height: 88dvh;
    /* Position is driven from JS so the panel can track your finger.
       A CSS transition here would fight the drag, so it's applied
       inline only when the sheet is snapping. */
    transform: translateY(calc(100% - var(--peek, 268px)));
    will-change: transform;
    touch-action: none;
    border-right: none; border-top: 1px solid var(--line);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: 0 -10px 34px -10px rgba(14, 28, 43, 0.3);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 40;
  }
  /* The list scrolls on its own and must not drag the page with it. */
  .sb-results { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .sb-form { touch-action: pan-y; }
  .sheet-handle { cursor: grab; }
  .sheet-handle:active { cursor: grabbing; }

  .sheet-handle {
    display: flex; align-items: center; justify-content: center;
    min-height: 26px; padding-top: 9px;
    flex-shrink: 0; cursor: grab; touch-action: none;
  }
  .sheet-handle::before {
    content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2);
  }

  .sb-head { padding: 10px 18px 14px; }
  .sb-form { padding: 0 18px 16px; }
  .results-head { padding: 13px 18px 9px; }
  .spot-card { padding: 13px 18px; }
  .list-note { margin: 14px 18px; }
  .list-credit { padding: 14px 18px 26px; }

  .legend { display: none; }
  .leaflet-bottom.leaflet-right { bottom: calc(var(--peek, 250px) + 10px); }
}

@media (max-width: 400px) {
  .sb-head { padding: 10px 15px 12px; gap: 9px; }
  .sb-form { padding: 0 15px 14px; }
  .spot-card { padding: 12px 15px; }
  .results-head { padding: 12px 15px 8px; }
  .brand-sub { display: none; }
  .btn-mini { padding: 0 10px; font-size: 12px; }
  .user-chip .who { max-width: 64px; }
  .brand-mark { width: 32px; height: 32px; }
}

/* Never shrink a target below 44px on touch */
@media (pointer: coarse) {
  .btn-mini, .chip-btn, .link-btn, .icon-btn { min-height: var(--tap); }
  .icon-btn { width: var(--tap); height: var(--tap); min-width: var(--tap); }
  .suggestion, .species-row { min-height: var(--tap); }
  .leaflet-control-zoom a { width: var(--tap) !important; height: var(--tap) !important; line-height: 42px !important; }
}

/* ---------- Leaflet ---------- */
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--raised) 88%, transparent) !important;
  color: var(--mute) !important; font-size: 9.5px !important;
}
.leaflet-control-attribution a { color: var(--aqua-ink) !important; }
.leaflet-control-zoom { border: none !important; box-shadow: var(--sh-2) !important; border-radius: var(--r-md) !important; overflow: hidden; }
.leaflet-control-zoom a {
  background: var(--raised) !important; color: var(--ink) !important;
  border-color: var(--line) !important;
  width: 38px !important; height: 38px !important; line-height: 36px !important;
}
.leaflet-control-zoom a:hover { background: var(--sunken) !important; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: brightness(0.62) saturate(0.72) contrast(1.1) hue-rotate(-6deg); }
}


/* ---------- identify-a-fish ---------- */
/* Camera lives in a footer bar at the bottom of the rail, so it is
   anchored to real UI instead of floating in the empty space below an
   unsearched results list. */
.sb-foot {
  position: fixed;
  left: 0; bottom: 0;
  width: var(--rail);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 20px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  padding-left: calc(20px + env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--raised);
}
/* Keep the results list clear of the fixed footer. */
.sb-results { padding-bottom: 68px; }
.sb-foot-hint {
  font-size: 12.5px;
  color: var(--mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.camera-fab {
  position: relative;
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: grid; place-items: center;
  padding: 0;
  border-radius: var(--r-md);
  border: none;
  background: var(--deep); color: var(--on-deep);
  box-shadow: var(--sh-1);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.camera-fab:hover { background: var(--deep-2); }
.camera-fab:active { transform: scale(0.96); }
.camera-fab:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }
.cf-icon { display: grid; place-items: center; }
.cf-icon svg { width: 21px; height: 21px; }

/* The tooltip is only needed where the button floats alone (mobile);
   in the rail the adjacent hint text already labels it. */
.cf-label {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  white-space: nowrap;
  background: var(--deep);
  color: var(--on-deep);
  font-size: 12.5px; font-weight: 550;
  padding: 7px 11px;
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  opacity: 0;
  pointer-events: none;
  display: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.cf-label::before {
  content: "";
  position: absolute;
  right: 100%; top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--deep);
}

/* Hover/focus reveals the tooltip, but only where it's shown at all. */
.camera-fab:hover .cf-label,
.camera-fab:focus-visible .cf-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.photo-capture {
  display: flex; align-items: center; gap: 13px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 22px 18px;
  cursor: pointer; color: var(--ink-2);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.photo-capture:hover { border-color: var(--aqua); background: var(--aqua-soft); }
.photo-capture svg { width: 26px; height: 26px; color: var(--aqua); flex-shrink: 0; }
.photo-capture b { display: block; font-size: 14.5px; font-weight: 600; }
.photo-capture small { display: block; font-size: 12px; color: var(--mute); margin-top: 2px; }

.id-preview {
  width: 100%; max-height: 220px; object-fit: contain;
  border-radius: var(--r-md); background: var(--sunken);
  display: block; margin-bottom: 14px;
}
.id-working {
  display: flex; align-items: center; gap: 11px;
  font-size: 13.5px; color: var(--ink-2);
  padding: 4px 0;
}
.id-verdict {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--sunken); margin-bottom: 14px;
}
.id-verdict svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--mute); }
.id-verdict b { display: block; font-size: 14px; font-weight: 620; }
.id-verdict p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.id-verdict.ok { background: var(--great-soft); }
.id-verdict.ok svg, .id-verdict.ok b { color: var(--great-ink); }
.id-verdict.warn { background: var(--good-soft); }
.id-verdict.warn svg, .id-verdict.warn b { color: var(--good-ink); }

.id-actions { display: flex; flex-direction: column; gap: 8px; }
.id-actions .btn-primary { margin-top: 0; }
.id-actions .chip-btn { justify-content: center; }

.water-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 14px; }
.water-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 78px; padding: 13px 10px;
  border: 1.5px solid var(--line-2); background: var(--paper);
  border-radius: var(--r-md); cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.water-btn svg { width: 21px; height: 21px; color: var(--aqua); }
.water-btn span { font-size: 13.5px; font-weight: 600; }
.water-btn small { font-size: 11px; color: var(--mute); }
.water-btn:hover { border-color: var(--aqua); background: var(--raised); }
.water-btn.on { border-color: var(--aqua); background: var(--aqua-soft); box-shadow: 0 0 0 3px var(--aqua-soft); }
.water-btn.on small { color: var(--aqua-ink); }

/* ---------- results filter (icon + dropdown) ---------- */
.filter-wrap { position: relative; flex-shrink: 0; }
.filter-btn {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  background: var(--raised);
  border-radius: var(--r-md);
  cursor: pointer; color: var(--ink-2);
  transition: all var(--dur) var(--ease);
}
.filter-btn svg { width: 16px; height: 16px; }
.filter-btn:hover { border-color: var(--aqua); color: var(--aqua-ink); }
.filter-btn.on { background: var(--deep); color: var(--on-deep); border-color: var(--deep); }
.fb-dot {
  position: absolute; top: -3px; right: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--aqua); border: 2px solid var(--raised);
}

.filter-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: 246px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  z-index: 80;
  padding: 5px;
  max-height: 70vh; overflow-y: auto;
  animation: fmIn 0.16s var(--ease);
}
@keyframes fmIn { from { opacity: 0; transform: translateY(-4px); } }
.filter-menu[hidden] { display: none; }

.fm-sec + .fm-sec { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }
.fm-head {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px 5px;
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mute);
}
.fm-head svg { width: 12px; height: 12px; }

.fm-row {
  display: flex; align-items: center; gap: 9px;
  width: 100%; min-height: 38px;
  padding: 7px 9px;
  border: none; background: none;
  border-radius: var(--r-sm);
  cursor: pointer; text-align: left;
  color: var(--ink); font-size: 13px;
  transition: background var(--dur) var(--ease);
}
.fm-row:hover { background: var(--sunken); }
.fm-row.on { background: var(--aqua-soft); color: var(--aqua-ink); font-weight: 580; }
.fm-row > svg:first-child { width: 15px; height: 15px; color: var(--mute); flex-shrink: 0; }
.fm-row.on > svg:first-child { color: var(--aqua-ink); }
.fm-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-n { font-family: var(--mono); font-size: 10.5px; color: var(--mute); }
.fm-row.on .fm-n { color: var(--aqua-ink); }
.fm-tick { width: 14px; height: 14px; color: var(--aqua-ink); }
.fm-chev { width: 14px; height: 14px; color: var(--mute-2); }

.fm-row.species { min-height: 46px; }
.fm-thumb {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--sunken);
  display: grid; place-items: center; color: var(--mute-2); flex-shrink: 0;
}
.fm-thumb svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .filter-bar { padding: 0 18px 10px; }
  /* The rail is a bottom sheet here, so a footer inside it would be
     hidden. Float the button over the map, clear of the sheet. */
  .sb-foot {
    width: auto;
    padding: 0;
    border: none;
    background: none;
    pointer-events: none;
    z-index: 60;
  }
  .sb-results { padding-bottom: 0; }
  .sb-foot-hint { display: none; }
  .camera-fab {
    pointer-events: auto;
    position: absolute;
    left: 14px;
    bottom: calc(var(--peek, 250px) + 14px);
    width: 48px; height: 48px;
    border-radius: var(--r-full);
    box-shadow: var(--sh-3);
  }
}

/* ---------- driving route ---------- */
.route-bar {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%) translateY(8px);
  z-index: 25;
  display: none;
  align-items: center; gap: 11px;
  max-width: min(92%, 460px);
  padding: 10px 12px 10px 15px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  box-shadow: var(--sh-3);
  font-size: 13px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.route-bar.visible { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }
.route-bar > svg { width: 18px; height: 18px; color: #d02b2b; flex-shrink: 0; }
.rb-main { flex: 1; min-width: 0; line-height: 1.25; }
.rb-main b { display: block; font-size: 13.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-main small { display: block; font-size: 11.5px; color: var(--mute); margin-top: 1px; }
.rb-go {
  flex-shrink: 0;
  background: #d02b2b; color: #fff;
  text-decoration: none;
  font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--r-full);
  min-height: 36px; display: inline-flex; align-items: center;
}
.rb-go:hover { background: #b62525; }

/* red destination pin */
.dest-marker { background: none; border: none; }
.dm-wrap { filter: drop-shadow(0 4px 7px rgba(14, 28, 43, 0.45)); animation: destDrop 0.4s var(--ease); }
@keyframes destDrop { from { transform: translateY(-14px); opacity: 0; } }

@media (max-width: 900px) {
  .route-bar {
    bottom: calc(var(--peek, 250px) + 12px);
    left: 12px; right: 12px;
    max-width: none;
    transform: none;
  }
  .route-bar.visible { transform: none; }
}

.id-pct {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  opacity: 0.8;
}
.id-alt {
  font-size: 12.5px; color: var(--mute);
  margin: -6px 0 12px; padding: 0 2px;
}
.id-alt .link-btn { font-size: 12.5px; font-weight: 600; }

.taught-note {
  display: flex; align-items: center; gap: 7px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--mute);
}
.taught-note svg { width: 14px; height: 14px; color: var(--great); flex-shrink: 0; }
.taught-note .link-btn { font-size: 12px; }

/* ---------- correct / wrong feedback ---------- */
.verdict-ask {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mute);
  margin: 4px 0 8px;
}
.verdict-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.vb {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line-2);
  background: var(--paper);
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.vb svg { width: 19px; height: 19px; }
.vb.yes { border-color: var(--great); color: var(--great-ink); background: var(--great-soft); }
.vb.yes:hover { background: var(--great); color: #fff; border-color: var(--great); }
.vb.no { border-color: var(--line-2); color: var(--ink-2); }
.vb.no:hover { background: var(--fair-soft); color: var(--fair-ink); border-color: var(--fair); }
.vb:active { transform: scale(0.97); }

.sc-setting { text-transform: capitalize; }

/* ==========================================================================
   Mobile polish — bigger targets, comfortable text, safe areas
   ========================================================================== */
@media (max-width: 900px) {
  :root { --peek: 268px; }

  /* Sheet: rounded, draggable, with room to breathe */
  .sidebar {
    height: 90dvh;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px -12px rgba(14, 28, 43, 0.32);
  }
  .sheet-handle { min-height: 30px; padding-top: 11px; }
  .sheet-handle::before { width: 44px; height: 5px; }

  /* Everything you tap gets a full 48px on a phone */
  .btn-mini { min-height: 40px; padding: 0 15px; font-size: 13.5px; }
  .btn-primary { min-height: 52px; font-size: 16px; }
  .species-pick { min-height: 64px; }
  .species-pick img, .species-pick .ph { width: 44px; height: 44px; }
  .species-pick .sp-name, .species-pick .sp-none { font-size: 15.5px; }
  .input, select.input { min-height: 50px; font-size: 16px; padding: 12px 14px; }
  .input-icon .input { padding-left: 40px; }
  .link-btn { min-height: 44px; font-size: 13.5px; }
  .chip-btn { min-height: 42px; padding: 0 14px; font-size: 13px; }
  .filter-btn { width: 42px; height: 42px; }
  .filter-btn svg { width: 18px; height: 18px; }

  /* Result cards: larger type, more room between rows */
  .spot-card { padding: 15px 18px; }
  .sc-name { font-size: 16px; }
  .sc-sub { font-size: 13px; margin-top: 5px; }
  .sc-why { font-size: 13.5px; margin-top: 9px; }
  .chip { font-size: 12px; padding: 4px 10px; }
  .sc-score b { font-size: 19px; }
  .sc-actions { gap: 8px; margin-top: 13px; flex-wrap: wrap; }
  .sc-actions .chip-btn { flex: 1 1 auto; justify-content: center; }

  .results-head h2 { font-size: 14.5px; }
  .cond { font-size: 12.5px; padding: 6px 12px; }

  /* Dropdown becomes a proper sheet-width panel */
  .filter-menu {
    width: min(320px, calc(100vw - 36px));
    max-height: 60vh;
  }
  .fm-row { min-height: 46px; font-size: 14px; }
  .fm-row.species { min-height: 56px; }

  /* Modals: full-height sheets rather than floating cards */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: none;
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    animation: sheetUp 0.26s var(--ease);
  }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .modal-head { padding: 16px 18px; }
  .modal-head h3 { font-size: 17px; }
  .modal-body {
    padding: 18px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .icon-btn { width: 44px; height: 44px; min-width: 44px; }
  .icon-btn .icon { width: 18px; height: 18px; }

  .species-row { min-height: 64px; padding: 9px 11px; }
  .species-row img, .species-row .ph { width: 50px; height: 50px; }
  .species-row .nm { font-size: 15px; }
  .species-row .meta { font-size: 12.5px; }

  .tab { min-height: 44px; font-size: 14.5px; }
  .vb { min-height: 58px; font-size: 15.5px; }
  .rate-num { min-height: 58px; }
  .rate-num b { font-size: 17px; }
  .water-btn { min-height: 88px; }
  .water-btn span { font-size: 14.5px; }
  .photo-capture { padding: 26px 18px; }
  .photo-capture b { font-size: 15.5px; }

  /* Route bar sits above the sheet and spans the width */
  .route-bar { padding: 12px 14px 12px 16px; font-size: 13.5px; }
  .rb-go { min-height: 42px; padding: 9px 16px; font-size: 13px; }
}

/* Very small phones */
@media (max-width: 380px) {
  :root { --peek: 244px; }
  .sc-name { font-size: 15px; }
  .btn-primary { min-height: 50px; font-size: 15.5px; }
  .filter-menu { width: calc(100vw - 28px); }
  .verdict-btns { grid-template-columns: 1fr; }
}

/* Landscape phones: the sheet must not eat the screen */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  :root { --peek: 150px; }
  .sidebar { height: 94dvh; }
  .modal-card { max-height: 96dvh; }
}

/* Filter menu as a bottom sheet on phones (moved to <body> so the
   results container's overflow can't clip it). */
.filter-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(14, 28, 43, 0.5);
}
.filter-menu.as-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: auto;
  width: auto; max-width: none;
  margin: 0;
  z-index: 100;
  border-radius: 20px 20px 0 0;
  border-left: none; border-right: none; border-bottom: none;
  max-height: 72dvh;
  padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px -10px rgba(14, 28, 43, 0.4);
  animation: sheetUp 0.24s var(--ease);
}
.filter-menu.as-sheet::before {
  content: "";
  display: block;
  width: 42px; height: 5px;
  margin: 4px auto 10px;
  border-radius: 3px;
  background: var(--line-2);
}
.filter-menu.as-sheet .fm-row { min-height: 52px; font-size: 15px; }
.filter-menu.as-sheet .fm-row.species { min-height: 62px; }
.filter-menu.as-sheet .fm-head { padding: 10px 11px 6px; font-size: 10px; }

/* The camera button lives over the map. Once the sheet is dragged up it
   would sit on top of the form, so it fades out as the sheet opens. */
@media (max-width: 900px) {
  .sb-foot {
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  }
  body.sheet-open .sb-foot {
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
  }
}
