/* Breeze look: warm off-white, deep ink, one loud orange, round and bold. */
:root {
  --ink: #1c1118;
  --ink-mid: #5a4d5f;
  --ink-light: #8c7d91;
  --orange: #ff5f3f;
  --orange-bg: #fff3f0;
  --green: #02ae28;
  --bg: #f8f7f5;
  --surface: #ffffff;
  --border: #e4dde9;
  --night: #1c1118;
  --night-line: #3d2f3a;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; }

#map { position: fixed; inset: 0; background: var(--night); }

/* Top bar: brand, control card, timer */
#bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: var(--night); color: #fff;
}
.brand { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.mitre { width: 19px; height: 21px; flex-shrink: 0; }
#slots { display: flex; gap: 5px; }
.slot {
  width: 28px; height: 32px; border: 1.5px dashed rgba(255, 255, 255, .35); border-radius: 8px;
  display: grid; place-items: center; font: 800 16px var(--sans); color: #fff;
}
/* Chocolate letters, the Sinterklaas kind: a chunky slab serif in milk chocolate, lit from
   the top left, with a thick dark edge underneath so it reads as a moulded block. All
   sizes are in em, so the same letter works at 20px in the bar and 150px held up. */
.choc {
  display: inline-block; line-height: 1; font-weight: 900;
  font-family: Rockwell, "Rockwell Extra Bold", "Roboto Slab", "Courier New", Georgia, serif;
  color: #6b3f1f;
  background: linear-gradient(158deg, #b98452 0%, #99633a 14%, #d9a877 21%, #8a5630 30%, #6e4122 58%, #4f2c14 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: .018em #3a1f0d;
  filter: drop-shadow(0 .035em 0 #5a3217) drop-shadow(0 .07em 0 #432310) drop-shadow(0 .105em 0 #2f180a) drop-shadow(0 .17em .09em rgba(20, 8, 2, .5));
}
/* The cream card with a gold edge that a chocolate letter comes boxed on. */
.slot.stamped { border: 1.5px solid #e9c46a; background: linear-gradient(#fffaf0, #f3e4c6); transform: rotate(-4deg); animation: stamp .35s ease-out; font-size: 21px; }
@keyframes stamp { from { transform: scale(2.2) rotate(-14deg); opacity: 0; } to { transform: scale(1) rotate(-4deg); opacity: 1; } }
.bar-end { display: flex; align-items: center; gap: 6px; }
#mute { border: 0; background: none; font-size: 17px; line-height: 1; padding: 6px; cursor: pointer; opacity: .8; }
#timer { font: 800 20px var(--sans); min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
#timer.over { color: #ff8f78; }
#timer.paused { color: #ffb8a8; }

/* Card: bottom sheet on phones, side panel on wide screens */
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  max-height: 68vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 24px 24px 0 0; box-shadow: 0 -8px 40px rgba(28, 17, 24, .35);
  --pad-x: 18px; --pad-bottom: calc(20px + env(safe-area-inset-bottom));
  padding: 20px var(--pad-x) var(--pad-bottom);
}
#sheet:empty, #sheet.away { display: none; }
@media (min-width: 880px) {
  #sheet { left: auto; right: 16px; top: 68px; bottom: 16px; width: 440px; max-height: none; border-radius: 24px; --pad-x: 22px; --pad-bottom: 24px; padding: 24px var(--pad-x) var(--pad-bottom); }
  #sheet.riding { bottom: auto; }
}

/* Arrival postcard: a photo of the place, held up over the map for a moment. */
#postcard {
  position: fixed; inset: 0; z-index: 2400; display: grid; place-items: center; padding: 20px;
  background: rgba(28, 17, 24, .6); opacity: 0; pointer-events: none; transition: opacity .45s ease;
}
#postcard.shown { opacity: 1; }
#postcard figure {
  margin: 0; width: min(880px, 100%); padding: 10px 10px 0; background: #fff; border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6); transform: rotate(-1.5deg) scale(.94); transition: transform .6s cubic-bezier(.2, 1.3, .4, 1);
}
#postcard.shown figure { transform: rotate(-1.5deg) scale(1); }
#postcard .frame { overflow: hidden; }
/* Shown whole when it fits; a tall photo is cropped from the bottom first, where there is usually foreground. */
#postcard img { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: cover; object-position: center 8%; }
#postcard figcaption { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 12px 6px 14px; color: var(--ink); }
#postcard figcaption b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
#postcard figcaption span { font-size: 14px; color: var(--ink-mid); }
#postcard figcaption small { margin-left: auto; font-size: 9px; color: var(--ink-light); }

.kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--orange);
}
.kicker::before { content: ""; width: 20px; height: 2px; border-radius: 1px; background: var(--orange); }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
#sheet h2 { font-size: 26px; line-height: 1.1; }
.addr { color: var(--ink-light); font-size: 13px; margin: 4px 0 12px; }
.story { font-size: 15px; line-height: 1.55; color: var(--ink-mid); margin: 0 0 14px; }
.rule {
  font-size: 14px; line-height: 1.5; color: var(--ink); margin: 12px 0;
  padding: 12px 14px; background: var(--orange-bg); border-left: 3px solid var(--orange); border-radius: 0 10px 10px 0;
}
.art { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 14px; }

.sticky {
  background: #ffe86b; color: #2b2610; font: 15px/1.4 "Marker Felt", "Comic Sans MS", cursive, var(--sans);
  padding: 14px 16px; transform: rotate(-1.5deg); box-shadow: 0 6px 14px rgba(28, 17, 24, .18); margin: 4px 6px 14px;
}
.keys { display: flex; gap: 6px; justify-content: center; background: var(--ink); border-radius: 14px; padding: 14px; }
.keys span { width: 34px; height: 38px; display: grid; place-items: center; font: 700 17px var(--mono); color: #fff; background: #4a3d47; border-radius: 8px; box-shadow: 0 2px 0 #0d080b; }

.log { margin-top: 10px; background: var(--ink); color: #6ee7a0; font: 14px var(--mono); padding: 12px 14px; border-radius: 12px; }
.log span { display: block; font-size: 10px; letter-spacing: .2em; color: #8c7d91; margin-bottom: 4px; }
.log ol { margin: 0; padding-left: 24px; columns: 2; column-gap: 18px; line-height: 1.7; }
.log li::marker { color: #8c7d91; }

.route { margin: 12px 0 0; padding: 12px 14px 12px 36px; font: 14px/1.7 var(--mono); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

.hn { font-family: Verdana, Geneva, sans-serif; background: #f6f6ef; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.hn-head { background: #ff6600; color: #000; font-size: 12px; font-weight: 700; padding: 5px 8px; }
.hn-head b { display: inline-block; border: 1px solid #fff; color: #fff; padding: 0 4px; margin-right: 4px; }
.hn-head span { font-weight: 400; margin-left: 6px; }
.hn ol { list-style: none; margin: 0; padding: 8px 8px 4px; }
.hn li { display: flex; gap: 6px; margin-bottom: 6px; }
.hn-rank { color: #828282; font-size: 12px; min-width: 16px; text-align: right; }
.hn-title { font-size: 12.5px; color: #000; }
.hn-site, .hn-sub { font-size: 9.5px; color: #828282; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips i { font-style: normal; letter-spacing: 0; margin-right: 6px; }
.chips span { font-size: 14px; font-weight: 700; letter-spacing: .12em; padding: 9px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; }

/* Answer row */
/* Pinned to the bottom of the card, so the input never scrolls out of sight under a tall puzzle. */
.answer {
  /* The card's own bottom padding sits below the sticky edge, so reach down over it. */
  position: sticky; bottom: calc(-1 * var(--pad-bottom)); z-index: 2;
  margin: 16px calc(-1 * var(--pad-x)) calc(-1 * var(--pad-bottom)); padding: 12px var(--pad-x) var(--pad-bottom);
  background: var(--bg); box-shadow: 0 -14px 14px -10px rgba(28, 17, 24, .18);
}
.answer label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-light); margin-bottom: 8px; }
.answer-row { display: flex; gap: 8px; }
.answer input {
  flex: 1; min-width: 0; font: 800 20px var(--sans); text-transform: uppercase; text-align: center; letter-spacing: .18em;
  padding: 12px; border: 2px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--ink);
}
.answer input.right { border-color: var(--green); background: #ecfbef; color: #017a1c; opacity: 1; }
.answer input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 95, 63, .18); }
.btn {
  font: 700 15px var(--sans); padding: 13px 22px; border: 0; border-radius: 99px;
  background: var(--orange); color: #fff; cursor: pointer; box-shadow: 0 6px 16px rgba(255, 95, 63, .35);
}
.btn:active { transform: translateY(1px); box-shadow: 0 3px 8px rgba(255, 95, 63, .35); }
.btn.ghost { background: var(--surface); color: var(--ink-mid); border: 1px solid var(--border); padding: 8px 14px; font-size: 13px; font-weight: 600; box-shadow: none; white-space: nowrap; }
.btn.ghost:disabled { opacity: .45; cursor: default; }
.below { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; min-height: 36px; }
.msg { font-size: 14px; line-height: 1.4; margin: 0; flex: 1; color: var(--ink-mid); }
.msg.bad { color: #c8321a; font-weight: 600; }
.msg.hint { color: var(--ink); }
.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* Riding state */
#sheet.riding { background: var(--night); color: #fff; }
.riding-card { display: flex; align-items: center; gap: 14px; }
.riding-card p { margin: 0; font-size: 14px; line-height: 1.4; color: #c9b8ce; }
.riding-card b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; color: #fff; }
.hud { display: grid; justify-items: center; min-width: 78px; padding: 8px 10px; background: #2a1c26; border-radius: 16px; }
.hud-km { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--orange); font-variant-numeric: tabular-nums; line-height: 1.1; }
.hud-label { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-light); }
.progress { height: 6px; margin-top: 14px; background: #2a1c26; border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 99px; }

/* Finish */
.finish-time { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 2px; color: var(--orange); }
.reveal { font-size: 17px; line-height: 1.55; font-weight: 500; margin: 14px 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 8px 24px rgba(28, 17, 24, .08); }
.card-word { font-size: 38px; letter-spacing: .28em; margin: 4px 0 14px; }

/* The letter just earned, held up over the card for a moment. */
#stamp-pop { position: fixed; inset: 0; z-index: 2450; display: grid; place-content: center; justify-items: center; gap: 14px; pointer-events: none; opacity: 0; background: rgba(28, 17, 24, .55); transition: opacity .3s ease; }
#stamp-pop.shown { opacity: 1; }
#stamp-pop b { display: grid; place-items: center; width: 200px; height: 210px; font-size: 128px; background: linear-gradient(#fffaf0, #f3e4c6); border: 5px solid #e9c46a; border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55), inset 0 0 0 6px rgba(255, 255, 255, .6); transform: scale(.6) rotate(-10deg); transition: transform .5s cubic-bezier(.2, 1.5, .4, 1); }
#stamp-pop.shown b { transform: scale(1) rotate(-4deg); }
#stamp-pop > span { padding: 8px 16px; border-radius: 99px; background: var(--bg); color: var(--ink); font-size: 15px; font-weight: 700; max-width: 86vw; text-align: center; }

/* 3D ride: the 3D view fills the screen and the flat map shrinks to a minimap. */
#map, #view3d { background: #e6e5e3 !important; }
#view3d { position: fixed; inset: 0; background: var(--night); }
body.ride3d #map {
  inset: auto; top: calc(60px + env(safe-area-inset-top)); left: 12px; z-index: 800;
  width: min(48vw, 400px); height: min(36vh, 300px);
  border: 3px solid #fff; border-radius: 20px; box-shadow: 0 10px 34px rgba(28, 17, 24, .55); overflow: hidden;
}
body.ride3d #map .leaflet-control-attribution { display: none; }
body.ride3d #map .pin { transform: scale(.6); }
.vehicle3d .vehicle { transform: scale(2.2); transform-origin: bottom center; filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 14px rgba(255, 95, 63, .95)); }
.dot { width: 18px; height: 18px; border-radius: 50%; background: var(--orange); border: 3px solid #fff; box-shadow: 0 0 10px 3px rgba(255, 95, 63, .8); }

/* Landmarks: a round badge in the brand's colour, standing on a pole, name beside it when zoomed in. */
.landmark { position: relative; display: flex; flex-direction: column; align-items: center; width: 44px; }
.landmark-badge {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0%, #fff 55%, #ece8ee 100%);
  border: 3px solid var(--brand); font-size: 21px; line-height: 1;
  box-shadow: 0 6px 14px rgba(28, 17, 24, .55), 0 0 0 3px rgba(255, 255, 255, .85);
}
.landmark-logo {
  width: 24px; height: 24px; background: var(--brand);
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat;
}
.landmark-monogram { font-size: 14px; font-weight: 800; letter-spacing: -.04em; color: var(--brand); }
#view3d .landmark-monogram { font-size: 18px; }
.landmark-pole { width: 3px; height: 16px; background: #fff; box-shadow: 0 0 4px rgba(28, 17, 24, .7); }
.landmark-pole::after {
  content: ""; position: absolute; left: 50%; bottom: -4px; width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}
.landmark-name {
  position: absolute; left: 100%; top: 11px; margin-left: 8px; white-space: nowrap;
  padding: 3px 10px; border-radius: 99px; background: rgba(28, 17, 24, .88); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: -.01em;
}
.landmark-anchor .landmark { position: absolute; transform: translate(-50%, -100%); }
#map.far .landmark-anchor .landmark { transform: translate(-50%, -100%) scale(.62); transform-origin: bottom center; }
/* The minimap shows only the route, the pins and the vehicle. */
body.ride3d #map .landmark-anchor { display: none; }
#map.far .landmark-name, body.ride3d #map .landmark-name { display: none; }
.vehicle3d ~ * .landmark, #view3d .landmark { transform-origin: bottom center; }
#view3d .landmark-badge { width: 56px; height: 56px; font-size: 27px; }
#view3d .landmark { width: 56px; }
#view3d .landmark-logo { width: 31px; height: 31px; }
#view3d .landmark-pole { height: 30px; }
#view3d .landmark-name { top: 16px; font-size: 13px; }

/* The flat map fades out and in around a 3D ride. */
#map { transition: opacity .45s ease; }
body.map-hidden #map { opacity: 0; }
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { background: rgba(28, 17, 24, .7) !important; color: #8c7d91; }
.leaflet-control-attribution a { color: #c9b8ce; }

.pin {
  position: relative; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font: 800 14px var(--sans);
  border: 2.5px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .6);
}
.pin.locked { transform: scale(.7); background: #3d2f3a; border-color: #6b5a68; color: #a898a6; box-shadow: none; }
.pin.done { background: var(--green); color: #fff; }
.pin.current { background: var(--orange); color: #fff; }
.pin.current::after {
  content: ""; position: absolute; inset: -2.5px; border-radius: 50%;
  border: 2.5px solid var(--orange); animation: beacon 1.5s ease-out infinite;
}
.pin.finish.locked { transform: scale(.85); }
@keyframes beacon { from { transform: scale(1); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }

.vehicle.waymo, .vehicle.estep { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
.vehicle3d .vehicle.waymo { transform: scale(1.7); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .55)); }
.vehicle3d .vehicle.estep { transform: scale(2.4); filter: drop-shadow(0 0 3px #fff) drop-shadow(0 4px 6px rgba(0, 0, 0, .6)); }
/* A glowing disc on the road under the vehicle, so it reads between tall buildings.
   The marker is already absolutely positioned by MapLibre, which anchors the disc. */
.vehicle3d::before {
  content: ""; position: absolute; left: 50%; bottom: -10px; width: 96px; height: 34px; margin-left: -48px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 95, 63, .75), rgba(255, 95, 63, .25) 60%, rgba(255, 95, 63, 0));
  border: 2px solid rgba(255, 255, 255, .8);
}

/* Finale: the five stamps as big tiles that slide into the final word. */
#finale-word { position: fixed; left: 50%; top: 38%; height: 84px; transform: translateX(-50%); z-index: 2500; pointer-events: none; opacity: 0; transition: opacity .4s; }
#finale-word.shown { opacity: 1; }
#finale-word b {
  position: absolute; left: 0; top: 0; width: 66px; height: 78px; display: grid; place-items: center;
  font-size: 44px; background: linear-gradient(#fffaf0, #f3e4c6); border: 3px solid #e9c46a; border-radius: 14px;
  box-shadow: 0 12px 30px rgba(28, 17, 24, .55); transition: transform .55s cubic-bezier(.3, 1.4, .5, 1), background .4s;
}
#finale-word.sorted b { background: #fff8e8; border-color: #f4c430; box-shadow: 0 0 0 4px rgba(244, 196, 48, .45), 0 12px 30px rgba(28, 17, 24, .55); }
@media (max-width: 420px) { #finale-word { transform: translateX(-50%) scale(.82); } }
.vehicle { width: 56px; height: 40px; display: grid; place-items: end center; filter: drop-shadow(0 0 7px rgba(255, 95, 63, .9)); }
.vehicle.estep { font-size: 32px; line-height: 1; }
.vehicle.mirrored { transform: scaleX(-1); }

/* Intro overlay */
#intro {
  position: fixed; inset: 0; z-index: 2000; overflow-y: auto;
  background: rgba(28, 17, 24, .78); display: grid; place-items: center; padding: 16px;
}
#intro.hidden { display: none; }
.intro-card { max-width: 480px; background: var(--bg); border-radius: 28px; padding: 30px 26px 26px; box-shadow: 0 24px 70px rgba(0, 0, 0, .5); }
.intro-card h1 { font-size: clamp(32px, 8vw, 42px); line-height: 1.05; margin-bottom: 14px; }
.intro-card h1 em { font-style: normal; color: var(--orange); }
.intro-card h2 { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-light); margin: 22px 0 10px; }
.intro-card p { font-size: 16px; line-height: 1.6; color: var(--ink-mid); margin: 0; }
.intro-card p.kicker { font-size: 11px; line-height: 1.5; color: var(--orange); margin-bottom: 10px; }
.intro-card ol { list-style: none; counter-reset: rule; margin: 0 0 22px; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.intro-card li { counter-increment: rule; display: flex; gap: 12px; padding: 12px 16px; font-size: 14.5px; line-height: 1.5; color: var(--ink-mid); border-bottom: 1px solid var(--border); }
.intro-card li:last-child { border-bottom: 0; }
.intro-card li::before { content: counter(rule); flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--orange-bg); color: var(--orange); font-size: 12px; font-weight: 800; }
.intro-card .btn { width: 100%; font-size: 17px; padding: 16px; }
.small { font-size: 12px !important; text-align: center; margin: 12px 0 0; }
.small a { color: var(--ink-light); }

/* Confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  .slot.stamped, .shake, .pin.current::after, #confetti i { animation: none; }
}
