:root {
  --paper: #f6f2ea;
  --paper-2: #efe9dd;
  --ink: #1f1c18;
  --muted: #6d655a;
  --line: #ddd4c4;
  --accent: #d9481f;      /* vermilion: the one color that means "reachable" */
  --accent-soft: #f6d9cc;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* clip, not hidden: "hidden" makes <body> its own scroll box (window.scrollY stuck at 0), which broke
   the phone map collapse. clip blocks sideways overflow without that side effect. */
html, body { margin: 0; height: 100%; overflow-x: clip; }
/* No page pinch / double-tap zoom (the map has its own); paired with the viewport meta + gesture handlers. */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font: 14px/1.45 var(--body); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }

.app { display: grid; grid-template-columns: 400px 1fr; height: 100vh; height: 100dvh; }
.panel { overflow-y: auto; border-right: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; }
.map { height: 100%; background: var(--paper-2); }

.brand { padding: 22px 22px 14px; }
.brand h1 { font: 700 44px/0.9 var(--display); letter-spacing: 0.01em; text-transform: uppercase; margin: 0; }
.brand h1::after { content: ""; display: block; width: 44px; height: 5px; background: var(--accent); margin-top: 10px; }
.brand p { margin: 10px 0 0; color: var(--muted); max-width: 30ch; }
.about-link { color: var(--accent); font-weight: 600; white-space: nowrap; }

.modes { display: flex; margin: 4px 22px 0; border-bottom: 1px solid var(--line); }
.modes button {
  flex: 1; background: none; border: 0; padding: 10px 0 9px; cursor: pointer;
  font: 600 17px var(--display); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.modes button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.modes button:hover { color: var(--ink); }

.controls { padding: 16px 22px 0; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.field output { color: var(--accent); font-family: var(--mono); font-size: 13px; }
.geo { position: relative; }
.geo input, #search {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf8;
}
.geo input:focus, #search:focus { border-color: var(--ink); outline: none; }
.suggest {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0;
  list-style: none; background: #fffdf8; border: 1px solid var(--ink); border-radius: 4px; box-shadow: 0 8px 24px rgb(0 0 0 / .12);
}
.suggest:empty { display: none; }
.suggest li { padding: 7px 11px; cursor: pointer; font-size: 13px; }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); }
.swap-row { margin: -8px 0 -6px; text-align: right; }
#swap { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 0; }
#swap:hover { color: var(--accent); }

input[type="range"] { width: 100%; accent-color: var(--accent); margin: 2px 0; }

.live-row { padding: 12px 22px 0; }
.live-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 7px 12px 7px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: #fffdf8; font-size: 13px; font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}
.live-toggle:hover { border-color: var(--ink); }
.live-toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); position: relative; }
.live-toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.live-toggle[aria-pressed="true"] .dot { background: var(--accent); }
.live-toggle[aria-pressed="true"] .dot::after,
.pin.live::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-out infinite;
}
.pin.live { background: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 4px 10px rgb(0 0 0 / .35); position: relative; }
.hint { margin: 10px 22px 0; font-size: 12px; color: var(--muted); }

.summary { padding: 18px 22px 6px; }
.count { display: flex; align-items: baseline; gap: 8px; }
#count { font: 700 64px/0.85 var(--display); font-variant-numeric: tabular-nums; }
#count-label { font: 600 20px var(--display); text-transform: uppercase; color: var(--muted); }
#context { margin: 8px 0 0; color: var(--muted); }
#context strong { color: var(--ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 10px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 5px; }
.pin-key { width: 11px; height: 11px; border-radius: 50%; background: #1748e0; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px var(--line); }
.pin-key.new { background: #fff; box-shadow: inset 0 0 0 3px #1748e0; }
.pin-key.listed { width: 13px; height: 13px; box-shadow: 0 0 0 3px #f2b200; }
.pin-key.private { background: #fff; box-shadow: inset 0 0 0 2px #8a8378; }
.pin-key.faded { opacity: .35; }

.filters { padding: 10px 22px 8px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  border: 1px solid var(--line); background: #fffdf8; border-radius: 999px; padding: 3px 9px; cursor: pointer;
  font-size: 12px; line-height: 1.4; transition: background .12s, border-color .12s, color .12s;
}
.chip b { font-family: var(--mono); font-weight: 500; color: var(--muted); margin-left: 3px; font-size: 11px; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] b { color: var(--accent-soft); }
.chip.more { border-style: dashed; color: var(--muted); }
.sortbar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sortbar select { border: 0; background: none; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); cursor: pointer; padding: 2px; }

.list { list-style: none; margin: 0; padding: 0 0 8px; flex: 1; }
.list li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 22px; cursor: pointer;
  border-bottom: 1px solid var(--paper-2); transition: background .1s;
}
.list li:hover, .list li.active { background: #fffdf8; }
.list li.active { box-shadow: inset 3px 0 0 var(--accent); }
.list .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { grid-column: 1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .min { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font: 500 13px var(--mono); }
.list .min small { display: block; font: 400 11px var(--body); color: var(--muted); }
.tag { display: inline-block; font: 600 10px/1 var(--body); letter-spacing: .05em; padding: 3px 4px 2px; border-radius: 3px; margin-left: 6px; vertical-align: 2px; }
.tag.new { background: var(--accent); color: #fff; }
.tag.grade { border: 1px solid var(--line); color: var(--muted); }
.tag.badge { background: var(--accent-soft); color: #8f2c0f; text-decoration: none; }
a.tag.badge:hover { background: var(--accent); color: #fff; }
.tag.stale { border: 1px dashed var(--muted); color: var(--muted); }
.pop .badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.pop .badges .tag { margin-left: 0; }
.pop .stale-note { color: var(--muted); font-style: italic; }
.tag.private { border: 1px solid var(--ink); color: var(--ink); background: transparent; }
.list .meta .open { color: var(--ink); font-weight: 600; }
.list .meta .closed { color: var(--muted); }
.chip.toggle { border-style: dashed; }
.chip.toggle[aria-pressed="true"] { border-style: solid; }
.pop .raw { color: var(--muted); font-size: 11px; }
.pop .private-note { font-weight: 600; border-left: 3px solid var(--ink); padding-left: 7px; margin: 4px 0 6px; }
.empty { padding: 24px 22px; color: var(--muted); }

.credits { padding: 14px 22px 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }

.status {
  position: fixed; right: 16px; bottom: 16px; z-index: 1000; background: var(--ink); color: var(--paper);
  padding: 8px 14px; border-radius: 4px; font-size: 13px; box-shadow: 0 6px 20px rgb(0 0 0 / .2);
}
.status.error { background: var(--accent); }

/* Leaflet bits */
.leaflet-container { font: inherit; }
.basemap { filter: grayscale(1) sepia(0.18) brightness(1.04) contrast(0.82); }
.leaflet-popup-content-wrapper { border-radius: 4px; background: #fffdf8; }
.leaflet-popup-content { margin: 12px 14px; min-width: 210px; }
.pop h3 { margin: 0 0 2px; font: 700 20px/1.05 var(--display); }
.pop .sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.pop .row { font-size: 12px; margin: 2px 0; }
.pop .links { display: flex; gap: 10px; margin-top: 10px; font-size: 12px; font-weight: 600; }
.pop .links a { color: var(--accent); text-decoration: none; }
.pop .links a:hover { text-decoration: underline; }
.pin {
  width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--ink), 0 4px 10px rgb(0 0 0 / .35); cursor: grab;
}
.pin.dest { background: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 4px 10px rgb(0 0 0 / .35); }
.pin-label {
  position: absolute; left: 24px; top: -2px; white-space: nowrap; background: var(--ink); color: var(--paper);
  font: 600 12px var(--display); text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 2px;
}

/* Live location, but nowhere near the map */
.far {
  position: fixed; z-index: 1100; top: 28px; left: calc(400px + (100vw - 400px) / 2); transform: translateX(-50%);
  width: min(420px, calc(100vw - 400px - 48px)); padding: 20px 22px 18px;
  background: var(--ink); color: var(--paper); border-radius: 6px; box-shadow: 0 18px 50px rgb(0 0 0 / .35);
  animation: far-in .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.far-kicker { margin: 0 0 6px; font: 600 13px var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.far h2 { margin: 0; font: 700 40px/.95 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.far-body { margin: 12px 0 16px; color: #d9d2c5; }
.far button {
  background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  font: 600 15px var(--display); text-transform: uppercase; letter-spacing: .05em;
}
.far button:hover { background: #ef5a2f; }
.far-line { animation: march .8s linear infinite; }
@keyframes march { to { stroke-dashoffset: -12; } }
@keyframes far-in { from { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(.92); } }

@keyframes pulse { 0% { transform: scale(1); opacity: .9 } 100% { transform: scale(3.2); opacity: 0 } }
.ping { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: pulse 0.9s ease-out infinite; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; height: auto; min-height: 100dvh; }
  .map { grid-row: 1; position: sticky; top: 0; z-index: 1; height: 46vh; transition: height .3s ease; box-shadow: 0 1px 0 var(--line); }
  .app.map-min .map { height: 120px; box-shadow: 0 6px 18px rgb(0 0 0 / .18); }
  .map-expand {
    /* Bottom-left, above Leaflet's controls: the OSM attribution owns the bottom-right corner. */
    position: absolute; inset: 0; z-index: 1001; display: flex; align-items: flex-end; justify-content: flex-start;
    padding: 0 0 10px 12px; border: 0; cursor: pointer; background: linear-gradient(transparent 30%, rgb(31 28 24 / .28));
  }
  .map-expand span {
    background: var(--ink); color: var(--paper); border-radius: 999px; padding: 5px 14px 4px;
    font: 600 14px var(--display); text-transform: uppercase; letter-spacing: .06em; box-shadow: 0 4px 12px rgb(0 0 0 / .25);
  }
  .map-expand span::after { content: " ↓"; }
  .panel { grid-row: 2; border-right: 0; overflow: visible; }
  .brand { padding-top: 16px; }
  .brand h1 { font-size: 36px; }
  .brand, .controls, .summary, .filters, .list li, .credits { padding-left: 16px; padding-right: 16px; }
  .modes, .hint { margin-left: 16px; margin-right: 16px; }
  .live-row { padding-left: 16px; padding-right: 16px; }
  .geo input, #search, .sortbar select { font-size: 16px; }
  .far { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; transform: none; }
  .far h2 { font-size: 32px; }
  @keyframes far-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Meet up ---- */
.people { display: grid; gap: 12px; }
.person > span { display: flex; align-items: center; gap: 7px; }
.person-dot {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font: 700 11px/1 var(--display); font-style: normal; color: #fff; background: var(--ink);
}
.person-dot.p1, .pin.person.p1 { background: #d9481f; }
.person-dot.p2, .pin.person.p2 { background: #7a3fb0; }
.person-dot.p3, .pin.person.p3 { background: #0f8a6a; }
.pin.person.p1 { box-shadow: 0 0 0 2px #d9481f, 0 4px 10px rgb(0 0 0 / .35); }
.pin.person.p2 { box-shadow: 0 0 0 2px #7a3fb0, 0 4px 10px rgb(0 0 0 / .35); }
.pin.person.p3 { box-shadow: 0 0 0 2px #0f8a6a, 0 4px 10px rgb(0 0 0 / .35); }
.remove-person {
  margin-left: auto; background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted);
  font: 500 12px var(--body); text-transform: none; letter-spacing: 0;
}
.remove-person:hover { color: var(--accent); }
.people-actions { margin-top: -4px; }
#add-person {
  background: none; border: 1px dashed var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
#add-person:hover { border-color: var(--ink); }
.share-row { padding: 0; }
.pick-pin {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: #f2b200; color: var(--ink); font: 700 15px/1 var(--display);
  box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px var(--ink), 0 4px 12px rgb(0 0 0 / .35);
}
.pick-tag {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-right: 6px; vertical-align: 1px;
  border-radius: 50%; background: #f2b200; color: var(--ink); font: 700 12px/1 var(--display);
}
.fair-center {
  width: 26px; height: 26px; border-radius: 50%; border: 2px dashed var(--ink); background: rgb(255 253 248 / .55);
  position: relative;
}
.fair-center::after {
  content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--ink);
}

.meet-at { display: flex; gap: 8px; align-items: center; }
#meet-at { padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf8; font-family: var(--mono); }
.bullet {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 9px;
  font: 700 11px/1 var(--body); vertical-align: 1px;
}
.pop .trips { list-style: none; margin: 6px 0 8px; padding: 0; display: grid; gap: 6px; font-size: 12px; }
.pop .trips li { display: grid; grid-template-columns: 20px 1fr; gap: 0 6px; align-items: start; }
.pop .trips .person-dot { width: 16px; height: 16px; font-size: 10px; margin-top: 1px; }
.list .meta.leave { color: var(--ink); font-weight: 500; }

/* ---- account + marks ---- */
/* Its own row above the title (it used to float over it and collide with "EVERY SPOT"). */
.account { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; margin: -8px 0 10px; min-height: 32px; }
.account img { width: 26px; height: 26px; border-radius: 50%; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.account .sign-out, .account .dev-signin {
  background: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.account .sign-out:hover, .account .dev-signin:hover { border-color: var(--ink); }
.pop .marks { margin: 6px 0 8px; }
.pop .mark-buttons { display: flex; gap: 6px; }
.mark-btn {
  flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 6px; cursor: pointer;
  font: 600 12px var(--body);
}
.mark-btn:hover { border-color: var(--ink); }
.mark-btn.want[aria-pressed="true"] { background: #d6247c; border-color: #d6247c; color: #fff; }
.mark-btn.tried[aria-pressed="true"] { background: #1a9e5a; border-color: #1a9e5a; color: #fff; }
.mark-btn.skip[aria-pressed="true"] { background: #8a8378; border-color: #8a8378; color: #fff; }
.mark-note {
  width: 100%; margin-top: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; resize: vertical;
  font: 13px/1.35 var(--body); background: #fffdf8;
}
.pop .signed-out { font-size: 12px; color: var(--muted); }
.mark-signin { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }
.tag.mark.want { background: #d6247c; color: #fff; }
.tag.mark.tried { background: #1a9e5a; color: #fff; }
.tag.mark.skip { background: var(--paper-2); color: var(--muted); }
.pin-key.want { background: #1748e0; box-shadow: 0 0 0 3px #d6247c; }
.pin-key.tried { background: #1a9e5a; }
.account .delete-me { background: none; border: 0; padding: 0; color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline; white-space: nowrap; }
.account .delete-me[data-armed] { color: var(--accent); font-weight: 600; }
.account { flex-wrap: wrap; }
.account span { max-width: 14em; }
.policy-links { white-space: nowrap; }

/* ---- account menu (from the profile photo) ---- */
.account { position: relative; }
.avatar-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: #fff; cursor: pointer;
  display: grid; place-items: center; overflow: hidden; transition: border-color .12s;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { border-color: var(--ink); }
.avatar-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-btn .initial { font: 700 16px var(--display); color: var(--paper); background: var(--ink); width: 100%; height: 100%; display: grid; place-items: center; }
.account-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 1200; min-width: 220px; max-width: min(300px, calc(100vw - 32px));
  background: #fffdf8; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgb(0 0 0 / .16);
  padding: 6px; display: grid; gap: 2px;
}
.account-menu .who { padding: 8px 10px 8px; border-bottom: 1px solid var(--paper-2); margin-bottom: 4px; display: grid; gap: 1px; }
.account-menu .who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu [role=menuitem] {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 5px; background: none; cursor: pointer;
  font: 500 13px var(--body); color: var(--ink); text-decoration: none;
}
.account-menu [role=menuitem]:hover, .account-menu [role=menuitem]:focus-visible { background: var(--paper-2); outline: none; }
.account-menu .delete-me { color: var(--muted); }
.account-menu .delete-me[data-armed] { color: var(--accent); font-weight: 700; }
