/* The cream room, Baboo’s dark coat and Biboo’s blue set the palette. */
:root{--cream:#fff9ef;--slate:#364762;--blush:#f3afaa;--sky:#c4dcf8}
*{box-sizing:border-box}
body{margin:0;background:#29364b;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cpath d='M45 36q1 9 8 9-7 1-8 9-1-8-8-9 7 0 8-9M0-5L5 0 0 5-5 0M90 85l5 5-5 5-5-5' fill='%23c3d5f0' opacity='.12'/%3E%3C/svg%3E");display:grid;place-items:center;min-height:100vh;min-height:100dvh;font-family:"Arial Rounded MT Bold","Trebuchet MS",system-ui,sans-serif;font-weight:800;color:#fffaf2;text-align:center}
#game{position:relative;isolation:isolate;width:min(100vw,60vh,500px);width:min(100vw,60dvh,500px);height:min(100vh,1050px);height:min(100dvh,1050px);overflow:hidden;container-type:size;background:#f0dfca;box-shadow:0 16px 70px #10152273;user-select:none;-webkit-user-select:none}
@media(min-width:600px){#game{height:min(95dvh,1000px);width:min(52dvh,500px);border-radius:26px;outline:4px solid #f4e2c9}}
img{display:block;width:100%;pointer-events:none;-webkit-user-drag:none}
.kitchen,section,#drops{position:absolute;inset:0}
.kitchen{background:url(art/home.webp) center top/100% 100% no-repeat;z-index:-2}
h1,h2,p{margin:0}
h1{position:absolute;top:9.5%;width:100%;font-size:min(6.9cqw,3.6cqh);color:#27354b;letter-spacing:-.04em;text-shadow:0 2px #fff8f0;transform:rotate(-2deg)}
h1 img{margin:1cqh auto 0;width:min(97%,46cqh)}
.friends{position:absolute;bottom:37.7%;left:50%;width:min(100%,46cqh);height:29%;transform:translateX(-50%)}
.friends>img{position:absolute;bottom:0;width:51%;transform-origin:50% 95%;animation:breathe 2.8s ease-in-out infinite}
.friends .baboo{left:5%;transform:rotate(3deg)}
.friends .biboo{right:5%;width:46%;transform:rotate(-3deg);animation:none}
#plate{position:absolute;background:linear-gradient(#fffaf4 0 22%,#c4d5eb 23% 52%,#738cac 53%);border:1cqw solid #38425a;border-radius:12% 12% 40% 40%/30% 30% 72% 72%;box-shadow:0 4px #36283438}
#plate{width:49%;height:10%;bottom:-2%;left:25.5%}
#plate img,#pile img{position:absolute;width:29%;bottom:55%;filter:drop-shadow(0 2px #47302955)}
.primary{position:absolute;top:76.2%;left:50%;transform:translateX(-50%);width:64%;height:8.7%;border:1cqw solid #fff7e9;border-radius:20cqw;color:#fffdf8;background:linear-gradient(#678ecd,#456fae 53%,#395d96);box-shadow:inset 0 4px #9dc0ec,inset 0 -5px #2b4978,0 5px #263751,0 9px #352a3573;font:inherit;font-size:min(8cqw,4.6cqh);text-shadow:0 3px #263d65;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:3cqw;touch-action:manipulation}
.primary:before{content:"";border:2.7cqw solid transparent;border-left:4.3cqw solid #fff8eb;border-right:0;filter:drop-shadow(0 2px #263d65)}
.primary:active{translate:0 4px}
.primary:focus-visible{outline:4px solid #ffdc91;outline-offset:6px}
.tips{position:absolute;top:87.3%;width:100%;font-size:min(4.2cqw,2.4cqh);text-shadow:0 2px #413041}
.tips div{display:flex;align-items:center;justify-content:center;gap:1.6cqw;margin-top:.7cqh;font-size:85%}
.tips img{width:min(8cqw,4.2cqh)}
.tips img+img{margin-left:3cqw}
#result,[data-state=end] h1,[data-state=end] .tips{display:none}
[data-state=end] #result{display:block}
#result{position:absolute;top:10.8%;width:100%;padding:0 8%;color:#343344;font-size:min(5cqw,2.65cqh)}
h2{color:#355880;font-size:min(10cqw,5.5cqh);letter-spacing:-.04em;text-shadow:0 3px #fffdf7;line-height:1.08;margin-bottom:1cqh}
#field{touch-action:none;cursor:ew-resize}
.hud{position:absolute;inset:1.7% 19% auto;display:flex;justify-content:space-between;font-size:5cqw;color:#27334a;z-index:2}
.hud span{display:flex;align-items:center;gap:1.8cqw;background:var(--cream);border:3px solid var(--slate);padding:1.2cqw 3cqw;border-radius:8cqw;box-shadow:0 3px #4233445c}
.hud img,.hud i{width:6cqw}
.hud i{height:6cqw;border:3px solid #456492;border-radius:50%;position:relative}
.hud i:after{content:"";position:absolute;left:43%;top:13%;height:34%;width:25%;border:solid #456492;border-width:0 0 3px 3px}
#baker,#player{position:absolute;left:0;transform:translate3d(50cqw,0,0) translateX(-50%);will-change:transform}
#drops .drop{top:0;will-change:transform}
.drop{position:absolute;width:11%;aspect-ratio:1;transform:translate(-50%,-100%);filter:drop-shadow(0 1px 0 #fffbf0) drop-shadow(0 2px 2px #33263666)}
.burnt:before{content:"";position:absolute;bottom:95%;left:33%;width:21%;height:45%;border-left:1cqw solid #5a5561;border-right:1cqw solid #5a5561;border-radius:50% 25%;opacity:.75}
#quip{position:absolute;top:-29%;left:50%;translate:-50%;color:#304d78;font-size:5cqw;white-space:nowrap;paint-order:stroke fill;-webkit-text-stroke:1.4cqw #fffaf0;opacity:0}
.dance #reaction{animation:hop .24s ease-out}
.sulk #face{animation:tear .52s ease-out both}
.dance #quip,.sulk #quip{animation:pop .66s ease-out}
@keyframes breathe{50%{scale:1.015 .975}}
@keyframes pop{15%,70%{opacity:1}100%{transform:translateY(-60%);opacity:0}}
@media(prefers-reduced-motion:reduce){.friends>img,.dance #reaction,.sulk #face{animation:none}#baker{transition:none}}

/* Keep the primary controls inside the portrait scene. */
button{font:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button:focus-visible{outline:3px solid #ffe095;outline-offset:3px}
.round{position:absolute;top:1.5%;width:max(44px,11.5cqw);aspect-ratio:1;display:grid;place-items:center;padding:0;background:var(--cream);border:3px solid var(--slate);color:#2c3e59;box-shadow:0 3px #362c4177,inset 0 -3px #e3d6c6;border-radius:50%;z-index:4}
.round svg{width:70%;fill:currentColor}
.round:active{translate:0 2px}
#music{right:3%}
#pause{left:3%}
#music .slash{stroke:#ac5360;stroke-width:3.7;stroke-linecap:round;filter:drop-shadow(1px -1px #fff9ef)}
#music[aria-pressed=true] .slash{display:none}
#music[aria-pressed=true]{background:var(--sky)}
#notice:not(:empty){position:absolute;z-index:6;right:3%;top:10%;background:#2b3950;padding:8px 12px;border-radius:14px}
#options{position:absolute;top:66.2%;left:7%;width:86%}
#levels{display:flex;align-items:stretch;padding:3px;background:#303e57;border-radius:99px;box-shadow:0 2px 0 #fff2df80,inset 0 2px 3px #202b41}
#levels button{flex:1;white-space:nowrap;min-height:max(42px,5.9cqh);border:0;background:none;border-radius:99px;color:#fffaf4;font-size:min(3.95cqw,2.35cqh);padding:0}
#levels [aria-pressed=true]{color:#302d39;background:linear-gradient(#ffe8b9,#f6bb61);box-shadow:inset 0 2px #fff7e6,inset 0 -3px #d8984c,0 2px 4px #232439}
#levels button:nth-child(2){flex:1.25}
#levels [aria-pressed=true]:before{content:'✓';margin-right:2px}
#best{display:block;margin-top:.9cqh;font-size:min(4cqw,2.25cqh);color:#3e5982}
#progress{position:absolute;left:9%;bottom:-3px;width:82%;height:5px;border-radius:9px;background:#334361;overflow:hidden}
#progress:before{content:'';display:block;height:100%;background:#f6c269;transform:scaleX(var(--left,1));transform-origin:left}
#field.urgent #progress:before{background:#ef8a88}
.urgent #time{color:#9a3648}
#sparkles{position:absolute;inset:0 -4% auto;display:flex;justify-content:space-between;color:#ffdc8c;font-size:7cqw;opacity:0;-webkit-text-stroke:1px #a36231}
#sparkles span{position:relative;top:-4cqh}
.dance #sparkles{animation:burst .48s ease-out}
@keyframes burst{20%{opacity:1}100%{opacity:0;transform:translateY(-4cqh) scale(1.32)}}
.burnt:before{border-color:#504957;filter:drop-shadow(0 0 2px #fffaf0)}
.drop img{border-radius:50%;box-shadow:0 0 0 2px #fff9ed}
#break{width:min(88cqw,380px);padding:4cqh 5cqw 1.5cqh;border-radius:26px;background:#fff8ed;color:#383847;border:4px solid #435575;box-shadow:0 6px #27364e;margin:auto;text-align:center;font-size:min(4.4cqw,2.6cqh)}
#break::backdrop{background:#20283eba}
#break p{margin:1.7cqh auto;line-height:1.35}
#difficulty{color:#405e86}
#resume{position:relative;top:auto;left:auto;transform:none;margin:3cqh auto 1cqh;width:88%;height:8cqh}
#home{background:none;color:#784653;border:0;text-decoration:underline;min-height:44px}
[data-state=paused] #field *{animation-play-state:paused}
@media(max-height:630px){#options{top:65%}.primary{top:75.5%}.tips{top:86.8%}#levels button{min-height:38px}}
@media(prefers-reduced-motion:reduce){.dance #sparkles{animation:none}}
/* Anchor the countdown to the timer, away from Baboo's hat. */
.hud span:last-child{position:relative}
#quip{font-size:min(4.7cqw,2.4cqh);left:50%}

#pauseOptions #levels button{font-size:min(3.6cqw,2.25cqh)}
#music .sound-state{display:none}
:is([data-state=intro],[data-state=end]) #music{
  display:flex;justify-content:center;gap:1cqw;aspect-ratio:auto;width:auto;
  border-radius:30px;min-height:44px;padding:0 2.6cqw;font-size:min(3.5cqw,2cqh)
}
:is([data-state=intro],[data-state=end]) #music svg{width:5.6cqw}
:is([data-state=intro],[data-state=end]) #music .sound-state{display:inline}
.sound-state:after{content:'Music off'}
[aria-pressed=true] .sound-state:after{content:'Music on'}
.sulk #quip{color:#95384c}

#voice{left:3%;width:auto;min-height:44px;aspect-ratio:auto;padding:0 3cqw;border-radius:32px;font-size:min(3.5cqw,2cqh)}
#voice:before{content:'◖))';letter-spacing:-.04em;margin-right:1.3cqw}
#voice{display:flex;align-items:center}
#voice[aria-pressed=true]{background:var(--sky)}
#pauseVoice #voice{position:static;margin:auto;font-size:inherit;padding:0 5cqw}
#menu{background:linear-gradient(transparent 62%,#46333a36 75%,#291d24bd 100%)}
h1{color:#29354c;paint-order:stroke fill;-webkit-text-stroke:.85cqw #fff9ee;text-shadow:0 2px 5px #fff3df}
h1 img{filter:drop-shadow(0 3px 5px #392b414a)}
.friends>img,#reaction>img{filter:drop-shadow(0 5px 3px #37253644)}
.friends:before{content:'';position:absolute;inset:92% 10% -2%;border-radius:50%;background:#482a2763;filter:blur(5px)}
#result{top:11%;width:88%;left:6%;border-radius:6cqw;background:#fff9f0f5;padding:1.5cqh 3%;box-shadow:0 4px 14px #47334538}
#result p{font-size:min(4.5cqw,2.45cqh)}
#result h2{font-size:min(9cqw,5cqh)}
#best:empty{display:none}
.tips{text-shadow:0 2px 4px #271b20,0 1px 3px #271b20}
:is([data-state=playing],[data-state=paused]) .kitchen{background-image:url(art/chalet.webp)}
#balcony{position:absolute;top:20.1%;width:100%;height:7.8%;background:url(art/balcony.svg) center top/100% 100% no-repeat;filter:drop-shadow(0 4px 3px #321c2440)}
#baker:before{content:'';position:absolute;bottom:-1%;left:12%;width:76%;height:7%;background:#44211199;border-radius:50%;filter:blur(2px)}
.sulk #face{position:absolute;top:35%;left:62%;width:6%;height:8%;background:linear-gradient(120deg,#f6fbff,#77afea);border:1px solid #415e8a;border-radius:0 60% 60%;transform:rotate(45deg)}
#plate{background:linear-gradient(#fffaf4,#d4e4f5 40%,#7394b7);border-color:#384964}
@media(max-height:630px){#break{padding-top:2cqh}#break p{margin:1cqh auto}}

/* The held and released cookie share the same bottom edge at 21% of the field. */
#baker{width:min(25cqw,11.6cqh);bottom:79%;transition:transform .16s ease-in-out}
#baker>img{clip-path:polygon(0 0,100% 0,100% 40%,80% 43%,80% 61%,84% 72%,82% 81%,100% 85%,100% 100%,0 100%,0 83%,17% 80%,16% 72%,20% 60%,22% 39%,0 37%)}
#held .drop{width:11cqw;left:50%;top:100%}
#held .burnt:before{display:none}
.wing{display:block;position:absolute;pointer-events:none;transform-origin:50% 15%}
#baker .wing{top:42%;width:20%;height:39%;background:linear-gradient(105deg,#514350,#29242e 52%,#19171e);border:1px solid #211c25;border-radius:50% 55% 68% 45%;transition:transform .09s ease-out;box-shadow:inset 1px 1px 2px #ffe2be52,0 2px 2px #281e284d}
#baker .left{left:13%;transform:rotate(41deg)}
#baker .right{right:13%;transform:scaleX(-1) rotate(41deg)}
#baker.holding .left{transform:rotate(-24deg)}
#baker.holding .right{transform:scaleX(-1) rotate(-24deg)}
/* Move the tray, cookies and penguin together. Land before the next possible catch. */
#player{bottom:3%;aspect-ratio:1;isolation:isolate}
#player:before{content:'';position:absolute;inset:92% 16% -2%;background:#42567f59;border-radius:50%;filter:blur(3px)}
#reaction{position:absolute;inset:0}
#reaction>img{height:100%}
#pile{position:absolute;top:6%;width:100%}
#pile img{width:20%;bottom:0}
#quip{top:-8.2cqh}
@keyframes hop{
  0%,100%{transform:translateY(0)}
  45%{transform:translateY(-4%);animation-timing-function:ease-in}
}
@keyframes tear{
  from{translate:0 -2px;opacity:0}
  25%{opacity:1}
  to{translate:0 5px;opacity:1}
}
#drops{z-index:1;pointer-events:none}
#baker{z-index:1}
@media(prefers-reduced-motion:reduce){#baker,#baker .wing{transition:none}}
