/* Layout: full-bleed map with a floating white panel on the left; on phones the panel becomes a bottom sheet.
   Light theme only, by request. */
:root {
  color-scheme: light;
  --canvas: #F3F3EF;        /* page ground, slightly warm neutral */
  --surface: #FFFFFF;
  --ink: #1C1E26;           /* text and primary buttons */
  --ink-2: #3B3E4B;
  --muted: #6A6D7A;
  --line: #E4E3DD;
  --marigold: #F29E0C;      /* the one accent: selection and focus */
  --marigold-bg: #FFF4DD;
  --ok-bg: #E8F5EC; --ok-ink: #1F6B3A;
  --warn-bg: #FFF4DD; --warn-ink: #875200;
  --err-bg: #FDECEC; --err-ink: #A51D1D;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --text-xs: 12px; --text-sm: 13px; --text-md: 15px; --text-lg: 18px; --text-xl: 26px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 30, 38, .06), 0 10px 30px rgba(28, 30, 38, .12);
  --panel-w: 392px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--canvas); color: var(--ink);
  font: var(--text-md)/1.45 var(--font-ui);
  overflow: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }
.muted { color: var(--muted); }

/* ---------- Map ---------- */
#map { position: fixed; inset: 0; background: var(--canvas); }
body.adding #map .mapboxgl-canvas-container { cursor: crosshair; }

.map-tools {
  position: fixed; z-index: 5;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
}
.seg {
  display: flex; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow);
}
.seg button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: var(--text-sm); font-weight: 600; color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.map-hint {
  position: fixed; z-index: 5;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: calc(var(--panel-w) + 32px + (100% - var(--panel-w) - 32px) / 2);
  transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: 999px;
  font-size: var(--text-sm); font-weight: 600; box-shadow: var(--shadow); white-space: nowrap;
}

/* ---------- Panel ---------- */
.panel {
  position: fixed; z-index: 10;
  top: calc(16px + env(safe-area-inset-top, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  width: var(--panel-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head { padding: 20px 20px 12px; border-bottom: 1px solid var(--line); }
.title-row { display: flex; align-items: center; gap: 10px; }
.panel-head h1 { font-size: var(--text-xl); font-weight: 800; line-height: 1.05; }
.summary { margin-top: 6px; color: var(--muted); font-size: var(--text-sm); }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink);
}
.panel-body {
  flex: 1 1 auto; overflow-y: auto; padding: 14px 20px 20px; min-height: 0;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
/* Keep the Mapbox logo visible beside the panel (required by Mapbox's terms). */
.mapboxgl-ctrl-bottom-left { left: calc(var(--panel-w) + 24px + env(safe-area-inset-left, 0px)); }
.panel-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--surface); }

/* Search + chips */
.search {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px;
  background: var(--canvas); border: 1px solid transparent; border-radius: 12px;
}
.search:focus-within { background: var(--surface); border-color: var(--ink); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: 0 0 auto; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer;
  font-size: var(--text-sm); font-weight: 600; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip .n { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .n { color: #C9CAD2; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); flex: 0 0 auto; box-shadow: 0 0 0 2px var(--surface); }

.count {
  margin: 16px 0 8px; font-size: var(--text-xs); font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}

/* Temple cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card {
  display: grid; gap: 3px; width: 100%; text-align: left; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.card:hover { border-color: var(--ink-2); }
.card.selected { border-color: var(--marigold); box-shadow: 0 0 0 3px var(--marigold-bg); }
.card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.25; }
.card-place { color: var(--ink-2); font-size: var(--text-sm); }
.card-time { color: var(--muted); font-size: var(--text-xs); }
.deity { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2);
}
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tc); }

.empty { padding: 24px 4px; color: var(--muted); display: grid; gap: 4px; }
.empty strong { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 10px; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.primary:hover { background: #000; }
.btn.ghost { background: var(--canvas); border-color: transparent; }
.btn.danger { color: var(--err-ink); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 12px; font-size: var(--text-sm); border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: wait; }

/* ---------- Add a temple ---------- */
.back {
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted);
  font-size: var(--text-sm); font-weight: 600; margin-bottom: 10px;
}
.back:hover { color: var(--ink); }
#add h2 { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; font-size: var(--text-sm); color: var(--ink-2); }
.steps li > span {
  flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--marigold-bg); color: var(--warn-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.steps strong { color: var(--ink); }

.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }
.btn.icon-only { width: 42px; padding: 0; flex: 0 0 42px; color: var(--ink-2); }
.btn[aria-busy="true"] svg { animation: tm-spin 1s linear infinite; }
@keyframes tm-spin { to { transform: rotate(360deg); } }
.results { list-style: none; margin: 6px 0 0; padding: 0; }
.results li.muted { padding: 8px 2px; font-size: var(--text-sm); }
.results button {
  width: 100%; text-align: left; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line);
  background: none; cursor: pointer; font-size: var(--text-sm); color: var(--ink-2);
}
.results button:hover { color: var(--ink); background: var(--canvas); }

.pin-status {
  margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--canvas);
  font-size: var(--text-sm); color: var(--ink-2); display: grid; gap: 2px;
}
.pin-status.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pin-status.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice { margin-top: 8px; padding: 12px; border-radius: 10px; font-size: var(--text-sm); }
.notice.err { background: var(--err-bg); color: var(--err-ink); }

:is(#add-form, #edit-form) { display: grid; margin-top: 6px; }
:is(#add-form, #edit-form) label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
input:not([type="search"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.hp), select, textarea, .field-row input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--marigold-bg); }
.search input:focus { box-shadow: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two > div { display: grid; min-width: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fine { margin: 16px 0 10px; font-size: var(--text-xs); color: var(--muted); }

.new-pin { width: 32px; height: 60px; cursor: grab; }
.new-pin img {
  display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none;
  /* White outline and a soft shadow so the thin trident stands out on satellite imagery. */
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.new-pin:active { cursor: grabbing; }
/* Logo pin: a round badge with a small point at the bottom marking the spot. */
.new-pin.logo { width: 46px; height: 56px; display: grid; justify-items: center; }
.pin-logo {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; background: #fff center / cover no-repeat;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.new-pin.logo::after {
  content: ""; width: 0; height: 0; margin-top: -2px;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 10px solid #fff;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .3));
}

/* ---------- Popup ---------- */
.mapboxgl-popup-content {
  padding: 14px 16px 12px; border-radius: 12px; box-shadow: var(--shadow); font-family: var(--font-ui);
}
.mapboxgl-popup-close-button { font-size: 20px; padding: 2px 8px; color: var(--muted); }
.popup { display: grid; gap: 5px; font-size: var(--text-sm); color: var(--ink-2); }
.popup img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 4px; }
.popup h3 { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.2; padding-right: 16px; }
.popup .deity { font-size: var(--text-sm); }
.popup .label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 4px;
}
.popup .desc { color: var(--muted); }
.popup-links { display: flex; gap: 8px; margin-top: 6px; }
.popup-links .btn.primary { color: var(--surface); }
.coords { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pin-status .coords { color: inherit; font-size: 12.5px; font-weight: 500; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: var(--text-sm); font-weight: 600;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--err-ink); }
#toast.ok { background: var(--ok-ink); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* ---------- Admin ---------- */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; background: var(--canvas);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.login form {
  width: 100%; max-width: 360px; padding: 28px; display: grid; gap: 6px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.login h1 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.login label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.login .btn { margin-top: 16px; }
.review-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 4px; }
.review-card.selected { border-color: var(--marigold); box-shadow: 0 0 0 3px var(--marigold-bg); }
.review-card h3 { font-size: 16px; font-weight: 700; }
.review-card .from { font-size: var(--text-xs); color: var(--muted); }
.review-actions { display: flex; gap: 8px; margin-top: 8px; }
.review-actions .btn { flex: 1; height: 36px; font-size: var(--text-sm); }
.head-links { display: flex; gap: 8px; margin-top: 12px; }
.pending-pin {
  width: 20px; height: 20px; border-radius: 50%; background: var(--tc); cursor: pointer;
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--ink), 0 2px 6px rgba(0, 0, 0, .3);
}

/* ---------- Badges ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--canvas); color: var(--ink-2); white-space: nowrap;
}
.pill.verified { background: #E7F0FD; color: #1D4ED8; }
.pill.onsite { background: var(--marigold-bg); color: var(--warn-ink); }
.pill.open { background: var(--ok-bg); color: var(--ok-ink); }
.pill.closed { background: var(--canvas); color: var(--muted); }
.pill.dup { background: var(--err-bg); color: var(--err-ink); }
.card .pills { margin-top: 4px; }
.popup .local, .review-card .local { color: var(--muted); font-size: var(--text-sm); margin-top: -2px; }
.popup .hours { white-space: pre-line; }
.popup .label { display: inline-block; min-width: 58px; }

.open-toggle { margin-top: 12px; }

/* ---------- Map pins (zoomed in): the logo badge, or the red trident ---------- */
.map-pin {
  width: 32px; height: 60px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; justify-items: center; align-content: end;
}
.map-pin > * { transition: transform .12s; transform-origin: 50% 100%; }
.map-pin img {
  display: block; width: 32px; height: 60px; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.map-pin.logo { width: 46px; height: 58px; }
.map-pin.logo::after {
  content: ""; width: 0; height: 0; margin-top: -2px;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 10px solid #fff;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .3));
}
.map-pin:hover > *, .map-pin:focus-visible > * { transform: scale(1.1); }
.map-pin:focus-visible { outline: none; }
.map-pin:focus-visible .pin-logo, .map-pin.selected .pin-logo { box-shadow: 0 0 0 3px var(--marigold), 0 3px 10px rgba(0, 0, 0, .35); }
.map-pin:focus-visible img, .map-pin.selected img {
  filter: drop-shadow(0 0 2px var(--marigold)) drop-shadow(0 0 2px var(--marigold)) drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.map-pin.selected > * { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) { .map-pin > * { transition: none; } }

/* ---------- Round photo pins (no longer used on the public map) ---------- */
.photo-pin {
  width: 38px; height: 38px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 3px solid #fff; background: var(--tc) center / cover no-repeat;
  box-shadow: 0 0 0 2px var(--tc), 0 3px 8px rgba(0, 0, 0, .3);
  color: #fff; font: 800 15px/1 var(--font-display);
  display: grid; place-items: center; transition: transform .12s;
}
.photo-pin:hover { transform: scale(1.08); }
.photo-pin.selected { box-shadow: 0 0 0 3px var(--marigold), 0 3px 10px rgba(0, 0, 0, .35); transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) { .photo-pin { transition: none; } }
.existing-pin {
  width: 12px; height: 12px; border-radius: 50%; background: var(--tc);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

/* ---------- Add page ---------- */
a.back { display: inline-block; text-decoration: none; }
.add-page .panel-head .back { margin-bottom: 8px; }
.step { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; display: grid; }
.step legend, .step summary {
  display: flex; align-items: center; gap: 10px; padding: 0; margin-bottom: 6px;
  font: 800 18px/1.2 var(--font-display); color: var(--ink);
}
.step summary { cursor: pointer; list-style: none; }
.step summary::-webkit-details-marker { display: none; }
.step summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 600; }
.step[open] summary::after { content: "–"; }
/* Optional sections: a bordered row that clearly opens, with a line saying what's inside. */
details.step.more > summary {
  min-height: 56px; padding: 12px 14px; margin: 0; border: 1px solid var(--line); border-radius: 12px;
}
details.step.more > summary:hover { border-color: var(--ink); }
details.step.more > summary:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }
details.step.more > summary::after { font-size: 20px; }
details.step.more > summary .sum-text { font-size: 16px; }
details.step.more[open] > summary { margin-bottom: 4px; }
.sum-text { display: grid; gap: 3px; min-width: 0; }
.sum-sub { font: 500 var(--text-sm)/1.3 var(--font-ui); color: var(--muted); }
.more-body { display: grid; padding: 0 2px; }
.intro-meta { font-size: var(--text-sm); }
/* Field errors stay next to the field until it is changed. */
.field-err { margin: 6px 0 0; font-size: var(--text-sm); font-weight: 600; color: var(--err-ink); }
[aria-invalid="true"], :is(#add-form, #edit-form) [aria-invalid="true"] { border-color: var(--err-ink) !important; }
.pin-status + .field-err, .radios + .field-err { margin-top: 8px; }
/* Bottom button before the email is confirmed: says what's missing, doesn't compete with "Email me a code". */
.btn.primary.waiting { background: var(--canvas); border-color: var(--line); color: var(--muted); }
.btn.primary.waiting:hover { background: var(--canvas); border-color: var(--ink); color: var(--ink-2); }
details.step { display: block; }
details.step > label, details.step > input { display: block; }
.num {
  flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--marigold-bg); color: var(--warn-ink);
  display: grid; place-items: center; font: 700 12px/1 var(--font-ui);
}
.opt { font: 500 var(--text-xs)/1 var(--font-ui); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hint { font-size: var(--text-sm); color: var(--muted); margin: 2px 0 10px; }
.ok-text { color: var(--ok-ink); }
.warn-text { color: var(--warn-ink); }
.sub { font: 700 var(--text-md)/1.2 var(--font-ui); margin: 18px 0 8px; }
.label-like { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.onsite-box { margin-top: 12px; display: grid; gap: 6px; }
.onsite-box .hint { margin: 0; }
.center { text-align: center; }
.panel-foot .fine { margin: 8px 0 0; }

:is(#add-form, #edit-form) .check, .check {
  display: flex; align-items: flex-start; gap: 10px; margin: 10px 0;
  font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.check input, .radios input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); flex: 0 0 auto; }
.radios { display: grid; gap: 6px; }
:is(#add-form, #edit-form) .radios label {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: var(--text-sm); font-weight: 500;
}
:is(#add-form, #edit-form) .radios label:has(input:checked) { border-color: var(--ink); background: var(--canvas); font-weight: 600; }

.link {
  border: 0; background: none; padding: 6px 0; cursor: pointer; text-align: left;
  color: var(--ink); font-size: var(--text-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: #000; }
.icon-btn {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted);
}
.icon-btn:hover { color: var(--err-ink); border-color: var(--err-ink); }

.hours-editor, .aarti-editor { display: grid; gap: 8px; }
.day { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.day-head strong { font-size: var(--text-sm); }
:is(#add-form, #edit-form) .day-head select { width: auto; height: 34px; font-size: var(--text-sm); padding: 0 8px; }
.day-note { font-size: var(--text-sm); color: var(--muted); }
.session { display: flex; align-items: center; gap: 8px; }
:is(#add-form, #edit-form) .session input { flex: 1 1 0; min-width: 0; height: 38px; }
.session span { font-size: var(--text-sm); color: var(--muted); }
.day .link, .add-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0; }

.uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
:is(#add-form, #edit-form) .upload {
  position: relative; display: grid; gap: 8px; padding: 12px; cursor: pointer; margin: 0;
  border: 1.5px dashed var(--line); border-radius: 12px;
}
:is(#add-form, #edit-form) .upload:hover, :is(#add-form, #edit-form) .upload:focus-within { border-color: var(--ink); }
:is(#add-form, #edit-form) .upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-preview {
  height: 84px; border-radius: 8px; background: var(--canvas) center / cover no-repeat;
  display: grid; place-items: center;
}
.upload-preview:not(.has)::before { content: "+"; font-size: 26px; color: var(--muted); }
.upload-preview.round { width: 84px; border-radius: 50%; justify-self: center; }
.upload-text { display: grid; gap: 2px; font-size: var(--text-sm); font-weight: 400; }
.upload-text span { color: var(--muted); font-size: var(--text-xs); }

/* Email code box */
.auth-box { display: grid; margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--canvas); }
:is(#add-form, #edit-form) .auth-box label, .auth-box label {
  display: block; margin: 4px 0 6px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2);
}
.auth-box .btn { margin-top: 10px; }
.auth-intro { font-size: var(--text-sm); color: var(--ink-2); margin-bottom: 6px; }
.turnstile:not(:empty) { margin-top: 10px; }
/* On the add page the email is an ordinary field in "About you", not a grey box. */
.form-page .auth-box { margin-top: 0; padding: 0; background: none; border-radius: 0; }
.form-page .auth-box[data-state="code"], .form-page .auth-box[data-state="signed-in"] {
  margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--canvas);
}
.auth-hint { margin: 0 0 8px; }
.form-page .auth-box[data-state="email"] label { margin-top: 14px; }
.radios.inline { grid-template-columns: 1fr 1fr; }
#fee-amount-wrap:not([hidden]), #tradition-other-wrap:not([hidden]) { display: grid; }
.radios.sizes { grid-template-columns: 1fr 1fr; }
:is(#add-form, #edit-form) .radios.sizes label { align-items: flex-start; }
.radios.sizes span { display: grid; gap: 2px; min-width: 0; }
.radios.sizes strong { font-weight: 600; }
.radios.sizes small { font-size: var(--text-xs); color: var(--muted); font-weight: 400; line-height: 1.3; }
.ts-status { margin: 8px 0 0; font-size: var(--text-sm); color: var(--muted); }
#auth .code-input { font: 600 22px/1 var(--font-mono); letter-spacing: .3em; text-align: center; height: 50px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 6px; }
.auth-done { display: flex; align-items: center; gap: 12px; }
.auth-done > div { display: grid; flex: 1; min-width: 0; font-size: var(--text-sm); }
.auth-done > div span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.auth-tick {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--ok-ink); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.auth-tick.big { width: 56px; height: 56px; font-size: 26px; }

.thanks { display: grid; gap: 12px; justify-items: start; padding: 16px 0; }
.thanks h2 { font-size: 26px; font-weight: 800; }
.thanks-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* ---------- Review page extras ---------- */
.login-card {
  width: 100%; max-width: 380px; padding: 28px; display: grid; gap: 6px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; font-weight: 800; }
.review-media { display: flex; gap: 8px; margin-bottom: 6px; }
.review-media a:first-child { flex: 1; }
.review-media img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; display: block; }
.review-media img.logo { width: 64px; height: 64px; border-radius: 50%; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 6px 0 0; font-size: var(--text-sm); }
.facts dt { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.checklist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: var(--text-sm); }
.checklist li { display: flex; gap: 6px; align-items: baseline; }
.checklist li::before { flex: none; width: 14px; font-weight: 700; text-align: center; }
.checklist li.ok::before { content: "✓"; color: var(--ok-ink); }
.checklist li.miss { color: var(--muted); }
.checklist li.miss::before { content: "–"; }
.checklist li.warn { color: var(--err-ink); font-weight: 600; }
.checklist li.warn::before { content: "!"; }
.facts dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.facts .pre { white-space: pre-line; }
.submitter {
  display: grid; gap: 2px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--canvas);
  font-size: var(--text-sm);
}
.submitter a { color: var(--ink); overflow-wrap: anywhere; }
.reject-box { display: grid; gap: 4px; margin-top: 8px; }
.reject-box label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.pending-pin.dup { box-shadow: 0 0 0 2px var(--err-ink), 0 2px 6px rgba(0, 0, 0, .3); }

/* ---------- Phones: bottom sheet ---------- */
@media (max-width: 760px) {
  :root { --sheet-h: 48svh; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h);
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  body.adding .panel { --sheet-h: 56svh; height: 56svh; }
  .panel-head, .panel-body, .panel-foot {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .panel-head { padding-top: 14px; padding-bottom: 10px; }
  .panel-head::before {
    content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px;
  }
  .panel-head h1 { font-size: 21px; }
  .map-hint { left: 50%; top: calc(64px + env(safe-area-inset-top, 0px)); }
  .mapboxgl-ctrl-bottom-right, .mapboxgl-ctrl-bottom-left { bottom: calc(var(--sheet-h) + 4px); }
  .mapboxgl-ctrl-bottom-left { left: env(safe-area-inset-left, 0px); }
  body.adding .mapboxgl-ctrl-bottom-right, body.adding .mapboxgl-ctrl-bottom-left { bottom: calc(56svh + 4px); }
  .two { grid-template-columns: 1fr; gap: 0; }
  #toast { bottom: calc(var(--sheet-h) + 12px); }
}

/* ---------- Public map: full-screen, name and Add button along the top ---------- */
.topbar {
  position: fixed; z-index: 10;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--surface); border-radius: 999px; padding: 10px 20px; box-shadow: var(--shadow);
}
.brand h1 { font-size: 20px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.add-top { height: 46px; padding: 0 20px; border-radius: 999px; box-shadow: var(--shadow); font-size: var(--text-md); }
.install-top { height: 46px; padding: 0 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: var(--text-md); background: var(--surface); margin-left: auto; }
.install-top[hidden] { display: none; }
.install-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-only .map-tools { top: calc(76px + env(safe-area-inset-top, 0px)); }
.map-only .mapboxgl-ctrl-bottom-left { left: env(safe-area-inset-left, 0px); }
.map-only #toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 760px) {
  .map-only .mapboxgl-ctrl-bottom-right, .map-only .mapboxgl-ctrl-bottom-left { bottom: env(safe-area-inset-bottom, 0px); }
  .topbar { top: calc(12px + env(safe-area-inset-top, 0px)); left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); gap: 8px; }
  .brand { padding: 9px 14px; }
  .brand h1 { font-size: 16px; }
  .add-top { height: 40px; padding: 0 14px; font-size: var(--text-sm); }
  .install-top { height: 40px; width: 40px; padding: 0; justify-content: center; flex: none; }
  .install-top span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .map-only .map-tools { top: calc(64px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); }
}

/* ---------- Add a temple: a normal scrolling form page ---------- */
body.form-page { overflow: auto; height: auto; }
.page-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(243, 243, 239, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand-link { font: 800 18px/1.1 var(--font-display); color: var(--ink); text-decoration: none; white-space: nowrap; }
.form-wrap {
  max-width: 720px; margin: 0 auto; padding: 28px 16px 48px;
}
.form-intro { margin-bottom: 20px; }
.form-intro h1 { font-size: 34px; font-weight: 800; line-height: 1.05; }
.form-intro p { margin-top: 8px; color: var(--muted); }
.form-page :is(#add-form, #edit-form), .form-page .thanks {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.form-page .step { margin-bottom: 30px; }
.form-page .step:last-of-type { margin-bottom: 0; }
.form-page details.step.more { margin-bottom: 30px; }
.form-page #more-step { margin: 30px 0 0; }
.map-box { position: relative; height: 440px; margin-top: 12px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.form-page #map { position: absolute; inset: 0; }
.form-page .map-tools { position: absolute; top: 12px; right: 12px; }
.form-page .map-hint { position: absolute; top: 12px; left: 12px; transform: none; }
.form-page .mapboxgl-ctrl-bottom-left { left: 0; }
.form-page .submit-area { margin-top: 20px; }
.form-page .submit-area .btn { height: 50px; font-size: var(--text-md); }
.form-page #toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 760px) {
  .form-wrap { padding: 20px 12px 40px; }
  .form-intro h1 { font-size: 28px; }
  .form-page :is(#add-form, #edit-form), .form-page .thanks { padding: 18px 14px; }
  .map-box { height: 360px; }
  .form-page .map-hint { top: auto; bottom: 12px; left: 50%; transform: translateX(-50%); }
  .form-page .mapboxgl-ctrl-bottom-right, .form-page .mapboxgl-ctrl-bottom-left { bottom: 0; }
}

/* ---------- Suggested edits (edit.html and the admin page) ---------- */
.suggest-link { font-size: var(--text-xs, 12px); color: var(--muted); text-decoration: underline; text-underline-offset: 2px; margin-top: 2px; }
.suggest-link:hover { color: var(--ink); }
.edit-temple { display: flex; gap: 12px; align-items: center; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.edit-temple img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.edit-temple div { display: grid; gap: 2px; min-width: 0; }
.edit-temple span { font-size: var(--text-sm); color: var(--muted); }
.upload-preview.current { opacity: .55; }
#pin-reset { margin-top: 6px; justify-self: start; }

.seg.tabs { margin: 10px 0 2px; box-shadow: none; border: 1px solid var(--line); }
.seg.tabs button { flex: 1 1 0; }
.seg.tabs .count { font-weight: 500; opacity: .8; }

.diff { display: grid; gap: 8px; margin: 8px 0 2px; }
.diff-row { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: var(--text-sm); }
.diff-row:has(input:not(:checked)) { opacity: .55; }
.diff-head { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--ink); cursor: pointer; }
.diff-head input { width: 16px; height: 16px; margin: 0; }
.diff-before, .diff-after { display: grid; grid-template-columns: 34px 1fr; gap: 6px; align-items: baseline; }
.diff-before > div, .diff-after > div { overflow-wrap: anywhere; white-space: pre-line; min-width: 0; }
.diff-before { color: var(--muted); }
.diff-before > div { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.diff-after { color: var(--ink); }
.diff-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.diff-after .diff-tag { color: var(--ok-ink); }
.diff-img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; display: block; }
.diff-img.logo { width: 44px; height: 44px; border-radius: 50%; }
.edit-note { font-size: var(--text-sm); color: var(--ink-2); background: var(--canvas); padding: 8px 10px; border-radius: 8px; margin-top: 4px; }
.pending-pin.old { background: #9A9CA6; }
.pending-pin.suggested { background: var(--marigold); width: 24px; height: 24px; }

/* ---------- Fix your submission (fix.html) ---------- */
.fix-auth { margin-top: 16px; }
.reviewer-note { margin: 12px 0; }
.reviewer-note p { margin-top: 4px; white-space: pre-line; }

/* ---------- Photo credit and history in the popup ---------- */
.popup .photo-credit { margin-top: -6px; font-size: 10.5px; color: var(--muted); text-align: right; }
.popup .photo-credit a { color: inherit; }
.popup-more summary { cursor: pointer; font-weight: 700; color: var(--ink); padding: 4px 0; }
.popup-more p { margin-top: 6px; white-space: pre-line; }
.popup-more[open] { max-height: 220px; overflow-y: auto; padding-right: 4px; }

/* ---------- Temple panel: side panel on wide screens, bottom sheet on phones ---------- */
.tp {
  position: fixed; z-index: 12;
  top: calc(76px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: 16px; width: 400px; max-width: calc(100% - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.tp[hidden] { display: none; }
.tp-open .map-tools { right: calc(432px + env(safe-area-inset-right, 0px)); }
.tp-grip { display: none; }
.tp-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); flex: none;
}
.tp-spacer { flex: 1; }
.tp-icon {
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.tp-icon:hover:not(:disabled) { border-color: var(--ink); }
.tp-icon:disabled { opacity: .35; cursor: default; }
.tp-icon svg, .tp-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tp-actions svg { width: 15px; height: 15px; }

.tp-body {
  overflow-y: auto; padding: 0 20px 20px; display: grid; gap: 12px; align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.tp-photo { margin: 0 -20px; }
.tp-photo img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--canvas); }
.tp-photo .photo-credit { margin: 4px 20px 0; font-size: 10.5px; color: var(--muted); text-align: right; }
.tp-photo .photo-credit a { color: inherit; }
.tp-body > :first-child:not(.tp-photo) { margin-top: 18px; }
.tp-head { display: flex; gap: 14px; align-items: center; }
.tp-logo, .near-logo {
  flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden;
  background: var(--canvas) center / cover no-repeat; border: 1px solid var(--line);
}
.tp-logo { width: 64px; height: 64px; }
.tp-logo img { width: 26px; height: 48px; object-fit: contain; }
.tp-title { min-width: 0; }
.tp-title h2 { font-size: 26px; font-weight: 800; line-height: 1.1; }
.tp-local { color: var(--muted); font-size: var(--text-sm); margin: 2px 0 0; }
.tp-type { color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; margin: 4px 0 0; }
.tp-deity { margin: 0; font-size: var(--text-sm); color: var(--ink-2); }
.tp-label, .tp-rows dt {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.tp-desc { margin: 0; color: var(--ink-2); }
.tp-actions { display: flex; gap: 8px; }
.tp-actions .btn { flex: 1; }
.tp-sec { border-top: 1px solid var(--line); padding-top: 12px; }
.tp-sec h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.tp-sec p { margin: 0; font-size: var(--text-sm); color: var(--ink-2); }
.tp-rows { margin: 0; display: grid; gap: 8px; }
.tp-rows dd { margin: 1px 0 0; font-size: var(--text-sm); color: var(--ink); white-space: pre-line; }
.tp-near { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tp-near button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit;
}
.tp-near button:hover { border-color: var(--ink-2); }
.near-logo { width: 36px; height: 36px; }
.near-logo img { width: 15px; height: 28px; object-fit: contain; }
.near-name { flex: 1; min-width: 0; font-weight: 600; font-size: var(--text-sm); line-height: 1.25; }
.near-name small { display: block; font-weight: 500; color: var(--muted); font-size: var(--text-xs); }
.near-d { flex: none; font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.tp-foot { margin: 4px 0 0; }

@media (max-width: 760px) {
  .tp {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none;
    height: 52vh; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: height .25s ease;
  }
  .tp.expanded { height: calc(100vh - 64px - env(safe-area-inset-top, 0px)); height: calc(100dvh - 64px - env(safe-area-inset-top, 0px)); }
  .tp-grip {
    display: grid; place-items: center; flex: none; height: 22px; padding: 0; border: 0; background: none; cursor: pointer;
  }
  .tp-grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .tp-bar { padding: 2px 12px 8px; }
  .tp-open .map-tools { right: calc(12px + env(safe-area-inset-right, 0px)); }
  .tp-open #toast { bottom: calc(52vh + 12px); }
  .tp-title h2 { font-size: 22px; }
  .tp-logo { width: 52px; height: 52px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .tp { transition: none; } }

/* ---------- Temple page (temple.html) ---------- */
.tpg { max-width: 960px; margin: 0 auto; padding: 24px 16px 56px; display: grid; gap: 14px; }
.tpg-loading { padding: 40px 0; }
.tpg-hero { margin: 0; }
.tpg-hero img { display: block; width: 100%; max-height: 440px; object-fit: cover; border-radius: var(--radius); background: var(--surface); }
.tpg-hero .photo-credit { margin: 4px 2px 0; font-size: 11px; color: var(--muted); text-align: right; }
.tpg-hero .photo-credit a { color: inherit; }
.tpg-head { display: flex; gap: 16px; align-items: center; margin-top: 6px; }
.tpg-head h1 { font-size: 38px; font-weight: 800; line-height: 1.05; }
.tpg-actions { flex-wrap: wrap; }
.tpg-actions .btn { flex: 0 0 auto; }
.tpg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; margin-top: 6px; }
.tpg-main, .tpg-side { display: grid; gap: 14px; }
.tpg-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: grid; gap: 10px; }
.tpg-card h2 { font-size: 20px; font-weight: 800; }
.tpg-card h3 { font-size: 15px; font-weight: 700; margin-top: 6px; }
.tpg-card p { margin: 0; color: var(--ink-2); }
.tpg-text { white-space: pre-line; line-height: 1.6; }
.tpg-map { position: relative; height: 220px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.tpg .tp-near a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
}
.tpg .tp-near a:hover { border-color: var(--ink-2); }
.tpg-foot { display: grid; gap: 4px; margin-top: 4px; }
@media (max-width: 760px) {
  .tpg { padding: 14px 12px 40px; }
  .tpg-grid { grid-template-columns: 1fr; }
  .tpg-head h1 { font-size: 28px; }
  .tpg-hero img { max-height: 280px; }
  .tpg-actions .btn { flex: 1 1 auto; }
}

/* ---------- Map search, filter chips and routes ---------- */
.msearch {
  position: relative; flex: 1 1 auto; max-width: 460px; min-width: 0;
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow);
}
.msearch:focus-within { box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.msearch > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.msearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--ink); height: 100%; }
.msearch input::-webkit-search-cancel-button { cursor: pointer; }
.msearch-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30;
  list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 420px); overflow-y: auto;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
}
.msearch-results li[role="option"] { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.msearch-results li[aria-selected="true"], .msearch-results li[role="option"]:hover { background: var(--canvas); }
.msearch-empty { padding: 10px; color: var(--muted); font-size: var(--text-sm); }
.topbar .brand { flex: none; }

.mchips {
  position: fixed; z-index: 9;
  top: calc(76px + env(safe-area-inset-top, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  right: calc(200px + env(safe-area-inset-right, 0px));
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none;
}
.mchips::-webkit-scrollbar { display: none; }
.mchips .chip { flex: none; height: 38px; box-shadow: 0 1px 2px rgba(28, 30, 38, .08), 0 4px 12px rgba(28, 30, 38, .08); }
.route-chip { gap: 6px; }
.route-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.route-chip[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.tp-open .mchips { right: calc(432px + env(safe-area-inset-right, 0px)); }

.routes-menu {
  position: fixed; z-index: 25;
  top: calc(124px + env(safe-area-inset-top, 0px)); left: calc(16px + env(safe-area-inset-left, 0px));
  width: 360px; max-width: calc(100% - 32px); padding: 8px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
}
.routes-menu-title { margin: 6px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.routes-menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.routes-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 10px;
  background: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
}
.routes-menu button:hover, .routes-menu button:focus-visible { background: var(--canvas); }

.rp-kicker { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-left: 4px; }
.rp-head { margin-top: 18px; }
.rp-head h2 { font-size: 26px; font-weight: 800; line-height: 1.1; }
.rp-total { margin: 0; font-size: var(--text-sm); color: var(--ink-2); }
.rp-from { cursor: default; color: var(--ok-ink); }
.rp-stops { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: none; }
.rp-stops button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit;
}
.rp-stops button:hover { border-color: var(--ink-2); }
.rp-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--marigold); color: #fff; font-size: 12px; font-weight: 800;
}
.rp-you { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.rp-you .rp-num { background: #1D4ED8; }
.rp-leg { margin: 2px 0 2px 21px; padding-left: 14px; border-left: 2px dashed var(--line); font-size: var(--text-xs); color: var(--muted); }
#tp-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stop-pin {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; padding: 0; cursor: pointer;
  background: var(--marigold); color: #fff; font: 800 12px/1 var(--font-ui);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .msearch { order: 3; flex: 1 0 100%; max-width: none; height: 44px; }
  .mchips { top: calc(120px + env(safe-area-inset-top, 0px)); left: 0; right: 0; padding: 2px 12px 8px; }
  .tp-open .mchips { right: 0; }
  .map-only .map-tools { top: calc(168px + env(safe-area-inset-top, 0px)); }
  .routes-menu { top: calc(166px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; width: auto; max-width: none; }
  .msearch-results { max-height: 50vh; }
}

/* ---------- Photo crop window (js/forms.js cropImage) ---------- */
.crop-overlay {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 16, 10, .55);
}
.crop-box {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); color: var(--ink); border-radius: 16px; padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3); display: grid; gap: 12px;
}
.crop-box.is-logo { width: min(420px, 100%); }
.crop-box h2 { margin: 0; font-size: var(--text-md); }
.crop-hint { margin: 0; font-size: var(--text-sm); color: var(--muted); }
.crop-stage {
  position: relative; width: 100%; overflow: hidden; border-radius: 10px; background: var(--canvas);
  cursor: grab; touch-action: none; user-select: none;
}
.crop-stage.dragging { cursor: grabbing; }
.crop-stage:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-stage.round::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); border: 2px solid #fff;
}
.crop-zoom { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--ink-2); }
.crop-zoom input { flex: 1; accent-color: var(--marigold); }
.crop-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
