:root {
  --bg: #ffffff;
  --fg: #1c1f24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0e7c86;
  --accent-fg: #ffffff;
  --shadow: 0 6px 24px rgba(0, 0, 0, .18);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#map { position: fixed; inset: 0; }

/* Numbered place markers */
.pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  display: grid; place-items: center;
}
.pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 15px; }
.pin.active { background: #d9822b; }

/* User position */
.me-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #2b7bf3; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 1px 4px rgba(0,0,0,.3);
}

.controls {
  position: fixed; z-index: 1000;
  top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ctrl {
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--bg); box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 20px;
}
.ctrl[aria-pressed="false"] { opacity: .75; }
#locate { color: #2b7bf3; }

/* Sheets */
.sheet {
  position: fixed; z-index: 1100; left: 0; right: 0; bottom: 0;
  background: var(--bg); box-shadow: var(--shadow);
  border-radius: var(--radius) var(--radius) 0 0;
  padding-bottom: var(--safe-b);
}

.list-sheet {
  max-height: 60vh;
  transform: translateY(calc(100% - 56px - var(--safe-b)));
  transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.list-sheet.open { transform: translateY(0); }
.handle {
  border: 0; background: none; width: 100%; height: 56px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600;
}
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
#place-list { list-style: none; margin: 0; padding: 0 12px 12px; overflow-y: auto; }
#place-list li button {
  width: 100%; text-align: left; border: 0; background: none;
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-top: 1px solid var(--line);
}
#place-list .num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
}
#place-list .name { flex: 1; }
#place-list .dist { color: var(--muted); font-size: 14px; white-space: nowrap; }

.card {
  z-index: 1200; max-height: 88vh; overflow-y: auto;
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.card[hidden] { display: none; }
.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: 16 / 9; border-radius: var(--radius) var(--radius) 0 0; background: var(--line);
}
.gallery::-webkit-scrollbar { display: none; }
.gallery[hidden] { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.dots {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; gap: 6px; padding: 5px 8px; border-radius: 999px; background: rgba(0,0,0,.35);
}
.dots[hidden] { display: none; }
.dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.5); }
.dots button.on { background: #fff; }
.media { position: relative; }
.model-frame { aspect-ratio: 4 / 3; background: #111; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.model-frame[hidden] { display: none; }
.model-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.view-toggle {
  position: absolute; left: 10px; bottom: 10px;
  border: 0; border-radius: 999px; padding: 8px 14px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 14px; font-weight: 600;
}
.view-toggle[hidden] { display: none; }
.credit { margin: 6px 18px 0; font-size: 12px; color: var(--muted); }
.credit a { color: inherit; }
.close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 24px; line-height: 1;
}
.card-body { padding: 16px 18px 20px; }
.card-body h1 { font-size: 21px; line-height: 1.25; margin: 0 0 4px; }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
#card-desc { margin: 14px 0 18px; }

.player { display: flex; align-items: center; gap: 12px; }
.play {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-fg); font-size: 18px;
}
.track { flex: 1; min-width: 0; }
#seek { width: 100%; accent-color: var(--accent); margin: 0; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.restart {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); font-size: 20px;
}

.transcript { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.transcript[hidden] { display: none; }
.transcript summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.transcript p { margin: 10px 0 0; font-size: 15px; }

.directions {
  display: block; text-align: center; text-decoration: none; font-weight: 600;
  padding: 13px; border-radius: 12px; background: #1a73e8; color: #fff;
}

.hint {
  position: fixed; z-index: 1300; left: 12px; right: 12px;
  bottom: calc(68px + var(--safe-b));
  background: #1c1f24; color: #fff; border-radius: 12px; padding: 12px 40px 12px 14px;
  font-size: 14px; box-shadow: var(--shadow);
}
.hint .x { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: #fff; font-size: 20px; width: 30px; height: 30px; }

/* Wider screens: panels on the left instead of bottom sheets */
@media (min-width: 768px) {
  .sheet { left: 16px; right: auto; width: 380px; bottom: 16px; border-radius: var(--radius); }
  .list-sheet { top: 16px; max-height: none; transform: none; }
  .handle { cursor: default; }
  .grip { display: none; }
  .card { top: 16px; max-height: none; }
  .hint { left: auto; right: 16px; width: 360px; bottom: 16px; }
}
