/* Each pose occupies one equal cell in the transparent 3 x 2 baby atlas. */
/* One size ladder for every life stage: the baby is step 0 and each later stage adds one step to
   both the art cap and the stage box, so adding kid/adult/awakened art only sets --pet-step and
   never needs a new layout. The baby is deliberately the smallest of the ladder so the pet, its
   stats and the four action buttons stay on one screen while the awakened art still fits. */
.pet-stage{--pet-step:0;--pet-cap:calc(188px + var(--pet-step) * 21px);--stage-height:calc(246px + var(--pet-step) * 21px);height:var(--stage-height);padding-bottom:24px;background:radial-gradient(ellipse 82% 40% at 50% 110%,#cadcb1 0,#e2edce 72%,transparent 73%)}
.pet-stage[data-life-stage="kid"]{--pet-step:1}
.pet-stage[data-life-stage="adult"]{--pet-step:2}
.pet-stage[data-life-stage="awakened"]{--pet-step:3}
.pet-stage .speech{top:18px;right:24px;padding:10px 14px;font-size:12px;z-index:2}
.pet-stage .cloud-one{top:48px;left:22px}
.pet-stage .cloud-two{top:78px;right:23px}
.life-stage{position:absolute;left:26px;top:23px;border:1px solid #fff;background:#fff9;color:#987465;border-radius:20px;padding:5px 13px;font-size:11px;font-weight:700;letter-spacing:1px}
.pet-actor{position:relative;width:min(56vw,var(--pet-cap));aspect-ratio:1;flex-shrink:0;transform-origin:50% 92%}
.pet-ground-shadow{position:absolute;left:19%;right:19%;bottom:5%;height:8%;border-radius:50%;background:radial-gradient(ellipse,#778d6952,transparent 72%);filter:blur(2px);transform-origin:50% 50%}
.pet-sprite{position:relative;width:100%;height:100%;background-image:url('./assets/baby-biscuit-v1.png');background-size:300% 200%;background-repeat:no-repeat;background-position:0 0;transform-origin:50% 92%}
.pet-sprite canvas{display:none;width:100%;height:100%}
.pet-sprite[data-atlas]{background-image:none}
.pet-sprite[data-atlas] canvas{display:block}
.pet-sprite[data-pose="eat"]{background-position:50% 0}
.pet-sprite[data-pose="play"]{background-position:100% 0}
.pet-sprite[data-pose="touch"]{background-position:0 100%}
.pet-sprite[data-pose="sleep"]{background-position:50% 100%}
.pet-sprite[data-pose="hungry"]{background-position:100% 100%}
.pet-stage>p{position:absolute;bottom:7px;margin:0;color:#68816f;font-size:12px}
.pet-sparkles{position:absolute;inset:0;pointer-events:none;opacity:0;color:#ed9dac;font-size:22px}
.pet-sparkles span{position:absolute;left:18%;top:36%}
.pet-sparkles span:nth-child(2){left:auto;right:17%;top:57%;font-size:26px}
.pet-sparkles span:nth-child(3){left:24%;top:72%;font-size:17px}
/* The approach moves the whole actor through the scene. Body motion is drawn frame by frame
   and dissolved between cells by pet-avatar.mjs; the rules below add the continuous part the
   drawings cannot carry on their own — stride bounce, squash on landing, breathing, hops. They
   move the sprite as a whole, so they stay small, and eating gets none (the bowl must not rock).
   data-motion is set by pet-avatar.mjs from the same reduced-motion check as the drawings. */
.pet-stage[data-arrival="run"] .pet-actor{animation:baby-approach 1.6s cubic-bezier(.18,.5,.25,1) both}
.pet-stage[data-motion="full"][data-arrival="run"] .pet-sprite{animation:baby-gallop .48s cubic-bezier(.4,0,.6,1) infinite}
.pet-stage[data-motion="full"][data-arrival="run"] .pet-ground-shadow{animation:baby-gallop-shadow .48s cubic-bezier(.4,0,.6,1) infinite}
.pet-stage[data-motion="full"][data-arrival="settle"] .pet-sprite{animation:baby-land .6s cubic-bezier(.2,.7,.3,1) both}
.pet-stage[data-arrival="greet"] .pet-sparkles{opacity:1;animation:baby-hearts .5s ease-out}
.pet-stage[data-motion="full"][data-animation="IDLE"]:not([data-arrival]) .pet-sprite{animation:baby-breathe 3.4s ease-in-out infinite}
.pet-stage[data-motion="full"][data-animation="HUNGRY"] .pet-sprite{animation:baby-breathe 3s ease-in-out infinite}
.pet-stage[data-motion="full"][data-animation="SLEEP"] .pet-sprite{animation:baby-breathe 4.6s ease-in-out infinite}
.pet-stage[data-motion="full"][data-animation="PLAY"] .pet-sprite{animation:baby-hop .8s cubic-bezier(.4,0,.6,1) 4}
.pet-stage[data-motion="full"][data-animation="PLAY"] .pet-ground-shadow{animation:baby-gallop-shadow .8s cubic-bezier(.4,0,.6,1) 4}
.pet-stage[data-motion="full"][data-animation="HAPPY"] .pet-sprite,.pet-stage[data-motion="full"][data-animation="TOUCH"] .pet-sprite{animation:baby-sway 1.6s ease-in-out 2}
.pet-stage[data-motion="full"][data-animation="LEVEL_UP"] .pet-sprite{animation:baby-celebrate 1.6s ease-in-out 2}
.pet-stage[data-animation="HAPPY"] .pet-sparkles,.pet-stage[data-animation="TOUCH"] .pet-sparkles,.pet-stage[data-animation="LEVEL_UP"] .pet-sparkles{opacity:1;animation:baby-hearts 3.2s ease-out}
.pet-stage[data-animation="LEVEL_UP"] .pet-sparkles{color:#deb558}
@keyframes baby-approach{from{transform:translateY(-38px) scale(.32);opacity:0}12%{opacity:1}to{transform:translateY(0) scale(1);opacity:1}}
/* One stride: push off, airborne stretch, land with a squash, recover. Same period as the RUN clip. */
@keyframes baby-gallop{0%{transform:translateY(0) scale(1,1)}28%{transform:translateY(-9px) scale(.965,1.045)}55%{transform:translateY(0) scale(1.035,.955)}78%{transform:translateY(-2px) scale(1,1)}100%{transform:translateY(0) scale(1,1)}}
@keyframes baby-gallop-shadow{0%{transform:scale(1);opacity:1}28%{transform:scale(.8);opacity:.55}55%{transform:scale(1.05);opacity:1}100%{transform:scale(1);opacity:1}}
@keyframes baby-land{0%{transform:translateY(-6px) scale(.97,1.03)}35%{transform:translateY(0) scale(1.05,.94)}70%{transform:scale(.99,1.01)}100%{transform:scale(1,1)}}
@keyframes baby-breathe{50%{transform:scale(1.012,1.02) translateY(-1px)}}
@keyframes baby-hop{0%{transform:translateY(0) rotate(0)}30%{transform:translateY(-13px) rotate(-3deg) scale(.98,1.03)}55%{transform:translateY(0) rotate(0) scale(1.03,.96)}75%{transform:translateY(-3px) rotate(2deg)}100%{transform:translateY(0) rotate(0)}}
@keyframes baby-sway{25%{transform:rotate(-2.5deg)}75%{transform:rotate(2.5deg)}}
@keyframes baby-celebrate{50%{transform:translateY(-8px) scale(1.04)}}
@keyframes baby-hearts{from{transform:translateY(10px);opacity:0}35%{opacity:1}to{transform:translateY(-6px)}}
/* Same selector as the base so the narrow-screen bases win without fighting the stage rules. */
@media(max-width:360px){.pet-stage{--pet-cap:calc(172px + var(--pet-step) * 18px);--stage-height:calc(228px + var(--pet-step) * 18px)}.pet-stage .speech{right:22px;font-size:11px}.life-stage{left:25px}}
/* The app always honours the OS preference. Only pet/dev/motion-preview.html sets
   data-preview-motion on <html> to demonstrate the full motion regardless of it. */
@media(prefers-reduced-motion:reduce){:root:not([data-preview-motion="full"]) .pet-stage *{animation:none!important;transition:none!important}}
