:root {
  --parch: #f7f0e1;
  --parch-2: #efe4cc;
  --ink: #2f2418;
  --ink-2: #5c4a35;
  --accent: #9b4a1c;
  --gold: #b8860b;
  --line: rgba(80, 60, 30, 0.18);
  --shadow: 0 10px 30px rgba(40, 25, 10, 0.25);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #c6dbe9; color: var(--ink); font-family: var(--sans); }
#app { position: fixed; inset: 0; }
canvas { display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

/* ------------------------------------------------ title */
.titlebar {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  padding: 10px 16px 11px; border-radius: 10px;
  background: rgba(247, 240, 225, 0.82); backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(40, 25, 10, 0.15);
}
.titlebar .home { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); text-decoration: none; font-weight: 600; }
.titlebar h1 { margin: 2px 0 0; font: 700 26px/1.05 var(--serif); }
.titlebar p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.titlebar .credit { font-size: 11px; color: #8a7658; }

/* ------------------------------------------------ labels */
.label {
  white-space: nowrap; transition: opacity 0.3s; user-select: none;
  transform-origin: center bottom;
}
.label.item {
  font: 700 15px/1 var(--serif); letter-spacing: 0.02em;
  padding: 5px 9px 4px; border-radius: 6px;
  background: var(--parch); color: var(--ink); border: 1.5px solid var(--accent);
  box-shadow: 0 2px 6px rgba(40, 25, 10, 0.3);
}
.label.item::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--accent); border-bottom: 0;
}
.label.tower, .label.feature {
  font: 500 italic 14px/1 var(--serif);
  padding: 3px 7px; border-radius: 5px;
  background: rgba(247, 240, 225, 0.86); color: var(--ink-2);
  border: 1px solid var(--line);
}
.label.tower { font-style: normal; font-weight: 600; color: var(--ink); }
.label.region {
  font: 700 22px/1 var(--serif); letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(70, 48, 20, 0.85); text-shadow: 0 0 6px rgba(255, 248, 230, 0.9), 0 0 2px #fff8e6;
}
.label.mount {
  font: italic 600 21px/1 var(--serif); letter-spacing: 0.06em;
  color: #3e4a26; text-shadow: 0 0 6px rgba(255, 250, 235, 0.95), 0 0 2px #fff;
}
.label.active {
  opacity: 1 !important; z-index: 2;
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.45), 0 4px 12px rgba(40, 25, 10, 0.35);
  background: #fff8e3;
}
.label.region.active, .label.mount.active { box-shadow: none; background: none; }

/* ------------------------------------------------ stop popup */
.popup {
  position: absolute; z-index: 6; left: 16px; bottom: 112px;
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 220px); overflow: auto;
  padding: 16px 18px 14px; border-radius: 12px;
  background: var(--parch); box-shadow: var(--shadow); border: 1px solid var(--line);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity 0.45s, transform 0.45s;
}
.popup.show { opacity: 1; transform: none; pointer-events: auto; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.popup h2 { margin: 4px 0 8px; font: 700 27px/1.05 var(--serif); }
blockquote {
  margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--gold);
  font: italic 500 17px/1.32 var(--serif); color: var(--ink);
}
.popup p, .card p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.facts { font-size: 12.5px; color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--line); }
.facts span { font-weight: 600; color: var(--ink); margin-right: 4px; }
.facts + .facts { border-top: 0; padding-top: 3px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 10px; padding: 0; }
.chips li { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; }
.chips li.status { background: var(--ink); color: var(--parch); }
.chips li.yes { background: #e6d29b; color: #4a3507; }
.chips li.yes::before { content: '✓ '; }
.chips li.no { background: transparent; color: #a8987d; border: 1px dashed #c9b998; text-decoration: line-through; }
.timer { height: 3px; margin-top: 10px; border-radius: 2px; background: var(--parch-2); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

.next-chip {
  position: absolute; z-index: 6; left: 50%; top: 18px; transform: translate(-50%, -8px);
  padding: 7px 14px; border-radius: 99px; background: rgba(47, 36, 24, 0.82); color: var(--parch);
  font: 600 16px/1 var(--serif); white-space: nowrap; opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none;
}
.next-chip span { font: 600 10.5px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: #e6c27a; margin-right: 6px; }
.next-chip em { font: 500 12px var(--sans); color: #cdbb98; margin-left: 6px; font-style: normal; }
.next-chip.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------ intro / finale card */
.card {
  position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -46%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  padding: 26px 28px 22px; border-radius: 14px; background: var(--parch); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.5s, transform 0.5s;
}
.card.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.card h1 { margin: 4px 0 12px; font: 700 40px/1 var(--serif); }
.card blockquote { font-size: 19px; }
.card .aside { font-size: 12.5px; color: #8a7658; font-style: italic; }
.card .credits { margin: 16px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; color: #8a7658; }
.card .credits a { color: var(--accent); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.actions button {
  font: 600 14px var(--sans); padding: 10px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
}
.actions button.primary { background: var(--accent); color: #fff; }
.actions button:hover { filter: brightness(1.08); }

/* ------------------------------------------------ dock */
.dock {
  position: absolute; z-index: 7; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
}
.progress {
  display: flex; gap: 4px; padding: 6px 9px; border-radius: 99px; background: rgba(247, 240, 225, 0.82);
  backdrop-filter: blur(6px); flex-wrap: wrap; justify-content: center;
}
.progress button {
  width: 11px; height: 11px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--ink-2); background: transparent; transition: transform 0.2s, background 0.2s;
}
.progress button:hover { transform: scale(1.35); }
.progress button.done { background: var(--ink-2); }
.progress button.current { background: var(--gold); border-color: var(--accent); transform: scale(1.35); }
.controls {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 12px;
  background: rgba(47, 36, 24, 0.86); box-shadow: var(--shadow);
}
.controls button, .controls .home-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; border: 0; cursor: pointer;
  background: transparent; color: var(--parch);
}
.controls button:hover, .controls .home-btn:hover { background: rgba(255, 255, 255, 0.1); }
.controls svg { width: 20px; height: 20px; fill: currentColor; }
#play { background: var(--accent); }
#play .i-play { display: none; }
#play.paused .i-play { display: block; }
#play.paused .i-pause { display: none; }
.controls button.text { width: auto; padding: 0 12px; font: 600 13px var(--sans); }
.controls button.text.on { background: var(--gold); color: var(--ink); }
.controls .sep { width: 1px; height: 24px; background: rgba(255, 255, 255, 0.18); margin: 0 4px; }
.speed { display: flex; align-items: center; gap: 6px; color: #cdbb98; font-size: 12px; padding-left: 4px; }
.speed select {
  font: 600 13px var(--sans); color: var(--parch); background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 7px; padding: 6px 6px;
}
.speed select option { color: var(--ink); }
.narration { display: flex; align-items: center; gap: 6px; }
.narration[hidden] { display: none; }
#mute .i-off, #mute.muted .i-on { display: none; }
#mute.muted .i-off { display: block; }
#volume { width: 72px; accent-color: var(--gold); }
#voice { max-width: 130px; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.explore-hint {
  position: absolute; z-index: 6; left: 50%; top: 18px; transform: translateX(-50%);
  padding: 7px 14px; border-radius: 99px; background: rgba(47, 36, 24, 0.82); color: var(--parch);
  font-size: 12.5px; opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
body.exploring .explore-hint { opacity: 1; }
body.exploring .next-chip { opacity: 0; }

/* ------------------------------------------------ compass: turns with the camera so N points north */
.compass {
  position: absolute; z-index: 5; top: 16px; right: 16px; width: 44px; height: 44px; pointer-events: none;
  opacity: 0.8;
}
.compass svg { display: block; width: 100%; height: 100%; overflow: visible; }
.compass circle { fill: rgba(247, 240, 225, 0.82); stroke: rgba(80, 60, 30, 0.35); stroke-width: 1; }
.compass #compass-rose { transform-origin: 20px 20px; }
.compass .n { fill: var(--accent); }
.compass .s { fill: #b6a88c; }
.compass text { font: 700 7px var(--sans); fill: var(--ink); text-anchor: middle; }
body.exploring .popup { opacity: 0.35; }

@media (max-width: 640px) {
  .titlebar { top: 10px; left: 10px; padding: 7px 12px; }
  .titlebar h1 { font-size: 21px; }
  .titlebar p { display: none; }
  .dock { left: 16px; right: 16px; transform: none; max-width: none; }
  .controls { flex-wrap: wrap; justify-content: center; width: 100%; }
  .controls .sep { display: none; }
  .popup { left: 16px; right: 16px; width: auto; bottom: 196px; max-height: 46vh; padding: 12px 14px; }
  .popup h2 { font-size: 22px; }
  blockquote { font-size: 15.5px; }
  .popup p { font-size: 13px; }
  .next-chip { top: auto; bottom: 198px; font-size: 14px; }
  .compass { top: 10px; right: 10px; width: 36px; height: 36px; }
  .speed span { display: none; }
  #volume { display: none; }
  .label.item { font-size: 13px; }
  .label.feature, .label.tower { font-size: 12px; }
  .label.region, .label.mount { font-size: 16px; }
}

/* The finale card sits at the side (at the bottom on phones), so the court stays in view. */
.card.low, .card.low.show { top: auto; left: 16px; bottom: 112px; width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 240px); }
.card.low { transform: translateY(12px); }
.card.low.show { transform: none; }
@media (max-width: 640px) {
  .card.low, .card.low.show { right: 16px; width: auto; bottom: 196px; max-height: 46vh; }
}
.label.person, .label.animal {
  font: 600 15px/1 var(--serif); letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 5px;
  background: rgba(247, 240, 225, 0.86); color: var(--ink);
  border: 1px solid var(--line);
}
@media (max-width: 640px) { .label.person, .label.animal { font-size: 12px; } }
.label.animal { font-weight: 500; font-style: italic; color: var(--ink-2); }

/* The day and the time of day, over the stop's title; a gap between the days in the progress dots. */
.popup .when { margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.progress button.day { margin-left: 7px; }
