:root {
  --ink: #f4e9d8;
  --ink-dim: rgba(244, 233, 216, 0.55);
  --glow: #f2b872;

  /* The map's look: 0 night (smoky glass, cream ink) … 1 day (cream glass, brown ink).
     minimap.js sets --map-day from the height of the sun; the canvas uses the same colours. */
  --map-day: 1;
  --map-ink-day: 1; /* text and lines: flip quickly once the glass is past halfway, so they never fade into it */
  --md: calc(var(--map-day) * 100%);
  --mi: calc(var(--map-ink-day) * 100%);
  --map-glass: color-mix(in srgb, rgba(244, 233, 216, 0.84) var(--md), rgba(24, 16, 10, 0.6));
  --map-glass-hover: color-mix(in srgb, rgba(255, 246, 228, 0.94) var(--md), rgba(40, 28, 18, 0.82));
  --map-solid: color-mix(in srgb, #f0e6d0 var(--mi), #1e150e);
  --map-ink: color-mix(in srgb, #34200f var(--mi), #f4e9d8);
  --map-ink-dim: color-mix(in srgb, rgba(52, 32, 16, 0.66) var(--mi), rgba(244, 233, 216, 0.66));
  --map-rim: color-mix(in srgb, rgba(255, 250, 240, 0.55) var(--md), rgba(244, 233, 216, 0.24));
  --map-accent: color-mix(in srgb, #b8692c var(--mi), #f2c98e);
  --map-pin: color-mix(in srgb, #fff9ee var(--mi), #f4e9d8);
  --map-pin-edge: color-mix(in srgb, #3a2412 var(--mi), #18100a);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d0b09;
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

#loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, #1c1611 0%, #0d0b09 70%);
  transition: opacity 1.6s ease;
  z-index: 10;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader[hidden] { display: none; }
#loader.ready { cursor: pointer; }
#loader.ready .ring { animation-play-state: paused; border-color: rgba(242, 184, 114, 0.35); }
#loader.ready #loader-status { color: var(--ink); animation: beckon 2.4s ease-in-out infinite; }
@keyframes beckon { 50% { opacity: 0.45; } }
#loader h1 {
  margin: 18px 0 0;
  font: italic 400 34px/1 "Cormorant Garamond", serif;
  letter-spacing: 0.02em;
}
#loader p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 184, 114, 0.15);
  border-top-color: var(--glow);
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 32px;
  display: grid;
  justify-items: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease 1s;
}
#hud.show { opacity: 1; }

#gait-name {
  margin: 0 0 6px;
  font: italic 400 30px/1 "Cormorant Garamond", serif;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#gait-name.show {
  opacity: 1;
  transform: none;
}

#keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
  padding: 0 16px;
}
#keys span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 10.5px/1 Inter, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
  transition: color 0.5s ease;
}
#keys kbd {
  font: 500 10px/1 Inter, sans-serif;
  letter-spacing: 0.12em;
  min-width: 26px;
  padding: 6px 8px;
  text-align: center;
  border-radius: 5px;
  border: 1px solid rgba(244, 233, 216, 0.3);
  background: rgba(20, 14, 10, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}
#keys span.active { color: var(--ink); }
#keys span.active kbd {
  color: #1a120b;
  background: rgba(244, 226, 196, 0.9);
  border-color: transparent;
}

#hint kbd {
  font: 500 9.5px/1 Inter, sans-serif;
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid rgba(244, 233, 216, 0.35);
}
#hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  transition: opacity 1.5s ease;
}
#hint.hide { opacity: 0; }

#fps {
  position: fixed;
  bottom: 10px;
  left: 10px;
  font: 11px/1.4 ui-monospace, monospace;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 7px;
  border-radius: 4px;
  display: none;
  white-space: pre;
}

/* ---- Shared glass chip ---- */
.cap {
  margin: 0 0 7px 2px;
  font: 500 9px/1 Inter, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(244, 233, 216, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 0 12px rgba(0, 0, 0, 0.5);
}
.chip {
  --hold: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 216, 0.2);
  background: rgba(20, 14, 10, 0.26);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  color: var(--ink);
  font: 500 11.5px/1 Inter, sans-serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.45s ease, color 0.45s ease, border-color 0.45s ease, transform 0.25s ease;
}
.chip:hover {
  border-color: rgba(244, 233, 216, 0.5);
  background: rgba(20, 14, 10, 0.38);
}
.chip:active { transform: scale(0.97); }
.chip svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chip.active {
  color: #1a120b;
  background: rgba(244, 226, 196, 0.92);
  border-color: transparent;
}
/* A bar along the bottom of a picked chip that runs down over the 30-second hold. */
.chip::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: #c77a32;
  transform: scaleX(var(--hold));
  transform-origin: left;
  pointer-events: none;
}

/* ---- Top left: time of day, weather, sound ---- */
#sky-bar {
  position: fixed;
  left: 28px;
  top: 26px;
  display: grid;
  gap: 16px;
  max-width: calc(100vw - 300px);
  opacity: 0;
  transition: opacity 2s ease 1.4s;
  z-index: 2;
}
#sky-bar.show { opacity: 1; }
#sky-bar .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#sound-chip kbd {
  font: 500 9px/1 Inter, sans-serif;
  padding: 3px 5px;
  margin-left: 2px;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: 0.55;
}
#sound-chip .off { display: none; }
#sound-chip.muted .on { display: none; }
#sound-chip.muted .off { display: inline; }
#sound-chip.waiting { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { border-color: rgba(244, 233, 216, 0.2); }
  50% { border-color: rgba(242, 184, 114, 0.9); }
}

/* ---- Top right: the map ---- */
#map-panel {
  position: fixed;
  right: 28px;
  top: 26px;
  width: 188px;
  display: grid;
  justify-items: stretch;
  gap: 12px;
  opacity: 0;
  transition: opacity 2s ease 1.4s;
  z-index: 2;
}
#map-panel.show { opacity: 1; }
#minimap {
  position: relative;
  width: 188px;
  height: 188px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: zoom-in;
  /* Glass, like the chips: the land is drawn see-through and the valley blurs behind it. */
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 0 0 1px var(--map-rim), 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
#minimap:hover {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px rgba(242, 184, 114, 0.9), 0 10px 30px rgba(0, 0, 0, 0.36);
}
#minimap canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
}
#minimap .north {
  position: absolute;
  width: 17px;
  height: 17px;
  margin: -8.5px 0 0 -8.5px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--map-ink);
  color: var(--map-solid);
  font: 600 9px/1 Inter, sans-serif;
  box-shadow: 0 0 0 1px var(--map-rim);
}
#minimap .expand {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--map-glass-hover);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#minimap:hover .expand { opacity: 1; }
#minimap .expand svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--map-ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The next place and how far: a pill sitting on the bottom of the map's rim. */
#next {
  justify-self: center;
  margin-top: -26px;
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--map-glass);
  border: 1px solid var(--map-rim);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  color: var(--map-ink);
  white-space: nowrap;
}
#next .cap { margin: 0; font-size: 8.5px; color: var(--map-ink-dim); text-shadow: none; }
#next .pname { font: italic 400 16px/1 "Cormorant Garamond", serif; }
#next .dist {
  font: 500 11px/1 Inter, sans-serif;
  color: var(--map-accent);
  font-variant-numeric: tabular-nums;
}
#here {
  margin: -2px 0 0;
  text-align: center;
  font: 500 9px/1 Inter, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(244, 233, 216, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 0 12px rgba(0, 0, 0, 0.5);
}

/* ---- The full map ---- */
#big-map {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 4, 0);
  transition: background 0.45s ease;
  z-index: 4;
}
#big-map[hidden] { display: none; }
#big-map.open { background: rgba(8, 6, 4, 0.55); }
#big-map .sheet {
  position: relative;
  width: min(84vh, 84vw, 880px);
  aspect-ratio: 1;
  border-radius: 22px;
  overflow: hidden;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 0 0 1px var(--map-rim), 0 30px 90px rgba(0, 0, 0, 0.5);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 0.45s ease;
}
#big-map canvas {
  width: 100%;
  height: 100%;
  display: block;
}
#big-map header {
  position: absolute;
  left: 26px;
  top: 22px;
  color: var(--map-ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}
#big-map.open header,
#big-map.open .pins,
#big-map.open .close { opacity: 1; }
#big-map h2 {
  margin: 0 0 6px;
  font: italic 400 34px/1 "Cormorant Garamond", serif;
}
#big-map header p {
  margin: 0;
  font: 500 10px/1 Inter, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.7;
}
#big-map .close {
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}
#big-map .close kbd {
  display: block;
  font: 600 10px/1 Inter, sans-serif;
  letter-spacing: 0.1em;
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--map-ink);
  background: var(--map-glass);
  border: 1px solid var(--map-rim);
}
#big-map .pins {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}
.pin {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.pin i {
  position: absolute;
  left: -8px;
  top: -8px;
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  background: var(--map-pin);
  border: 2px solid var(--map-pin-edge);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, background 0.25s ease;
}
.pin .label {
  position: absolute;
  left: 16px;
  top: -14px;
  display: grid;
  gap: 4px;
  padding: 6px 10px 7px;
  border-radius: 8px;
  background: var(--map-glass);
  border: 1px solid var(--map-rim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
  color: var(--map-ink);
  text-align: left;
  white-space: nowrap;
  transition: background 0.25s ease, transform 0.25s ease;
}
.pin .pname { font: italic 600 17px/1 "Cormorant Garamond", serif; }
.pin .dist {
  font: 500 9.5px/1 Inter, sans-serif;
  letter-spacing: 0.08em;
  opacity: 0.75;
}
.pin.flip .label { left: auto; right: 16px; text-align: right; }
.pin:hover i { transform: rotate(45deg) scale(1.3); background: #f2b872; }
.pin:hover .label { background: var(--map-glass-hover); transform: translateX(3px); }
.pin.flip:hover .label { transform: translateX(-3px); }
.pin.here i { background: #f2b872; }
.pin.here { cursor: default; }

/* ---- A question for the rider (let the horse drink?): above the controls, a few seconds to answer ---- */
#ask {
  position: fixed;
  left: 50%;
  bottom: 158px;
  transform: translate(-50%, 8px);
  display: grid;
  justify-items: center;
  gap: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 3;
}
#ask.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
#ask .q {
  margin: 0;
  font: italic 400 30px/1 "Cormorant Garamond", serif;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
#ask .opts { display: flex; gap: 12px; }
#ask button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 5px 16px 5px 5px;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 216, 0.22);
  background: rgba(20, 14, 10, 0.3);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  color: var(--ink);
  font: 500 10.5px/1 Inter, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
#ask button:hover {
  color: #1a120b;
  background: rgba(244, 226, 196, 0.92);
  border-color: transparent;
}
#ask kbd {
  font: 500 10px/1 Inter, sans-serif;
  letter-spacing: 0.12em;
  min-width: 24px;
  padding: 5px 7px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 216, 0.3);
}
#ask button:hover kbd { border-color: rgba(26, 18, 11, 0.35); }
#ask .time {
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glow), transparent);
}
#ask.show .time { animation: ask-time var(--wait, 5s) linear forwards; }
@keyframes ask-time { to { transform: scaleX(0); } }

/* ---- Place names as you ride in ---- */
#place-banner {
  position: fixed;
  left: 50%;
  top: 13vh;
  transform: translate(-50%, 8px);
  display: grid;
  justify-items: center;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease, transform 1.4s ease;
  z-index: 1;
}
#place-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#place-banner .rule {
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glow), transparent);
}
#place-banner .name {
  font: italic 400 44px/1 "Cormorant Garamond", serif;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}
#place-banner .note {
  font: 500 10px/1 Inter, sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}

/* ---- The opening: title and "Click to begin" over the live valley ---- */
#begin {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(10vh + 5vh);
  display: grid;
  justify-items: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.6s ease, transform 1.6s ease;
  z-index: 6;
}
#begin::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 90vw);
  height: 260px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(10, 8, 6, 0.42) 0%, rgba(10, 8, 6, 0) 70%);
  z-index: -1;
}
#begin.show {
  opacity: 1;
  transform: none;
  transition-delay: 0.9s;
}
#begin.gone {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
#begin h1 {
  margin: 0 0 8px;
  font: italic 400 62px/1 "Cormorant Garamond", serif;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
}
#begin .go {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 22px 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 216, 0.45);
  background: rgba(20, 14, 10, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: 500 11px/1 Inter, sans-serif;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  animation: beckon 2.6s ease-in-out infinite;
}
#begin .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0 0 rgba(242, 184, 114, 0.6);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(242, 184, 114, 0.55); }
  70%, 100% { box-shadow: 0 0 0 12px rgba(242, 184, 114, 0); }
}
#begin .note {
  margin: 2px 0 0;
  font: 400 11px/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  color: rgba(244, 233, 216, 0.6);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
#scene.waiting { cursor: pointer; }

/* ---- Credit ---- */
.credit {
  margin: 0;
  font: 400 11px/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  color: rgba(244, 233, 216, 0.6);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.credit a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 233, 216, 0.35);
  transition: border-color 0.3s ease, color 0.3s ease;
}
.credit a:hover { color: var(--glow); border-color: var(--glow); }
#credit {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease 1s;
}
#credit.show { opacity: 1; pointer-events: auto; }
#credit.ride { opacity: 0.85; }
#credit.ride:hover { opacity: 1; transition: opacity 0.3s ease; }
/* Sound credits: a quiet link before the name, stepping aside with the controls (main.js,
   syncTuck), and the list it opens just above. */
#sound-credit { transition: opacity 0.9s ease; }
#sound-credit.tucked { opacity: 0; pointer-events: none; }
#sound-credit button {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-shadow: inherit;
  transition: color 0.3s ease;
}
#sound-credit button:hover,
#sound-credit button[aria-expanded='true'] { color: var(--glow); }
#sound-credit .dot { margin: 0 0.7em; }
#credits {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 24px);
  z-index: 8;
  width: min(340px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(244, 233, 216, 0.16);
  background: rgba(20, 14, 10, 0.55);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: rgba(244, 233, 216, 0.78);
  text-shadow: none;
}
#credits p { margin: 0; }
#credits p + p { margin-top: 8px; }

/* ---- Controls that step aside: faded out a few seconds after last use, back on hover ---- */
#sky-bar.show.tucked {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
}
#sky-bar.show:not(.tucked) { transition: opacity 0.35s ease; }
#hud #keys,
#hud #hint { transition: opacity 0.9s ease; }
#hud.tucked #keys,
#hud.tucked #hint { opacity: 0; }

/* Film bars for the opening shot; they slide away as the riding camera takes over. */
#letterbox {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
#letterbox i {
  position: absolute;
  left: 0;
  right: 0;
  height: 10vh;
  background: #0a0908;
  transform: scaleY(0);
  transition: transform 1.6s cubic-bezier(0.6, 0, 0.2, 1);
}
#letterbox i:first-child { top: 0; transform-origin: top; }
#letterbox i:last-child { bottom: 0; transform-origin: bottom; }
#letterbox.on i { transform: scaleY(1); transition: none; }

/* Sat on the bench at sundown (see main.js): everything but the picture steps aside meanwhile. */
body.cinema :is(#hud, #sky-bar, #map-panel, #credit, #credits, #place-banner, #ask) {
  opacity: 0 !important;
  pointer-events: none !important;
}

#fade {
  position: fixed;
  inset: 0;
  background: #0d0b09;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
  z-index: 5;
}
#fade.on {
  opacity: 1;
  pointer-events: auto;
}

/* Smaller windows: tighter margins and a smaller map. */
@media (max-width: 900px), (max-height: 700px) {
  #sky-bar { left: 16px; top: 16px; gap: 12px; max-width: calc(100vw - 200px); }
  #map-panel { right: 16px; top: 16px; width: 150px; }
  #minimap { width: 150px; height: 150px; }
  #place-banner .name { font-size: 34px; }
}

/* ---- Phones and touch-only tablets (see index.html) ---- */
#phone {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: end;
  padding: 16px 16px max(28px, env(safe-area-inset-bottom));
  background:
    linear-gradient(to bottom, rgba(13, 11, 9, 0.1) 0%, rgba(13, 11, 9, 0.55) 45%, #0d0b09 88%),
    url("og-image.jpg") 34% 40% / cover no-repeat,
    #0d0b09;
  z-index: 20;
  overflow-y: auto;
}
#phone[hidden] { display: none; }
#phone .card {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}
#phone h1 {
  margin: 0 0 4px;
  font: italic 400 clamp(34px, 10vw, 52px)/1 "Cormorant Garamond", serif;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
}
#phone .msg {
  margin: 0 0 10px;
  max-width: 32ch;
  font: 400 14px/1.55 Inter, sans-serif;
  color: rgba(244, 233, 216, 0.78);
}
#phone button {
  font: 500 11px/1 Inter, sans-serif;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}
#phone-copy {
  min-width: 220px;
  padding: 15px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(244, 226, 196, 0.92);
  color: #1a120b !important;
}


/* ---- Phones and touch-only tablets (html.touch, set by main.js) ---- */
#sky-toggle,
#begin .turn { display: none; }
html.touch,
html.touch body {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.touch button,
.touch #keys span { touch-action: manipulation; }
.touch #scene,
.touch #scene:active { cursor: default; }

/* Top left: sound, and the time and weather folded behind one button. Corners keep clear of
   the notch and the rounded screen edges. */
.touch #sky-bar {
  left: max(14px, env(safe-area-inset-left));
  top: max(12px, env(safe-area-inset-top));
  gap: 10px;
  max-width: min(420px, calc(100vw - 180px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}
.touch #sky-toggle { display: inline-flex; justify-self: start; }
.touch #sky-bar.open #sky-toggle {
  color: #1a120b;
  background: rgba(244, 226, 196, 0.92);
  border-color: transparent;
}
.touch #sky-bar .group[data-kind="sound"] { order: 1; }
.touch #sky-bar .group[data-kind="phase"] { order: 2; }
.touch #sky-bar .group[data-kind="sky"] { order: 3; }
.touch #sky-bar:not(.open) .group[data-kind="phase"],
.touch #sky-bar:not(.open) .group[data-kind="sky"] { display: none; }
.touch .chip { height: 34px; }

/* Top right: a smaller map. */
.touch #map-panel {
  right: max(14px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  width: 150px;
  gap: 9px;
}
.touch #minimap { width: 118px; height: 118px; justify-self: center; }
.touch #minimap .expand { display: none; }
.touch #next { margin-top: -21px; padding: 6px 11px; gap: 6px; }
.touch #next .cap { font-size: 7.5px; }
.touch #next .pname { font-size: 14px; }
.touch #next .dist { font-size: 10px; }
.touch #here { font-size: 8px; }

/* Bottom: the gaits as buttons, and the credit centred under them. */
.touch #hud { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 20px); gap: 9px; }
.touch #credit {
  right: 0;
  left: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 10.5px;
}
.touch #credits { right: 0; left: 0; margin: 0 auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 22px); }
.touch #keys { gap: 8px; padding: 0 12px; }
.touch #keys span {
  pointer-events: auto;
  cursor: pointer;
  height: 40px;
  padding: 0 17px;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 216, 0.22);
  background: rgba(20, 14, 10, 0.3);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  color: var(--ink);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-shadow: none;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.touch #keys span.active {
  color: #1a120b;
  background: rgba(244, 226, 196, 0.92);
  border-color: transparent;
}
.touch #gait-name { font-size: 24px; margin-bottom: 2px; }
.touch #hint { font-size: 10.5px; padding: 0 16px; text-align: center; }

/* The opening and place names. */
.touch #begin { bottom: 12vh; padding: 0 16px; }
.touch #begin h1 { font-size: clamp(34px, 10vw, 46px); }
.touch #place-banner .name { font-size: 30px; }
.touch #ask { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 130px); }
.touch #ask .q { font-size: 24px; }
.touch #ask kbd { display: none; }
.touch #ask button { height: 40px; padding: 0 22px; touch-action: manipulation; }
.touch #big-map .sheet { width: min(92vh, 92vw); }
.touch #big-map h2 { font-size: 26px; }
.touch .pin .pname { font-size: 14px; }
.touch .pin .dist { font-size: 8.5px; }
.touch .pin .label { padding: 5px 8px 6px; }
.touch #big-map header { right: 86px; }
.touch #big-map header p { line-height: 1.5; }
/* Touch: names only, and the distance once a place is picked; on a narrow (upright) phone the
   names too wait for a tap, or they'd pile up. */
.touch .pin:not(.selected):not(.here) .dist { display: none; }
.touch .pin.selected i { transform: rotate(45deg) scale(1.3); background: #f2b872; }
.touch .pin.selected { z-index: 1; }
@media (max-width: 599px) {
  .touch .pin:not(.selected):not(.here) .label { display: none; }
}
@media (orientation: portrait) {
  .touch #begin .turn {
    display: block;
    margin: 4px 0 0;
    font: 400 11px/1.4 Inter, sans-serif;
    color: rgba(244, 233, 216, 0.6);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  }
  .touch #place-banner { top: 24vh; }
}

/* ---- The 3D picture was lost (phones; see main.js) ---- */
#lost {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: 16px;
  background: radial-gradient(ellipse at center, #1c1611 0%, #0d0b09 70%);
  z-index: 30;
}
#lost[hidden] { display: none; }
#lost p {
  margin: 0;
  font: italic 400 28px/1.2 "Cormorant Garamond", serif;
  text-align: center;
}
#lost button {
  padding: 14px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(244, 226, 196, 0.92);
  color: #1a120b;
  font: 500 11px/1 Inter, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
}
