/* Home-only side rails: never change the match board or its coordinates. */
.storybook-game #valley-home.home-with-rails[open]{display:grid;grid-template-columns:82px minmax(0,1fr) 82px;grid-template-rows:auto auto repeat(3,minmax(94px,1fr)) auto;gap:10px 6px;padding:12px;align-items:center;overflow-y:auto;background-image:linear-gradient(#173b2f11,transparent 45%,#163c2a88),url('/assets/game/flower-garden.webp')}
.home-with-rails .valley-wallet{grid-column:1/-1;grid-row:1;width:100%;box-sizing:border-box;gap:6px;padding:6px}.home-with-rails .valley-wallet>span{font-size:16px;padding:7px 4px}.home-with-rails .valley-wallet button{flex-shrink:0}
#valley-home.home-with-rails h1{grid-column:1/-1;grid-row:2;font-size:clamp(27px,7.4vw,38px);margin:6px 0;line-height:1.05;pointer-events:none}.home-with-rails .valley-subtitle{display:none}#valley-home.home-with-rails .valley-destinations{display:contents}
#valley-home.home-with-rails .home-side-action{box-sizing:border-box;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;align-self:center;gap:0;width:82px;height:94px;min-height:94px;margin:0;padding:3px 0 0;border:0;border-radius:20px;background:transparent;box-shadow:none;color:#fff6d8;text-decoration:none;font-size:0;cursor:pointer;overflow:visible}
#valley-home.home-with-rails .home-side-action[data-side=left]{grid-column:1}#valley-home.home-with-rails .home-side-action[data-side=right]{grid-column:3}
#valley-home.home-with-rails .home-side-action:before{content:'';position:absolute;z-index:0;top:3px;left:7px;right:7px;height:66px;border:2px solid #ecd17b;border-radius:50%;background:radial-gradient(circle at 40% 25%,#c2d78d,#547d43 65%,#315137);box-shadow:inset 0 2px #fff3b9,0 3px 3px #1d3e3880}
#valley-home.home-with-rails .home-side-action>.home-side-label{position:relative;z-index:2;display:block;width:auto;max-width:100%;height:auto;margin-top:3px;padding:4px 6px;border:1px solid #dec274;border-radius:9px;background:linear-gradient(#496c3b,#25472e);box-shadow:0 2px #203f2b;color:#fff6d8;font-size:12px;font-weight:800;line-height:1.2;text-align:center;white-space:nowrap}
#valley-home.home-with-rails .home-side-action>img,#valley-home.home-with-rails .home-side-action>.piece,#valley-home.home-with-rails .home-side-action>.home-chest-art,#valley-home.home-with-rails .home-side-action>.team-emblem,#valley-home.home-with-rails .home-side-action>.automation-house,#valley-home.home-with-rails .valley-mystery>span:first-child{position:relative;z-index:1;display:block;flex:0 0 60px;width:60px;height:60px;margin:0;font-size:49px;line-height:60px;filter:drop-shadow(0 3px 2px #1a392f66)}
#valley-home.home-with-rails .home-side-action>img{object-fit:contain}#valley-home.home-with-rails .valley-mystery>span:first-child{border:0;border-radius:0;background:transparent;color:#ffecae;text-align:center}
#valley-home.home-with-rails .home-side-action>span:nth-child(2):not(.home-side-label),#valley-home.home-with-rails .valley-mystery>div,#valley-home.home-with-rails #open-teams>span:nth-child(3):not(.home-side-label){display:none}
#valley-home.home-with-rails .automation-house{text-align:center;color:#fff1ac}.home-with-rails .automation-house i{font-size:16px;line-height:20px;width:20px;bottom:0;right:0;padding:0;color:#315039}
#valley-home.home-with-rails .home-chest-art .gift-chest{top:23px;left:3px;transform:scale(.56);transform-origin:top left}.home-with-rails #open-teams>.team-emblem{box-sizing:border-box;font-size:43px!important;line-height:54px!important;text-align:center}
#valley-home.home-with-rails .valley-start{grid-column:1/-1;grid-row:6;align-self:end;margin:0;padding:6px 0 0;text-align:center}.home-with-rails #valley-story{display:none}#valley-home.home-with-rails .valley-start .storybook-primary{width:min(100%,270px);min-height:72px;padding:8px 20px;font-size:28px;margin:0 auto}
#valley-home.home-with-rails .home-side-action:focus-visible{outline:3px solid #fff1b8;outline-offset:3px}#valley-home.home-with-rails .home-side-action:hover:before{filter:brightness(1.12)}
@media(max-width:350px){.storybook-game #valley-home.home-with-rails[open]{grid-template-columns:74px minmax(0,1fr) 74px;padding:8px;gap:6px}#valley-home.home-with-rails .home-side-action{width:74px}#valley-home.home-with-rails .home-side-action>.home-side-label{font-size:11px}}
@media(max-height:650px){.storybook-game #valley-home.home-with-rails[open]{grid-template-rows:auto auto repeat(3,88px) auto;gap:6px}#valley-home.home-with-rails h1{font-size:25px;margin:2px 0}#valley-home.home-with-rails .home-side-action{height:88px;min-height:88px}#valley-home.home-with-rails .valley-start .storybook-primary{min-height:60px;font-size:25px}}

/* Illustrated world: artwork is one continuous scene, not object cards. */
.storybook-game #valley-home.illustrated-valley[open]{max-width:none;width:100%;padding:10px;grid-template-columns:76px minmax(0,1fr) 76px;grid-template-rows:58px 48px repeat(3,minmax(78px,1fr)) 82px;gap:7px;background:#267d77;isolation:isolate;overflow:hidden}
#valley-home.illustrated-valley .valley-wallet{position:relative;z-index:4;padding:5px;gap:5px;border-radius:18px;background:linear-gradient(#6e8c53,#31583c);box-shadow:0 3px 8px #16382d77}
#valley-home.illustrated-valley .valley-wallet>span{font-size:15px;padding:7px 3px;white-space:nowrap}#valley-home.illustrated-valley #home-lives{width:auto;min-width:47px;height:36px;padding:3px 6px;border-radius:12px;background:#fff7d9;font-size:15px;color:#8b3e2a;border:0}#valley-home.illustrated-valley #valley-settings{width:38px;height:38px;font-size:22px}
#valley-home.illustrated-valley .home-side-action{z-index:4;width:76px;height:88px;min-height:88px;align-self:center;transition:filter .15s,translate .15s}#valley-home.illustrated-valley .home-side-action:active{translate:0 2px;filter:brightness(1.15)}
#valley-home.illustrated-valley .home-side-action>.home-side-label{font-size:11px}#valley-home.illustrated-valley .home-side-action:before{box-shadow:inset 0 3px #fff3b9,0 4px 0 #274937,0 7px 9px #123a3355}
#valley-home.illustrated-valley .home-map{position:absolute;inset:0;overflow:hidden;z-index:0;touch-action:none;cursor:grab;background:#268880;outline-offset:-5px}.home-map-scene{position:absolute;left:50%;top:50%;transform-origin:center;will-change:transform;user-select:none}.valley-base,.valley-restored-layer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;user-select:none}.valley-restored-layer{opacity:0;transition:opacity 1.2s ease;mask-repeat:no-repeat}.valley-restored-layer.built{opacity:1}.valley-restored-layer.restoring{animation:valley-restore 1.3s ease-out}
.valley-object{position:absolute;transform:translate(-50%,-50%);border:0;background:transparent;border-radius:50%;padding:0;cursor:pointer;z-index:3;touch-action:none}.valley-object .object-marker{display:inline-flex;align-items:center;justify-content:center;min-width:50px;min-height:42px;padding:3px 10px;border:3px solid #f8db7e;border-radius:24px;background:linear-gradient(#658d4b,#294d38);box-shadow:0 4px 6px #15392b77;color:#fff5ce;font-size:26px;font-weight:800}.valley-object.built .object-marker{display:none}.valley-object.fogged .object-marker{background:#586d5a;font-size:24px;opacity:.85}.valley-object:focus-visible{outline:4px solid #ffeb96;outline-offset:-5px}
.valley-cloud{position:absolute;z-index:2;pointer-events:none;opacity:0;transform:scale(.95);transition:opacity 1.3s ease,transform 1.5s ease;filter:drop-shadow(0 14px 10px #193d3b33)}.valley-cloud.visible{opacity:.88;transform:scale(1)}.valley-cloud i{position:absolute;width:75%;height:65%;border-radius:50%;background:radial-gradient(ellipse,#fff 15%,#eaf4eb 48%,#e8f6ec99 63%,transparent 74%);filter:blur(5px);animation:valley-cloud-drift 8s ease-in-out infinite alternate;animation-delay:var(--drift)}.valley-cloud i:nth-child(1){left:-10%;top:0}.valley-cloud i:nth-child(2){right:-10%;top:10%;animation-direction:alternate-reverse}.valley-cloud i:nth-child(3){left:12%;bottom:-8%;width:90%}
.valley-water-light{position:absolute;pointer-events:none;left:42%;top:33%;width:15%;height:58%;background:linear-gradient(110deg,transparent 15%,#eaffff33 45%,transparent 60%);mask-image:radial-gradient(ellipse,black,transparent 70%);animation:valley-water 5s ease-in-out infinite alternate}.valley-firefly{position:absolute;width:5px;height:5px;border-radius:50%;background:#fff4a3;box-shadow:0 0 10px 4px #ffec9977;pointer-events:none;animation:valley-glow 4s ease-in-out infinite;z-index:2}
#valley-home.illustrated-valley .valley-selector{grid-column:1/-1;grid-row:2;position:relative;z-index:4;justify-self:center;max-width:90%;padding:5px 14px;background:#234c3bd9;color:#fff4d3;border:1px solid #dfc77f;border-radius:18px;box-shadow:0 3px 8px #16392b44;cursor:pointer}.valley-selector strong{display:block;font-size:15px}.valley-selector small{display:block;font-size:11px;margin-top:2px}
#valley-home.illustrated-valley .valley-start{position:relative;z-index:4;grid-row:6;pointer-events:none;align-self:end;padding:0;margin:0}#valley-home.illustrated-valley .valley-start .storybook-primary{pointer-events:auto;width:min(100%,270px);min-height:70px;font-size:27px;box-shadow:inset 0 3px #fffce2,0 5px #345e32,0 8px 16px #123e3666}.valley-zoom{position:absolute;right:10px;bottom:91px;z-index:5;display:flex;gap:5px}.valley-zoom button{width:44px;height:44px;border:2px solid #e7cb79;border-radius:50%;background:#315a43e8;color:#fff6d2;font-size:25px;font-weight:800;cursor:pointer}
.valley-sheet{box-sizing:border-box;width:calc(100% - 24px);max-width:420px;max-height:80dvh;overflow:auto;border:3px solid #d6b65e;border-radius:22px;padding:25px 20px;background:linear-gradient(#fff6d9,#dce9c4);color:#284b36;box-shadow:0 15px 70px #173d36aa}.valley-sheet::backdrop{background:#143f35a8;backdrop-filter:blur(3px)}.valley-sheet h2{font-size:23px;padding-right:30px;margin:0 0 15px}.valley-sheet p{line-height:1.45}.valley-sheet-close{position:absolute;right:10px;top:9px;width:40px;height:40px;border:1px solid #bdad70;border-radius:50%;background:#e3edc0;color:#284b36;font-size:26px}.valley-sheet .primary{width:100%;min-height:46px}.valley-sheet .primary:disabled{opacity:.6}#valley-options{display:grid;gap:10px}#valley-options button{padding:13px;text-align:left;min-height:64px;border:1px solid #aebc82;border-radius:14px;background:#f9f4d8;color:#284b36;font:inherit}#valley-options strong,#valley-options small{display:block}#valley-options small{margin-top:6px;font-size:13px}#valley-options button:disabled{opacity:.65}
@keyframes valley-cloud-drift{to{translate:12px -6px}}@keyframes valley-water{to{translate:6px 13px;opacity:.5}}@keyframes valley-glow{0%,100%{opacity:.2;translate:0 0}50%{opacity:1;translate:5px -12px}}@keyframes valley-restore{0%{filter:brightness(1)}40%{filter:brightness(1.35)}100%{filter:brightness(1)}}
@media(max-height:650px){.storybook-game #valley-home.illustrated-valley[open]{grid-template-rows:50px 42px repeat(3,minmax(70px,1fr)) 62px;gap:3px;padding:7px}#valley-home.illustrated-valley .home-side-action{height:78px;min-height:78px}#valley-home.illustrated-valley .home-side-action>.home-side-label{font-size:10px;padding:3px 4px}#valley-home.illustrated-valley .home-side-action:before{height:55px}#valley-home.illustrated-valley .home-side-action>img,#valley-home.illustrated-valley .home-side-action>.piece,#valley-home.illustrated-valley .home-side-action>.home-chest-art,#valley-home.illustrated-valley .home-side-action>.team-emblem,#valley-home.illustrated-valley .home-side-action>.automation-house,#valley-home.illustrated-valley .valley-mystery>span:first-child{width:52px;height:52px;flex-basis:52px}#valley-home.illustrated-valley .valley-start .storybook-primary{min-height:58px;font-size:23px}.valley-zoom{bottom:74px}}
@media(prefers-reduced-motion:reduce){.valley-cloud i,.valley-firefly,.valley-water-light,.valley-restored-layer.restoring{animation:none}.valley-cloud,.valley-restored-layer{transition-duration:.01ms}}
/* Separate transparent building sprites share the landscape's perspective. */
.valley-building{position:absolute;transform:translate(-50%,-100%);pointer-events:none}.valley-building>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}.valley-building .valley-ruined-object{opacity:1;transition:opacity 1.2s ease}.valley-building.built .valley-ruined-object{opacity:0}.valley-building>.valley-object{pointer-events:auto;position:absolute;inset:0;width:100%;height:100%;transform:none;display:flex;align-items:center;justify-content:center}.valley-building .valley-cloud{z-index:2}.valley-building .valley-object{z-index:3}.valley-building .object-marker{margin-top:35%;font-size:24px;min-width:60px;min-height:48px}.valley-firefly{z-index:99}.valley-water-light{z-index:1}#valley-home.illustrated-valley .valley-selector{background:linear-gradient(#fff5ce,#e9c983);color:#643416;border:2px solid #e4a849;box-shadow:inset 0 2px #fff9dc,0 4px 7px #284d3c66;padding:7px 18px;border-radius:10px 10px 22px 22px}.valley-selector strong{font-size:22px;line-height:1.1;font-family:Georgia,serif}.valley-selector small{font-size:10px;margin-top:3px}#valley-home.illustrated-valley button:focus-visible{outline:3px solid #ffef9d;outline-offset:2px}@media(prefers-reduced-motion:reduce){.valley-building .valley-ruined-object{transition:none}}
.valley-building>img{object-position:center bottom}
#valley-home.illustrated-valley .home-map:before{content:'';position:absolute;inset:-20px;background:url('/assets/game/valley-one-v2/landscape.webp') center/cover;filter:blur(12px);pointer-events:none}
/* Shared original 3D icons on phone and desktop. */
#valley-home.illustrated-valley .home-side-action>.home-icon-3d{position:relative;z-index:2;display:block!important;flex:0 0 64px;width:70px;height:64px;object-fit:contain;filter:drop-shadow(0 4px 3px #163b3266);margin:0}
#valley-home.illustrated-valley .home-side-action>*:not(.home-icon-3d):not(.home-side-label){display:none!important}
#valley-home.illustrated-valley .home-side-action:before{display:none}
#valley-home.illustrated-valley .home-side-action>.home-side-label{background:linear-gradient(#365d43ee,#183c2eee);border-color:#dfbb64;padding:4px 7px;box-shadow:0 2px 3px #10332755}
.home-map-scene.camera-moving{transition:none}
#valley-home.mobile-focus-valley .valley-building:not(.focused){visibility:hidden;pointer-events:none}
#valley-home.mobile-focus-valley .valley-building.focused{visibility:visible}
.valley-object-nav{position:absolute;z-index:5;left:50%;bottom:91px;transform:translateX(-50%);display:flex;align-items:center;gap:8px;max-width:calc(100% - 20px);padding:4px 6px;border:1px solid #dcc37a;border-radius:18px;background:#204c3be8;color:#fff6d5;box-shadow:0 3px 9px #17382c55}
.valley-object-nav[hidden],.valley-zoom[hidden]{display:none}.valley-object-nav button{flex-shrink:0;width:44px;height:44px;border:1px solid #d5bc73;border-radius:50%;background:linear-gradient(#6f9557,#365f40);color:#fff8dc;font-size:30px;cursor:pointer}.valley-object-nav span{font-size:12px;font-weight:700;text-align:center;line-height:1.2;min-width:120px}
@media(min-width:900px){
 .storybook-game #valley-home.desktop-valley[open]{grid-template-columns:112px minmax(0,1fr) 112px;grid-template-rows:68px 62px repeat(3,minmax(100px,1fr)) 96px;padding:16px 24px;gap:8px;inset:0 0 78px;border-radius:0;max-width:none;width:100%}
 #valley-home.desktop-valley .home-map:before{display:none}
 #valley-home.desktop-valley .home-map{background:#24766c}
 #valley-home.desktop-valley .valley-wallet{justify-self:center;width:min(780px,70vw);border-width:2px;border-radius:20px;padding:8px;gap:10px}
 #valley-home.desktop-valley .valley-wallet>span{font-size:20px;padding:9px 16px}
 #valley-home.desktop-valley #home-lives{font-size:18px;height:42px;min-width:60px}
 #valley-home.desktop-valley #valley-settings{width:44px;height:44px;font-size:25px}
 #valley-home.desktop-valley .valley-selector{padding:9px 24px;max-width:420px}
 #valley-home.desktop-valley .valley-selector strong{font-size:28px}
 #valley-home.desktop-valley .valley-selector small{font-size:12px}
 #valley-home.desktop-valley .home-side-action{width:108px;height:108px;min-height:108px;justify-self:center}
 #valley-home.desktop-valley .home-side-action>.home-icon-3d{width:94px;height:84px;flex-basis:84px}
 #valley-home.desktop-valley .home-side-action>.home-side-label{font-size:13px;padding:4px 10px}
 #valley-home.desktop-valley .valley-start .storybook-primary{width:330px;min-height:82px;font-size:33px}
 #valley-home.desktop-valley .valley-start .storybook-primary small{font-size:17px}
 #valley-home.desktop-valley .valley-zoom{right:39px;bottom:22px}
 #valley-home.desktop-valley .valley-zoom button{width:48px;height:48px}
 body.storybook-game:has(#valley-home.desktop-valley[open]) .game-bottom-tabs{left:0;right:0;transform:none!important;box-sizing:border-box;width:100%;max-width:none;height:78px;padding:6px 20px;display:flex;justify-content:center;gap:16px;border-radius:0;border-top:2px solid #d2b264;background:linear-gradient(#2a513c,#153b2f)}
 body.storybook-game:has(#valley-home.desktop-valley[open]) .game-bottom-tabs button{flex:0 1 150px;font-size:13px}
 body.storybook-game:has(#valley-home.desktop-valley[open]) .game-bottom-tabs button>span{font-size:26px}
}
@media(max-height:650px) and (max-width:899px){.valley-object-nav{bottom:71px}.valley-object-nav button{width:40px;height:40px}#valley-home.illustrated-valley .home-side-action>.home-icon-3d{width:58px;height:52px;flex-basis:52px}.valley-object-nav span{font-size:11px}}
@media(prefers-reduced-motion:reduce){.home-map-scene.camera-moving{transition:none}}
/* Framed game controls: the complete medallion is one touch target. */
#valley-home.illustrated-valley .home-side-action{box-sizing:border-box;width:68px;height:72px;min-height:72px;padding:5px;display:flex;align-items:center;justify-content:center;border:3px solid #f5d16e;border-radius:23px;background:radial-gradient(ellipse at 38% 23%,#5fbaa2,#246154 62%,#133f3b);box-shadow:inset 0 3px 2px #fff5b4,inset 0 -4px 3px #173e36,0 3px 0 #956020,0 5px 0 #f7d36f,0 8px 9px #102c3699;transition:translate .12s,filter .12s;overflow:visible}
#valley-home.illustrated-valley .home-side-action:after{content:'';position:absolute;inset:3px;border:1px solid #e8c578;border-radius:17px;pointer-events:none;z-index:3}
#valley-home.illustrated-valley .home-side-action>.home-icon-3d{width:61px;height:61px;flex:0 0 61px;object-fit:contain;margin:0;filter:drop-shadow(0 3px 2px #072b39aa);pointer-events:none}
#valley-home.illustrated-valley .home-side-action>.home-side-label{display:none!important}
#valley-home.illustrated-valley .home-side-action:active{translate:0 3px;filter:brightness(1.12);box-shadow:inset 0 3px 2px #fff5b4,inset 0 -3px 3px #173e36,0 2px 0 #956020,0 4px 6px #102c3699}
#valley-home.illustrated-valley .home-side-action:focus-visible{outline:3px solid #fff5ce;outline-offset:5px}
#valley-home.mobile-focus-valley[open]{grid-template-columns:68px minmax(0,1fr) 68px;padding-left:6px;padding-right:6px}
#valley-home.mobile-focus-valley .valley-building .object-marker{font-size:14px;min-width:24px;min-height:24px;padding:2px 5px;border-width:1px}
@media(min-width:900px){#valley-home.desktop-valley .home-side-action{width:88px;height:92px;min-height:92px;border-radius:28px}#valley-home.desktop-valley .home-side-action>.home-icon-3d{width:79px;height:79px;flex-basis:79px}#valley-home.desktop-valley .home-side-action:after{border-radius:22px}}
#valley-home.illustrated-valley .home-map-scene:before,#valley-home.illustrated-valley .home-map-scene:after{content:'';position:absolute;top:0;width:100%;height:100%;background:url('/assets/game/valley-one-v2/landscape.webp') center/100% 100%;transform:scaleX(-1);pointer-events:none}
#valley-home.illustrated-valley .home-map-scene:before{left:-100%}#valley-home.illustrated-valley .home-map-scene:after{left:100%}
/* Focused mobile stage: controls above, architecture below without overlap. */
@media(max-width:899px){
 #valley-home.mobile-focus-valley .home-side-action{position:absolute;width:64px;height:64px;min-height:64px;top:132px}
 #valley-home.mobile-focus-valley .home-side-action[data-side=left]{left:8px}
 #valley-home.mobile-focus-valley .home-side-action[data-side=right]{right:8px}
 #valley-home.mobile-focus-valley .home-side-action[style*="4"]{top:202px}
 #valley-home.mobile-focus-valley .home-side-action[style*="5"]{top:272px}
 #valley-home.mobile-focus-valley .home-side-action>.home-icon-3d{width:55px;height:55px;flex-basis:55px}
 #valley-home.mobile-focus-valley .valley-object-nav{bottom:87px}
}
.valley-ambient{position:absolute;inset:0;pointer-events:none;z-index:2;transform:translate3d(var(--depth-x,0px),var(--depth-y,0px),0);transition:transform .3s ease-out}
.waterfall-flow{position:absolute;left:9%;top:23%;width:10%;height:15%;border-radius:40%;background:repeating-linear-gradient(0deg,transparent 0 14px,#ddffff70 17px,transparent 24px);mask-image:linear-gradient(transparent,#000 20%,#000 75%,transparent);opacity:.4;animation:water-stream 3s linear infinite}
.river-ripples{position:absolute;left:45%;top:48%;width:13%;height:31%;border-radius:50%;background:repeating-linear-gradient(165deg,transparent 0 24px,#d4ffff80 27px,transparent 31px);mask-image:radial-gradient(ellipse,#000,transparent 70%);animation:water-stream 6s linear infinite;opacity:.38}
.drifting-mist{position:absolute;left:20%;top:13%;width:48%;height:12%;border-radius:50%;background:radial-gradient(ellipse,#fff9,transparent 70%);animation:mist-drift 18s ease-in-out infinite alternate}
.foreground-leaves{position:absolute;left:10%;top:67%;width:44px;height:70px;font-size:0;transform-origin:bottom;animation:leaf-sway 5s ease-in-out infinite alternate}
.foreground-leaves:before,.foreground-leaves:after{content:'';position:absolute;width:34px;height:15px;background:linear-gradient(25deg,#245e32,#9fc659);border-radius:0 90% 0 90%;transform:rotate(25deg);box-shadow:0 2px 3px #113b3344}.foreground-leaves:after{top:25px;left:14px;transform:rotate(-30deg)}
.building-life{display:none;position:absolute;left:35%;top:40%;width:30%;height:33%;border-radius:50%;background:radial-gradient(ellipse,#ffd36677,transparent 65%);pointer-events:none;z-index:2;animation:building-light 4s ease-in-out infinite alternate;mix-blend-mode:screen}
.valley-building.built .building-life{display:block}.building-life.life-gate{left:25%;top:17%;width:50%;height:60%;background:radial-gradient(ellipse,transparent 35%,#62ffc799 45%,transparent 62%);animation:portal-light 3.6s ease-in-out infinite alternate}.building-life.life-crystal{background:radial-gradient(ellipse,#cc9bff88,transparent 65%)}
#valley-home:not([open]) .valley-ambient *,#valley-home:not([open]) .building-life{animation-play-state:paused}
@keyframes water-stream{to{background-position:0 96px}}@keyframes mist-drift{to{transform:translate3d(30px,4px,0);opacity:.5}}@keyframes leaf-sway{to{transform:rotate(5deg)}}@keyframes building-light{from{opacity:.35}to{opacity:.85}}@keyframes portal-light{from{opacity:.4;transform:scale(.95)}to{opacity:.9;transform:scale(1.05)}}
/* Existing shop nodes and controls, grouped without changing the economy. */
.storybook-game #game-shop{inset:0 0 76px;width:100%;max-width:560px;padding:16px 12px;border:0;border-radius:0;max-height:none;background:linear-gradient(#244e3b,#54774b);scrollbar-width:none;overflow-x:hidden;box-sizing:border-box}
#game-shop::-webkit-scrollbar{display:none}#game-shop .shop-heading{margin-bottom:12px}#game-shop .shop-heading small{display:none}
.wonder-tabs{display:flex;gap:6px;margin-bottom:16px;position:sticky;top:-16px;z-index:4;background:#294f3d;padding:10px 0}
.wonder-tabs button{flex:1;min-height:48px;border:2px solid #cfb663;border-radius:15px;background:linear-gradient(#fff1c5,#d7d7a1);color:#284a34;font:700 14px inherit;cursor:pointer}.wonder-tabs button[aria-selected=true]{background:linear-gradient(#d7f480,#83b148);box-shadow:inset 0 2px #faffd3,0 3px #163e2c;color:#24432d}
.wonder-panel[hidden]{display:none!important}#game-shop .shop-section-title[hidden]{display:none}
#game-shop #shop-items{gap:12px}#game-shop .shop-item{border:0;padding:12px 8px;box-shadow:inset 0 2px #fff9d9,0 4px #173e2d;border-radius:22px;gap:8px}#game-shop .shop-item-art{height:104px}#game-shop .shop-item-art .piece{width:102px;height:102px}#game-shop .moves-gift{width:86px;height:86px;font-size:40px}
#game-shop .shop-item strong{font-size:17px;line-height:1.25}#game-shop .shop-item small{font-size:12px;line-height:1.3}#game-shop .shop-item button{min-height:48px;font-size:15px;border-radius:14px;background:linear-gradient(#e4fb95,#98c255);box-shadow:inset 0 2px #ffffd6,0 3px #6b8834}
#game-shop .shop-item button:disabled{background:#d6dfbd;box-shadow:none}#game-shop .shop-guide{font-size:13px;margin:15px 0}#game-shop #close-shop{min-height:48px;width:100%}#game-shop #shop-status:empty{display:none}
.wish-preview{width:210px;height:210px;border:8px solid #e9c45e;border-radius:50%;margin:28px auto;display:grid;place-items:center;background:conic-gradient(#b4dd83 0deg 45deg,#f5d396 45deg 90deg,#abd6c6 90deg 135deg,#e3b7d2 135deg 180deg,#b4dd83 180deg 225deg,#f5d396 225deg 270deg,#abd6c6 270deg 315deg,#e3b7d2 315deg);box-shadow:inset 0 0 0 3px #fff0b5,0 7px #8b6c32}.wish-preview span{font-size:80px;color:#fff8cf;text-shadow:0 3px #9a723a}#wonder-wishes p{text-align:center;line-height:1.5;font-size:15px}
@media(prefers-reduced-motion:reduce){.valley-ambient *,.building-life{animation:none!important}.valley-ambient{transition:none}}
@media(max-width:899px){#valley-home.mobile-focus-valley .home-side-action{grid-row:auto!important;grid-column:auto!important}}
/* Victory presentation only: original amounts, handlers and reward ledger. */
.storybook-game #result.victory-result{padding:22px 16px 18px;border:3px solid #efd887;border-radius:28px;background:radial-gradient(ellipse at 50% 20%,#769e53,#315d42 65%,#214735);box-shadow:inset 0 0 0 3px #9daa64,0 14px 60px #092d2c99;color:#fff5cf;isolation:isolate}
.storybook-game #result.victory-result[open]{animation:victory-arrive .5s cubic-bezier(.15,.8,.25,1.15)}
#result.victory-result:before{content:'';position:absolute;inset:45px 10px auto;height:230px;background:radial-gradient(ellipse,#ffe89c55,transparent 68%);pointer-events:none;z-index:-1}
.storybook-game #result.victory-result h2{font-size:30px;text-shadow:0 3px #244a34;margin:12px 0}.storybook-game #result.victory-result .result-joke{display:none}
.storybook-game #result.victory-result .result-rewards{border:0;background:transparent;display:flex;justify-content:space-around;padding:10px 0;margin:8px 0 16px}
.storybook-game #result.victory-result .result-rewards>div{display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px;flex:1}
.storybook-game #result.victory-result .result-rewards .piece,.storybook-game #result.victory-result .reward-coin{width:90px;height:90px;font-size:48px;filter:drop-shadow(0 5px 5px #173d2b66)}
.storybook-game #result.victory-result .result-rewards b{font-size:32px;line-height:1.1}.storybook-game #result.victory-result .result-rewards small{font-size:12px;max-width:130px}
#result.victory-result[open] .result-rewards>div{animation:reward-arrive .65s ease-out both}#result.victory-result[open] .result-rewards>div:nth-child(2){animation-delay:.15s}
.storybook-game #result.victory-result #next{min-height:62px;font-size:23px;border-radius:22px;border:3px solid #fff0a1;background:linear-gradient(#d8f58c,#75af39 65%,#568f2f);box-shadow:inset 0 3px #fffbd3,0 5px #1c442c,0 7px 12px #183a2c66;margin:12px 0}
#result.victory-result .victory-details{font-size:12px;margin:8px 0;color:#f6ebc8}#result .victory-details summary{cursor:pointer;padding:6px}.storybook-game #result.victory-result #result-level-chest{min-height:44px;padding:8px 14px;width:auto;background:linear-gradient(#ffe8a4,#dbb858);color:#4d3a1f;border:2px solid #fff1b7;border-radius:14px;font-size:14px}
#result.victory-result .victory-confetti i{background:#ffdf75!important;border-radius:50%;box-shadow:0 0 6px #fff2ac;pointer-events:none}
@keyframes victory-arrive{from{opacity:0;transform:translateY(24px) scale(.88)}to{opacity:1;transform:none}}@keyframes reward-arrive{from{opacity:0;transform:translateY(-20px) scale(.6)}65%{opacity:1;transform:scale(1.08)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){#result.victory-result[open],#result.victory-result[open] .result-rewards>div{animation:none!important}}
/* Render artwork at its final layout size; do not magnify a cached compositor bitmap. */
#valley-home.illustrated-valley .home-map:before{filter:none}
.home-map-scene{will-change:auto}.valley-base{image-rendering:auto}
@media(max-width:899px) and (max-height:760px){#valley-home.mobile-focus-valley .home-side-action{top:114px;width:52px;height:52px;min-height:52px;border-radius:18px}#valley-home.mobile-focus-valley .home-side-action[style*="4"]{top:172px}#valley-home.mobile-focus-valley .home-side-action[style*="5"]{top:230px}#valley-home.mobile-focus-valley .home-side-action>.home-icon-3d{width:45px;height:45px;flex-basis:45px}}
.drifting-petals{position:absolute;left:12%;top:48%;width:32%;height:22%;background:radial-gradient(ellipse at 10% 15%,#ffdae8 0 2px,transparent 3px),radial-gradient(ellipse at 70% 35%,#ffcbe5 0 3px,transparent 4px),radial-gradient(ellipse at 40% 70%,#ffe4ed 0 2px,transparent 3px);animation:petal-drift 8s linear infinite;opacity:.7}
@keyframes petal-drift{from{transform:translate3d(0,-12px,0);opacity:0}20%{opacity:.7}to{transform:translate3d(24px,35px,0);opacity:0}}
#valley-home.illustrated-valley .home-map-scene:before,#valley-home.illustrated-valley .home-map-scene:after{background-image:var(--landscape-art,url('/assets/game/valley-one-v2/landscape.webp'))}
.wonder-tabs button{font-family:inherit;font-size:14px;font-weight:700}
/* Shop dismissal and keyboard focus use the game's gold palette. */
.storybook-game #game-shop .shop-heading{position:sticky;top:-16px;z-index:6;background:#244e3b;padding:10px 0;margin-top:-6px;gap:8px}
#game-shop .shop-heading>div{flex:1;min-width:0}.storybook-game #game-shop .shop-heading #shop-title{font-size:22px}
#game-shop .shop-wallet{flex:none;padding:6px;font-size:16px}
#game-shop #shop-close-top{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0;border:2px solid #e5cd7f;border-radius:50%;background:linear-gradient(#ecf5b9,#bbd975);color:#244a33;font-size:30px;line-height:1;cursor:pointer;box-shadow:inset 0 2px #fffce0,0 2px #183c2b}
#game-shop .wonder-tabs{top:48px}
.storybook-game #game-shop :is(button,summary):focus{outline:none}
.storybook-game #game-shop :is(button,summary):focus-visible{outline:2px solid #ffeab0;outline-offset:2px}

/* Animate camera geometry as one transform, never competing CSS transitions. */
.home-map-scene.camera-dragging .valley-ambient{transition:none}
#valley-home.mobile-focus-valley .home-map-scene.camera-moving .valley-building{visibility:visible;pointer-events:none}

/* Beyond the northern edge there is sky, never a second repeated valley. */
#valley-home.illustrated-valley .home-map:before{display:none}
#valley-home.illustrated-valley .home-map{background:#1689ec}
.home-map-scene .valley-base{mask-image:linear-gradient(to bottom,transparent,#000 48px)}
#valley-home.illustrated-valley .home-map-scene:before,#valley-home.illustrated-valley .home-map-scene:after{mask-image:linear-gradient(to bottom,transparent,#000 48px)}
.valley-object-nav button:disabled{opacity:.45;cursor:default}
