/* Map styling follows the approved playful concept. */
:root{background:#e8f4ef;color:#244039}
body{background:radial-gradient(circle at 4% 15%,#cde9e3 0 5%,transparent 5.1%),radial-gradient(circle at 95% 60%,#f8e4ba 0 5%,transparent 5.1%),#e8f4ef}
.map-topbar{border-bottom:2px solid #b9d5ca}.intro .eyebrow{color:#bd6946}
.intro h1{font-family:ui-rounded,"Avenir Next",system-ui,sans-serif;font-weight:900;letter-spacing:-.06em}
.intro h1 em{font-style:normal;font-weight:900;color:#c66d49}
.map-shell{background:#fff6e4;padding:10px;border:2px solid #335f50;box-shadow:5px 6px 0 #80b3a2;border-radius:19px}
.map-art{border-radius:10px}.pin{border:2px solid #315d50;background:#fff9e9;box-shadow:2px 3px 0 #315d5066}.pin.current{background:#ffcf60}.pin.completed{background:#80bd94;color:#173d30}.pin.locked{background:#fff9e9;color:#435b50;filter:none}
.pin-label{border:1px solid #d8decb;border-radius:5px}.counter{border-color:#d7c180;background:#fff5d8}.map-status{color:#557466}
@media(max-width:700px){.map-shell{padding:5px}.pin:nth-of-type(3) .pin-label{position:absolute;right:calc(100% + 4px);top:4px;left:auto;transform:none;margin:0}.pin:nth-of-type(4) .pin-label,.pin:nth-of-type(5) .pin-label,.pin:nth-of-type(6) .pin-label{position:absolute;left:calc(100% + 4px);top:4px;transform:none;margin:0}}

/* Intro is decorative, skippable and only affects the map's presentation. */
.map-introduction{position:fixed;inset:0;z-index:100;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 42%,#316b60,#173d36 58%,#102d29);color:#fff8df;text-align:center;opacity:1;transition:opacity .65s ease}
.map-introduction.is-leaving{opacity:0;pointer-events:none}.intro-content{animation:intro-appear .7s both}.intro-compass{width:84px;height:84px;margin:0 auto 24px;border:1px solid #e9dda080;border-radius:50%;display:grid;place-items:center;font-size:38px;color:#ffe18a;box-shadow:0 0 0 10px #fff4c808,0 0 42px #f3d66a26;animation:compass-in 1.8s ease both}.intro-kicker{font-size:10px;letter-spacing:.24em;font-weight:800;color:#c5dbc1}.map-introduction h1{font:700 clamp(30px,5vw,52px)/1.05 ui-rounded,system-ui,sans-serif;letter-spacing:-.05em;margin:10px 20px}.map-introduction p{font-size:14px;color:#d0e3d6}.intro-skip{position:absolute;right:24px;top:22px;color:#e2ede1;background:transparent;border:1px solid #ffffff85;border-radius:20px;padding:9px 15px;font:700 12px system-ui;cursor:pointer}.intro-spark{position:absolute;width:4px;height:4px;border-radius:50%;background:#f9df98;opacity:.7;animation:twinkle 2s ease infinite alternate}.intro-spark:nth-child(1){top:23%;left:21%}.intro-spark:nth-child(2){top:32%;right:19%;animation-delay:.4s}.intro-spark:nth-child(3){bottom:25%;left:30%;animation-delay:.8s}.intro-spark:nth-child(4){bottom:28%;right:27%;animation-delay:.2s}
.intro-replay{align-self:center;margin:0 0 10px;border:1px solid #8ab5a4;background:#fff9e9;color:#315e50;border-radius:9px;padding:10px 14px;font:800 12px system-ui;cursor:pointer}.intro-replay:hover{background:#e3f0dd}
.map-intro-playing .map-shell{transform-origin:50% 65%;animation:map-unfold 1.1s cubic-bezier(.2,.7,.2,1) .15s backwards}.map-intro-playing .path-dashed{animation:route-reveal 2.5s ease-in-out .65s backwards, march 2s linear 3.15s infinite}.map-intro-playing .pin{animation:pin-appear .5s cubic-bezier(.2,1.5,.4,1) backwards}.map-intro-playing .pin:nth-of-type(1){animation-delay:1.45s}.map-intro-playing .pin:nth-of-type(2){animation-delay:1.65s}.map-intro-playing .pin:nth-of-type(3){animation-delay:1.85s}.map-intro-playing .pin:nth-of-type(4){animation-delay:2.05s}.map-intro-playing .pin:nth-of-type(5){animation-delay:2.25s}.map-intro-playing .pin:nth-of-type(6){animation-delay:2.45s}.map-intro-playing .pin.current .pin-icon{animation:pin-pulse 2s ease-in-out 2.4s 2}
@keyframes intro-appear{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}@keyframes compass-in{from{transform:scale(.7) rotate(-80deg);opacity:0}to{transform:scale(1) rotate(0);opacity:1}}@keyframes twinkle{from{opacity:.2;transform:scale(.7)}to{opacity:1;transform:scale(1.7)}}@keyframes map-unfold{from{opacity:0;transform:perspective(900px) rotateX(16deg) scale(.9)}to{opacity:1;transform:none}}@keyframes route-reveal{0%{stroke-dasharray:1600;stroke-dashoffset:1600}99%{stroke-dasharray:1600;stroke-dashoffset:0}100%{stroke-dasharray:2 14;stroke-dashoffset:0}}@keyframes pin-appear{from{opacity:0;transform:translate(-50%,-80%) scale(.45)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes pin-pulse{50%{filter:drop-shadow(0 0 8px #ffda62)}}
@media(prefers-reduced-motion:reduce){.map-introduction,.map-introduction *,.map-intro-playing .map-shell,.map-intro-playing .pin,.map-intro-playing .pin.current .pin-icon{animation:none!important;transition:none!important}.map-intro-playing .path-dashed{animation:none!important;stroke-dasharray:2 14;stroke-dashoffset:0}}

/* Centre the map content in the space below the navigation on every device. */
body:has(#map-view:not([hidden])) { display:flex; flex-direction:column; min-height:100dvh; }
body:has(#map-view:not([hidden])) > main { display:flex; flex:1; flex-direction:column; }
#map-view:not([hidden]) { flex:1; justify-content:center; }
/* In portrait layouts, balance the title above the map against the empty space below. */
@media (max-width:700px) and (min-height:650px) { #map-view:not([hidden]) { padding-bottom:min(25dvh, 200px); } }
@media (min-width:701px) and (min-height:900px) and (max-aspect-ratio: 1/1) { #map-view:not([hidden]) { padding-bottom:min(18dvh, 165px); } }
#first-sheet,.second-sheet{width:100%;max-width:min(100%,max(300px,calc((100dvh - 320px)*16/9)));margin-inline:auto}
.sheet-nav{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 3px;color:#607b6d;font-size:.85rem;font-weight:750}.sheet-nav button{min-height:44px;border:1px solid #9abaaa;border-radius:10px;background:#fff9e9;color:#285c4c;padding:8px 15px;font:inherit;cursor:pointer}.sheet-nav button:hover{background:#dceedd}.second-cover{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:340px;overflow:hidden;background:#fff9e9;border:2px solid #315e50;border-radius:19px;box-shadow:5px 6px 0 #80b3a2}.second-cover img{width:100%;height:100%;max-height:450px;object-fit:contain;background:#d5e9de}.second-copy{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:clamp(18px,3vw,36px)}.sheet-tag{color:#ad6549;font-weight:850;font-size:.72rem;letter-spacing:.08em}.second-copy h2{font-size:clamp(1.8rem,3vw,2.8rem);line-height:1.05;margin:12px 0}.second-copy p{line-height:1.45;color:#536e61}.second-copy .second-status{font-weight:750;font-size:.9rem}.second-copy .button-primary{background:#2e6e68;color:#fffdf4}.second-sheet .sheet-nav{margin-top:20px}@media(max-width:600px){.second-cover{grid-template-columns:1fr}.second-cover img{height:230px}.second-copy{padding:18px}.second-copy h2{font-size:1.8rem}.second-copy p{margin:6px 0}.second-copy .button{margin-top:10px}}
.turning-page{animation:sheet-open .38s ease both;transform-origin:8% 50%}@keyframes sheet-open{from{opacity:.25;transform:perspective(900px) rotateY(-5deg) translateX(8px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.turning-page{animation:none}}
/* The page markers are part of the route, not separate navigation controls. */
.visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.sheet-marker{background:#fff9e9;color:#315d50}.next-marker{left:89%;top:85%}.previous-marker{left:93%;top:59.17%}.second-token{left:40%;top:76%}
@media(max-width:700px){.next-marker .pin-label{position:absolute;left:calc(100% + 4px);top:4px;transform:none;margin:0}.previous-marker .pin-label{position:absolute;right:calc(100% + 4px);left:auto;top:4px;transform:none;margin:0}#second-map-stops .pin-label{position:absolute;left:calc(100% + 4px);top:4px;transform:none;margin:0}}

.map-intro-playing .second-sheet .pin{animation:none}
@media(max-width:700px){#map-stops .pin:nth-of-type(5) .pin-label{position:absolute;top:-22px;left:50%;right:auto;transform:translateX(-50%);margin:0}}
/* When turning a leaf, play only the leaf transition, not the opening animation again. */
.map-intro-playing .turning-page .map-shell,.map-intro-playing .turning-page .pin{animation:none}
.map-intro-playing .turning-page .path-dashed{animation:march 2s linear infinite}
@media(prefers-reduced-motion:reduce){.map-intro-playing .turning-page .path-dashed{animation:none}}
.map-art .second-token{left:40%;top:76%}
/* Distinct leaf motion and clear feedback on a locked adventure. */
.turning-page{animation:sheet-open-repaired .55s cubic-bezier(.22,.75,.25,1) both;transform-origin:50% 50%}
@keyframes sheet-open-repaired{from{opacity:0;transform:perspective(1000px) rotateY(9deg) translateX(18px) scale(.985)}to{opacity:1;transform:none}}
.locked-message{position:absolute;z-index:8;left:50%;top:12px;transform:translateX(-50%);max-width:calc(100% - 24px);margin:0;padding:10px 15px;border:2px solid #315e50;border-radius:12px;background:#fff9e9;color:#24483c;font-size:clamp(.75rem,1.5vw,.92rem);font-weight:800;line-height:1.3;text-align:center;box-shadow:0 4px 12px #173d3250}
@media(prefers-reduced-motion:reduce){.turning-page{animation:none}}

/* Reveal the dotted route and its numbered stops in travel order. */
.map-intro-playing #first-sheet .path-dashed{mask:url(#intro-route-mask);animation:march 2s linear infinite}
.map-intro-playing #first-sheet .intro-mask-path{stroke-dasharray:1;stroke-dashoffset:1;animation:ordered-route 4.2s linear .65s both}
.map-intro-playing #first-sheet .pin{animation:pin-appear .5s cubic-bezier(.2,1.5,.4,1) var(--pin-delay, 0ms) backwards}
.map-intro-playing #first-sheet.turning-page .pin{animation:none}
.map-intro-playing #first-sheet.turning-page .path-dashed{mask:none}
@keyframes ordered-route{to{stroke-dashoffset:0}}
@media(prefers-reduced-motion:reduce){.map-intro-playing #first-sheet .path-dashed{mask:none;animation:none}.map-intro-playing #first-sheet .intro-mask-path{animation:none}}

/* Navigation markers sit on the paths at the edges of the map. */
.next-marker{left:89%;top:85.6667%}.previous-marker{left:90%;top:61.6667%}

/* Only the current trip lights up, making direction clear on shared roads. */
.travel-outline,.travel-trail{fill:none;stroke-linecap:round;stroke-linejoin:round;opacity:0;pointer-events:none}
.travel-outline{stroke:#214e42;stroke-width:12}.travel-trail{stroke:#ffe683;stroke-width:7}
.map-art.is-travelling .path-dashed,.map-art.is-travelling .route-leg.done{opacity:.35}
.map-art.is-travelling .travel-outline,.map-art.is-travelling .travel-trail{opacity:1}
.token.is-travelling{z-index:7;animation:travel-beacon .9s ease-in-out infinite alternate}
.pin.travel-destination{box-shadow:0 0 0 4px #fff8c9,0 0 0 7px #285c4c99}
.travel-note{position:absolute;z-index:9;top:10px;left:50%;transform:translateX(-50%);padding:8px 13px;margin:0;border-radius:10px;background:#fffbed;color:#214e42;font-weight:800;font-size:clamp(.72rem,1.4vw,.9rem);white-space:nowrap;box-shadow:0 3px 12px #173d3238}
.travel-note[hidden]{display:none}
@keyframes travel-beacon{from{transform:translate(-50%,-135%) scale(1)}to{transform:translate(-50%,-135%) scale(1.22)}}
@media(prefers-reduced-motion:reduce){.token.is-travelling{animation:none}}
