/* Shared farm materials and layout. The world is scenery; controls use one cream UI. */
:root {--farm-ink:#65472f;--farm-line:#bd965f;--farm-paper:#fff5db;--farm-green:#54883d;background:#aaca7c;}
body.farm-world {padding:0;background:#aaca7c;isolation:isolate;}
.farm-world::before {display:none;}
.farm-backdrop {position:fixed;inset:0;z-index:-2;pointer-events:none;background:#aaca7c url('assets/farm/world-map.webp') center/cover no-repeat;}
.farm-world .masthead {position:fixed;z-index:40;top:14px;left:50%;transform:translateX(-50%);width:min(calc(100% - 24px),1180px);min-height:66px;padding:7px 9px;gap:12px;border:2px solid var(--farm-line);border-radius:22px;background:var(--farm-paper);box-shadow:0 6px 18px #35532520;}
.farm-world .brand {min-height:46px;padding:3px 6px;border:0;background:transparent;box-shadow:none;color:var(--farm-ink);font-size:1.35rem;}
.farm-world .brand-mark {width:30px;height:34px;}
.farm-world .sound-controls {padding-right:54px;gap:7px;}
.farm-world .sound,.farm-world .music {min-height:44px;min-width:44px;padding:8px 12px;border:1px solid #d2ba8e;border-radius:13px;background:#fff9e8;color:var(--farm-ink);box-shadow:none;}
.farm-world .music[aria-pressed="true"] {background:#e7f2d0;border-color:#b0c781;}
.farm-world .audio-settings {position:fixed;z-index:42;top:24px;right:max(23px,calc((100vw - 1180px)/2 + 11px));width:330px;max-width:calc(100% - 24px);margin:0;border:1px solid #d2ba8e;border-radius:13px;background:var(--farm-paper);color:var(--farm-ink);box-shadow:none;}
.farm-world .audio-settings:not([open]) {width:44px;height:44px;overflow:hidden;}
.farm-world .audio-settings summary {display:flex;align-items:center;gap:8px;min-height:44px;padding:9px 11px;list-style:none;font-size:.85rem;color:var(--farm-ink);}
.audio-settings summary::-webkit-details-marker {display:none;}
.settings-icon {flex:0 0 22px;width:22px;height:22px;}
.farm-world .audio-settings:not([open]) summary span {display:none;}
.farm-world .audio-settings[open] {max-height:calc(100dvh - 95px);overflow:auto;box-shadow:0 12px 30px #35532528;}
.farm-world .audio-settings[open]>summary {border-bottom:1px solid #e5d3ae;}
.farm-world .audio-settings .observer {position:static;width:auto;max-width:none;margin:12px 10px 10px;padding:0;border:1px solid #d9c49a;border-radius:12px;background:#fff9e8;box-shadow:none;}
.farm-world .audio-settings .observer summary {font-size:.78rem;}
.audio-settings .observer p,.audio-settings .observer ol {font-size:.78rem;margin:10px;}
.audio-settings .observer-actions {padding:0 10px 10px;}
.audio-settings .observer-actions button {font-size:.73rem;min-height:44px;}
.farm-world .game {position:relative;width:min(100%,1040px);min-height:100dvh;margin:auto;padding:112px 22px 42px;display:grid;grid-template-columns:130px minmax(0,700px);justify-content:center;align-content:center;gap:14px 24px;}
.farm-world .game .meadow {grid-column:1;grid-row:1;align-self:end;width:130px;height:185px;min-height:0;overflow:visible;border:0;border-radius:0;background:transparent;}
.farm-world .meadow>.sun,.farm-world .meadow>.cloud,.farm-world .meadow>.rainbow-arc,.farm-world .meadow>.hill,.farm-world .meadow>.grass {display:none;}
.farm-world .game .rabbit {left:0;bottom:0;width:112px;height:130px;}
.farm-world .game .flower {left:76px;bottom:0;transform:scale(.44);transform-origin:left bottom;}
.farm-world .game .panel {grid-column:2;grid-row:1;width:100%;min-height:0;padding:28px 30px;border:3px solid var(--farm-line);border-radius:24px;background:var(--farm-paper);box-shadow:0 12px 30px #35532524;}
.farm-world .panel::before {display:none;}
.farm-world h1 {color:var(--farm-ink);}
.farm-world .prompt {color:#6d5b40;}
.farm-world .panel[data-presentation="success"],.farm-world .panel[data-presentation="finish"] {background:var(--farm-paper);border-color:var(--farm-line);}
.farm-world .panel[data-presentation="success"] h1 {color:var(--farm-green);}
.farm-world .primary {background:var(--farm-green);box-shadow:0 3px 7px #365b3530;}
.farm-world .primary:not(:disabled):hover {background:#467933;}
.farm-world .primary:disabled {background:#e6e7d7;color:#76816a;box-shadow:none;}
.farm-world .repeat {background:#edf4d9;border-color:#adc586;color:#4f703b;}
.farm-world .secondary {background:#fff0c9;border-color:#c7aa75;color:var(--farm-ink);}
.farm-world .game .garden-progress {grid-column:2;margin:0 auto;padding:5px 14px;width:fit-content;min-height:30px;border:1px solid var(--farm-line);border-radius:12px;background:var(--farm-paper);color:var(--farm-ink);font-weight:850;}
/* Exploration: one full-screen scroll surface; no independent level frame. */
.farm-world:has(.game[data-stage="garden"]) {overflow:hidden;}
.farm-world:has(.game[data-stage="garden"]) .farm-backdrop {visibility:hidden;}
.farm-world .game[data-stage="garden"] {width:100%;height:100dvh;min-height:0;padding:0;display:block;pointer-events:none;}
.farm-world .game[data-stage="garden"] .panel {position:static;max-width:none;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;pointer-events:none;}
.farm-world .game[data-stage="garden"] h1,.farm-world .game[data-stage="garden"] .prompt {position:fixed;left:0;top:0;width:1px;height:1px;padding:0;margin:0;overflow:hidden;clip-path:inset(50%);border:0;}
.farm-world .garden-map.choices {position:fixed;z-index:0;inset:0;display:block;width:100%;max-width:none;height:100dvh;min-height:0;margin:0;padding:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;touch-action:pan-x;pointer-events:auto;border-radius:0;background:#aaca7c;}
.garden-map.choices::-webkit-scrollbar {display:none;}
.farm-trail {position:relative;height:100%;min-width:100%;overflow:clip;isolation:isolate;background:#aaca7c url('assets/farm/world-map.webp') center/cover no-repeat;}
.farm-road {position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;}
.farm-road path {fill:none;stroke-linecap:round;}
.road-shadow {stroke:#6a8b43;stroke-width:68;opacity:.12;}
.road-edge {stroke:#c2a96e;stroke-width:57;opacity:.5;}
.road-sand {stroke:#edd29b;stroke-width:51;}
.road-light {stroke:#f8dfad;stroke-width:35;opacity:.5;}
.road-pebble {fill:#ad9159;opacity:.32;}
.farm-world .garden-map .lesson-choice.choice {position:absolute;z-index:2;width:164px;min-height:164px;max-width:none;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;transform:translate(-50%,-50%);user-select:none;-webkit-user-select:none;}
.farm-world .garden-map .lesson-choice:hover {transform:translate(-50%,-50%);}
.farm-world .garden-map .lesson-choice::before {inset:auto;left:50%;top:-9px;width:188px;height:188px;transform:translateX(-50%);border:0;border-radius:0;background:transparent url('assets/farm/props-atlas.webp') 0 100%/300% 200% no-repeat;box-shadow:none;}
.farm-world .garden-map .lesson-choice.is-complete::before {background-position:50% 100%;}
.farm-world .garden-map .lesson-choice::after {display:none;}
.farm-world .garden-map .plant-art,.farm-world .garden-map .crop-row,.farm-world .garden-map .plant-status {display:none;}
.farm-world .garden-map .plant-sign {position:absolute;bottom:30px;min-height:38px;min-width:78px;padding:0 9px;border:2px solid #b88c50;border-radius:9px;background:#fff3d7;color:var(--farm-ink);box-shadow:0 3px 7px #6c4c2626;font-size:1.85rem;}
.farm-world .garden-map .is-complete .plant-sign {background:#e5f2c9;color:#416b32;}
.farm-world .garden-map .is-in-progress .plant-sign {border-color:#74a2b5;}
.farm-world .garden-map .lesson-petals {position:absolute;bottom:10px;padding:3px 6px;gap:5px;border-radius:8px;background:#fff3d7;}
.farm-world .garden-map .lesson-petals i {width:8px;height:8px;}
.farm-level-number {position:absolute;z-index:3;top:66px;left:10px;display:grid;place-items:center;width:25px;height:25px;border:2px solid #ffeac3;border-radius:50%;background:#947449;color:#fff9e8;font-size:.75rem;font-weight:900;}
.farm-prop {position:absolute;z-index:1;width:160px;height:160px;padding:0;border:0;background:none;transform:translate(-50%,-50%);touch-action:pan-x;}
.farm-prop--pond {width:180px;height:180px;}
.farm-prop-art,.farm-grass-tuft {display:block;width:100%;height:100%;background-image:url('assets/farm/props-atlas.webp');background-size:300% 200%;background-repeat:no-repeat;transform-origin:50% 85%;}
.farm-prop-art--tree {background-position:0 0;}.farm-prop-art--pond {background-position:50% 0;}.farm-prop-art--barn {background-position:100% 0;}
.farm-grass-tuft {position:absolute;width:65px;height:65px;background-position:100% 100%;pointer-events:none;transform:translate(-50%,-50%);}
.farm-image-hit {position:absolute;z-index:0;min-width:44px;min-height:44px;padding:0;background:none;border:0;border-radius:24px;}
.farm-image-hit:focus-visible {outline:3px dashed #fff1a2;outline-offset:-3px;}
.farm-world .game[data-stage="garden"] .garden-pages {position:fixed;z-index:6;bottom:18px;left:50%;transform:translateX(-50%);width:max-content;margin:0;padding:5px;gap:10px;border:1px solid var(--farm-line);border-radius:20px;background:var(--farm-paper);box-shadow:0 4px 12px #35532522;pointer-events:auto;}
.farm-world .garden-arrow {min-height:44px;min-width:50px;border:0;border-radius:13px;background:#eaf2d4;color:var(--farm-ink);box-shadow:none;}
.farm-world .garden-arrow:disabled {background:#f3edda;color:#a0a38a;}
.farm-world .garden-position {padding:0 8px;border:0;background:none;color:var(--farm-ink);font-size:.8rem;}
.farm-world .game[data-stage="garden"] .garden-progress {position:fixed;z-index:41;top:28px;bottom:auto;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:7px;margin:0;padding:5px 12px;border:0;background:none;font-size:.85rem;box-shadow:none;}
.garden-progress .icon {width:23px;height:23px;}
.farm-world .game[data-stage="garden"] .meadow {display:block;position:fixed;z-index:5;left:20px;bottom:78px;width:120px;height:140px;pointer-events:none;}
.farm-world .game[data-stage="garden"] .rabbit {left:0;bottom:0;width:120px;height:140px;pointer-events:auto;}
.farm-world .game[data-stage="garden"] .flower {display:none;}
.farm-world .farm-swipe-hint {position:fixed;z-index:5;left:137px;top:auto;bottom:129px;display:flex;align-items:center;gap:7px;padding:7px 10px;border:1px solid var(--farm-line);border-radius:15px;background:var(--farm-paper);color:var(--farm-ink);font-size:.8rem;box-shadow:0 3px 9px #3553251a;pointer-events:none;animation:farm-swipe 2.8s ease-in-out 3;}
.farm-swipe-hint svg,.farm-swipe-hint .icon {width:24px;height:24px;}
@keyframes farm-swipe {0%,100% {translate:0 0}50% {translate:7px 0}}
.farm-friend {display:none;position:fixed;z-index:3;min-width:44px;min-height:44px;padding:0;border:0;background:none;pointer-events:auto;}
.farm-friend svg {width:100%;height:100%;}
.farm-world:has(.game[data-stage="garden"]) .farm-friend,.farm-world:has(.game[data-stage="finish"]) .farm-friend {display:block;}
.farm-friend--butterfly {width:65px;height:65px;top:25%;left:4%;}
.farm-friend--butterfly svg {animation:farm-float 9s ease-in-out infinite;}
.farm-friend--chick {width:90px;height:90px;right:4%;bottom:17%;}
.farm-friend--chick svg {animation:farm-peck 8s ease-in-out infinite;transform-origin:50% 85%;}
.farm-paused .farm-friend svg {animation-play-state:paused;}
@keyframes farm-float {0%,100% {translate:0 0;rotate:-3deg}50% {translate:0 -8px;rotate:4deg}}
@keyframes farm-peck {0%,65%,100% {rotate:0deg}73% {rotate:8deg}81% {rotate:0deg}}
.farm-dragging .garden-map,.farm-dragging .garden-map * {cursor:grabbing!important;}
.farm-world .tap-burst,.farm-world .pointer-leaf {z-index:70;}
@media(max-width:900px) {
 .farm-world .game {grid-template-columns:minmax(0,650px);padding:104px 14px 30px;gap:10px;}
 .farm-world .game .meadow {grid-column:1;grid-row:1;width:100%;height:90px;}
 .farm-world .game .rabbit {left:8px;width:85px;height:95px;}
 .farm-world .game .flower {left:auto;right:6px;bottom:0;transform:scale(.4);transform-origin:right bottom;}
 .farm-world .game .panel {grid-column:1;grid-row:2;padding:22px 18px;}
 .farm-world .game .garden-progress {grid-column:1;grid-row:3;}
}
@media(max-width:700px) {
 .farm-world .masthead {top:10px;width:calc(100% - 20px);min-height:58px;padding:5px 6px;border-radius:18px;gap:5px;}
 .farm-world .brand {font-size:1.08rem;min-height:44px;padding:2px;gap:4px;}
 .farm-world .brand-mark {width:25px;height:28px;}
 .farm-world .sound-controls {gap:5px;padding-right:49px;}
 .farm-world .sound,.farm-world .music {width:44px;min-width:44px;min-height:44px;padding:9px;}
 .farm-world .control-label {display:none;}
 .farm-world .audio-settings {top:17px;right:18px;}
 .farm-world .game[data-stage="garden"] .garden-progress {top:auto;bottom:30px;left:50%;min-height:30px;padding:0;pointer-events:none;font-size:.8rem;}
 .farm-world .garden-position {visibility:hidden;width:85px;padding:0;}
 .farm-world .game[data-stage="garden"] .garden-pages {bottom:18px;gap:5px;}
 .farm-world .game[data-stage="garden"] .meadow {left:9px;bottom:83px;width:85px;height:100px;}
 .farm-world .game[data-stage="garden"] .rabbit {width:85px;height:100px;}
 .farm-world .farm-swipe-hint {left:94px;bottom:118px;font-size:.72rem;padding:5px 7px;}
 .farm-world .garden-map .lesson-choice.choice {width:144px;min-height:144px;}
 .farm-world .garden-map .lesson-choice::before {width:170px;height:170px;top:-9px;}
 .farm-world .garden-map .plant-sign {font-size:1.7rem;bottom:28px;min-height:34px;min-width:70px;}
 .farm-world .garden-map .lesson-petals {bottom:8px;}
 .farm-level-number {top:57px;left:5px;}
 .farm-prop {width:135px;height:135px;}.farm-prop--pond {width:155px;height:155px;}
 .farm-grass-tuft {width:55px;height:55px;}
 .farm-friend--butterfly {width:48px;height:48px;}.farm-friend--chick {width:70px;height:70px;}
}
@media(max-height:650px) {
 .farm-world .garden-map .lesson-choice.choice {width:124px;min-height:124px;}
 .farm-world .garden-map .lesson-choice::before {width:150px;height:150px;}
 .farm-world .garden-map .plant-sign {font-size:1.5rem;bottom:27px;min-height:30px;}
 .farm-level-number {top:49px;left:1px;}
 .farm-prop {width:110px;height:110px;}.farm-prop--pond {width:130px;height:130px;}
 .farm-world .game {align-content:start;}
}
@media(prefers-reduced-motion:reduce) {.farm-friend svg,.farm-swipe-hint {animation:none;}}
@media(max-width:900px){.farm-world .control-label{display:none;}.farm-world .sound,.farm-world .music{width:44px;padding:9px;}}
@media(max-width:700px){.farm-world .farm-swipe-hint{bottom:91px;}}
/* The lesson flower uses the same painted ground as the level map. */
.farm-world .meadow .flower::before {content:'';position:absolute;inset:0 auto auto 0;width:144px;height:144px;background:url('assets/farm/props-atlas.webp') 0 100%/300% 200% no-repeat;}
.farm-world .meadow .flower:has(.petals i:last-child.bloom)::before {background-position:50% 100%;}
.farm-world .flower .stem,.farm-world .flower>.leaf {display:none;}
.farm-world .flower .petals {position:absolute;top:auto;bottom:0;left:25px;display:flex;gap:5px;width:auto;height:16px;}
.farm-world .flower .petals i {position:static;width:14px;height:14px;border:1px solid #adac83;border-radius:50%;background:#fff6db;opacity:1;transform:none;transition:background-color 200ms ease-out;}
.farm-world .flower .petals i.bloom {background:var(--bloom);}
.farm-world .flower .flower-center {top:98px;left:43px;width:58px;height:27px;border:1px solid #bd965f;border-radius:7px;background:#fff3d7;box-shadow:none;font-size:1.35rem;}
.farm-world .game .flower {transform:scale(.58);}
@media(max-width:900px){.farm-world .game .flower{transform:scale(.55);}}
/* Keep the settings trigger still; its contents open below the shared toolbar. */
.farm-world .audio-settings,.farm-world .audio-settings[open] {width:44px;height:44px;max-height:none;overflow:visible;box-shadow:none;}
.farm-world .audio-settings>summary {width:44px;height:44px;border:0;}
.farm-world .audio-settings[open]>summary {border-bottom:0;}
.farm-world .audio-settings>summary>span {display:none;}
.audio-settings-panel {position:absolute;top:54px;right:0;width:330px;max-width:calc(100vw - 36px);max-height:calc(100dvh - 100px);overflow:auto;border:1px solid #cbb183;border-radius:16px;background:var(--farm-paper);box-shadow:0 12px 30px #35532528;}
.farm-world .audio-settings[open]>summary {background:#e7f2d0;border-radius:13px;}
.farm-world .audio-settings label,.farm-world .audio-settings output {color:var(--farm-ink);}
.farm-world .audio-settings select {color:var(--farm-ink);border-color:#d2ba8e;background:#fffaf0;}
.farm-world .audio-settings .voice-preview {color:#4f703b;background:#e8f1d1;border-color:#b4c893;box-shadow:none;}
.farm-world .audio-settings input[type="range"] {accent-color:var(--farm-green);}
/* Local cause-and-effect: water stays inside its basin and leaves fall with gravity. */
.farm-effect {position:absolute;inset:0;pointer-events:none;z-index:4;}
.farm-effect i {position:absolute;display:block;pointer-events:none;}
.farm-effect--pond {left:16%;top:40%;width:68%;height:30%;right:auto;bottom:auto;overflow:hidden;border-radius:50%;}
.farm-effect--pond i {left:var(--water-x,50%);top:var(--water-y,50%);width:19px;height:8px;border:2px solid #d5fff5;border-radius:50%;animation:pond-touch 850ms ease-out both;animation-delay:calc(var(--i)*80ms);box-shadow:0 1px 1px #3d9eae35;}
@keyframes pond-touch {from{opacity:.95;transform:translate(-50%,-50%) scale(.35)}to{opacity:0;transform:translate(-50%,-50%) scale(4)}}
.farm-effect--tree i {width:10px;height:16px;border:1px solid #57993e;border-radius:85% 5% 85% 5%;background:#93cb54;transform-origin:50% 30%;animation:tree-leaf-fall 950ms ease-out both;animation-delay:calc(var(--i)*35ms);}
.farm-effect--tree i::after {content:'';position:absolute;left:4px;top:3px;height:9px;border-left:1px solid #d3ec97;transform:rotate(22deg);}
@keyframes tree-leaf-fall {0%{opacity:0;translate:0 0;rotate:0deg}15%{opacity:1}100%{opacity:0;translate:var(--fall-x) 70px;rotate:110deg}}
.farm-effect--chick i,.farm-effect--rabbit i {bottom:10%;left:calc(41% + var(--i)*15%);width:11px;height:4px;border-radius:50%;background:#bda36a;animation:soft-footstep 700ms ease-out both;}
@keyframes soft-footstep {from{opacity:.45;scale:.6}to{opacity:0;scale:1.8}}
.farm-friend[data-reacting] svg {filter:brightness(1.06);}
.farm-prop-art--tree {transform-origin:50% 87%;}
.farm-swipe-hint[hidden] {display:none!important;}
@media(prefers-reduced-motion:reduce){.farm-effect i{animation:none;opacity:.7;}.farm-effect--pond i{transform:translate(-50%,-50%) scale(1.5);}.farm-effect--chick i,.farm-effect--rabbit i{opacity:.35;}}
/* Scene hit targets must never inherit the UI button's translate/scale on press. */
.farm-world .farm-prop,.farm-world .farm-prop:not(:disabled):active {transform:translate(-50%,-50%);transition:none;}
.farm-world .farm-image-hit:not(:disabled):active,.farm-world .farm-friend:not(:disabled):active {transform:none;}
.farm-effect--barn i {left:var(--contact-x,55%);top:var(--contact-y,65%);width:6px;height:6px;border-radius:50%;background:#f4d7a0;animation:wood-touch 650ms ease-out both;animation-delay:calc(var(--i)*140ms);}
@keyframes wood-touch {from{opacity:.7;translate:-4px -2px;scale:.7}to{opacity:0;translate:10px -12px;scale:1.3}}
@media(prefers-reduced-motion:reduce){.farm-effect--barn i{animation:none;opacity:.6;}}

/* Keep the fixed helper and navigation outside the road's playable band. */
@media(max-height:650px) {
 .farm-world .game[data-stage="garden"] .meadow {left:12px;bottom:12px;width:84px;height:98px;}
 .farm-world .game[data-stage="garden"] .rabbit {left:0;bottom:0;width:84px;height:98px;}
 .farm-world .game[data-stage="garden"] .garden-pages {left:auto;right:12px;bottom:14px;transform:none;width:min(260px,calc(100% - 116px));gap:4px;}
 .farm-world .garden-arrow {min-width:44px;width:44px;flex-shrink:0;}
 .farm-world .garden-position {visibility:hidden;flex:1;min-width:0;width:auto;padding:0;}
 .farm-world .game[data-stage="garden"] .garden-progress {top:auto;left:auto;right:12px;bottom:30px;transform:none;width:min(260px,calc(100% - 116px));min-height:30px;justify-content:center;padding:0;font-size:.8rem;z-index:7;pointer-events:none;}
 .farm-world .farm-swipe-hint {bottom:114px;left:12px;font-size:.72rem;padding:5px 7px;}
}
@media(max-height:500px) {
 .farm-world .game[data-stage="garden"] .meadow {width:68px;height:72px;}
 .farm-world .game[data-stage="garden"] .rabbit {width:68px;height:72px;}
 .farm-world .farm-swipe-hint {display:none;}
 .farm-world .garden-map .lesson-choice.choice {width:108px;min-height:108px;}
 .farm-world .garden-map .lesson-choice::before {width:126px;height:126px;}
 .farm-world .garden-map .plant-sign {bottom:22px;min-height:30px;font-size:1.35rem;}
 .farm-world .garden-map .lesson-petals {bottom:3px;}
 .farm-level-number {top:39px;left:0;}
}
@media(max-height:360px) {
 .farm-world .game[data-stage="garden"] .meadow {height:56px;}
 .farm-world .game[data-stage="garden"] .rabbit {height:56px;}
 .farm-world .garden-map .lesson-choice.choice {width:80px;min-height:80px;}
 .farm-world .garden-map .lesson-choice::before {width:92px;height:92px;}
 .farm-world .garden-map .plant-sign {bottom:18px;min-width:60px;padding-inline:5px;font-size:1.2rem;}
 .farm-world .garden-map .lesson-petals {bottom:0;gap:3px;}
 .farm-level-number {top:20px;left:-8px;}
}
