:root {
  color-scheme: dark;
  /* Brand palette sampled from the Sound Deter banner and icon */
  --bg: #0b2a14; --card: #113a1d; --panel: #113a1d; --fg: #f5eedc; --muted: #b3c4ac; --line: #1f5530;
  --accent: #f86a10; --accent-fg: #fff; --ok: #6ee7a0; --bad: #ff8a7a;
  --medium-coyote: #fbbf24; --long-coyote: #ef4444; --doe-bleat: #4ade80; --cow-distress: #38bdf8; --other: #c084fc;
  --field: #0b2a14;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; -webkit-tap-highlight-color: transparent;
}
#map { position: fixed; top: var(--appbar-h); left: 0; right: 0; bottom: 0; background: #071c0d; }


@media (max-width: 719px) { .leaflet-control-zoom { display: none; } } /* pinch to zoom on phones */

/* "Show my location" pill above the control sheet. Dark when idle, orange while following. */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1000;
  min-height: 44px; padding: 0 1.1rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--fg); font: inherit; font-size: .95rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.45); white-space: nowrap;
}
.fab.following { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.fab.on { border-color: var(--ok); }
.fab:active { transform: translateX(-50%) scale(.97); }
.fab.locate { bottom: calc(var(--sheet-h, 150px) + .9rem); }

/* Distance + bearing to the selected device */
.range { font-size: 1rem; min-height: 1.3em; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.range.dim { color: var(--muted); font-size: .85rem; }
.range.here { color: var(--ok); }
.range b { font-weight: 700; }
.range .arrow { display: inline-block; color: var(--accent); font-size: 1.15rem; line-height: 1; transform-origin: 50% 50%; transition: transform .3s; }

/* Compact control sheet: device picker, two buttons, one status line */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 28px rgba(0,0,0,.45);
  padding: .75rem .9rem calc(.75rem + env(safe-area-inset-bottom));
  display: grid; gap: .5rem;
}
.sheet select, .btn {
  width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--field); color: var(--fg); font: inherit; font-size: 1rem; padding: 0 .8rem;
}
.sheet select { appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem; }
.btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.btn { cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.armed { background: #3a2f05; border-color: var(--medium-coyote); color: var(--medium-coyote); }
.status { min-height: 1.2em; font-size: .85rem; color: var(--muted); }
.status.ok { color: var(--ok); } .status.bad { color: var(--bad); }

/* Markers */
.pin { position: relative; width: 26px; height: 26px; }
.pin .dot {
  position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.pin .lbl {
  position: absolute; left: 50%; top: 27px; transform: translateX(-50%);
  white-space: nowrap; font-size: 11px; font-weight: 700; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000;
}
.pin.sel .dot { box-shadow: 0 0 0 4px rgba(59,130,246,.7), 0 2px 6px rgba(0,0,0,.6); }
.me { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(59,130,246,.5), 0 2px 6px rgba(0,0,0,.6); }

.leaflet-popup-content-wrapper { background: var(--panel); color: var(--fg); border-radius: 10px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: .8rem .95rem; font: inherit; }
.leaflet-popup-content .pname { font-weight: 700; margin-bottom: .15rem; }
.leaflet-popup-content .pmeta { color: var(--muted); font-size: .85rem; }
.leaflet-popup-content .pmeta a { color: var(--fg); }
.leaflet-popup-content .pbtns { display: flex; gap: .4rem; margin-top: .6rem; }
.leaflet-popup-content .pbtns .lnk {
  flex: 1; min-height: 36px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: .85rem; text-decoration: none;
}
.leaflet-popup-content .pbtns button {
  flex: 1; min-height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--field); color: var(--fg); font: inherit; font-size: .85rem; cursor: pointer;
}
.leaflet-popup-content .pbtns button.danger { color: var(--bad); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: rgba(11,42,20,.75) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }

@media (min-width: 720px) {
  .sheet { left: auto; right: 1rem; bottom: 1rem; width: 380px; border-radius: 16px; border: 1px solid var(--line); }
  .fab.locate { bottom: 1.25rem; }
}
