:root { --ink:#302338; --cream:#fff5d5; --green:#58a47a; }
* { box-sizing:border-box; }
body { margin:0; min-height:100svh; display:grid; place-items:center; background:#233c39; font-family:"Trebuchet MS","Segoe UI",sans-serif; }
[hidden] { display:none!important; }
button { font:inherit; color:var(--ink); cursor:pointer; touch-action:manipulation; }
button:focus-visible { outline:4px solid #fff3a2; outline-offset:5px; }
#world { position:relative; width:min(100vw,177.78svh); aspect-ratio:16/9; container-type:inline-size; isolation:isolate; overflow:hidden; }
#stage { width:100%; height:100%; display:block; }
#opening { position:absolute; top:7%; left:39%; right:8%; text-align:left; }
h1 { margin:0 0 3cqw; font-size:7.8cqw; letter-spacing:-.52cqw; line-height:.91; color:var(--ink); text-shadow:.33cqw .36cqw #f7eed1; }
.leaf { border:.34cqw solid var(--ink); background:#f9dc83; border-radius:3cqw 1cqw 3cqw 1cqw; padding:1cqw 2.1cqw; font-size:3cqw; line-height:1.25; font-weight:800; box-shadow:0 .45cqw 0 var(--ink); }
.leaf:hover { background:#ffe8a4; }
.leaf:active { translate:0 .28cqw; box-shadow:0 .17cqw 0 var(--ink); }
#controls { position:absolute; left:4%; bottom:3%; display:flex; gap:1.1cqw; }
#controls button { width:4.3cqw; height:4.3cqw; min-width:33px; min-height:33px; padding:0; border:.25cqw solid var(--ink); border-radius:50%; background:var(--cream); font-size:max(19px,2.7cqw); line-height:1; font-weight:bold; box-shadow:0 .22cqw var(--ink); }
#next { position:absolute; right:5%; bottom:3.4%; min-width:12cqw; text-align:center; }
#lesson-name { position:absolute; left:35%; top:6%; font-size:2.05cqw; font-weight:800; color:#365956; }
#math { position:absolute; left:34%; right:6%; top:15%; min-height:11%; display:flex; justify-content:center; gap:1.5cqw; align-items:center; font-weight:900; font-size:7.4cqw; line-height:1; color:var(--cream); -webkit-text-stroke:.22cqw var(--ink); paint-order:stroke fill; text-shadow:0 .35cqw var(--ink); }
#math span { display:inline-block; animation:letter .28s backwards; }
#math .operator { color:#ffd676; }
#math .total { color:#fff0aa; }
#answers { position:absolute; left:36%; right:10%; top:76.7%; height:17.5%; display:flex; justify-content:center; align-items:center; gap:3cqw; }
.bubble { isolation:isolate; }
.bubble { width:9.35cqw; aspect-ratio:1; background:transparent; border:0; padding:0; position:relative; font-size:5.7cqw; color:var(--ink); font-weight:900; line-height:1; display:grid; place-items:center; }
.bubble:before { content:""; position:absolute; inset:2%; z-index:-1; border:.36cqw solid var(--ink); border-radius:50%; background:#d9f1e5; box-shadow:inset -.5cqw -.55cqw #a5d8c7,0 .35cqw var(--ink); animation:float 3.3s ease-in-out infinite; }
.bubble:after { content:""; width:19%; height:10%; border-radius:50%; background:#fff6db; position:absolute; left:20%; top:17%; transform:rotate(-31deg); animation:float 3.3s ease-in-out infinite; }
.bubble:nth-child(2):before,.bubble:nth-child(2):after { animation-delay:-1.1s; }
.bubble:nth-child(3):before,.bubble:nth-child(3):after { animation-delay:-2.2s; }
.bubble:hover:before,.bubble:focus-visible:before { background:#fff2b5; }
.bubble:disabled { cursor:default; }
.bubble:disabled:before,.bubble:disabled:after { animation-play-state:paused; }
#paused { position:absolute; inset:0; background:#233c397d; display:grid; place-items:center; z-index:10; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
#head { transform-origin:0 74px; transform-box:view-box; }
#pip { transform-origin:0 220px; }
#arm { transform-origin:62px 113px; }
#mouth { opacity:0; }
.talk #mouth { opacity:1; }
.talk #smile { opacity:0; }
.blink #eyes { transform:scaleY(.12); transform-box:fill-box; transform-origin:center; }
.motion { transform-box:fill-box; transform-origin:center; }
.fruit .halo { opacity:0; }
.fruit.lit .halo { opacity:1; }
.fruit .tag { opacity:0; font-size:33px; font-weight:900; fill:#fff5d5; stroke:#302338; stroke-width:5px; paint-order:stroke fill; }
.fruit.lit .tag { opacity:1; }
.fruit.preview .tag { opacity:0; }
.paused * { animation-play-state:paused!important; }
@keyframes float { 50% { transform:translateY(-.44cqw); } }
@keyframes letter { from { opacity:0; translate:0 .65cqw; scale:.85; } }
@media (prefers-reduced-motion:reduce) { *,*:before,*:after { animation:none!important; } }
@media (orientation:portrait) { #world { width:100vw; } }
@media (max-width:480px) { .bubble { min-width:44px; } }
