:root {
  --bg: #10130f;
  --panel: rgba(23, 28, 22, 0.92);
  --panel-solid: #171c16;
  --ink: #eef2e9;
  --ink-dim: #a9b4a2;
  --line: rgba(255, 255, 255, 0.09);
  --berry: #7a1f9e;
  --berry-lite: #b46fd0;
  --accent: #6fbf73;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* the [hidden] attribute must win over id-level display rules (#intro, #threed-bar, …) */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
#map { position: absolute; inset: 0; }

/* ---------- Top bar ---------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 12px 14px; pointer-events: none;
}
#topbar > * { pointer-events: auto; }

.brand {
  display: inline-flex; align-items: center; gap: 11px; font-family: inherit;
  width: 306px;                 /* match the control panel below it */
  padding: 7px 15px 7px 7px;
  background: var(--panel); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow);
  cursor: pointer; text-align: left; transition: border-color .15s, transform .15s;
}
.brand:hover { border-color: rgba(180,111,208,.45); }
.brand:active { transform: scale(.985); }
.logo { width: 40px; height: 40px; display: block; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.logo svg { display: block; width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.wordmark { font-size: 18px; font-weight: 700; letter-spacing: .2px; color: var(--ink); line-height: 1; }
.wordmark b { font-weight: 700; color: var(--berry-lite); }
.tagline { font-size: 10.5px; color: var(--ink-dim); letter-spacing: .3px; line-height: 1; }

.search { position: relative; width: min(340px, 46vw); }
#search-input {
  width: 100%; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 14px; box-shadow: var(--shadow);
  outline: none;
}
#search-input:focus { border-color: var(--accent); }
#search-results {
  position: absolute; top: 44px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
#search-results li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
#search-results li small { color: var(--ink-dim); }
#search-results li:hover, #search-results li.active { background: rgba(111,191,115,0.16); }

/* ---------- Account / auth ---------- */
.account { position: relative; }
.acct-btn {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(10px); color: var(--ink);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; max-width: 42vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acct-btn:hover { border-color: rgba(180,111,208,.45); }
.acct-btn.in::before { content: ""; width: 17px; height: 17px; flex: none; background: url("img/logo.svg") center / contain no-repeat; }
.acct-menu {
  position: absolute; top: 46px; right: 0; min-width: 190px; padding: 6px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 6;
}
.acct-email { padding: 8px 10px; font-size: 12px; color: var(--ink-dim); border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.acct-mi { width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; color: var(--ink); font-size: 13px; border-radius: 7px; cursor: pointer; }
.acct-mi:hover { background: rgba(255,255,255,.06); }

#auth-modal {
  position: absolute; inset: 0; z-index: 21; display: flex; align-items: center; justify-content: center;
  background: rgba(8,10,7,.62); backdrop-filter: blur(3px); padding: 16px;
}
.auth-card {
  position: relative; width: min(380px, 94vw); background: var(--panel-solid);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}
.auth-x { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border: none; border-radius: 50%; background: rgba(255,255,255,.06); color: var(--ink-dim); font-size: 13px; cursor: pointer; }
.auth-x:hover { color: var(--ink); }
.auth-brandline { font-size: 12px; color: var(--ink-dim); font-weight: 600; letter-spacing: .3px; }
.auth-berry { font-size: 13px; }
.auth-card h2 { margin: 6px 0 4px; font-size: 20px; color: var(--ink); }
.auth-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
.auth-field { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 12px; }
.auth-field input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font-size: 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); outline: none;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-hint { display: block; margin-top: 5px; font-size: 11px; color: var(--ink-dim); }
.auth-error { margin: 0 0 12px; padding: 8px 10px; font-size: 12.5px; color: #ffd7d7; background: rgba(200,60,60,.18); border: 1px solid rgba(200,60,60,.4); border-radius: 8px; }
.auth-submit { width: 100%; padding: 11px; border: none; border-radius: 10px; background: var(--berry); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.auth-submit:hover { background: #8a2bb0; }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-toggle { margin: 14px 0 0; font-size: 12.5px; color: var(--ink-dim); text-align: center; }
.linklike { border: none; background: none; color: var(--berry-lite); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }
.linklike:hover { text-decoration: underline; }
.auth-fineprint { margin: 12px 0 0; font-size: 10.5px; color: var(--ink-dim); text-align: center; opacity: .8; }

/* ---------- Gated landing / sign-in page ---------- */
#gate {
  position: fixed; inset: 0; z-index: 100; overflow: auto; color: var(--ink);
  background:
    linear-gradient(103deg, rgba(9,11,8,.93) 0%, rgba(9,11,8,.74) 30%, rgba(9,11,8,.32) 56%, rgba(9,11,8,.52) 100%),
    linear-gradient(0deg, rgba(9,11,8,.72) 0%, rgba(9,11,8,0) 42%),
    url("img/hero-berries.jpg") center / cover no-repeat;
  background-color: #0f150e;   /* fallback before the image loads */
}
.gate-scene { display: none; }   /* replaced by the generated hero photo */
.gate-scene-off { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.gate-range { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42vh; opacity: .8; }
.gate-berry { position: absolute; font-size: 22px; opacity: .5; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); animation: gate-float 9s ease-in-out infinite; }
.gate-berry.b1 { top: 16%; left: 12%; font-size: 30px; animation-delay: 0s; }
.gate-berry.b2 { top: 62%; left: 46%; font-size: 20px; animation-delay: 1.6s; opacity: .35; }
.gate-berry.b3 { top: 26%; right: 40%; font-size: 26px; animation-delay: 3.1s; opacity: .4; }
@keyframes gate-float { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }

.gate-inner {
  position: relative; z-index: 1; min-height: 100%;
  display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: center;
  gap: 40px; max-width: 1120px; margin: 0 auto; padding: 6vh 32px;
}
.gate-brand { font-size: 20px; font-weight: 700; letter-spacing: .3px; color: var(--ink); display: inline-flex; align-items: center; gap: 9px; }
.gate-brand b { color: var(--berry-lite); }
.gate-brand .gate-blob { width: 30px; height: 30px; vertical-align: middle; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.gate-head { margin: 18px 0 14px; font-size: clamp(30px, 4.6vw, 52px); line-height: 1.04; letter-spacing: -0.5px; font-weight: 800; }
.gate-ed { display: inline-block; margin-top: 14px; padding: 4px 13px; border-radius: 999px;
  font-size: clamp(12px, 1.3vw, 15px); font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: #ecccf7; background: rgba(180,111,208,.18); border: 1px solid rgba(180,111,208,.42);
  vertical-align: middle; }
.gate-hook { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 18px;
  padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #ffdcae;
  background: rgba(240,140,60,.16); border: 1px solid rgba(240,140,60,.4); box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.gate-hook b { color: #fff; font-weight: 700; }
.hook-dot { width: 8px; height: 8px; border-radius: 50%; background: #ffb057; flex: none;
  box-shadow: 0 0 0 0 rgba(255,176,87,.7); animation: hook-pulse 1.8s infinite; }
@keyframes hook-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,176,87,.6); } 70% { box-shadow: 0 0 0 7px rgba(255,176,87,0); } 100% { box-shadow: 0 0 0 0 rgba(255,176,87,0); } }
.gate-lede { margin: 0 0 26px; font-size: clamp(14px, 1.5vw, 17px); line-height: 1.6; color: #d7dfd2; max-width: 33em; }
.gate-lede b { color: #fff; font-weight: 700; }
.gate-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 34em; }
.gate-feats li { display: flex; gap: 12px; align-items: flex-start; }
.gf-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 19px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); }
.gate-feats li div { font-size: 12.5px; color: var(--ink-dim); line-height: 1.45; }
.gate-feats li div b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; margin-bottom: 1px; }
.gate-credit { margin: 26px 0 0; font-size: 11px; color: var(--ink-dim); opacity: .8; }

.gate-auth { display: flex; justify-content: center; }
.gate-card {
  width: 100%; max-width: 380px; background: rgba(23,28,22,.82); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.gate-card .auth-submit { margin-top: 4px; }
.gate-soon { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; color: var(--ink-dim);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); }

@media (max-width: 860px) {
  .gate-inner { grid-template-columns: 1fr; gap: 26px; padding: 40px 20px; }
  .gate-auth { order: -1; }              /* form first on small screens */
  .gate-feats { display: none; }          /* keep the mobile splash tight */
  .gate-range { height: 30vh; }
}

/* Sun & time */
.sel-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-dim); margin-bottom: 10px; }
.sel-row select { flex: none; max-width: 60%; padding: 6px 8px; font-size: 12.5px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-solid); color: var(--ink); outline: none; }
.sel-row select:focus { border-color: var(--accent); }
#sun-now { margin-top: 8px; }
.pp-sun { color: #ffcf6a; }

/* Admin panel */
#admin-modal { position: absolute; inset: 0; z-index: 22; display: flex; align-items: center; justify-content: center; background: rgba(8,10,7,.62); backdrop-filter: blur(3px); padding: 16px; }
.admin-card { position: relative; width: min(560px, 96vw); max-height: 88vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; }
.admin-card h2 { margin: 0 0 14px; font-size: 18px; }
.admin-signup { margin-bottom: 14px; }
.admin-new { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.admin-new input[type=text] { flex: 1; min-width: 120px; padding: 8px 10px; font-size: 13px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); outline: none; }
.admin-new input:focus { border-color: var(--accent); }
.admin-err { margin: 0 0 12px; padding: 8px 10px; font-size: 12.5px; color: #ffd7d7; background: rgba(200,60,60,.18); border: 1px solid rgba(200,60,60,.4); border-radius: 8px; }
.admin-row { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.admin-row .au-name { flex: 1; min-width: 0; font-weight: 600; color: var(--ink); word-break: break-all; }
.admin-row .au-badge { font-size: 9.5px; padding: 1px 7px; border-radius: 999px; background: rgba(180,111,208,.22); color: var(--berry-lite); font-weight: 600; }
.admin-row .au-meta { font-size: 10.5px; color: var(--ink-dim); flex: none; }
.admin-row .au-actions { display: flex; gap: 4px; flex: none; }
.au-btn { border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--ink-dim); font-size: 11px; padding: 4px 7px; border-radius: 6px; cursor: pointer; }
.au-btn:hover { color: var(--ink); border-color: rgba(180,111,208,.45); }
.au-btn.danger:hover { color: #ff9d9d; border-color: rgba(200,60,60,.5); }

/* My spots list */
#myspots-list { display: flex; flex-direction: column; gap: 6px; }
.myspot { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); cursor: pointer; }
.myspot:hover { border-color: rgba(180,111,208,.45); }
.myspot-main { flex: 1; min-width: 0; }
.myspot-title { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.myspot-note { font-size: 11px; color: var(--ink-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.myspot-tags { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.myspot-tag { font-size: 9.5px; padding: 1px 6px; border-radius: 999px; background: rgba(111,191,115,.16); color: var(--accent); }
.myspot-del { border: none; background: none; color: var(--ink-dim); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.myspot-del:hover { color: #ff9d9d; }

/* Popup save block */
.pp-save { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pp-fav { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--ink); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pp-fav.on { background: rgba(214,180,50,.18); border-color: rgba(214,180,50,.6); color: #ffe08a; }
.pp-note-in, .pp-tags-in { width: 100%; margin-top: 8px; padding: 7px 9px; font-size: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); outline: none; font-family: inherit; }
.pp-note-in { resize: vertical; min-height: 44px; }
.pp-note-in:focus, .pp-tags-in:focus { border-color: var(--accent); }
.pp-save-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pp-save-btn { padding: 6px 12px; border: none; border-radius: 8px; background: var(--berry); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.pp-save-btn:hover { background: #8a2bb0; }
.pp-save-status { font-size: 11px; color: var(--accent); }
.pp-signin-cta { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-dim); }

/* ---------- Panel ---------- */
#panel {
  position: absolute; top: 80px; left: 14px; z-index: 4; width: 306px;
  max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px 16px 16px;
}
#panel.collapsed { display: none; }
#panel-toggle {
  float: right; margin: 6px -6px 0 0; border: none; background: none; color: var(--ink-dim);
  font-size: 18px; cursor: pointer; line-height: 1;
}
#panel-reopen {
  position: absolute; top: 80px; left: 14px; z-index: 4;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 10px; padding: 9px 13px; cursor: pointer; box-shadow: var(--shadow); font-size: 14px;
}
.ctl { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ctl:last-child { border-bottom: none; }
.ctl h2 { margin: 0 0 9px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-dim); font-weight: 600; }
.hint { font-size: 12px; color: var(--ink-dim); margin: 7px 0 0; line-height: 1.45; }

.segmented { display: flex; background: rgba(0,0,0,.28); border-radius: 9px; padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; border: none; background: none; color: var(--ink-dim); padding: 8px 6px;
  border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.segmented button.active { background: var(--berry); color: #fff; box-shadow: 0 1px 6px rgba(122,31,158,.5); }

#date-label { color: var(--accent); font-weight: 700; text-transform: none; letter-spacing: 0; }
#date-slider { width: 100%; accent-color: var(--berry-lite); margin-top: 4px; }
#quality-slider { width: 100%; accent-color: var(--accent); margin-top: 2px; }
#quality-label { color: var(--accent); font-weight: 700; text-transform: none; letter-spacing: 0; }
.date-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.mini {
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink);
  border-radius: 7px; padding: 4px 9px; font-size: 12px; cursor: pointer;
}
.mini:hover { border-color: var(--accent); }
#date-section.disabled { opacity: .4; pointer-events: none; }
.date-cta { display: block; width: 100%; margin-top: 11px; padding: 9px 12px; border-radius: 9px;
  border: 1px solid rgba(180,111,208,.45); background: rgba(180,111,208,.14); color: #e7c8f5;
  font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; line-height: 1.35; }
.date-cta:hover { background: rgba(180,111,208,.24); border-color: rgba(180,111,208,.7); }
#date-section.disabled #date-cta { opacity: 1; pointer-events: auto; }   /* stays live while the rest dims */

#legend-bar { height: 14px; border-radius: 7px; border: 1px solid var(--line); }
.legend-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-dim); margin-top: 4px; }
.legend-key { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.lk { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: var(--ink-dim); }
.lk-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.lk-dot.green { background: #1fbf6b; border: 1px solid #0c2f1c; }
.lk-dot.berry { background: linear-gradient(135deg, #c273da, #7a1f9e); }
.lk-pin { width: 11px; height: 11px; flex: none; background: #7a1f9e; border-radius: 50% 50% 50% 0; transform: rotate(45deg); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.lk-line { width: 14px; height: 0; flex: none; border-top: 2px dashed #bda079; }

.chk { display: flex; align-items: center; gap: 9px; font-size: 13px; margin: 8px 0; cursor: pointer; }
.chk input { accent-color: var(--accent); }
.pill { font-size: 11px; background: rgba(111,191,115,.18); color: var(--accent); border-radius: 999px; padding: 1px 8px; }

#stats { font-size: 13px; line-height: 1.7; }
#stats .big { font-size: 22px; font-weight: 700; color: var(--berry-lite); }
#stats .label { color: var(--ink-dim); }

.panel-foot { padding: 12px 0 2px; text-align: center; font-size: 11px; color: var(--ink-dim); letter-spacing: .02em; }
.about #about-body { font-size: 12px; color: var(--ink-dim); line-height: 1.55; margin-top: 8px; }
.about #about-body h3 { color: var(--ink); font-size: 12px; margin: 12px 0 4px; }
.about #about-body a { color: var(--accent); }
.about #about-body ul { padding-left: 18px; margin: 4px 0; }

/* ---------- Popup ---------- */
.maplibregl-popup-content {
  background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 13px 15px; font-size: 13px; max-width: 290px;
}
.maplibregl-popup-tip { border-top-color: var(--panel-solid) !important; border-bottom-color: var(--panel-solid) !important; }
.maplibregl-popup-close-button { color: var(--ink-dim); font-size: 17px; padding: 2px 7px; }
.pp-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.pp-score { display: inline-block; color: #fff; border-radius: 6px; padding: 1px 8px; font-weight: 700; font-size: 12px; }
.pp-grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 9px 0; }
.pp-grid .k { color: var(--ink-dim); }
.pp-grid .v { text-align: right; font-variant-numeric: tabular-nums; }
.pp-spark { margin-top: 8px; }
.pp-spark .cap { color: var(--ink-dim); font-size: 11px; margin-bottom: 3px; }
.pp-note { color: var(--ink-dim); font-size: 11px; margin-top: 8px; line-height: 1.4; }
.pp-dim { color: var(--ink-dim); font-weight: 400; }
.pp-bear { margin: 9px 0; padding: 8px 10px; border-radius: 8px; font-size: 11.5px; line-height: 1.45; }
.pp-bear b { display: inline; }
.pp-bear.grz { background: rgba(217,83,30,.16); border: 1px solid rgba(217,83,30,.45); color: #ffcdb2; }
.pp-bear.grz b { color: #ffb599; }
.pp-bear.blk { background: rgba(140,140,140,.14); border: 1px solid rgba(160,160,160,.3); color: #dcdcdc; }
.pp-bear.blk b { color: #fff; }
.pp-own { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .4px; padding: 0 5px; border-radius: 4px; margin-right: 4px; vertical-align: middle; }
.pp-own.pub { background: rgba(61,158,87,.22); color: #6fe09a; }
.pp-own.prv { background: rgba(176,69,58,.22); color: #f0a08f; }
.own-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 2px; }
.own-sw { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-dim); }
.own-sw i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.pp-dir { color: var(--accent); text-decoration: none; font-weight: 600; }
.pp-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.pp-3d { border: 1px solid rgba(180,111,208,.4); background: rgba(122,31,158,.28); color: #e8caf2; border-radius: 7px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pp-3d:hover { background: rgba(122,31,158,.5); }
.pp-sat-wrap { position: relative; margin: -13px -15px 11px; cursor: pointer; overflow: hidden; border-radius: 10px 10px 0 0; background: #1a1f18; }
.pp-sat { display: block; width: 100%; height: 152px; object-fit: cover; }
.pp-sat-badge { position: absolute; bottom: 6px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 5px; letter-spacing: .2px; }

#threed-bar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 8px; align-items: center;
}
#threed-bar button {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--panel-solid); color: var(--ink);
  border-radius: 999px; padding: 9px 15px; cursor: pointer; box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600;
}
#threed-bar button:hover { border-color: var(--berry-lite); }
#naip-toggle .td-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-dim); transition: background .15s; }
#naip-toggle.active { background: rgba(122,31,158,.32); border-color: var(--berry-lite); }
#naip-toggle.active .td-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
#compass-btn { font-variant-numeric: tabular-nums; }
#compass-needle { display: inline-block; color: var(--berry-lite); font-size: 15px; line-height: 1; transition: transform .1s linear; }

/* ---------- Loading ---------- */
#loading {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg); color: var(--ink-dim); font-size: 15px;
}
#loading.done { display: none; }
.spinner { width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--berry-lite); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.maplibregl-ctrl-attrib { font-size: 10px; }

/* ---------- Season histogram ---------- */
#season-hist { width: 100%; height: 40px; display: block; margin: 8px 0 4px; cursor: pointer; }
#peak-btn { color: var(--berry-lite); border-color: rgba(180,111,208,.4); }

/* ---------- Selected-spot panel (details + nearby campgrounds) ---------- */
#spot-panel {
  position: absolute; right: 14px; bottom: 26px; z-index: 9; width: 300px;
  max-height: 82vh; overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px; color: var(--ink);
}
#spot-close {
  position: absolute; top: 6px; right: 8px; z-index: 3; width: 24px; height: 24px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; cursor: pointer; line-height: 1;
}
#spot-close:hover { background: rgba(0,0,0,.8); }
/* Nearby campgrounds: separate panel, sits just left of the spot panel, bottom-anchored */
#lodge-panel {
  position: absolute; right: 328px; bottom: 26px; z-index: 9; width: 288px;
  background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px; color: var(--ink);
}
#lodge-panel h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-dim); }
#lodge-close { position: absolute; top: 8px; right: 10px; border: none; background: none; color: var(--ink-dim); font-size: 15px; cursor: pointer; }
#lodge-close:hover { color: var(--ink); }
/* fixed-height results area: loading -> results -> filter changes never reflow the panel */
#lodge-body { height: 186px; overflow-y: auto; }
.lodge-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; margin-bottom: 8px; font-size: 12px; flex-wrap: wrap; }
.lodge-controls label { display: flex; align-items: center; gap: 6px; }
.lodge-controls select { background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.lodge-cg { padding: 8px 0; border-bottom: 1px solid var(--line); }
.lodge-cg:last-child { border-bottom: none; }
.lodge-cg-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; align-items: baseline; }
.lodge-dim { color: var(--ink-dim); font-size: 12px; white-space: nowrap; }
.lodge-avail { font-size: 12px; color: var(--ink-dim); margin-top: 3px; }
.lodge-avail b { color: var(--accent); font-size: 14px; }
.lodge-avail a { color: var(--accent); text-decoration: none; margin-left: 4px; font-weight: 600; }
.lodge-loading { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--ink-dim); padding: 8px 0; }
.lodge-empty { font-size: 12px; color: var(--ink-dim); line-height: 1.5; padding: 4px 0; }
.lodge-foot { font-size: 10px; color: var(--ink-dim); margin-top: 9px; }
.mini-spin { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--berry-lite); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.pp-stay { border: 1px solid rgba(111,191,115,.4); background: rgba(111,191,115,.18); color: #bfe8c4; border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pp-stay:hover { background: rgba(111,191,115,.32); }
@media (max-width: 620px) {
  #spot-panel { right: 14px; left: 14px; width: auto; bottom: 47vh; }
  #lodge-panel { right: 14px; left: 14px; width: auto; top: 62px; bottom: auto; }
}

/* ---------- Map tools ---------- */
.tool-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--ink);
  border-radius: 9px; padding: 9px 11px; cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.tool-btn:hover { border-color: var(--accent); }
.tool-btn.active { background: var(--berry); border-color: var(--berry); color: #fff; }
.tool-ic { flex: none; width: 22px; height: 22px; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.tool-ic svg { width: 20px; height: 20px; display: block; }
.tool-btn.active .tool-ic { color: #fff; }
.tool-txt { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.tool-txt b { font-size: 13px; font-weight: 600; }
.tool-txt small { font-size: 11px; color: var(--ink-dim); }
.tool-btn.active .tool-txt small { color: rgba(255,255,255,.82); }
.tool-btn + .tool-btn, .hint + .tool-btn { margin-top: 8px; }

#measure-readout {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 8px 7px 14px; box-shadow: var(--shadow); color: var(--ink); font-size: 14px; font-weight: 600;
}
#measure-dist { font-variant-numeric: tabular-nums; }
.mr-ic { font-size: 13px; }
#measure-clear { border: none; background: rgba(255,255,255,.08); color: var(--ink-dim); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 12px; }
#measure-clear:hover { color: var(--ink); }

/* ---------- Draw-a-box area tool ---------- */
.draw-rect {
  position: fixed; z-index: 7; pointer-events: none;
  border: 2px dashed #6fbf73; background: rgba(111,191,115,.12); border-radius: 3px;
}
#box-results {
  position: absolute; right: 14px; bottom: 26px; z-index: 8; width: 268px;
  background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px; color: var(--ink);
}
#box-results h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-dim); }
#box-clear { position: absolute; top: 8px; right: 10px; border: none; background: none; color: var(--ink-dim); font-size: 15px; cursor: pointer; }
#box-clear:hover { color: var(--ink); }
.br-row { font-size: 13px; line-height: 1.6; }
.br-big { font-size: 22px; font-weight: 700; color: var(--berry-lite); }
.br-dim { color: var(--ink-dim); font-size: 12px; }
.br-hist { width: 100%; height: 32px; display: block; margin: 8px 0 6px; }
.br-empty { font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
@media (max-width: 620px) { #box-results { right: 14px; left: 14px; width: auto; bottom: 47vh; } }

/* ---------- Collapsible sections ---------- */
.ctl.collapsible > h2 { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.ctl.collapsible > h2::after { content: "⌄"; font-size: 13px; color: var(--ink-dim); transition: transform .2s; }
.ctl.collapsible.collapsed > h2 { margin-bottom: 0; }
.ctl.collapsible.collapsed > h2::after { transform: rotate(-90deg); }
.ctl.collapsible.collapsed > *:not(h2) { display: none; }

/* ---------- Basemap segmented ---------- */
.segmented.sm { margin-bottom: 10px; }
.segmented.sm button { padding: 6px 4px; font-size: 12px; }
#hs-row { transition: opacity .15s; }

/* ---------- Why-this-score bars ---------- */
.pp-why { margin: 10px 0 4px; }
.pp-why .cap { color: var(--ink-dim); font-size: 11px; margin-bottom: 5px; }
.pp-why-row { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 8px; margin: 3px 0; font-size: 11px; }
.pp-why-row .wl { color: var(--ink-dim); }
.pp-why-row .wb { height: 7px; background: rgba(255,255,255,.09); border-radius: 4px; overflow: hidden; }
.pp-why-row .wb i { display: block; height: 100%; background: linear-gradient(90deg, #bd77d9, #6c2094); }
.pp-why-bonus { color: var(--accent); font-size: 11px; margin-top: 5px; }
.pp-share { border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink); border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pp-share:hover { border-color: var(--accent); }
.pp-actions { flex-wrap: wrap; }

/* ---------- First-run intro ---------- */
#intro {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 13px; max-width: min(540px, 92vw);
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); color: var(--ink);
}
#intro .intro-emoji { font-size: 24px; }
#intro .intro-text { font-size: 13px; line-height: 1.45; }
#intro #intro-dismiss { border: none; background: var(--berry); color: #fff; border-radius: 8px; padding: 9px 15px; cursor: pointer; font-weight: 600; white-space: nowrap; }
#intro #intro-dismiss:hover { background: #8f2ab5; }

/* ---------- Mobile bottom-sheet handle ---------- */
#panel-handle { display: none; width: 42px; height: 4px; border-radius: 2px; background: var(--ink-dim); margin: 8px auto 4px; cursor: pointer; }

/* ---------- Accessibility ---------- */
button:focus-visible, input:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .spinner { animation: spin 0.8s linear infinite !important; }
}

@media (max-width: 620px) {
  #panel {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%;
    max-height: 44vh; border-radius: 16px 16px 0 0; padding: 2px 16px 20px;
    transition: max-height .25s ease; border-bottom: none;
  }
  #panel.expanded { max-height: 82vh; }
  #panel-handle { display: block; }
  #panel-toggle, #panel-reopen { display: none; }
  .search { width: 42vw; }
  .brand { width: auto; max-width: 56vw; }
  .tagline { display: none; }
  #intro { bottom: auto; top: 60px; }
}
