/* amble — all styles. Light is the daytime default (high contrast, big type);
   dark follows prefers-color-scheme in a deep blue-slate family. Tokens carry
   both themes so components never hard-code a colour. */

:root {
  color-scheme: light dark;

  --bg: #f2eee4;
  --panel: #fffdf8;
  --panel-2: #f8f3e8;        /* map background — warm paper */
  --ink: #171a1d;
  --muted: #5b6470;
  --hairline: #e3dccd;

  --street: #c4b8a2;
  --street-major: #a5946f;
  --map-casing: #fffdf8;     /* a hair lighter than the paper → soft casing */

  --accent: #b5842a;         /* gold */
  --accent-strong: #86590f;  /* darker gold for text/links on light bg */
  --accent-soft: #f2e6c7;

  --route: #b07f27;
  --pin: #c9962e;
  --pin-hi: #e4ba5b;
  --pin-ink: #2a1e05;
  --visited: #9aa1a8;

  --shadow: rgba(46, 36, 12, .13);
  --focus: #86590f;
  --danger: #b3261e;         /* form / registry error text */

  --maxw: 680px;
  --radius: 14px;
}

/* Dark tokens. Applied by the system preference (unless ?theme=light pins it)
   and by an explicit ?theme=dark override. Light is the plain :root default. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1418;
    --panel: #14202a;
    --panel-2: #0f1a22;
    --ink: #e8edf1;
    --muted: #93a1ad;
    --hairline: #233543;

    --street: #33454f;
    --street-major: #4c6472;
    --map-casing: #17262f;

    --accent: #d8ad4e;
    --accent-strong: #e6c169;
    --accent-soft: #26313b;

    --route: #d8ad4e;
    --pin: #cf9f3f;
    --pin-hi: #e8c46a;
    --pin-ink: #171003;
    --visited: #48545f;

    --shadow: rgba(0, 0, 0, .5);
    --focus: #e6c169;
    --danger: #f2a19b;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1418;
  --panel: #14202a;
  --panel-2: #0f1a22;
  --ink: #e8edf1;
  --muted: #93a1ad;
  --hairline: #233543;

  --street: #33454f;
  --street-major: #4c6472;
  --map-casing: #17262f;

  --accent: #d8ad4e;
  --accent-strong: #e6c169;
  --accent-soft: #26313b;

  --route: #d8ad4e;
  --pin: #cf9f3f;
  --pin-hi: #e8c46a;
  --pin-ink: #171003;
  --visited: #48545f;

  --shadow: rgba(0, 0, 0, .5);
  --focus: #e6c169;
  --danger: #f2a19b;
}

/* ── base ─────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

/* [hidden] must always win, even on elements we give a display (e.g. .lightbox). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

a { color: var(--accent-strong); text-underline-offset: 2px; }

h1, h2, h3 { line-height: 1.2; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 5px;
}

.loading { color: var(--muted); padding: 28px 0; }

.skip-link {
  position: absolute;
  left: 8px; top: -60px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 80;
  transition: top .15s;
}
.skip-link:focus { top: calc(8px + env(safe-area-inset-top)); }

/* ── index: header, cards ─────────────────────────────────────────────── */

.site-head {
  padding: calc(20px + env(safe-area-inset-top)) 0 18px;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel);
}
.brand { margin: 0; font-size: 1.85rem; letter-spacing: -.015em; }
.brand-tag { margin: .25em 0 0; color: var(--muted); }

#index-root { padding-block: 8px 24px; }

.tour-list { list-style: none; margin: 0; padding: 0; }

.tour-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tour-card:hover { border-color: var(--accent); box-shadow: 0 3px 10px var(--shadow); }
.tour-card:active { transform: translateY(1px); }
.tour-card-body { flex: 1; min-width: 0; }
.tour-card-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.18rem; }
.tour-card-tag { margin: .28em 0 .5em; color: var(--muted); }
.tour-card-meta { margin: 0; font-size: .9rem; font-weight: 600; }
.tour-card-start { margin: .25em 0 0; font-size: .85rem; color: var(--muted); }
.tour-card-go { flex: 0 0 auto; font-size: 1.5rem; color: var(--accent); }
.dev-badge {
  font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-strong); background: var(--accent-soft);
  border-radius: 5px; padding: 2px 6px;
}

.empty-state { text-align: center; color: var(--muted); padding: 48px 12px; }
.empty-state strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }

.qr-block { text-align: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.qr-block img { width: 132px; height: 132px; image-rendering: pixelated; border-radius: 10px; }
.qr-caption { margin: 8px 0 0; color: var(--muted); font-size: .85rem; }

.site-foot {
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: .88rem;
  padding: 20px 0 calc(22px + env(safe-area-inset-bottom));
  margin-top: 20px;
}

/* ── tour: header ─────────────────────────────────────────────────────── */

.tour-head {
  padding: calc(14px + env(safe-area-inset-top)) 0 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel);
}
.back-link { display: inline-block; font-weight: 600; font-size: .9rem; text-decoration: none; margin-bottom: 8px; }
.back-link:hover { text-decoration: underline; }
.tour-title { margin: .05em 0; font-size: 1.72rem; letter-spacing: -.01em; }
.tour-tagline { margin: .2em 0 0; color: var(--muted); font-size: 1.04rem; }
.tour-meta { margin: .6em 0 0; font-size: .9rem; color: var(--ink); opacity: .82; }

.tour-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 14px;
}
.progress { color: var(--muted); font-weight: 600; font-size: .95rem; }

.locate-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 15px;
  border: 1.5px solid var(--hairline); border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.locate-btn.is-on { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.locate-ico {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; position: relative; flex: 0 0 auto;
}
.locate-ico::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}

/* ── tour: intro ──────────────────────────────────────────────────────── */

.intro { padding: 18px 0 4px; }
.intro p { margin: 0 0 .7em; }
.intro-toggle { margin-top: 2px; }
.link-btn {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--accent-strong); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline;
}

/* ── tour: map ────────────────────────────────────────────────────────── */

.map-section { padding: 10px 0 6px; }

.map-frame {
  position: relative;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--hairline), 0 1px 3px var(--shadow);
  touch-action: pan-y;
}
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.street-casing { fill: none; stroke: var(--map-casing); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.street { fill: none; stroke: var(--street); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.street-major { stroke: var(--street-major); stroke-width: 3.4; }

.route-glow { fill: none; stroke: var(--route); stroke-opacity: .16; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.route { fill: none; stroke: var(--route); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 0.5 8.5; }

.map-overlay { position: absolute; inset: 0; pointer-events: none; }

.street-label {
  position: absolute; transform-origin: center;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 3px var(--panel-2), 0 0 3px var(--panel-2), 0 0 2px var(--panel-2), 0 0 2px var(--panel-2);
}

/* pins — 44px hit target, ~30px visual dot */
.pin {
  position: absolute; transform: translate(-50%, -50%);
  width: 44px; height: 44px; padding: 0; margin: 0; border: 0;
  background: none; cursor: pointer; pointer-events: auto;
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.pin-dot {
  position: relative;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(157deg, var(--pin-hi), var(--pin));
  color: var(--pin-ink); font-weight: 700; font-size: 15px; line-height: 1;
  box-shadow: 0 0 0 2px var(--panel-2), 0 2px 5px var(--shadow);
  transition: transform .14s, box-shadow .14s;
}
.pin-check { display: none; font-size: 16px; }
.pin.is-visited .pin-dot { background: var(--visited); box-shadow: 0 0 0 2px var(--panel-2), 0 1px 3px var(--shadow); }
.pin.is-visited .pin-num { display: none; }
.pin.is-visited .pin-check { display: block; color: var(--panel-2); }
.pin.is-active .pin-dot {
  transform: scale(1.14);
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px var(--panel-2), 0 3px 7px var(--shadow);
}
.pin-badge {
  position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  color: var(--pin-ink); background: var(--accent);
  padding: 1px 6px; border-radius: 6px; box-shadow: 0 1px 2px var(--shadow);
}
.pin.is-startfinish .pin-dot { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--panel-2), 0 2px 5px var(--shadow); }

/* near-stop nudge — a static accent ring plus a sonar pulse (motion only) */
.pin.is-nudge .pin-dot {
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px var(--panel-2), 0 3px 8px var(--shadow);
}
.pin.is-nudge::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%; border: 2px solid var(--accent);
  pointer-events: none; z-index: -1;
  animation: pin-pulse 1.2s ease-out infinite;
}
@keyframes pin-pulse {
  0%   { transform: scale(.85); opacity: .8; }
  70%  { transform: scale(2); opacity: 0; }
  100% { transform: scale(2); opacity: 0; }
}

.here-dot {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px var(--panel-2), 0 0 0 4px var(--accent); z-index: 3;
}
.here-accuracy {
  position: absolute; border-radius: 50%;
  background: var(--accent); opacity: .14; transform: translate(-50%, -50%);
  pointer-events: none; z-index: 2;
}

.map-compass {
  position: absolute; top: 11px; right: 11px; width: 50px; height: 50px;
  pointer-events: none; filter: drop-shadow(0 1px 2px var(--shadow));
}
.compass { display: block; width: 100%; height: 100%; }
.compass-ring { fill: var(--panel); fill-opacity: .92; stroke: var(--muted); stroke-width: 1.2; }
.compass-needle-n { fill: var(--accent); }
.compass-needle-s { fill: var(--muted); }
.compass-hub { fill: var(--panel-2); stroke: var(--muted); stroke-width: .7; }
.compass-n { fill: var(--ink); font-size: 11px; font-weight: 700; }

.map-hint {
  position: absolute; left: 9px; top: 9px; max-width: calc(100% - 76px);
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 6px 13px; font-size: 13px; font-weight: 600;
  box-shadow: 0 1px 3px var(--shadow); pointer-events: none;
}

.map-attribution { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }

/* ── tour: stop cards ─────────────────────────────────────────────────── */

.stops { padding-bottom: 8px; }

.stop-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  margin-top: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px var(--shadow);
}
.stop-header {
  width: 100%; display: flex; gap: 13px; align-items: flex-start;
  text-align: left; background: none; border: 0; color: inherit; font: inherit;
  padding: 15px 16px; min-height: 44px; cursor: pointer;
}
.stop-num {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  color: var(--accent-strong); background: var(--accent-soft);
  border: 1.5px solid var(--accent);
}
.stop-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.stop-name { font-weight: 700; font-size: 1.08rem; }
.stop-where { color: var(--muted); font-size: .85rem; }
.stop-hook { font-size: .95rem; margin-top: 3px; }
.chevron {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .18s;
}
.stop-card.is-open .chevron { transform: rotate(-135deg); }

.stop-panel { padding: 0 16px 16px; }

.stop-figure { margin: 0 0 14px; position: relative; }
.img-btn {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  cursor: zoom-in; border-radius: 10px; overflow: hidden;
}
.stop-img {
  display: block; width: 100%; max-height: 40vh; object-fit: cover;
  border-radius: 10px; background: var(--panel-2);
}
.img-credit { margin: 7px 2px 0; color: var(--muted); font-size: 12px; }
.img-credit a { color: var(--accent-strong); }

/* then ↔ now flip badge — a corner pill over the image, in card + lightbox */
.flip-badge {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  display: inline-flex; align-items: center; min-height: 40px;
  padding: 6px 13px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(12, 16, 20, .66); color: #fff;
  font: inherit; font-weight: 700; font-size: 12px; letter-spacing: .02em;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4); backdrop-filter: blur(2px);
}
.flip-badge:hover { background: rgba(12, 16, 20, .8); }
.lb-flip { top: 10px; right: 10px; }
.is-flipping { animation: flip-fade .15s ease; }
@keyframes flip-fade { from { opacity: .25; } to { opacity: 1; } }

.stop-body { font-size: 1.02rem; }
.stop-body p { margin: 0 0 .8em; }
.stop-body p:last-child { margin-bottom: 0; }

.facts { margin: 16px 0; }
.facts-title { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.facts-list { margin: 0; padding-left: 1.15em; }
.facts-list li { margin: .25em 0; }

.sources { margin: 14px 0 0; border-top: 1px solid var(--hairline); padding-top: 12px; }
.sources summary { cursor: pointer; font-weight: 600; color: var(--accent-strong); min-height: 28px; }
.sources-list { margin: 8px 0 0; padding-left: 1.15em; }
.sources-list li { margin: .3em 0; }

/* footer area is a distinct block so v2 "Ask the guide" can slot in as a sibling */
.stop-footer { margin-top: 16px; border-top: 1px solid var(--hairline); padding-top: 13px; display: flex; flex-direction: column; gap: 13px; }
.leg { margin: 0; font-size: .95rem; }
.leg-label { font-weight: 700; }
.leg-directions { color: var(--muted); }
.leg-end { color: var(--muted); font-style: italic; }

.visited-btn {
  align-self: flex-start; min-height: 44px; padding: 8px 18px;
  border: 1.5px solid var(--accent); border-radius: 999px;
  background: transparent; color: var(--accent-strong);
  font: inherit; font-weight: 600; cursor: pointer;
}
.visited-btn[aria-pressed="true"] { background: var(--accent); color: var(--pin-ink); }

/* ── tour: read it to me (TTS) ──────────────────────────────────────────── */
/* A pill play/pause button + a round ✕ stop, in the card's gold accent. Sits at
   the top of an expanded card; only rendered when Web Speech is supported. */

.tts-wrap { margin-bottom: 14px; }
.tts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tts-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border: 1.5px solid var(--accent); border-radius: 999px;
  background: transparent; color: var(--accent-strong);
  font: inherit; font-weight: 600; cursor: pointer;
}
.tts-btn.is-active { background: var(--accent); color: var(--pin-ink); }
.tts-ico { font-size: .82em; line-height: 1; }
.tts-stop {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0;
  border: 1.5px solid var(--hairline); border-radius: 50%;
  background: var(--panel); color: var(--ink);
  font: inherit; font-size: 1rem; cursor: pointer;
}

/* §1b: voice + pace settings — a gear chip that expands an inline row */
.tts-gear {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 8px 15px;
  border: 1.5px solid var(--hairline); border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.tts-gear.is-active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.tts-gear-ico { font-size: 1.05em; line-height: 1; }

.tts-settings {
  margin-top: 11px; padding: 13px 14px;
  border: 1px solid var(--hairline); border-radius: 12px; background: var(--panel-2);
  display: flex; flex-direction: column; gap: 13px;
}
.tts-field { display: flex; flex-direction: column; gap: 7px; }
.tts-field-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700;
}
.tts-voice-select {
  min-height: 44px; padding: 8px 12px;
  border: 1.5px solid var(--hairline); border-radius: 10px;
  background: var(--panel); color: var(--ink); font: inherit;
}
.tts-pace-group { display: flex; gap: 8px; flex-wrap: wrap; }
.tts-pace {
  flex: 1 1 auto; min-height: 44px; padding: 8px 16px;
  border: 1.5px solid var(--hairline); border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.tts-pace.is-on { border-color: var(--accent); background: var(--accent); color: var(--pin-ink); }

/* ── tour: ask the guide (v2) ─────────────────────────────────────────── */
/* A search-bar affordance + a streamed answer set apart from the tour prose by
   a left accent rule. This whole block only ever renders when the guide backend
   is live, so its absence leaves a v1 card untouched. */

.guide-lead { margin: 0; font-size: .95rem; font-weight: 700; }
.guide-sub { color: var(--muted); font-weight: 400; }

.guide-form { display: flex; gap: 8px; margin-top: 9px; }
.guide-input {
  flex: 1; min-width: 0; min-height: 44px; padding: 9px 13px;
  border: 1.5px solid var(--hairline); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font: inherit;
}
.guide-input::placeholder { color: var(--muted); }
.guide-ask {
  flex: 0 0 auto; min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--accent); border-radius: 10px;
  background: var(--accent); color: var(--pin-ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.guide-input:disabled, .guide-ask:disabled { opacity: .6; cursor: default; }

.guide-answer {
  margin-top: 11px; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent);
  font-size: .94rem; line-height: 1.55; white-space: pre-wrap;
}
.guide-answer.is-thinking { color: var(--muted); font-style: italic; border-left-color: var(--hairline); }
.guide-note { margin: 9px 0 0; font-size: .72rem; color: var(--muted); }

/* question chips — pre-baked prompts between the lead and the ask box */
.guide-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.guide-chip {
  min-height: 44px; padding: 8px 15px;
  border: 1.5px solid var(--hairline); border-radius: 999px;
  background: var(--panel-2); color: var(--accent-strong);
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  text-align: left;
}
.guide-chip:hover { border-color: var(--accent); }
.guide-chip:disabled { opacity: .55; cursor: default; }

/* ── tour: the registry (guest book) ──────────────────────────────────── */
/* Sits after the visited toggle on the last stop; only renders when the
   guide backend is healthy, so its absence leaves a v1 card untouched. */

.registry { border-top: 1px solid var(--hairline); padding-top: 13px; }
.registry > summary {
  cursor: pointer; font-weight: 700; color: var(--accent-strong);
  min-height: 28px; list-style: revert;
}
.registry-count { font-weight: 400; color: var(--muted); }
.registry-list { list-style: none; margin: 11px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.registry-sig { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; font-size: .92rem; }
.sig-name { font-weight: 700; }
.sig-line { color: var(--ink); }
.sig-ts { color: var(--muted); font-size: .8rem; margin-left: auto; font-variant-numeric: tabular-nums; }
.registry-empty { color: var(--muted); font-style: italic; }

.registry-form { display: flex; flex-direction: column; gap: 9px; margin-top: 13px; }
.registry-fields { display: flex; flex-direction: column; gap: 9px; }
.registry-name, .registry-line {
  min-height: 44px; padding: 9px 13px;
  border: 1.5px solid var(--hairline); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font: inherit;
}
.registry-name::placeholder, .registry-line::placeholder { color: var(--muted); }
.registry-sign {
  align-self: flex-start; min-height: 44px; padding: 0 22px;
  border: 1.5px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: var(--pin-ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.registry-sign:disabled { opacity: .6; cursor: default; }
.registry-error { margin: 0; color: var(--danger); font-size: .85rem; font-weight: 600; }
.registry-signed { margin: 13px 0 0; font-weight: 700; color: var(--accent-strong); }

/* ── tour: footer ─────────────────────────────────────────────────────── */

.tour-foot {
  margin-top: 26px; border-top: 1px solid var(--hairline);
  padding: 20px 0 calc(22px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: .9rem;
}
.credits { margin-bottom: 12px; }
.credits p { margin: 0 0 .6em; }
.foot-links { margin: 0 0 8px; }
.foot-brand { margin: 0; opacity: .8; }
.foot-receipt { margin: 0 0 8px; }
.registry-link { font-weight: 600; }

/* ── error card ───────────────────────────────────────────────────────── */

.error-card {
  margin: 40px auto; max-width: 460px; text-align: center;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 28px 22px; box-shadow: 0 1px 3px var(--shadow);
}
.error-card h1 { margin: 0 0 8px; font-size: 1.3rem; }
.error-card p { color: var(--muted); margin: 0 0 18px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block; min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 1.5px solid var(--accent);
  font-weight: 600; text-decoration: none; cursor: pointer; font: inherit;
  color: var(--pin-ink); background: var(--accent);
}
.btn-ghost { background: transparent; color: var(--accent-strong); }

/* ── lightbox ─────────────────────────────────────────────────────────── */

.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 22px; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(5, 9, 11, .88); }
.lb-figure { position: relative; margin: 0; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.lb-img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; }
.lb-credit { margin: 0; color: #e8edf1; font-size: 13px; text-align: center; }
.lb-close {
  position: absolute; top: -12px; right: -8px; width: 40px; height: 40px;
  border-radius: 50%; border: 0; cursor: pointer; font-size: 18px;
  background: var(--panel); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

/* ── finish receipt ───────────────────────────────────────────────────── */
/* A till-style card: dashed border, tabular numerals, the gold accent. */

.receipt { position: fixed; inset: 0; z-index: 92; display: grid; place-items: center; padding: 22px; }
.receipt-backdrop { position: absolute; inset: 0; background: rgba(5, 9, 11, .8); }
.receipt-card {
  position: relative; z-index: 1; width: 100%; max-width: 340px;
  background: var(--panel); color: var(--ink);
  border: 2px dashed var(--accent); border-radius: 8px;
  padding: 24px 22px 18px; box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
  font-variant-numeric: tabular-nums;
}
.receipt-x {
  position: absolute; top: 6px; right: 6px; width: 34px; height: 34px;
  border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer;
}
.receipt-brand {
  margin: 0; text-align: center; font-weight: 800;
  letter-spacing: .3em; text-transform: lowercase; color: var(--accent-strong);
}
.receipt-title { margin: .35em 0 .1em; text-align: center; font-size: 1.18rem; }
.receipt-date { margin: 0; text-align: center; color: var(--muted); font-size: .85rem; }
.receipt-summary { margin: .5em 0 0; text-align: center; font-weight: 700; }
.receipt-rule { border-top: 1.5px dashed var(--hairline); margin: 14px 0; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; font-size: .96rem; }
.receipt-k { color: var(--muted); }
.receipt-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.receipt-foot { margin: 4px 0 0; text-align: center; font-size: .8rem; color: var(--muted); font-style: italic; }
.receipt-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.receipt-actions .btn { min-height: 44px; }

/* ── toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  max-width: calc(100% - 32px); text-align: center;
  opacity: 0; pointer-events: none; z-index: 95;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── reduced motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .pin-dot, .chevron, .toast, .tour-card { transition: none !important; }
  /* nudge pulse and photo cross-fade fall back to a static, motion-free state */
  .pin.is-nudge::after { animation: none; opacity: .5; transform: scale(1.5); }
  .is-flipping { animation: none; }
}

/* ── v0.2.0: family footer + share link ─────────────────────────────────── */
.foot-family { display: inline-block; margin-top: .35rem; font-size: .78rem; color: var(--muted, #8a8375); }
.foot-family a, p.foot-family a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
p.foot-family { margin: .35rem 0 0; font-size: .78rem; color: var(--muted, #8a8375); }
.qr-link { display: inline-block; line-height: 0; border-radius: 8px; }
.qr-link:focus-visible { outline: 3px solid var(--accent, #c9962e); outline-offset: 3px; }

/* ── v0.2.1: guide debug expander ───────────────────────────────────────── */
.guide-debug { margin-top: .45rem; font-size: .74rem; color: var(--muted, #8a8375); }
.guide-debug summary { cursor: pointer; user-select: none; }
.guide-debug summary::marker { color: var(--accent, #c9962e); }
.guide-debug-grid { display: grid; grid-template-columns: auto 1fr; gap: .12rem .8rem; margin: .4rem 0 0; }
.guide-debug-grid dt { opacity: .75; }
.guide-debug-grid dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ── v0.2.1: theme toggle ───────────────────────────────────────────────── */
.theme-toggle { position: absolute; top: calc(.6rem + env(safe-area-inset-top));
  right: calc(.6rem + env(safe-area-inset-right)); z-index: 60;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--panel);
  color: var(--ink); font-size: 1.1rem; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .14); }
.theme-toggle:focus-visible { outline: 3px solid var(--accent, #c9962e); outline-offset: 2px; }

/* ── v0.4: index place cards (town-first) ───────────────────────────────── */
/* A photo-forward card per place; the flat walk list still renders unchanged
   when the registry carries no area entries. */
.place-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); margin-top: 14px; overflow: hidden;
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.place-card:hover { border-color: var(--accent); box-shadow: 0 3px 10px var(--shadow); }
.place-card:active { transform: translateY(1px); }
.place-card-img { display: block; width: 100%; height: 170px; object-fit: cover; background: var(--panel-2); }
.place-card-body { padding: 15px 18px 16px; }
.place-card-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.28rem; }
.place-card-tag { margin: .3em 0 0; color: var(--muted); }
.place-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: .6em; }
.place-card-label { margin: 0; font-size: .92rem; font-weight: 700; color: var(--accent-strong); }
.place-card-go { flex: 0 0 auto; font-size: 1.5rem; color: var(--accent); }

/* ── v0.4: area (town guide) page ───────────────────────────────────────── */

.area-hero { margin: 0; }
.area-hero-img { display: block; width: 100%; max-height: 42vh; object-fit: cover; background: var(--panel-2); }
.area-hero-credit {
  max-width: var(--maxw); margin-inline: auto;
  padding: 7px max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  color: var(--muted); font-size: 12px;
}
.area-hero-credit a { color: var(--accent-strong); }

/* hero already fills the very top, so the header drops the safe-area top inset */
.area-head { padding-top: 15px; }

/* "Walks in <place>" — compact tap-targets right under the header */
.walks-slot:empty { display: none; }
.walks-block { padding: 16px 0 4px; }
.walks-title { margin: 0 0 2px; font-size: 1.16rem; }
.walks-list { list-style: none; margin: 0; padding: 0; }
.walk-row {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 13px 16px; margin-top: 10px;
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.walk-row:hover { border-color: var(--accent); box-shadow: 0 3px 10px var(--shadow); }
.walk-row:active { transform: translateY(1px); }
.walk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.walk-row-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.02rem; }
.walk-row-meta { color: var(--muted); font-size: .88rem; font-weight: 600; }
.walk-row-go { flex: 0 0 auto; font-size: 1.4rem; color: var(--accent); }

/* "About <place>" — the overview prose */
.about { padding: 16px 0 2px; }
.about-title { margin: 0 0 6px; font-size: 1.16rem; }
.about-body { font-size: 1.02rem; }
.about-body p { margin: 0 0 .8em; }
.about-body p:last-child { margin-bottom: 0; }

/* the top "Ask about <place>" shell — reuses the .guide component, wrapped to
   the reading column and always present (offline note appears when the guide is down) */
.guide-area {
  max-width: var(--maxw); margin-inline: auto;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-top: 18px; padding-bottom: 8px;
}
.guide-area .guide-lead { font-size: 1.16rem; }
.area-chips { margin-top: 11px; }
.guide-orask { margin: 12px 0 0; font-size: .85rem; color: var(--muted); }
.guide-offline {
  margin: 11px 0 0; padding: 10px 13px;
  border: 1px solid var(--hairline); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--panel-2);
  color: var(--muted); font-size: .9rem;
}

/* chapter cards — the pin badge becomes a light "Chapter N" kicker */
.chapter-kicker {
  font-size: .7rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent-strong);
}
.chapter-guide-slot:empty { display: none; }
.chapter-guide-slot .guide { margin-top: 16px; border-top: 1px solid var(--hairline); padding-top: 14px; }

/* ── v0.4: save for offline ─────────────────────────────────────────────── */
/* Sits in the footer of walks and town guides, above the family line. Hairline
   and muted like the registry block; a ghost button so the footer stays quiet.
   Every colour is a token, so dark mode needs no rules of its own. */

.dl { margin: 14px 0 12px; padding-top: 13px; border-top: 1px solid var(--hairline); }
.dl-btn { font-size: .9rem; }
.dl-btn[hidden] { display: none; }        /* .btn sets display, which would beat [hidden] */
.dl-btn:disabled { opacity: .6; cursor: default; }
.dl-status { margin: 0; color: var(--ink); font-weight: 600; }
.dl-sub { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.dl-actions { display: flex; align-items: baseline; gap: 8px; margin: 9px 0 0; font-size: .85rem; }
.dl-actions[hidden] { display: none; }    /* same trap: a display rule outranks [hidden] */
.dl-links { display: inline-flex; align-items: baseline; gap: 5px; }
.dl-when { margin-left: auto; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
