:root {
  --ink: #18312d;
  --muted: #5d6f6a;
  --panel: #fffaf0;
  --line: #d9cfb7;
  --forest: #2f7d57;
  --clay: #b74e37;
}

* { box-sizing: border-box; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A class that sets `display` outranks the browser's own [hidden] rule. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: Avenir Next, Trebuchet MS, Verdana, sans-serif;
  color: var(--ink);
}

#map {
  position: absolute;
  inset: 0;
}

.bar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(24, 49, 45, 0.18);
}

.back {
  text-decoration: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: inherit;
}

.bar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  margin-right: auto;
  overflow: hidden;
}

.bar-title strong { font-size: 0.95rem; white-space: nowrap; }
.bar-title small { color: var(--muted); }

.follow {
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.follow.is-on {
  background: var(--forest);
  border-color: var(--forest);
  color: #fffaf0;
}

.back:focus-visible, .follow:focus-visible, .watcher summary:focus-visible,
.watcher-body input:focus-visible, .watcher-body select:focus-visible,
.watcher-body button:focus-visible, .filters input:focus-visible {
  outline: 3px solid #d88b2f;
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .bar-title { display: none; }
  .bar { gap: 6px; padding-inline: 8px; }
  .back { padding-inline: 8px; }
  .follow { padding-inline: 9px; }
  #lang { margin-left: auto; }
  .notify-toggle, .notify-mute {
    min-width: 36px;
    padding-inline: 8px;
    font-size: 0;
  }
  .notify-toggle::before { content: "🔔"; font-size: 0.95rem; }
  .notify-mute::before { content: "🔊"; font-size: 0.95rem; }
  .notify-mute.is-off::before { content: "🔇"; }
}

.panel {
  position: absolute;
  z-index: 500;
  left: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(340px, calc(100% - 24px));
  max-height: 46vh;
  overflow-y: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(24, 49, 45, 0.22);
}

.empty {
  margin: 0;
  color: var(--muted);
}

.riders {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.riders li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.who strong { display: block; }
.who small { color: var(--muted); }

.foot {
  margin: 12px 0 0;
  font-size: 0.85rem;
}

.foot a { color: var(--forest); font-weight: 800; }

.watcher, .filters { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.watcher summary { font-weight: 800; cursor: pointer; }
.watcher-body { display: grid; gap: 8px; margin-top: 10px; }
.watcher-privacy, .watcher-summary {
  margin: 4px 0;
  font-size: .78rem;
  line-height: 1.4;
  color: #536660;
}
.watcher-summary {
  padding: 8px 10px;
  border-left: 3px solid #d88b2f;
  background: rgba(216, 139, 47, .09);
  color: #18312d;
}
.watcher-body input[type=text], .watcher-body select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
.watcher-row { display: flex; gap: 14px; font-size: 0.88rem; }
.watcher-row label { display: flex; gap: 5px; align-items: center; }
.watcher-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.w-send {
  font: inherit; font-weight: 800; cursor: pointer; padding: 13px;
  border-radius: 8px; border: 1px solid var(--forest); background: var(--forest); color: #fffaf0;
}
.w-send:disabled { opacity: 0.6; cursor: progress; }
.w-leave { font: inherit; font-size: 0.85rem; border: 0; background: none; padding: 0;
  color: var(--muted); text-decoration: underline; cursor: pointer; }
.w-message { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--forest); min-height: 1.1em; }
.filters { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; }
.filters label { display: flex; gap: 5px; align-items: center; }

/* A spectator is a hollow mark, so it never reads as a rider. */
.watcher-marker .w-dot {
  display: block; width: 12px; height: 12px; border-radius: 50%;
  background: #fffaf0; border: 3px solid var(--muted);
}
.watcher-marker.is-mine .w-dot { border-color: var(--ink); }
.watcher-marker .w-tag {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 0.68rem; font-weight: 700; padding: 1px 6px;
  border-radius: 999px; background: rgba(255, 250, 240, 0.9); border: 1px solid var(--line);
}
/* A photo marker is the photo itself: at 40 px it reads as "something was seen
   here" without another legend to learn. */
.photo-marker img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #fffaf0;
  box-shadow: 0 2px 8px rgba(24, 49, 45, 0.4);
  cursor: zoom-in;
}

.leaflet-tooltip.link-label {
  background: rgba(255, 250, 240, 0.94); border: 1px solid var(--line);
  color: var(--ink); font-weight: 800; font-size: 0.75rem; box-shadow: none;
}
.leaflet-tooltip.link-label::before { display: none; }

.rider-marker .dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fffaf0;
  box-shadow: 0 2px 8px rgba(24, 49, 45, 0.4);
}

.rider-marker .tag {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid var(--line);
}

.hub-marker {
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf0;
  border: 2px solid #fffaf0;
}

@media (max-width: 620px) {
  .panel { max-height: 38vh; }
  .bar-title strong { font-size: 0.85rem; }
}

/* Trail heat layer: a canvas over the tiles, under every marker. */
.heat-canvas {
  position: absolute; inset: 0; z-index: 350; /* tilePane 200 < this < overlayPane 400 */
  pointer-events: none;
}
.heat-range { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.heat-range label { font-size: 0.82rem; }
.heat-range strong { font-variant-numeric: tabular-nums; }
.heat-range input[type="range"] { width: 100%; min-height: 44px; accent-color: #efb94f; }

/* Notify bell in the map header: .follow gives the shape, these give state. */
.notify-toggle.is-off, .notify-mute.is-off { opacity: 0.55; }
.notify-mute.is-off { text-decoration: line-through; }
.notify-toggle.is-denied { opacity: 0.4; cursor: default; }
