/* Backpocket — structural stylesheet. All look/feel comes from design tokens
   defined in the active skin file (skins/*.css). This file never hardcodes a
   palette, font, or map tone. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--paper);
}

.leaflet-tile-pane { filter: var(--map-filter); }

.leaflet-container {
  background: var(--paper) !important;
  font-family: var(--font-body);
}

/* Theme-aware Leaflet controls */
.leaflet-bar a {
  border-radius: 7px !important;
  color: var(--ink) !important;
  background: var(--surface) !important;
  border-bottom-color: var(--surface-line) !important;
}
.leaflet-bar a:hover { background: var(--paper-deep) !important; }
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--ink-soft) !important;
  border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: var(--ink-soft) !important; }

/* ---- Crest / title ---- */
.crest {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  padding: 11px 20px 11px 16px;
  box-shadow: 0 8px 22px var(--shadow);
  max-width: 74vw;
}
.crest-mark {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.crest-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 0.95;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.crest-text p {
  margin: 5px 0 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--ink-soft);
  line-height: 1;
}

/* ---- Progress counter ---- */
.progress {
  position: absolute;
  top: 16px;
  right: 14px;
  z-index: 500;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 9px 18px;
  box-shadow: 0 8px 18px var(--shadow);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.progress {
  cursor: pointer;
}
.progress-count {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0;
}
.progress::before {
  content: "❧";
  color: var(--metal);
  font-size: 14px;
}
.progress-caret {
  font-size: 9px;
  color: var(--ink-soft);
  margin-left: 1px;
}

/* ---- Checklist panel ---- */
.checklist {
  position: absolute;
  top: 62px;
  right: 14px;
  z-index: 600;
  width: 290px;
  max-width: 82vw;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  box-shadow: 0 12px 28px var(--shadow);
  overflow: hidden;
}
.checklist[hidden] { display: none; }
.checklist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface-line);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
}
.checklist-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checklist-passport {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
}
.checklist-close {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}
.checklist-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
}
.checklist-section {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 10px 8px 5px;
}
.checklist-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13.5px;
}
.checklist-row:hover { background: var(--paper); }
.checklist-row .cl-x {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  width: 14px;
  text-align: center;
}
.checklist-row .cl-name { color: var(--ink); }
.checklist-row.done .cl-name { color: var(--ink-soft); text-decoration: line-through; }
.checklist-row .cl-check {
  margin-left: auto;
  color: var(--metal);
  font-size: 12px;
  font-weight: 700;
}

/* ---- First-visit note ---- */
.intro {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  width: 460px;
  max-width: 92vw;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  color: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 10px 28px var(--shadow);
}
.intro[hidden] { display: none; }
.intro p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.45;
}
.intro strong { color: var(--accent); }
.intro button {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
@media (max-width: 640px) {
  .intro { flex-direction: column; align-items: stretch; bottom: 74px; }
  .intro button { width: 100%; }
}

/* ---- Legend / filters ---- */
.legend {
  position: absolute;
  bottom: 20px;
  left: 14px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 64vw;
}
.legend button {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: 0 3px 9px var(--shadow);
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.legend button:hover { transform: translateY(-2px); }
.legend button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.legend button.fav-filter {
  border-color: var(--metal);
  color: var(--metal);
}
.legend button.fav-filter.active {
  background: var(--metal);
  border-color: var(--metal);
  color: var(--surface);
}
.legend button.featured-filter {
  border-color: var(--gold, #c79328);
  color: #9c7412;
  font-weight: 600;
}
.legend button.featured-filter.active {
  background: var(--gold, #c79328);
  border-color: var(--gold, #c79328);
  color: #2a2008;
}
.legend button.local-filter {
  border-color: var(--accent);
  color: var(--accent);
}
.legend button.local-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

/* ---- Search ---- */
.search {
  position: absolute;
  top: 76px;
  left: 14px;
  z-index: 500;
  width: 250px;
  max-width: 74vw;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--ink-soft);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 10px 34px 10px 36px;
  box-shadow: 0 6px 16px var(--shadow);
  outline: none;
}
#searchInput::placeholder { color: var(--ink-soft); }
#searchInput:focus { border-color: var(--accent); }
.search-clear {
  position: absolute;
  right: 12px;
  top: 18px;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
  display: none;
}
.search.has-query .search-clear { display: block; }
.search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  box-shadow: 0 10px 24px var(--shadow);
  max-height: 46vh;
  overflow-y: auto;
  display: none;
}
.search-results.open { display: block; }
.search-results li {
  padding: 8px 11px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
}
.search-results li:hover, .search-results li.active { background: var(--paper); }
.search-results .res-x {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
}
.search-results .res-name { font-weight: 500; color: var(--ink); }
.search-results .res-cat {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.search-results .res-empty {
  padding: 10px 11px;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: default;
}
.search-results .res-empty:hover { background: none; }

/* ---- X-marks-the-spot markers ---- */
/* .x-hit is the (larger, invisible) clickable box; the X sits centered inside it
   so spots are easy to tap without enlarging the glyph. */
.x-hit {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
}
.x-marker {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 25px;
  line-height: 1;
  color: var(--pin, var(--accent));
  text-shadow:
     1.5px 1.5px 0 var(--surface), -1.5px -1.5px 0 var(--surface),
     1.5px -1.5px 0 var(--surface), -1.5px 1.5px 0 var(--surface),
     0 2px 3px var(--marker-shadow);
  transition: transform 0.15s ease;
  animation: drop-in 0.35s ease backwards;
}
.x-marker:hover { transform: scale(1.28) rotate(-6deg); }
.x-marker.closed {
  color: var(--closed);
  opacity: 0.85;
}
/* Featured (partner) spots get a gold glow so they stand out */
.x-marker.featured {
  filter: drop-shadow(0 0 3px var(--gold, #c79328)) drop-shadow(0 0 6px var(--gold, #c79328));
}
.x-marker .fav-star {
  position: absolute;
  left: -8px;
  top: -9px;
  font-size: 13px;
  line-height: 1;
  color: var(--metal);
  text-shadow:
     1px 1px 0 var(--surface), -1px -1px 0 var(--surface),
     1px -1px 0 var(--surface), -1px 1px 0 var(--surface);
}
/* Not interested / "don't want to go": shrink and fade so it recedes */
.x-marker.skip {
  transform: scale(0.55);
  opacity: 0.5;
}
.x-marker.skip:hover { transform: scale(0.8) rotate(-6deg); opacity: 0.85; }
.x-marker.visited::after {
  content: "✓";
  position: absolute;
  right: -7px;
  top: -8px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--surface);
  background: var(--metal);
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: none;
  box-shadow: 0 1px 2px var(--marker-shadow);
}
@keyframes drop-in {
  0% { transform: translateY(-12px) scale(0.4); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---- Story card ---- */
.card {
  position: absolute;
  z-index: 900;
  top: 0;
  right: 0;
  height: 100%;
  width: 380px;
  max-width: 88vw;
  background: var(--surface);
  border-left: 1px solid var(--surface-line);
  box-shadow: -14px 0 34px var(--shadow);
  transform: translateX(102%);
  transition: transform 0.32s cubic-bezier(0.4, 0.0, 0.1, 1);
  display: flex;
  flex-direction: column;
}
.card.open { transform: translateX(0); }

.card-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--surface-line);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 9px var(--shadow);
  transition: transform 0.12s ease;
}
.card-close:hover { transform: rotate(90deg); background: var(--paper-deep); }

.card-scroll {
  overflow-y: auto;
  padding: 56px 30px 32px;
  height: 100%;
}

.card-featured {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #2a2008;
  background: var(--gold, #c79328);
  border-radius: 8px;
  padding: 9px 14px;
  margin-bottom: 14px;
}
.card-featured[hidden] { display: none; }

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 14px;
}
.card-cat {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--pin, var(--accent));
  border-radius: 999px;
  padding: 5px 13px;
}
.card-fav {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--metal);
  background: transparent;
  border: 1px solid var(--metal);
  border-radius: 999px;
  padding: 4px 12px;
}
.card-fav[hidden] { display: none; }
.card-local {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
}
.card-local.popular {
  color: var(--ink-soft);
  border-color: var(--surface-line);
}
.card-new {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
}
.card-new[hidden] { display: none; }

/* NEW flag on the map marker */
.x-marker .new-flag {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--surface);
  background: var(--accent);
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.25;
  text-shadow: none;
  box-shadow: 0 1px 2px var(--marker-shadow);
  white-space: nowrap;
}

/* Extra legend pills */
.legend button.trails-filter { border-color: var(--accent); color: var(--accent); }
.legend button.grave-filter { border-color: var(--ink-soft); color: var(--ink-soft); }
.legend button.grave-filter.active {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
  color: var(--surface);
}

/* Draw-your-zone bar (top-center) */
.zone-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 560;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--ink);
  color: var(--surface);
  border-radius: 999px;
  padding: 8px 10px 8px 16px;
  box-shadow: 0 8px 22px var(--shadow);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  max-width: 84vw;
}
.zone-bar[hidden] { display: none; }
.zone-bar b { color: var(--accent); }
.zone-bar button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface) 20%, transparent);
  color: var(--surface);
}
.zone-bar button.primary { background: var(--accent); color: var(--surface); }
.zone-bar button.ghost {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--surface) 40%, transparent);
}
.zone-btn-ctrl a { font-size: 15px; line-height: 30px; text-align: center; }
.zone-btn-ctrl a.active { color: var(--accent) !important; background: var(--paper) !important; }

/* Active-trail banner */
.trail-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--surface);
  border-radius: 999px;
  padding: 9px 10px 9px 18px;
  box-shadow: 0 8px 22px var(--shadow);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  max-width: 66vw;
}
.trail-banner[hidden] { display: none; }
.trail-banner-count { color: var(--accent); font-weight: 700; }
.trail-banner-list {
  border: none;
  background: color-mix(in srgb, var(--surface) 22%, transparent);
  color: var(--surface);
  border-radius: 999px;
  padding: 5px 11px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}
.trail-banner-clear {
  border: none;
  background: color-mix(in srgb, var(--surface) 22%, transparent);
  color: var(--surface);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
}

/* Trails chooser */
.trails {
  position: absolute;
  inset: 0;
  z-index: 1150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  padding: 18px;
}
.trails[hidden] { display: none; }
.trails-box {
  position: relative;
  width: 420px;
  max-width: 94vw;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  border: 2px solid var(--surface-line);
  box-shadow: 8px 8px 0 var(--ink);
  border-radius: 14px;
  padding: 26px 24px 22px;
}
.trails-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--surface-line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.trails-title {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 4px;
  text-transform: uppercase;
  color: var(--ink);
}
.trails-sub {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.trails-list { display: flex; flex-direction: column; gap: 8px; }
.trail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.12s ease;
}
.trail-row:hover { transform: translateY(-1px); border-color: var(--accent); }
.trail-emoji { font-size: 22px; line-height: 1; }
.trail-info { flex: 1; min-width: 0; }
.trail-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.trail-blurb {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-soft);
}
.trail-progress {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}

/* Trails chooser as a clean bottom sheet on phones */
@media (max-width: 640px) {
  .trails { align-items: flex-end; padding: 0; }
  .trails-box {
    width: 100%;
    max-width: 100%;
    max-height: 86vh;
    border: none;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .trails-title { font-size: 21px; }
  .trails-sub { font-size: 12px; margin-bottom: 12px; }
  .trail-row { padding: 11px 12px; gap: 11px; }
  .trail-emoji { font-size: 20px; }
  .trail-name { font-size: 14px; }
  .trail-blurb { font-size: 11.5px; }
}
.card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 31px;
  line-height: 1.06;
  margin: 0 0 8px;
  color: var(--ink);
}
.card-status {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 20px;
}
.card-status.open { color: var(--accent-deep); }
.card-status.closed { color: var(--closed); }
.card-status.unsure { color: var(--metal); }

.card-hook {
  font-size: 15px;
  line-height: 1.65;
  font-weight: 400;
  color: var(--ink-body);
  margin: 0 0 22px;
}

.card-order {
  background: var(--paper);
  border: 1px dashed var(--accent);
  padding: 13px 16px;
  border-radius: 10px;
  margin-bottom: 22px;
}
.card-order-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 4px;
}
#cardOrder { font-size: 16px; font-weight: 500; }

.card-meta {
  border-top: 1px solid var(--surface-line);
  padding-top: 18px;
  margin-bottom: 20px;
}

/* ---- Your take: personal rating + notes (saved on-device) ---- */
.card-yours {
  border-top: 1px solid var(--surface-line);
  padding-top: 18px;
  margin-bottom: 22px;
}
.card-yours-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.card-yours-label em {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.3px;
  text-transform: none;
  opacity: 0.8;
}
.card-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.card-stars button {
  border: none;
  background: none;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  transition: transform 0.1s ease, color 0.1s ease;
}
.card-stars button:hover { transform: scale(1.15); }
.card-stars button.filled { color: var(--metal); }
#cardNotes {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
#cardNotes:focus { border-color: var(--accent); }
#cardNotes::placeholder { color: var(--ink-soft); }
.card-meta-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
  margin-bottom: 9px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.card-visit {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--surface);
  border: 1.5px solid var(--accent);
  padding: 11px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.card-visit:hover { transform: translateY(-2px); }
.card-visit.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.card-directions {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--ink);
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 5px 14px var(--shadow);
  transition: transform 0.12s ease, background 0.15s ease;
}
.card-directions:hover { transform: translateY(-2px); background: var(--accent-deep); }

.attribution-note {
  position: absolute;
  bottom: 7px;
  right: 10px;
  z-index: 500;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.75;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.attribution-note:hover { color: var(--accent); opacity: 1; }

/* Card: make-a-shareable-card button */
.card-make {
  display: block;
  width: 100%;
  margin-top: 14px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--accent);
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.card-make:hover { transform: translateY(-2px); background: var(--accent-deep); }

/* Trail-complete badge modal */
.trail-done {
  position: absolute;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 62%, transparent);
  padding: 18px;
}
.trail-done[hidden] { display: none; }
.trail-done-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 380px;
  max-width: 94vw;
}
.trail-done-close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 9px var(--shadow);
}
.trail-done-img {
  max-width: min(360px, 88vw);
  max-height: 58vh;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.trail-done-caption {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 11px 16px;
  outline: none;
}
.trail-done-caption:focus { border-color: var(--accent); }
.trail-done-actions { display: flex; gap: 10px; }
.trail-done-download, .trail-done-native {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--ink);
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.trail-done-native { background: var(--accent); }
.trail-done-native[hidden] { display: none; }
.trail-done-hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--surface);
  opacity: 0.85;
  text-align: center;
}
/* Completed trail row state */
.trail-row.done { border-color: var(--accent); }
.trail-row .trail-share {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}

/* Shareable card modal */
.share {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 60%, transparent);
  padding: 18px;
}
.share[hidden] { display: none; }
.share-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 94vw;
}
.share-close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 9px var(--shadow);
}
.share-modes {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 4px;
}
.share-modes button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
}
.share-modes button.active {
  background: var(--ink);
  color: var(--surface);
}
.share-img-wrap {
  position: relative;
  display: inline-flex;
  line-height: 0;
}
.share-img {
  max-width: min(360px, 88vw);
  max-height: 60vh;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  transition: opacity 0.15s ease;
}
.share-img.loading { opacity: 0.4; }
.share-photo-hit {
  position: absolute;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.share-photo-hit[hidden] { display: none; }
.share-photo-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--surface);
  background: none;
  border: 1.5px solid var(--surface);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.share-photo-btn[hidden] { display: none; }
.share-actions {
  display: flex;
  gap: 10px;
}
.share-download, .share-native {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--ink);
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.share-native { background: var(--accent); }
.share-native[hidden] { display: none; }
.share-hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--surface);
  opacity: 0.85;
  text-align: center;
}

/* Card: not-interested + report links */
.card-links {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.card-skip, .card-report {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s ease;
}
.card-skip:hover, .card-report:hover { color: var(--accent); }
.card-skip.done { color: var(--danger, #e4322b); font-weight: 600; }

/* ---- "You found them all" celebration ---- */
.celebrate {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  padding: 20px;
}
.celebrate[hidden] { display: none; }
.celebrate-box {
  position: relative;
  width: 380px;
  max-width: 92vw;
  background: var(--surface);
  border: 2px solid var(--surface-line);
  box-shadow: 8px 8px 0 var(--ink);
  border-radius: 14px;
  padding: 34px 30px 30px;
  text-align: center;
  animation: pop-in 0.35s cubic-bezier(0.34, 1.4, 0.5, 1) backwards;
}
@keyframes pop-in {
  0% { transform: scale(0.8) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.celebrate-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--surface-line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.celebrate-badge {
  font-size: 40px;
  color: var(--metal);
  line-height: 1;
  margin-bottom: 8px;
}
.celebrate-box h2 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 0.98;
  margin: 0 0 12px;
  color: var(--ink);
  text-transform: uppercase;
}
.celebrate-box p {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-body);
  margin: 0 0 20px;
}
.celebrate-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  margin-bottom: 6px;
}
#celebrateInput {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
}
#celebrateInput:focus { border-color: var(--accent); }
.celebrate-send {
  width: 100%;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--ink);
  border: none;
  padding: 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.celebrate-send:hover { background: var(--accent-deep); }
.celebrate-thanks {
  margin: 12px 0 0 !important;
  color: var(--accent) !important;
  font-weight: 600;
}
.celebrate-thanks[hidden] { display: none; }

/* Locate button + "you are here" dot */
.locate-ctrl a {
  font-size: 17px;
  line-height: 30px;
  text-align: center;
}
.locate-ctrl a.active {
  color: #3d7d8c !important;
  background: var(--paper) !important;
}
.user-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #3d7d8c;
  border: 3px solid #fff;
  box-shadow: 0 0 0 0 rgba(61, 125, 140, 0.5);
  animation: user-pulse 2s infinite;
}
@keyframes user-pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 125, 140, 0.5); }
  70% { box-shadow: 0 0 0 13px rgba(61, 125, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 125, 140, 0); }
}

/* ---- Theme switcher (temporary chooser) ---- */
.skin-switch {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 8px 22px var(--shadow);
  max-width: 92vw;
  flex-wrap: wrap;
}
.skin-switch-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.skin-switch button {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.skin-switch button:hover { transform: translateY(-1px); }
.skin-switch button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  /* Compact top chrome */
  .crest { padding: 7px 12px; gap: 9px; }
  .crest-mark { font-size: 18px; }
  .crest-text h1 { font-size: 19px; }
  .crest-text p { font-size: 8px; letter-spacing: 1.8px; }
  .progress { font-size: 9px; letter-spacing: 0.8px; padding: 7px 11px; gap: 5px; }
  .progress-count { font-size: 15px; }
  .search { width: 200px; top: 66px; }
  #searchInput { padding: 9px 30px 9px 32px; font-size: 13px; }
  .search-icon { font-size: 15px; }

  /* Filters: one swipeable row instead of a wrapping cloud */
  .legend {
    bottom: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 0 4px;
    gap: 6px;
    scrollbar-width: none;
  }
  .legend::-webkit-scrollbar { display: none; }
  .legend button { flex: 0 0 auto; padding: 8px 13px; }

  /* Map controls sit above the filter strip; drop the +/- (pinch to zoom) */
  .leaflet-control-zoom { display: none !important; }
  .leaflet-bottom.leaflet-right { bottom: 58px; }
  .attribution-note { display: none; }

  /* Card + overlays fill / fit the narrow screen */
  .card { width: 100%; max-width: 100%; }
  /* Context banners sit BELOW the crest + search so they don't get crushed */
  .zone-bar { max-width: 94vw; top: 110px; padding: 7px 8px 7px 14px; }
  .zone-bar button { padding: 6px 10px; }
  .trail-banner { max-width: 94vw; top: 110px; padding: 7px 8px 7px 14px; }
  .trail-banner-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
  }
  .checklist, .search-results { max-width: calc(100vw - 20px); }
}
