:root {
  --lake: #123e59;
  --lake-2: #0d6283;
  --mist: #dceaf0;
  --cream: #f7f0e2;
  --paper: #fffdf7;
  --ink: #173344;
  --muted: #657682;
  --nature: #a81fc4;
  --accent: #ec7c2b;
  --shadow: 0 12px 34px rgba(7, 31, 45, .18);
  --nav-height: 76px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--cream); color: var(--ink); }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

button { font: inherit; }

button:focus-visible { outline: 3px solid #86d6ef; outline-offset: 2px; }

.app-shell { min-height: 100dvh; max-width: 760px; margin: 0 auto; background: var(--paper); }

.topbar {
  height: 78px;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  background: var(--lake);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.topbar-home {
  margin-left: auto; margin-right: 10px; flex: 0 0 auto;
  color: white; text-decoration: none; font-size: .82rem; font-weight: 850;
  padding: 9px 12px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; white-space: nowrap;
}
@media (max-width: 520px) { .topbar-home { font-size: 0; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; } .topbar-home::before { content: "⌂"; font-size: 1.2rem; } }

.header-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .78;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: 1.55rem; line-height: 1; }
h2 { font-family: Georgia, serif; font-size: 1.55rem; line-height: 1.12; margin-bottom: 10px; }
h3 { font-family: Georgia, serif; font-size: 1.25rem; margin-bottom: 6px; }

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.08);
  color: white;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.map-workspace { position: relative; height: calc(100dvh - 78px); min-height: 560px; overflow: hidden; background: #d8e3dd; }

.map-viewport {
  position: absolute;
  inset: 0 0 var(--nav-height);
  overflow: hidden;
  touch-action: none;
  background: #a8b9ab;
  cursor: grab;
}

.map-viewport.dragging { cursor: grabbing; }

.map-canvas {
  position: absolute;
  width: min(100%, 620px);
  aspect-ratio: 1353 / 2048;
  left: 50%;
  top: 50%;
  transform-origin: center;
  will-change: transform;
  user-select: none;
}

.map-canvas > img { width: 100%; height: 100%; display: block; pointer-events: none; }

.status-card {
  position: absolute;
  z-index: 20;
  top: auto;
  bottom: calc(var(--nav-height) + 12px);
  left: 12px;
  right: auto;
  width: min(66%, 320px);
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 13px;
  background: rgba(255, 253, 247, .94);
  box-shadow: 0 6px 20px rgba(14, 48, 65, .16);
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: .86rem;
  font-weight: 700;
}

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lake-2); box-shadow: 0 0 0 5px rgba(13,98,131,.12); flex: 0 0 auto; }
.status-card.live .status-dot { background: #187c4d; box-shadow: 0 0 0 5px rgba(24,124,77,.14); }

.mode-controls {
  position: absolute;
  z-index: 20;
  top: 12px;
  left: 12px;
  right: auto;
  display: grid;
  gap: 8px;
  width: min(44%, 180px);
}

.primary-control, .secondary-control, .tour-button, .text-button {
  border: 0;
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 15px;
  font-weight: 800;
}

.primary-control, .tour-button { background: var(--lake); color: white; box-shadow: 0 4px 16px rgba(18,62,89,.2); }
.tour-link { display: block; text-align: center; text-decoration: none; }
.secondary-control { background: rgba(255,253,247,.94); color: var(--lake); border: 1px solid rgba(18,62,89,.2); }
.text-button { background: var(--mist); color: var(--lake); }
.wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }

.zoom-controls {
  position: absolute;
  z-index: 20;
  right: 12px;
  bottom: calc(var(--nav-height) + 12px);
  display: grid;
  gap: 6px;
}

.zoom-controls button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,253,247,.96);
  color: var(--lake);
  box-shadow: 0 5px 18px rgba(7,31,45,.2);
  font-size: 1.4rem;
  font-weight: 800;
}

.bottom-nav {
  position: fixed;
  z-index: 25;
  bottom: 0;
  left: 50%;
  width: min(100%, 760px);
  transform: translateX(-50%);
  min-height: var(--nav-height);
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  background: rgba(255,253,247,.97);
  border-top: 1px solid rgba(18,62,89,.15);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  gap: 2px;
}

.bottom-nav button span { font-size: 1.15rem; }
.bottom-nav button.active { background: var(--mist); color: var(--lake); }

.hotspot {
  position: absolute;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
}

.hotspot.selected { border-color: transparent; box-shadow: none; background: transparent; }

@media (hover: hover) {
  .hotspot:hover {
    border-color: rgba(255,255,255,.96);
    box-shadow: 0 0 0 3px rgba(18,62,89,.78);
  }
}

.hotspot:focus-visible {
  outline: 2px solid rgba(255,255,255,.98);
  outline-offset: 1px;
  box-shadow: 0 0 0 4px rgba(18,62,89,.82);
}

.you-are-here, .accuracy-ring { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.accuracy-ring { width: 72px; height: 72px; border-radius: 50%; background: rgba(20,123,209,.15); border: 1px solid rgba(20,123,209,.42); }
.you-are-here { width: 26px; height: 26px; z-index: 10; }
.you-are-here .dot { position: absolute; inset: 6px; border-radius: 50%; background: #147bd1; border: 3px solid white; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.you-are-here .pulse { position: absolute; inset: 0; border-radius: 50%; background: rgba(20,123,209,.28); animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }

.list-view, .tour-view { min-height: calc(100dvh - 78px); padding: 22px 18px calc(var(--nav-height) + 28px); background: var(--cream); }
.view-heading { margin-bottom: 18px; }
.place-list { display: grid; gap: 10px; }
.place-row {
  width: 100%;
  border: 1px solid rgba(18,62,89,.15);
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
}
.place-marker { width: 42px; height: 42px; border-radius: 50%; background: var(--lake-2); color: white; display: grid; place-items: center; font-weight: 900; }
.place-marker.nature { background: var(--nature); }
.place-row strong { display: block; margin-bottom: 2px; }
.place-row small { color: var(--muted); font-size: .78rem; }
.place-row .chevron { color: var(--lake-2); font-size: 1.35rem; }

.tour-view { display: grid; align-content: start; gap: 16px; }
.tour-card { border-radius: 20px; overflow: hidden; background: var(--paper); box-shadow: var(--shadow); }
.tour-card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.featured-tour img { object-position: center 48%; }
.compact-tour { display: grid; grid-template-columns: 120px 1fr; }
.compact-tour img { height: 100%; min-height: 190px; }
.tour-copy { padding: 17px; }
.tour-copy p { color: var(--muted); line-height: 1.45; }
.tour-meta { color: var(--lake-2) !important; font-size: .75rem; text-transform: uppercase; font-weight: 900; letter-spacing: .06em; }
.coming-soon { display: inline-block; color: var(--lake); font-size: .82rem; font-weight: 800; }

.sheet-backdrop { position: fixed; z-index: 80; inset: 0; background: rgba(8,27,38,.44); backdrop-filter: blur(2px); }
.bottom-sheet {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 0;
  width: min(100%, 760px);
  max-height: min(78dvh, 680px);
  overflow-y: auto;
  transform: translateX(-50%);
  padding: 25px 20px max(24px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  box-shadow: 0 -15px 50px rgba(8,27,38,.24);
}
.sheet-handle { width: 42px; height: 5px; border-radius: 5px; background: #c7d0d4; position: absolute; top: 9px; left: 50%; transform: translateX(-50%); }
.sheet-close { position: absolute; top: 13px; right: 15px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--mist); color: var(--lake); font-size: 1.5rem; }
.sheet-kicker { margin: 7px 48px 4px 0; color: var(--lake-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 900; }
.bottom-sheet > p:not(.sheet-kicker) { color: var(--muted); line-height: 1.5; }
.sheet-photo {
  display: block;
  width: calc(100% + 40px);
  height: auto;
  margin: 12px -20px 16px;
  object-fit: contain;
  background: transparent;
}
.sheet-photo.portrait {
  width: min(100%, 520px);
  max-height: none;
  margin: 12px auto 16px;
  object-position: center;
}
.sheet-photo.cutout { display: block; width: min(78%, 310px); height: 260px; margin: 4px auto 16px; object-fit: contain; }
.trail-details { margin: 4px 0 16px; }
.trail-details > strong { display: block; margin-bottom: 9px; color: var(--lake); }
.trail-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.trail-list li { padding: 9px 10px; border-radius: 11px; background: var(--mist); color: var(--ink); font-size: .86rem; font-weight: 750; }
.audio-box { padding: 14px; border-radius: 15px; background: var(--mist); margin: 14px 0; }
.audio-box audio { width: 100%; margin-top: 8px; }
.sheet-action {
  display: block;
  width: 100%;
  margin-top: 14px;
  border-radius: 999px;
  padding: 13px 16px;
  background: var(--lake);
  color: white;
  text-align: center;
  text-decoration: none;
  font-weight: 900;
}
.show-on-map {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(18,62,89,.22);
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--paper);
  color: var(--lake);
  font-weight: 900;
}
.house-stops { margin: 14px 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.house-stops li { display: flex; gap: 9px; align-items: center; font-size: .9rem; }
.stop-number { width: 25px; height: 25px; border-radius: 50%; background: var(--lake); color: white; display: grid; place-items: center; flex: 0 0 auto; font-size: .72rem; font-weight: 900; }
.info-callout { margin: 16px 0; padding: 14px; border-left: 4px solid var(--accent); background: #fff4e9; }
.info-callout p { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }

.calibration-list { margin: 18px 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.calibration-item { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid rgba(18,62,89,.15); border-radius: 14px; }
.calibration-item .marker { width: 36px; height: 36px; border-radius: 50%; background: var(--lake); color: white; display: grid; place-items: center; font-weight: 900; }
.calibration-item strong, .calibration-item small { display: block; }
.calibration-item small { color: var(--muted); margin-top: 2px; }
.capture-button { border: 0; border-radius: 999px; padding: 9px 11px; background: var(--mist); color: var(--lake); font-weight: 800; }
.capture-button.saved { background: #dff3e8; color: #17683f; }
.setup-actions { display: grid; gap: 8px; }

@media (min-width: 720px) {
  body { padding: 18px; }
  .app-shell { min-height: calc(100dvh - 36px); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); }
  .map-workspace { height: calc(100dvh - 114px); }
  .bottom-sheet { bottom: 18px; border-radius: 24px; width: min(calc(100% - 36px), 724px); }
  .bottom-nav { bottom: 18px; width: min(calc(100% - 36px), 724px); border-radius: 0 0 26px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---------- v11 desktop layout: illustrated map + side panel ---------- */
.side-panel { display: none; }
.hotspot-label { display: none; }
.hotspot.hover { border-color: rgba(255,255,255,.96); box-shadow: 0 0 0 3px rgba(18,62,89,.78); }

@media (min-width: 1000px) {
  body { padding: 0; background: var(--paper); }
  .app-shell {
    max-width: none; min-height: 100dvh; border-radius: 0; box-shadow: none;
    display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: auto 1fr;
  }
  .topbar { grid-column: 1 / -1; }
  .map-workspace { height: calc(100dvh - 78px); min-height: 560px; }
  .map-viewport { inset: 0; }
  .map-canvas.illustrated {
    aspect-ratio: 1568 / 2662;
    width: min(100%, calc((100dvh - 78px) * 1568 / 2662));
  }
  .map-canvas.aerial-desktop { width: min(100%, calc((100dvh - 78px) * 1353 / 2048)); }
  .map-canvas.aerial-desktop .hotspot-label { display: none; }
  .map-canvas.aerial-desktop .hotspot { border: 2px solid transparent; transform: translate(-50%, -50%); }
  .map-canvas.aerial-desktop .hotspot.hover, .map-canvas.aerial-desktop .hotspot.selected { border-color: white; box-shadow: 0 0 0 3px rgba(18,62,89,.8); }
  .map-style { display: inline-flex; border: 1px solid rgba(18,62,89,.2); border-radius: 999px; padding: 3px; margin: 0 0 18px; background: white; }
  .map-style button { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: .82rem; padding: 6px 14px; border-radius: 999px; color: var(--lake); cursor: pointer; }
  .map-style button.active { background: var(--lake); color: white; }
  .mode-controls { display: none; }
  .bottom-nav { display: none; }
  .map-viewport { background: #e9e3d3; }
  .hotspot-label { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--lake-2); color: white; font-weight: 900; font-size: .8rem; border: 2px solid white; box-shadow: 0 2px 6px rgba(8,27,38,.35); }
  .hotspot[data-category="nature"] .hotspot-label { background: var(--nature); }
  .hotspot[data-category="other"] .hotspot-label { background: #b8642b; }
  .hotspot { display: grid; place-items: center; transform: translate(-50%, -50%) scale(var(--inv, 1)); }
  .hotspot.selected .hotspot-label, .hotspot.hover .hotspot-label { transform: scale(1.25); background: white; color: var(--lake); }
  .hotspot.selected { border-color: transparent; box-shadow: none; }
  .zoom-controls { bottom: 18px; }
  .status-card { bottom: 18px; }
  .list-view, .tour-view { display: none !important; }

  .side-panel {
    display: block; position: relative; background: var(--cream); border-left: 1px solid rgba(18,62,89,.12);
    height: calc(100dvh - 78px); min-height: 560px; overflow: hidden;
  }
  .side-scroll { height: 100%; overflow-y: auto; padding: 22px 22px 28px; }
  .side-intro h2 { font-family: Georgia, serif; font-weight: 500; font-size: 1.55rem; margin: 0 0 6px; color: var(--lake); }
  .side-intro p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; font-size: .92rem; }
  .legend-group { margin-bottom: 18px; }
  .legend-group h3 { margin: 0 0 6px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--lake-2); font-weight: 900; }
  .legend-row {
    display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; width: 100%;
    padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  }
  .legend-row .place-marker { width: 32px; height: 32px; font-size: .82rem; }
  .legend-row .place-marker.other { background: #b8642b; }
  .legend-row:hover, .legend-row.hover, .legend-row:focus-visible { background: var(--mist); }
  .legend-row.selected { background: var(--lake); color: white; }
  .legend-row.selected .place-marker { background: white; color: var(--lake); }
  .side-tours { border-top: 1px solid rgba(18,62,89,.12); padding-top: 16px; margin-top: 6px; }
  .side-tours h3 { margin: 0 0 8px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--lake-2); font-weight: 900; }
  .side-tours a { display: block; padding: 10px 12px; border-radius: 12px; background: white; border: 1px solid rgba(18,62,89,.1); margin-bottom: 8px; text-decoration: none; color: var(--ink); }
  .side-tours a strong { display: block; color: var(--lake); }
  .side-tours a span { font-size: .85rem; color: var(--muted); }
  .side-tours a:hover { border-color: var(--lake-2); }
  .side-foot { margin: 14px 0 0; font-size: .85rem; }
  .side-foot a { color: var(--lake); }

  /* place sheet lives inside the panel on desktop */
  .side-panel .bottom-sheet {
    position: absolute; inset: 0; left: 0; bottom: auto; width: 100%; max-height: none; height: 100%;
    transform: none; border-radius: 0; box-shadow: none; background: var(--cream); padding: 22px 22px 32px; z-index: 5;
  }
  .side-panel .sheet-handle { display: none; }
  .side-panel .sheet-photo { width: calc(100% + 44px); margin: 12px -22px 16px; }
  .side-panel .sheet-photo.portrait { width: 100%; margin: 12px 0 16px; }
  .side-panel .show-on-map { display: inline-flex; }
}
