/* Cover layout follows the currently visible display, including browser chrome. */
html.cover-viewport{width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;overscroll-behavior:none}
body.cover-screen-active{position:fixed;inset:0 auto auto 0;width:var(--cover-viewport-w,100vw)!important;height:var(--cover-viewport-h,100dvh)!important;min-height:0!important;padding:0!important;margin:0!important;overflow:hidden!important;overscroll-behavior:none}
body.cover-screen-active :is(.app,.game,#world){box-sizing:border-box!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;max-height:100%!important;max-width:100%!important;aspect-ratio:auto!important;margin:0!important;padding:0!important}
body.cover-screen-active .app>.game{display:block!important;flex:1 1 auto;overflow:hidden!important}
body.cover-screen-active #coverPageSwitch{font:700 12px/1.1 system-ui!important}
#coverMostEmpty[hidden]{display:none!important}
#coverMostEmpty{grid-column:1/-2;align-self:center;text-align:center;font:600 12px/1.2 system-ui}
body.cover-screen-active #coverQuickActions [data-cover-page=most] small{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 9px/1.1 system-ui}
body.cover-screen-active #world.bath-wash-active #petwrap{left:67%!important;top:54%!important;width:min(50vw,70dvh)!important;height:min(50vw,70dvh)!important;transform:translate(-50%,-50%)!important;transition:none!important;animation:none!important;z-index:32!important}
body.cover-screen-active #world.bath-wash-active #bathWashLayer:not([data-stage=dry]){display:block!important;pointer-events:auto!important;touch-action:none;z-index:60!important}
body.cover-screen-active #world.bath-wash-active #coverMapleHotspot{display:none!important}
body.cover-screen-active #world.bath-wash-active #bathWashPanel:not([hidden]){left:4px!important;top:auto!important;bottom:4px!important;width:35%!important;max-width:150px!important;max-height:calc(100% - 42px)!important;box-sizing:border-box}
body.cover-screen-active #world.bath-wash-active #bathWashPanel #bathWashInstruction{display:block!important;line-height:1.15;font-size:10px;margin:2px 0}
body.cover-screen-active #world.bath-wash-active #bathWashPanel .bath-wash-meter[hidden]{display:none!important}
@media(max-height:210px){
 body.cover-screen-active #world.bath-wash-active #bathWashPanel:not([hidden]){top:auto!important;bottom:3px!important;max-height:calc(100% - 8px)!important;width:40%!important;overflow:hidden!important}
 body.cover-screen-active #world.bath-wash-active #bathWashPanel:has(#bathWashDry:not([hidden])) :is(#bathWashInstruction,.bath-wash-help){display:none!important}
 body.cover-screen-active #world.bath-wash-active #bathWashPanel #bathWashDry{width:100%;min-height:28px!important;height:auto!important;line-height:1.1;margin:1px 0 0}
 body.cover-screen-active #coverQuickActions:not([hidden]){grid-template-columns:repeat(6,minmax(0,1fr));gap:2px;left:2px;right:2px;bottom:2px;padding:2px}
 body.cover-screen-active #coverQuickActions button:not([hidden]){min-height:28px!important;height:auto;padding:1px!important}
 body.cover-screen-active #coverQuickActions .cover-action-art{width:21px!important;height:21px!important}
}

#trainingGames{grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fit,minmax(95px,1fr));gap:.4rem;padding:.65rem;border:1px solid #78835b;border-radius:.7rem}
#trainingGames h3{grid-column:1/-1;margin:0}
body.cover-screen-active #world #careRoutinePanel:not([hidden]){position:absolute!important;inset:auto auto 3px 3px!important;width:min(34%,135px)!important;max-height:90%;overflow:auto;z-index:120;padding:4px;transform:none!important}
body.cover-screen-active #careRoutinePanel h3{margin:0}
body.cover-screen-active #careRoutineStatus{font-size:11px;line-height:1.1;margin:3px 0}
body.cover-screen-active #world.care-routine #petwrap{left:65%!important;top:50%!important;transform:translate(-50%,-50%)!important;transition:none!important}
#lakeCourse{box-sizing:border-box;width:min(96vw,470px);max-height:96dvh;overflow:auto;margin:auto;padding:12px;background:#f8eed7;color:#263e2d;border:3px solid #af975d;border-radius:18px}
#lakeCourse::backdrop{background:#102b22dc}
#lakeCourse header,.lake-status,.lake-paddles{display:flex;align-items:center;justify-content:space-between;gap:5px}
#lakeCourse button{border:1px solid #bda269;background:#335b3e;color:#fff4d9;border-radius:12px;padding:8px;min-height:34px;margin:2px}
#lakeCourse button:disabled{opacity:.55}
#lakeCourse button:active{background:#708c49}
#lakeCourse canvas{display:block;width:100%;height:min(56dvh,440px);border-radius:12px}
#lakeCourse small{display:block}
.lake-cards{display:grid;grid-template-columns:1fr 1fr}
.lake-paddles button{flex:1;min-height:44px!important}
#actions [data-action="fishingbuddy"]::after{content:'🐾';position:absolute;top:2px;right:4px;font-size:12px}
#actions [data-action="fishingbuddy"]{position:relative}
@media(max-height:320px){#lakeCourse{padding:3px}#lakeCourse canvas{height:calc(96dvh - 112px)}#lakeCourse button{padding:3px;min-height:24px}}
#lakeCourse .lake-card-art{display:block;border-radius:7px;width:100%;height:clamp(32px,8dvh,70px);object-fit:cover;margin-bottom:4px}
.lake-portrait{float:right;width:58px;border-radius:50%;margin:4px}
#lakeCourse progress{display:block;width:100%;height:6px;accent-color:#557838}
.lake-cue{font-size:12px}
@media(max-height:320px){#lakeCourse canvas{height:max(46px,calc(96dvh - 134px))}}
body.foreground-speech #bubble{visibility:hidden!important}
#mapleSpeechForeground{position:fixed;inset:auto;margin:0;transform:translateX(-50%);z-index:2147483647;pointer-events:none;border:2px solid #998050;border-radius:14px;background:#fff3d3;color:#293b2e;max-width:min(80vw,330px);width:max-content;padding:7px 12px;text-align:center;font:600 14px/1.25 system-ui;box-shadow:0 2px 9px #0006}
#mapleSpeechForeground[hidden],#barnyardStoryBook[hidden]{display:none!important}
#barnyardStoryBook{position:absolute;left:53%;bottom:8%;z-index:12;width:48px;height:46px;padding:2px;background:transparent;border:0;filter:drop-shadow(1px 2px 2px #332a16);transform:rotate(-9deg)}
#barnyardStoryBook img{width:100%;height:100%;object-fit:contain}
#campRoomTrack #campPanorama{z-index:-1}

#world > #homeDecorLayer,#world > #homeDecorLayer.decor-editing,#world > #trailCamPlacedLayer{z-index:1}
#world > #petwrap{z-index:2}
#mapleSpeechForeground{box-sizing:border-box;max-width:none;margin:0;overflow:auto;align-content:center;padding:2px 8px;font-size:clamp(11px,2.8vw,14px);line-height:1.15}

/* Keep the scene and header in the viewport. The activity panel owns scrolling. */
html:has(main.app),body:has(main.app){height:100%;overflow:hidden;overscroll-behavior:none}
body:not(.cover-screen-active) main.app.phone-fit{
 box-sizing:border-box;height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden;
}
body:not(.cover-screen-active) main.app>.game{
 flex:1 1 0;min-height:0;overflow:hidden;
}
body:not(.cover-screen-active) .game>.panel{
 box-sizing:border-box;min-height:0;max-height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;
}
@media(min-width:768px) and (pointer:fine),(min-width:1025px){
 body:not(.cover-screen-active) main.app>.game{grid-template-rows:minmax(0,1fr)}
 body:not(.cover-screen-active) .game>.panel{align-self:stretch}
 body:not(.cover-screen-active) .game>#world{min-height:0;max-height:100%}
}
@media(min-width:768px){
 body:not(.cover-screen-active) .game>#world{flex-shrink:0}
 body:not(.cover-screen-active) .game>.panel{flex:1 1 0}
}
body.cover-screen-active #world #coverQuickActions{background:transparent!important;box-shadow:none}
body.cover-screen-active #world #coverQuickActions button[data-action]{--action-fill:#fff1d9;--action-edge:#9d794d;background:color-mix(in srgb,var(--action-fill) 50%,transparent)!important;border-color:color-mix(in srgb,var(--action-edge) 50%,transparent)!important;opacity:1!important}
html[data-theme="dark"] body.cover-screen-active #world #coverQuickActions button[data-action]{--action-fill:#2a4229;--action-edge:#8da166}
body.cover-screen-active #world #coverQuickActions button[data-action][aria-pressed="true"]{--action-fill:#678857}
body.cover-screen-active #world #coverQuickActions button[data-action="recall"]:enabled{--action-fill:#294b37}
body.cover-screen-active #world #coverQuickActions button[data-action]:disabled{border-style:dashed}
body.cover-screen-active #world #coverQuickActions .cover-action-art{opacity:1}

.snowfall-pile{position:absolute;right:3%;bottom:15%;width:clamp(62px,17%,116px);height:54px;border:0;background:transparent!important;box-shadow:none;padding:0;z-index:1;cursor:pointer}
.snowfall-pile[hidden]{display:none!important}
.snowfall-mound{position:absolute;inset:15% 0 0;border-radius:62% 72% 24% 24% / 98% 100% 17% 18%;background:radial-gradient(ellipse at 32% 20%,white,#e8f2fa 50%,#aac6dc 84%,#7995ab);box-shadow:0 3px 5px #41537152}
.snowfall-boo,.snowfall-print{display:none;position:absolute;object-fit:contain;pointer-events:none}
.snowfall-pile.jumping .snowfall-boo{display:block;width:80%;height:140%;bottom:10%;left:8%;animation:snowfallLeap .9s ease-in-out both}
.snowfall-pile.imprinted .snowfall-print{display:block;inset:18% 10% 0;width:80%;height:75%}
@keyframes snowfallLeap{0%{transform:translate(var(--boo-start-x),var(--boo-start-y)) scale(.85);opacity:0}22%{opacity:1}48%{transform:translate(calc(var(--boo-start-x)*.45),calc(var(--boo-start-y)*.45 - 45px)) rotate(-9deg)}80%{transform:translate(0,0) rotate(12deg)}100%{transform:translateY(12%) rotate(-12deg);opacity:0}}

#world.snowfall-boo-jumping #booPet{visibility:hidden!important}

body.cover-screen-active #world #booPet{scale:1.5;translate:calc(20px * var(--cover-facing,1)) 5px;transform-origin:center bottom}
#world:has(.snowfall-pile:not([hidden])) #petwrap{pointer-events:none}
#world:has(.snowfall-pile:not([hidden])) #petwrap :is(button,[role=button],input){pointer-events:auto}
body.foreground-speech{--speech-height:clamp(32px,5dvh,44px)}
body.foreground-speech #mapleSpeechForeground{height:var(--speech-height);max-height:none;display:grid;place-content:center}
body.foreground-speech.cover-screen-active #world{height:calc(100% - var(--speech-height))!important}
@media(max-width:767px),(pointer:coarse) and (max-width:1024px){
 body.foreground-speech:not(.cover-screen-active) .game>#world{margin-bottom:var(--speech-height)}
}
@media(min-width:768px) and (pointer:fine),(min-width:1025px){
 body.foreground-speech:not(.cover-screen-active) .game>#world{max-height:calc(100% - var(--speech-height))}
}
