:root {
  --paper: #FBF8F1;
  --green: #12382B;
  --deep: #0E2A20;
  --gold: #C29A4B;
  --gold-l: #E9D49C;
  --sign: #0B6B3A;
  --wa: #1FA855;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--deep); color: #fff; font: 500 18px/1.4 var(--sans); overscroll-behavior: none; }
button, a { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- layers ---------- */
.layer { position: fixed; inset: 0; width: 100%; height: 100%; transition: opacity .8s ease; }
#dash, #freeze, #film { object-fit: cover; background: var(--deep); }
#dash { z-index: 0; }
#freeze { z-index: 1; pointer-events: none; }
#pano { z-index: 2; touch-action: none; cursor: grab; }
#pano canvas { width: 100%; height: 100%; display: block; }
#film { z-index: 3; pointer-events: none; }
.off { opacity: 0; pointer-events: none !important; }
#shade { z-index: 4; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.6) 0, rgba(0,0,0,.15) 20%, transparent 40%, transparent 55%, rgba(0,0,0,.75) 100%); }

/* ---------- top: the line ---------- */
#top { position: fixed; z-index: 20; left: 0; right: 0; top: 0; padding: calc(12px + var(--safe-t)) 16px 0; transition: opacity .5s; }
#route { position: relative; height: 30px; margin: 0 6px; }
#track { position: absolute; left: 0; right: 0; top: 13px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); }
#done { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: var(--gold); }
#dots button { position: absolute; top: 15px; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0; border: 0; background: none; cursor: pointer; }
#dots button::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--deep); box-shadow: 0 0 0 2.5px #fff; }
#dots button.past::after { background: var(--gold); box-shadow: 0 0 0 2.5px var(--gold); }
#dots button.home::after { inset: 4px; border-radius: 3px; transform: rotate(45deg); background: var(--gold); box-shadow: inset 0 0 0 4px var(--green), 0 0 0 2px #fff; }
#car { position: absolute; top: 15px; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--gold), 0 2px 8px rgba(0,0,0,.5); transition: left .25s linear; }
#nextRow { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-top: 8px; }
#next { display: grid; text-shadow: 0 2px 10px rgba(0,0,0,.7); }
#next small { font: 800 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-l); }
#next b { font: 600 clamp(26px, 7vw, 38px)/1.05 var(--serif); margin-top: 5px; }
#next em { font-style: normal; font-weight: 700; font-size: 16px; opacity: .92; margin-top: 3px; }
body.at-stop #top, body.at-start #top, body.at-end #top { opacity: 0; pointer-events: none; }
.pill { flex: none; border: 0; border-radius: 999px; padding: 10px 15px; background: rgba(14,42,32,.62); color: #fff; font-weight: 700; font-size: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0 0 1px rgba(255,255,255,.16); cursor: pointer; }

/* ---------- live map ---------- */
#mini { position: fixed; z-index: 15; right: 16px; bottom: calc(100px + var(--safe-b)); width: 118px; height: 118px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px #fff, 0 8px 24px rgba(0,0,0,.45); transition: all .9s cubic-bezier(.6,0,.3,1); background: #2b3b2c; }
#map { position: absolute; inset: 0; }
#miniLabel { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font: 800 10px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 1px 4px #000; pointer-events: none; }
#mini .maplibregl-ctrl-attrib, #mini .maplibregl-ctrl-bottom-right { display: none; }
body.at-stop #mini, body.at-start #mini { opacity: 0; transform: scale(.7); pointer-events: none; visibility: hidden; }
body.big-map #mini { right: 0; bottom: 0; width: 100%; height: 100%; border-radius: 0; box-shadow: none; z-index: 1; opacity: 1; transform: none; }
body.big-map #miniLabel { display: none; }
body.big-map #mini .maplibregl-ctrl-bottom-right { display: block; }
.carDot { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px var(--gold), 0 0 18px 6px rgba(233,212,156,.6); }
.mk { display: grid; justify-items: center; gap: 3px; }
.mk i { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px #fff; }
.mk b { padding: 5px 9px; border-radius: 999px; background: rgba(14,42,32,.88); font: 800 13px/1 var(--sans); white-space: nowrap; }
.mk b em { font-style: normal; color: var(--gold-l); }
.mk.home i { width: 26px; height: 26px; border-radius: 4px; transform: rotate(45deg); background: var(--gold); box-shadow: inset 0 0 0 6px var(--green), 0 0 0 3px #fff, 0 0 40px 16px rgba(233,212,156,.5); }
.mk.home b { margin-top: 8px; background: var(--gold); color: var(--deep); letter-spacing: .14em; font-size: 15px; }
.mk.side i { background: #fff; box-shadow: 0 0 0 3px var(--gold); }

/* ---------- road sign and conductor call ---------- */
#roadsign { position: fixed; z-index: 14; left: 50%; top: 36%; transform: translateX(-50%); width: min(88vw, 520px); padding: 14px 18px 16px; border-radius: 14px; background: var(--sign); border: 3px solid #fff; box-shadow: 0 10px 30px rgba(0,0,0,.45); display: grid; gap: 4px; text-align: center; animation: pop .45s cubic-bezier(.2,1.4,.4,1) both; }
#roadsign small { font: 800 13px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; opacity: .85; }
#roadsign b { font: 800 clamp(24px, 6.4vw, 34px)/1.1 var(--sans); }
#roadsign span { font: 600 17px/1.35 var(--sans); }
#roadsign span:empty { display: none; }
#arriving { position: fixed; z-index: 16; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 18px 30px 22px; border-radius: 20px; background: var(--gold); color: var(--deep); text-align: center; box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
#arriving small { display: block; font: 800 13px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; }
#arriving b { display: block; margin-top: 8px; font: 600 clamp(34px, 10vw, 56px)/1 var(--serif); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.8); } }
#roadsign { animation-name: drop; } @keyframes drop { from { opacity: 0; transform: translate(-50%, -16px); } }

/* ---------- at a stop ---------- */
#title { position: fixed; z-index: 11; left: 16px; right: 16px; top: calc(18px + var(--safe-t)); text-shadow: 0 2px 16px rgba(0,0,0,.75); animation: rise .7s ease both; }
#title small { font: 800 13px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-l); }
#title h2 { margin: 8px 0 8px; font: 600 clamp(32px, 8.6vw, 54px)/1.03 var(--serif); max-width: 16ch; }
#tMin { margin: 0; display: inline-block; padding: 7px 13px; border-radius: 999px; background: var(--gold); color: var(--deep); font: 800 17px/1 var(--sans); text-shadow: none; }
#tFact { margin: 10px 0 0; max-width: 32ch; font: 600 19px/1.4 var(--sans); }
#title p:empty { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
#coach { position: fixed; z-index: 14; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 6px; padding: 22px 26px 20px; border-radius: 24px; background: rgba(14,42,32,.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); text-align: center; pointer-events: none; animation: rise .6s ease both; }
#coach b { font: 800 24px/1.15 var(--sans); }
#coach span { font-size: 16px; opacity: .88; }
#coach .hand { width: 150px; height: 64px; position: relative; }
#coach .hand::before { content: ""; position: absolute; left: 10px; right: 10px; top: 30px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); }
#coach .hand::after { content: ""; position: absolute; top: 4px; left: 50%; width: 46px; height: 56px; margin-left: -23px; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 56'%3E%3Cpath d='M17 30V8a4 4 0 0 1 8 0v14l10 2.4c3 .7 4.8 3.6 4.2 6.6L37 44c-.6 3-3.2 5-6.2 5H22c-2 0-3.8-.9-5-2.5L8 35a3.6 3.6 0 0 1 5.4-4.7z' fill='%23fff' stroke='%230E2A20' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E"); animation: swipe 2.2s ease-in-out infinite; }
@keyframes swipe { 0%, 100% { transform: translateX(-48px) rotate(-8deg); } 50% { transform: translateX(48px) rotate(8deg); } }
#ring { position: fixed; z-index: 13; left: 16px; bottom: calc(100px + var(--safe-b)); width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; background: rgba(14,42,32,.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; display: grid; place-items: center; }
#ring svg { position: absolute; inset: 2px; }
#ring .rim { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 2; }
#ring #cone { fill: rgba(233,212,156,.6); transform-origin: 30px 30px; }
#ring .dot { fill: #fff; }
#ring span { position: relative; top: 19px; font: 800 11px/1 var(--sans); }

/* ---------- caption ---------- */
#caption { position: fixed; z-index: 12; left: 50%; bottom: calc(232px + var(--safe-b)); transform: translate(-50%, 8px); width: min(92vw, 760px); text-align: center; font: 700 clamp(21px, 5.6vw, 30px)/1.28 var(--sans); text-shadow: 0 2px 14px rgba(0,0,0,.8), 0 1px 2px rgba(0,0,0,.9); opacity: 0; transition: opacity .35s, transform .35s; pointer-events: none; text-wrap: balance; }
#caption.on { opacity: 1; transform: translate(-50%, 0); }
body.at-stop #caption { bottom: calc(180px + var(--safe-b)); }
body.at-end #caption { z-index: 40; bottom: auto; top: calc(24px + var(--safe-t)); }

/* ---------- bottom ---------- */
#bar { position: fixed; z-index: 17; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(16px + var(--safe-b)); display: flex; gap: 10px; justify-content: center; }
#bar .btn { flex: 1 1 0; max-width: 420px; }
#secondary { flex: 0 0 auto !important; }
#secondary:empty { display: none; }
body.at-start #bar, body.at-end #bar { display: none; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; padding: 0 22px; border-radius: 18px; border: 0; font: 800 19px/1.15 var(--sans); text-decoration: none; cursor: pointer; text-align: center; transition: transform .15s; }
.btn:active { transform: scale(.98); }
.btn.gold { background: var(--gold); color: var(--deep); box-shadow: 0 8px 26px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.gold:disabled { filter: saturate(.3) brightness(.85); }
.btn.ghost { background: rgba(14,42,32,.6); color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn.light { background: var(--paper); color: var(--deep); }
.btn.link { background: none; min-height: 48px; padding: 0 10px; text-decoration: underline; text-underline-offset: 4px; font-weight: 700; font-size: 17px; }
.btn.big { width: 100%; min-height: 64px; font-size: 20px; }
.btn.pulse { animation: beckon 1.6s ease-in-out infinite; }
@keyframes beckon { 50% { box-shadow: 0 8px 26px rgba(0,0,0,.35), 0 0 0 9px rgba(233,212,156,.35); } }
#count { width: 28px; height: 28px; transform: rotate(-90deg); }
#count circle { fill: none; stroke: var(--deep); stroke-width: 4; stroke-dasharray: 95; stroke-dashoffset: 0; }
#count.run circle { animation: countdown var(--secs, 4s) linear forwards; }
@keyframes countdown { to { stroke-dashoffset: 95; } }
.wa { position: fixed; z-index: 16; right: 16px; bottom: calc(100px + var(--safe-b)); width: 58px; height: 58px; border-radius: 50%; background: var(--wa); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.wa svg { width: 32px; height: 32px; }

/* ---------- start / end ---------- */
.card { position: fixed; z-index: 30; inset: 0; display: grid; align-items: end; padding: 16px 16px calc(22px + var(--safe-b)); background: linear-gradient(180deg, rgba(8,26,19,.15), rgba(8,26,19,.0) 25%, rgba(8,26,19,.86) 62%, rgba(8,26,19,.97)); transition: opacity .8s; overflow-y: auto; }
.card .inner { width: min(100%, 520px); margin: 0 auto; display: grid; gap: 12px; text-align: center; justify-items: center; }
.card .kicker { font: 800 12.5px/1.3 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-l); }
.card h1 { margin: 0; font: 600 clamp(46px, 13vw, 84px)/.98 var(--serif); }
#end h1 { font-size: clamp(40px, 11vw, 72px); }
.card .lede { margin: 0; font-size: 19px; line-height: 1.45; opacity: .94; }
.card .small { margin: 0; font-size: 15px; opacity: .75; }
.card .row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.card.fade { opacity: 0; pointer-events: none; }
#startStops { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#startStops li { padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,.12); font: 700 14px/1 var(--sans); }
#startStops li.home { background: var(--gold); color: var(--deep); }
body.at-end .card { background: linear-gradient(180deg, rgba(8,26,19,0) 30%, rgba(8,26,19,.9) 62%, rgba(8,26,19,.97)); }

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  #mini { width: 170px; height: 170px; }
  #caption { bottom: calc(110px + var(--safe-b)); width: min(60vw, 820px); }
  body.at-stop #caption { bottom: calc(110px + var(--safe-b)); }
  #route { margin: 0 40px; }
  #title { left: 32px; top: 28px; }
  #bar { justify-content: flex-end; }
  .card { align-items: center; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #next b { font-size: 24px; } #next em { font-size: 14px; }
  #mini { width: 96px; height: 96px; bottom: 84px; }
  #caption, body.at-stop #caption { bottom: 84px; font-size: 20px; width: 70vw; }
  #title h2 { font-size: 30px; } #tFact { font-size: 16px; }
  .btn { min-height: 50px; }
  .card h1, #end h1 { font-size: 40px; } #startStops { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* review fixes */
body:not(.big-map) .mk { display: none; }
#coach { top: 42%; }
body:has(#coach:not([hidden])) #tFact { display: none; }
@media (max-height: 520px) and (orientation: landscape) { #tFact { display: none; } body.at-end .card { align-items: center; justify-items: start; } body.at-end .card .inner { margin: 0; width: min(46vw, 460px); } }

/* ---------- the small "drag to look around" sign, on every 360 until you drag ---------- */
#dragHint { position: fixed; z-index: 14; left: 50%; bottom: calc(108px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px; border-radius: 999px; background: rgba(14,42,32,.72); box-shadow: 0 0 0 1.5px rgba(233,212,156,.55), 0 6px 18px rgba(0,0,0,.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font: 800 16px/1 var(--sans); white-space: nowrap; pointer-events: none; animation: hintIn .5s ease both; }
#dragHint .mini-hand { width: 40px; height: 26px; position: relative; }
#dragHint .mini-hand::before { content: "‹  ›"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold-l); font-size: 14px; letter-spacing: 10px; }
#dragHint .mini-hand::after { content: ""; position: absolute; left: 50%; top: -2px; width: 22px; height: 27px; margin-left: -11px; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 56'%3E%3Cpath d='M17 30V8a4 4 0 0 1 8 0v14l10 2.4c3 .7 4.8 3.6 4.2 6.6L37 44c-.6 3-3.2 5-6.2 5H22c-2 0-3.8-.9-5-2.5L8 35a3.6 3.6 0 0 1 5.4-4.7z' fill='%23fff' stroke='%230E2A20' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"); animation: miniSwipe 1.8s ease-in-out infinite; }
@keyframes miniSwipe { 0%, 100% { transform: translateX(-11px) rotate(-8deg); } 50% { transform: translateX(11px) rotate(8deg); } }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 8px); } }
#dragHint { left: calc(50% + 22px); }

.topR { display: flex; gap: 8px; flex: none; align-items: flex-start; }
#tourPill { text-decoration: none; }

/* arriving at Altana */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 15; pointer-events: none; }
#arriving.home { background: linear-gradient(160deg, #E9D49C, #C29A4B 55%, #A67C33); padding: 20px 36px 26px; box-shadow: 0 18px 50px rgba(0,0,0,.5), 0 0 0 3px rgba(255,255,255,.55), 0 0 60px 10px rgba(233,212,156,.45); }
#arriving.home b { font-size: clamp(44px, 13vw, 72px); }
