/* Neighborhood map and first-client presentation. */
#levelMenu{width:min(1220px,96vw);max-width:none;height:min(780px,94dvh);padding:0;overflow:hidden;background:var(--paper)}
.map-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:22px 26px;border-bottom:1px solid #84937a33}.map-header h2{font-size:26px;margin:6px 0}.map-header p{margin:0;font-size:12px;color:var(--muted)}
.map-layout{display:grid;grid-template-columns:minmax(0,1fr) 290px;height:calc(100% - 112px)}
#levelGrid{display:block;position:relative;margin:0;overflow:hidden;isolation:isolate;background:radial-gradient(ellipse at 65% 65%,#c3d8b5 0 13%,transparent 14%),repeating-linear-gradient(20deg,#e4e8ce 0 60px,#dfe5c8 60px 63px)}
.map-road{position:absolute;inset:0;width:100%;height:100%;z-index:-1}.road-edge{fill:none;stroke:#a3ae9a;stroke-width:49;stroke-linecap:round;stroke-linejoin:round}.road-center{fill:none;stroke:#f4eaca;stroke-width:2;stroke-dasharray:12 14}
.map-tree{position:absolute;width:21px;height:29px;border-radius:55% 55% 42% 42%;background:#7da374;box-shadow:5px 5px #617f5933;z-index:-1}.map-tree:after{content:'';position:absolute;bottom:-5px;left:9px;background:#a58b62;width:4px;height:9px}
#levelGrid .map-stop{position:absolute;transform:translate(-50%,-50%);width:116px;height:100px;background:transparent!important;border:none!important;box-shadow:none;color:#244739!important;padding:0;border-radius:8px;overflow:visible;opacity:1;transition:filter .15s}
.map-stop svg{width:100%;height:85px;display:block;filter:drop-shadow(0 4px 1px #33532a22)}
#levelGrid .map-stop.locked{filter:grayscale(.8);opacity:.6}.stop-name{display:block;font-size:10px;background:#f7f2d9;color:#294735;padding:4px 2px;border-radius:5px;white-space:nowrap;box-shadow:0 2px 3px #173b3822}
.stop-number{position:absolute;left:0;top:5px;display:grid;place-items:center;width:25px;height:25px;border-radius:50%;background:#e6a052;color:#293b30;border:2px solid #fff0cc;font-size:12px}.done .stop-number{background:#477b55;color:white}.done .stop-name{background:#d7e8c6}.map-stop[aria-pressed=true] svg{filter:drop-shadow(0 0 6px #df8d30)}.map-stop[aria-pressed=true] .stop-name{outline:3px solid #dd8c35}.map-stop.available .stop-number{animation:map-bob 2.5s ease-in-out infinite}
.map-card{padding:24px 20px;display:flex;flex-direction:column;justify-content:center;gap:8px;background:var(--paper);border-left:1px solid #899b7033}.map-card h2{font-size:24px;margin:0}.map-card p{font-size:13px;line-height:1.6;margin:4px 0}.map-card small{font-size:10px;line-height:1.5;color:var(--muted);margin-top:8px}.map-card button{width:100%;margin-top:6px}.map-card button:disabled{opacity:1;background:#dce1d2;color:#647160}#mapBuilding{width:145px;margin:0 auto 10px}#mapRecord{font-size:12px;color:#62844a;font-weight:bold}
.client-brief{display:flex;align-items:center;gap:18px;text-align:left;background:#dce6d155;border-radius:14px;padding:10px;margin-bottom:18px}.client-portrait{width:95px;flex:none}.client-portrait svg{width:100%;display:block}.client-brief p{font-size:14px;line-height:1.65}.client-reaction{display:flex;align-items:center;text-align:left;gap:10px;margin:8px 0}.client-reaction .client-portrait{width:60px}.client-reaction p{font-size:11px;line-height:1.6}.client-reaction strong{font-size:10px;color:var(--muted)}#paymentReveal{color:#578147;font-weight:bold;font-size:23px;padding:6px}#stars span{display:inline-block;animation:star-arrive .45s backwards}.stars{letter-spacing:4px}
#deliveryScene{width:min(1100px,96vw);max-width:none;padding:0;overflow:hidden;background:#deebdb}.delivery-stage{height:min(630px,85dvh);position:relative;overflow:hidden;background:linear-gradient(#90c6c2 0 62%,#d8dabc 62% 76%,#738d83 76%)}.scene-sky{position:absolute;inset:0;background:linear-gradient(#74b0ad22,#23494555),url('assets/city.png') center/cover;opacity:.55}.scene-road{position:absolute;bottom:0;height:20%;width:100%;background:#556c69;border-top:8px solid #ccc9a6}.scene-road:after{content:'';position:absolute;top:60%;width:100%;height:3px;background:repeating-linear-gradient(90deg,#dccfa0 0 45px,transparent 45px 95px)}
#sceneStore{position:absolute;right:6%;bottom:18%;width:40%;opacity:0;transition:opacity .4s}#sceneStore svg{width:100%}#sceneVan{position:absolute;width:68%;left:3%;bottom:13%;transition:transform 1.2s ease-in-out;filter:drop-shadow(0 10px 4px #233f3633)}#sceneCourier{position:absolute;height:45%;width:20%;object-fit:contain;left:45%;bottom:9%;transition:transform 1s,opacity .8s;filter:drop-shadow(0 4px 2px #233f3633)}
#sceneClient{position:absolute;right:13%;bottom:13%;width:12%;opacity:0;transition:opacity .4s}#sceneParcel{position:absolute;right:23%;bottom:18%;font-size:38px;color:#b77942;opacity:0;transition:opacity .4s}.scene-copy{position:absolute;top:6%;left:5%;right:5%;background:#fcf6dfeb;border:1px solid #f5e8ba;border-radius:14px;padding:18px 22px;color:#27483b;box-shadow:0 8px 18px #25483222}.scene-copy .eyebrow{color:#627c64}.scene-copy h2{font-size:clamp(19px,3vw,30px);margin:7px 0}#skipDelivery{position:absolute;right:20px;bottom:20px;background:#fcf6df;color:#29483d}
.boarding #sceneCourier{animation:board-van 1.2s forwards}.departing #sceneVan{transform:translateX(155%)}.departing #sceneCourier{opacity:0}.arriving #sceneStore,.delivered #sceneStore,.arriving #sceneClient,.delivered #sceneClient{opacity:1}.arriving #sceneVan,.delivered #sceneVan{width:46%;transform:translateX(0);left:2%}.arriving #sceneCourier,.delivered #sceneCourier{left:44%;height:37%;opacity:1;transform:translateX(25%)}.delivered #sceneParcel{opacity:1}.delivered #sceneClient{animation:map-bob 1.5s ease-in-out infinite}
@keyframes board-van{to{transform:translate(-25%,-5%) scale(.65);opacity:0}}@keyframes map-bob{50%{translate:0 -3px}}@keyframes star-arrive{from{opacity:0;transform:translateY(12px) scale(.4)}to{opacity:1;transform:none}}
html[data-theme=dark] #levelGrid{background:radial-gradient(ellipse at 65% 65%,#284a3d 0 13%,transparent 14%),repeating-linear-gradient(20deg,#344c40 0 60px,#30473c 60px 63px)}html[data-theme=dark] .road-edge{stroke:#5b7265}html[data-theme=dark] .map-tree{background:#527d58}html[data-theme=dark] #mapRecord{color:#bdd49c}html[data-theme=dark] #paymentReveal{color:#b3d591}html[data-theme=dark] .map-card button:disabled{background:#34483c;color:#bdcbb4}
[hidden]{display:none!important}
@media(max-width:750px){#levelMenu{height:95dvh}.map-header{padding:12px}.map-header h2{font-size:18px}.map-header .eyebrow{font-size:8px}.map-header button{padding:8px;font-size:10px}.map-layout{grid-template-columns:1fr;grid-template-rows:minmax(250px,1fr) auto;height:calc(100% - 92px)}#levelGrid .map-stop{width:75px;height:63px}.map-stop svg{height:53px}.stop-name{font-size:7px;padding:3px 0}.stop-number{width:18px;height:18px;font-size:9px;top:0}.map-card{padding:12px;display:grid;grid-template-columns:1fr 1fr;gap:5px;border-left:0;border-top:1px solid #899b7033}.map-card h2{font-size:17px;grid-column:1/-1}.map-card p{font-size:11px;line-height:1.35;grid-column:1/-1}.map-card small,#mapBuilding{display:none}#mapMission{grid-column:1/-1}.map-card button{grid-column:1/-1;margin:0;padding:9px;font-size:11px}.client-brief{gap:8px;padding:6px}.client-brief .client-portrait{width:68px}.client-brief p{font-size:12px;line-height:1.5}.delivery-stage{height:72dvh}.scene-copy{padding:12px}.scene-copy .eyebrow{font-size:8px}#sceneVan{width:87%;left:-8%;bottom:24%}#sceneCourier{bottom:17%;height:30%;width:28%}#sceneStore{width:70%;right:2%;bottom:23%}#sceneClient{width:23%;right:4%;bottom:18%}.arriving #sceneVan,.delivered #sceneVan{width:64%;left:-14%;bottom:20%}.arriving #sceneCourier,.delivered #sceneCourier{height:32%;left:35%;bottom:14%}#sceneParcel{right:25%;bottom:22%}#skipDelivery{bottom:12px;right:12px}}
@media(prefers-reduced-motion:reduce){.delivery-stage *{transition:none!important;animation:none!important}}

#levelMenu[open]{display:flex;flex-direction:column}.map-header{flex:none}.map-layout{flex:1;min-height:0;height:auto}
#mapGo{background:#e59c4d;color:#253c32}html[data-theme=dark] #mapGo{background:#e7ac60;color:#213b30}
#mapGo:disabled,html[data-theme=dark] #mapGo:disabled{background:#d3dbca;color:#576650}
#sceneClient svg{width:100%;display:block}#sceneParcel{width:42px;height:38px;background:#c58a4f;border:3px solid #704c30;border-radius:3px;font-size:0;box-shadow:inset 0 7px #dbac73}
#sceneParcel:after{content:'';display:block;height:100%;width:9px;background:#e8d1a1;margin:auto}
.delivered #sceneParcel{animation:parcel-handoff .8s both}
@keyframes parcel-handoff{from{transform:translateX(-100px);opacity:0}to{transform:translateX(0);opacity:1}}
@media(max-width:750px){.map-layout{height:auto;grid-template-rows:minmax(190px,1fr) auto}#levelGrid .map-stop{width:66px}.stop-name{font-size:6.7px}.map-header h2{font-size:17px}.map-card{padding:10px 12px}.map-header{padding:10px 12px}#sceneClient{width:18%;right:9%}}

#sceneProps{position:absolute;right:24%;bottom:44%;font-size:36px;opacity:0;color:#f8e4ac;pointer-events:none;text-shadow:1px 3px 2px #3e594d55}
.arriving #sceneProps,.delivered #sceneProps{opacity:1}
[data-reception=steam] #sceneProps{animation:neighborhood-drift 2s infinite;color:#fff8de}
[data-reception=leaves] #sceneProps{animation:neighborhood-drift 3s infinite;color:#8bad5e}
[data-reception=pixels] #sceneProps,[data-reception=spark] #sceneProps{animation:neighborhood-glow 1.4s steps(2) infinite;color:#a4d8df}
[data-reception=ribbons] #sceneProps,[data-reception=flags] #sceneProps{animation:neighborhood-sway 2s ease-in-out infinite}
[data-reception=confetti] #sceneProps{animation:neighborhood-drift 2s infinite;color:#eed08c}
[data-reception=read] #sceneProps{color:#e8d3a6;animation:neighborhood-sway 3s infinite}
.delivery-stage[data-layout="1"] #sceneStore{right:3%;width:46%}.delivery-stage[data-layout="1"] #sceneClient{right:8%}
.delivery-stage[data-layout="2"] #sceneStore{right:10%;width:36%}.delivery-stage[data-layout="2"] #sceneClient{right:16%}
#endingFaces{display:grid;grid-template-columns:repeat(5,1fr);gap:4px;margin:14px auto;max-width:370px}#endingFaces svg{display:block;width:100%}#endingSummary{padding:12px;border-radius:10px;background:#78956122;font-weight:bold;font-size:13px;line-height:1.7}
@keyframes neighborhood-drift{0%{translate:0 8px;opacity:0}40%{opacity:1}100%{translate:8px -22px;opacity:0}}
@keyframes neighborhood-sway{50%{rotate:7deg;translate:0 -4px}}
@keyframes neighborhood-glow{50%{opacity:.4}}
@media(max-width:750px){.delivery-stage[data-layout="1"] #sceneStore,.delivery-stage[data-layout="2"] #sceneStore{width:65%;right:2%}.delivery-stage[data-layout="1"] #sceneClient,.delivery-stage[data-layout="2"] #sceneClient{right:8%}#sceneProps{font-size:23px;bottom:43%;right:20%}#endingFaces{max-width:270px}}
@media(prefers-reduced-motion:reduce){#sceneProps{animation:none!important}.boarding #sceneCourier{opacity:0}.delivered #sceneClient{animation:none!important}}

.transit #sceneVan{width:46%;left:2%;transform:translateX(-130%);transition:none}.transit #sceneStore,.transit #sceneClient{opacity:1}.transit #sceneCourier{opacity:0}
#endingDaily,html[data-theme=dark] #endingDaily{background:#e3a153;color:#203a30}#endingClose,html[data-theme=dark] #endingClose{background:#385b4d;color:#f1f3dd}
@media(max-width:750px){.transit #sceneVan{width:64%;left:-14%;bottom:20%}}

/* First delivery: dialogue in the street, then a stamped transport receipt. */
.life-first #missionBrief{position:fixed;inset:auto 16px 16px auto;margin:0;width:min(680px,94vw);max-height:80dvh;border:0;background:transparent;box-shadow:none;overflow:visible}
.life-first #missionBrief::backdrop{background:#102f2528;backdrop-filter:none}
.life-first #missionBrief .win-card{position:relative;padding:16px 20px 14px 110px;background:#f5e5b8;color:#213e32;border:4px solid #284739;box-shadow:5px 5px 0 #142f27;text-align:left;animation:dispatch-enter .22s ease-out}
.life-first #clientBrief{background:none;padding:0;margin:0;border:0;display:block;min-height:0}
.life-first #clientBrief .client-portrait{position:absolute;left:6px;bottom:8px;width:96px;filter:drop-shadow(3px 3px 0 #12362855)}
.life-first #clientBrief p{font-size:14px;line-height:1.45;margin:6px 0;color:#213e32}
.life-first #clientBrief .eyebrow{color:#675436;font-size:10px}.life-first #briefTitle,.life-first #briefText{display:none}.life-first #briefLimits{font-size:10px;line-height:1.3;color:#675436;margin:6px 0}
.life-first #beginMission{width:100%;min-height:44px;margin:4px 0 0;background:#e7ad53;color:#213e32}
.life-first #win{background:#f5e8c8;color:#263b31;border:0;border-top:8px solid #375647;border-bottom:8px dashed #a18d65;border-radius:0;box-shadow:6px 6px 0 #102e28}
.life-first #win .win-card{background:transparent;padding:20px 24px}.life-first #win h2{color:#263b31}.life-first #win .stamp{border:3px double #4e7a51;color:#4e7a51;background:transparent;transform:rotate(-9deg);border-radius:0;width:44px;height:40px;margin:0 auto 8px}
.life-first #win #resultStats{border-top:2px dashed #bba77f;border-bottom:2px dashed #bba77f;padding:8px 0}.life-first #win #resultStats div{background:transparent;box-shadow:none;border:0;padding:5px}.life-first #win #resultStats strong{color:#263b31}.life-first #win #resultStats small,.life-first #win #winText,.life-first #win .eyebrow,.life-first #win #clientReaction strong{color:#655b43}.life-first #win #clientReaction{border-top:1px solid #c8b68a;padding-top:8px;color:#263b31}.life-first #win #paymentReveal{color:#3e6c43}.life-first #win #back{color:#365240}
.life-first #deliveryScene{animation:dispatch-enter .25s ease-out}.life-first #deliveryScene::backdrop{background:#102d27aa;backdrop-filter:none}.life-first .scene-copy{border:3px solid #375647;border-radius:0;box-shadow:4px 4px 0 #163c3255;padding:10px 16px}
@keyframes dispatch-enter{from{opacity:0;translate:0 10px}to{opacity:1;translate:0 0}}
@media(max-height:500px){.life-first #missionBrief{bottom:8px;right:8px;width:min(620px,94vw)}.life-first #missionBrief .win-card{padding:10px 14px 10px 91px}.life-first #clientBrief .client-portrait{width:80px}.life-first #clientBrief p{font-size:12px}.life-first #win .win-card{padding:12px 18px}}
@media(prefers-reduced-motion:reduce){.life-first #missionBrief .win-card,.life-first #deliveryScene{animation:none}}

@media(max-height:500px) and (min-width:600px){
.life-first #win .win-card{display:grid;grid-template-columns:1.1fr 1fr;gap:4px 12px;padding:10px 14px;text-align:center}
.life-first #win .stamp{display:none}.life-first #win #resultLabel{grid-column:1/-1;font-size:8px}.life-first #win #winTitle{grid-column:1/-1;font-size:16px;margin:0}.life-first #win #stars{grid-column:1/-1;font-size:20px;margin:0;line-height:24px}
.life-first #win #resultStats{grid-column:1;grid-row:4/6;margin:0;padding:4px 0;gap:2px}.life-first #win #resultStats div{padding:3px}.life-first #win #resultStats strong{font-size:14px}.life-first #win #resultStats small{font-size:9px}
.life-first #win #clientReaction{grid-column:2;grid-row:4;margin:0;padding:4px 0}.life-first #win #clientReaction .client-portrait{width:42px}.life-first #win #clientReaction p{font-size:10px;line-height:1.35}
.life-first #win #paymentReveal{grid-column:2;grid-row:5;font-size:18px;padding:2px}.life-first #win #winText{grid-column:1/-1;font-size:9px;line-height:1.3;margin:2px 0}
.life-first #win #copyStatus:empty{display:none}.life-first #win #next,.life-first #win #replay{margin:0;min-height:42px;font-size:10px;padding:6px}.life-first #win #back{grid-column:1/-1;margin:0;min-height:30px;padding:3px;font-size:10px}
}

.yard-tools label{color:#f5e7b8}

/* Browser phones need the same short-screen map treatment as the native app. */
@media (max-height:550px) and (orientation:landscape){
 html #levelMenu{width:98vw;max-width:98vw;height:96dvh;max-height:96dvh;overflow:hidden}
 html #levelMenu .map-header{padding:5px 10px;gap:8px;min-height:44px}
 html #levelMenu .map-header h2{font-size:13px;margin:2px 0}
 html #levelMenu .map-header .eyebrow{display:none}
 html #levelMenu .map-header p{font-size:10px}
 html #levelMenu .map-header button{font-size:10px;padding:5px 8px;min-height:40px}
 html #levelMenu .map-layout{grid-template-columns:minmax(0,1fr) minmax(170px,28%);grid-template-rows:minmax(0,1fr);min-height:0;overflow:hidden}
 html #levelMenu #levelGrid{min-height:0;height:100%}
 html #levelMenu #levelGrid .map-stop{width:64px;height:54px;min-height:44px}
 html #levelMenu .map-stop svg{height:40px}
 html #levelMenu .stop-name{font-size:7px;padding:2px 0;white-space:normal;line-height:1.1}
 html #levelMenu .stop-number{width:17px;height:17px;font-size:9px;top:0}
 html #levelMenu .map-card{display:flex;flex-direction:column;justify-content:flex-start;gap:4px;padding:8px;min-height:0;overflow-y:auto;touch-action:pan-y;border-top:0}
 html #levelMenu #mapBuilding,html #levelMenu .map-card small{display:none}
 html #levelMenu .map-card h2{font-size:14px;margin:0}
 html #levelMenu #mapMission{font-size:8px;letter-spacing:1px}
 html #levelMenu .map-card p{font-size:11px;line-height:1.35;margin:2px 0}
 html #levelMenu #mapGo{order:-1;flex-shrink:0;margin:0 0 4px;min-height:44px;font-size:11px;padding:7px}
 html #levelMenu #mapRetry{flex-shrink:0;min-height:44px;font-size:10px}
}
@media (max-width:750px) and (orientation:portrait){
 html #levelMenu{overflow-y:auto;touch-action:pan-y}
 html #levelMenu .map-layout{flex:none;min-height:540px;grid-template-rows:300px auto}
}
