/* Coco's Cake Party — game styles. GameKit tokens loaded first.
   The bakery is all warm pinks and cream: frosting walls, wooden counter,
   party bunting, a sleepy cat — cozy first, then the party. */

:root {
    --wall1: #FBE3EC;
    --wall2: #F7C8D8;
    --wall3: #E8A8C0;
    --wood: #C98F5A;
    --wood-dark: #8A5A32;
    --wood-deep: #6E4626;
    --paper: #FFF8F0;
    --pink: #E87E9C;
    --pz: clamp(210px, 25vw, 300px);
}

html, body { overflow: hidden; }
body { background: var(--wall2); font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif; }

.screen { position: fixed; inset: 0; }

/* ═══ START SCREEN ═══ */

#screen-start {
    background:
        radial-gradient(ellipse at 50% -30%, rgba(255, 244, 220, 0.6), transparent 55%),
        linear-gradient(var(--wall1), var(--wall2) 55%, var(--wall3));
    z-index: 10;
}

.bunting { position: absolute; top: 0; left: 0; right: 0; height: clamp(54px, 9vh, 84px); z-index: 3; pointer-events: none; }
.bunting svg { width: 100%; height: 100%; }
.bunt-flag { transform-box: fill-box; transform-origin: 50% 0; animation: bunt-sway 3.2s ease-in-out infinite; }
@keyframes bunt-sway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3.5deg); }
}

.cozy-window { position: absolute; border: 10px solid var(--wood-dark); border-radius: 14px; overflow: hidden; box-shadow: 0 8px 20px rgba(140, 60, 90, 0.25), inset 0 0 0 4px var(--wood-deep); }
.cozy-window svg { width: 100%; height: 100%; display: block; }
#start-window { left: 4%; top: 9%; width: 26%; height: 25%; }
.wn-petal { animation: petal-fall linear infinite; }
@keyframes petal-fall { from { transform: translateY(0); } to { transform: translateY(150px); } }
.wn-btf { animation: btf-loop 11s ease-in-out infinite; }
@keyframes btf-loop {
    0%   { transform: translate(30px, 80px); }
    25%  { transform: translate(70px, 40px); }
    50%  { transform: translate(120px, 70px); }
    75%  { transform: translate(80px, 96px); }
    100% { transform: translate(30px, 80px); }
}

#start-chalk { position: absolute; right: 5%; top: 7%; width: clamp(150px, 17vw, 212px); z-index: 2; }
#start-chalk svg { width: 100%; display: block; }
#start-shelf { position: absolute; right: 26%; top: 12%; width: clamp(150px, 16vw, 210px); z-index: 2; }
#start-shelf svg { width: 100%; display: block; }

.cat-holder { position: absolute; pointer-events: none; }
.cat-holder svg { width: 100%; display: block; }
.start-cat { left: 3%; bottom: 4vh; width: clamp(96px, 11vw, 140px); z-index: 4; }
.cat-zzz { animation: zzz-float 3s ease-in-out infinite; }
@keyframes zzz-float {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 0.95; transform: translateY(-4px); }
}
.cat-body { transform-box: fill-box; transform-origin: 50% 90%; animation: cat-breathe 3.4s ease-in-out infinite; }
@keyframes cat-breathe {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.035); }
}
.cat-holder.twitch .cat-body { animation: cat-twitch 0.7s ease-in-out; }
@keyframes cat-twitch {
    0%, 100% { transform: rotate(0); }
    30% { transform: rotate(-2deg); }
    65% { transform: rotate(1.4deg); }
}

.cup-holder { position: absolute; right: 3%; bottom: 26.5%; width: clamp(54px, 6vw, 80px); z-index: 12; pointer-events: none; }
.cup-holder svg { width: 100%; display: block; overflow: visible; }
.steam-a { animation: steam-rise 2.4s ease-in-out infinite; }
.steam-b { animation: steam-rise 2.4s ease-in-out 1.1s infinite; }
@keyframes steam-rise {
    0% { opacity: 0; transform: translateY(6px); }
    40% { opacity: 0.8; }
    100% { opacity: 0; transform: translateY(-10px); }
}

.start-inner { position: absolute; inset: 0; }
#start-sign {
    position: absolute; left: 50%; top: 8.5%; transform: translateX(-50%) rotate(-2deg);
    background: linear-gradient(#E87E9C, #C9527A);
    border: 6px solid #A83A60;
    border-radius: 22px;
    padding: 14px 34px 16px;
    text-align: center;
    color: var(--paper);
    box-shadow: 0 10px 24px rgba(140, 40, 80, 0.35);
    z-index: 5;
}
#start-sign h1 {
    font-size: clamp(1.7rem, 4.6vw, 2.9rem);
    line-height: 1.05;
    text-shadow: 0 3px 0 rgba(140, 30, 70, 0.4);
}
#start-sign .tagline { font-size: clamp(0.9rem, 2vw, 1.15rem); margin-top: 4px; opacity: 0.95; }

.coco-holder svg { width: 100%; display: block; overflow: visible; }
#start-coco {
    position: absolute; left: 9%; bottom: 8vh;
    width: clamp(150px, 19vw, 220px);
    z-index: 4;
}
.coco-holder .cc-eyes-happy { transition: opacity 0.15s; }
.coco-holder.blink .cc-eyes, .coco-holder.happy .cc-eyes { opacity: 0; }
.coco-holder.blink .cc-eyes-happy, .coco-holder.happy .cc-eyes-happy { opacity: 1; }
.cc-arm-l, .cc-arm-r, .cc-hat, .cc-all, .cc-whisk { transform-box: fill-box; }
.coco-holder.wave .cc-arm-l { transform-origin: 90% 20%; animation: cc-wave 0.5s ease-in-out 2; }
@keyframes cc-wave {
    0%, 100% { transform: rotate(0); }
    50% { transform: rotate(-38deg); }
}
.coco-holder.nod .cc-all { transform-origin: 50% 80%; animation: cc-nod 0.42s ease-in-out; }
@keyframes cc-nod { 45% { transform: translateY(5px) scale(1.02, 0.97); } }
.coco-holder.giggle .cc-all { transform-origin: 50% 90%; animation: cc-gig 0.55s ease-in-out; }
@keyframes cc-gig {
    25% { transform: rotate(-2.4deg) translateY(-3px); }
    65% { transform: rotate(2.4deg) translateY(-1px); }
}
.coco-holder.curious .cc-all { transform-origin: 50% 85%; animation: cc-cur 1.3s ease-in-out; }
@keyframes cc-cur {
    30%, 70% { transform: rotate(4deg) translateX(4px); }
}
.coco-holder.happy .cc-all { animation: cc-bounce 0.55s ease-in-out 2; transform-origin: 50% 100%; }
@keyframes cc-bounce {
    35% { transform: translateY(-12px) scale(1.02); }
    75% { transform: translateY(0) scale(1, 0.97); }
}
.coco-holder.dance .cc-all { transform-origin: 50% 95%; animation: cc-dance 0.5s ease-in-out 3; }
@keyframes cc-dance {
    0%, 100% { transform: rotate(0) translateY(0); }
    30% { transform: rotate(-5deg) translateY(-10px); }
    70% { transform: rotate(5deg) translateY(-6px); }
}
.coco-holder.whisking .cc-whisk { transform-origin: 30% 80%; animation: cc-whisk 0.24s ease-in-out 4; }
@keyframes cc-whisk {
    from { transform: rotate(-8deg); }
    to   { transform: rotate(10deg); }
}
.coco-holder.twirl .cc-all { transform-origin: 50% 90%; animation: cc-twirl 0.9s ease-in-out; }
@keyframes cc-twirl {
    40% { transform: rotate(-352deg) scale(0.96); }
    70% { transform: rotate(-360deg) scale(1.03); }
    100% { transform: rotate(-360deg); }
}

#btn-start {
    position: absolute; left: 50%; top: 53%;
    transform: translate(-50%, -50%);
    width: clamp(190px, 25vw, 250px);
    height: clamp(190px, 25vw, 250px);
    border: none; background: none; cursor: pointer;
    animation: start-pulse 1.7s ease-in-out infinite;
    filter: drop-shadow(0 12px 22px rgba(150, 40, 80, 0.35));
    z-index: 5;
}
@keyframes start-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.06); }
}
#start-cake-art { position: absolute; inset: 0; }
.sca { position: absolute; left: 8%; width: 84%; }
.sca svg { width: 100%; display: block; }
.sca1 { bottom: 8%; }
.sca2 { bottom: 30%; }
.sca3 { bottom: 47%; left: 10%; width: 80%; }
.sca4 { left: 38%; bottom: 58%; width: 24%; }
.sca5 { left: 12%; bottom: 60%; width: 22%; transform: rotate(-8deg); }
.start-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding-left: 10px; padding-bottom: 16%;
    font-size: clamp(3.2rem, 6.6vw, 4.6rem);
    color: #FFF;
    text-shadow: 0 4px 0 rgba(150, 40, 80, 0.5), 0 8px 22px rgba(120, 20, 60, 0.5);
}

#level-doors {
    position: absolute; left: 50%; bottom: 10.5vh; transform: translateX(-50%);
    display: flex; gap: clamp(14px, 2.4vw, 26px);
    z-index: 5;
}
.door {
    width: clamp(106px, 12.5vw, 134px);
    height: clamp(126px, 15vw, 154px);
    border-radius: 60px 60px 14px 14px;
    border: 5px solid #A83A60;
    background: linear-gradient(#FBD9E5, #F0A8C2);
    cursor: pointer;
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    box-shadow: 0 8px 16px rgba(150, 40, 80, 0.28), inset 0 3px 0 rgba(255, 255, 255, 0.5);
    transition: transform 0.15s;
    font-family: inherit;
}
.door:hover { transform: translateY(-4px); }
.door:active { transform: scale(0.95); }
.door-num {
    width: 42px; height: 42px; line-height: 42px;
    border-radius: 50%;
    background: #C9527A;
    color: var(--paper);
    font-size: 1.5rem; font-weight: bold;
}
.door-icon { font-size: 1.55rem; }
.door-name { font-size: 0.72rem; font-weight: bold; color: #8E2F52; padding: 0 4px; }
.door-stars { font-size: 1.05rem; color: #FFB800; letter-spacing: 2px; text-shadow: 0 1px 0 rgba(150, 60, 0, .4); }
.door-stars i { font-style: normal; color: rgba(255, 255, 255, 0.7); text-shadow: none; }
.door-lock { font-size: 1.35rem; }
.door.locked { filter: grayscale(0.6) brightness(0.9); }
.door.fresh { border-color: #FFD700; animation: door-glow 1.2s ease-in-out infinite; }
@keyframes door-glow {
    0%, 100% { box-shadow: 0 8px 16px rgba(150, 40, 80, 0.28), 0 0 0 0 rgba(255, 215, 0, 0.7); }
    50%      { box-shadow: 0 8px 16px rgba(150, 40, 80, 0.28), 0 0 28px 10px rgba(255, 215, 0, 0.6); }
}
.door.wiggle { animation: door-wig 0.5s ease-in-out; }
@keyframes door-wig {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-4deg); }
    75% { transform: rotate(4deg); }
}

#star-sign {
    position: absolute; right: 2.5%; bottom: 3.5vh;
    background: linear-gradient(#E87E9C, #C9527A);
    border: 5px solid #A83A60;
    border-radius: 16px;
    padding: 10px 20px;
    font-size: 1.45rem; font-weight: bold;
    color: var(--paper);
    box-shadow: 0 8px 16px rgba(150, 40, 80, 0.28);
    z-index: 5;
}

.info-btn {
    position: absolute; left: 2.5%; bottom: 3.5vh;
    width: 64px; height: 64px;
    border: none; border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    font-size: 1.7rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(150, 60, 100, 0.3);
    transition: transform 0.15s;
    z-index: 6;
}
.info-btn:hover { transform: scale(1.08); }
.info-btn:active { transform: scale(0.92); }

/* ═══ BAKERY SCENE ═══ */

#scene { position: absolute; inset: 0; }

.bg-wall {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 50% -30%, rgba(255, 246, 224, 0.55), transparent 55%),
        linear-gradient(var(--wall1), var(--wall2) 50%, var(--wall3));
}

#bg-window { left: 3%; top: 5%; width: 29%; height: 26%; z-index: 1; }
#shelf { position: absolute; left: 34.5%; top: 19%; width: clamp(150px, 17vw, 215px); z-index: 2; }
#shelf svg { width: 100%; display: block; }
#chalkboard { position: absolute; left: 54%; top: 2.5%; width: clamp(150px, 16vw, 212px); z-index: 2; }
#chalkboard svg { width: 100%; display: block; }
/* the bakery cat naps on the counter beside Coco (behind the cake stand) */
.play-cat { left: 32.5%; bottom: 24.5%; width: clamp(80px, 9vw, 116px); z-index: 12; }

.vignette {
    position: absolute; inset: 0; pointer-events: none; z-index: 40;
    box-shadow: inset 0 -46px 90px rgba(150, 60, 100, 0.16), inset 0 30px 60px rgba(150, 60, 100, 0.1);
}

/* ── balloon rail ── */

#rail {
    position: absolute; top: 56px; left: 33%;
    display: flex; gap: 8px; z-index: 8;
}
.rail-slot {
    width: 44px; height: 54px; border-radius: 50% 50% 46% 46%;
    border: 3px dashed rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.16);
}
.rail-slot.filled {
    border: none;
    background: none;
    animation: balloon-land 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.rail-slot svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 4px rgba(150, 40, 80, .35)); animation: balloon-bob 2.8s ease-in-out infinite; }
.rail-slot:nth-child(odd) svg { animation-delay: -1.4s; }
@keyframes balloon-land { from { transform: scale(1.7); } to { transform: scale(1); } }
@keyframes balloon-bob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-4px) rotate(2.4deg); }
}

/* ── counter ── */

#counter { position: absolute; left: 0; right: 0; bottom: 0; height: 28%; z-index: 10; }
.counter-top {
    height: 36px;
    background: linear-gradient(#F0D3A8, #D9A870);
    border-top: 5px solid #F7E3C2;
    box-shadow: 0 5px 10px rgba(90, 40, 30, 0.24);
}
.counter-front {
    position: absolute; inset: 36px 0 0 0;
    background: #C9779C repeating-linear-gradient(90deg, rgba(140, 50, 90, 0.22) 0 6px, transparent 6px 148px);
    box-shadow: inset 0 16px 26px rgba(120, 40, 70, 0.28);
}

/* ── oven ── */

#oven-wrap {
    position: absolute; left: 1.2%; bottom: 25%;
    width: clamp(180px, 18vw, 240px);
    z-index: 5;
}
.oven-svg { width: 100%; display: block; overflow: visible; }
.oven-fire path { transform-box: fill-box; transform-origin: 50% 100%; }
.oven-fire path:first-child { animation: flick 0.5s ease-in-out infinite alternate; }
.oven-fire path:last-child { animation: flick 0.36s ease-in-out infinite alternate 0.12s; }
@keyframes flick {
    from { transform: scaleY(1); }
    to   { transform: scaleY(0.78) scaleX(1.07); }
}
.oven-heart { transform-box: fill-box; transform-origin: 50% 100%; animation: heart-beat 2.2s ease-in-out infinite; }
@keyframes heart-beat {
    0%, 20%, 100% { transform: scale(1); }
    10% { transform: scale(1.14); }
}
.oven-fire { opacity: 0.35; transition: opacity 0.4s; }
.glowing .oven-fire, .baking .oven-fire { opacity: 1; }
.glowing .oven-svg { filter: drop-shadow(0 0 26px rgba(255, 170, 120, 0.9)); }
.baking .oven-svg { animation: oven-rumble 0.24s linear infinite; }
@keyframes oven-rumble {
    25% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, 1px); }
}
#oven-arrow {
    position: absolute; top: 4%; left: 50%; margin-left: -26px;
    font-size: 3.1rem; color: #FFD700;
    text-shadow: 0 3px 0 rgba(160, 90, 0, 0.6), 0 0 18px rgba(255, 200, 60, 0.9);
    animation: arrow-bounce 0.7s ease-in-out infinite;
    pointer-events: none; z-index: 7;
}
@keyframes arrow-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}
#oven-tap { position: absolute; inset: 0; border: none; background: none; cursor: pointer; }

#coco { position: absolute; left: 20%; bottom: 23%; width: clamp(130px, 15vw, 190px); z-index: 14; }
#coco.entering { animation: coco-enter 1.1s ease-out; }
@keyframes coco-enter { from { transform: translateX(-260px); } }
#coco.walking .cc-all { animation: coco-walk 0.34s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes coco-walk {
    0%, 100% { transform: translateY(0) rotate(-1.4deg); }
    50% { transform: translateY(-7px) rotate(1.4deg); }
}

/* ── the cake ── */

#cake-wrap {
    position: absolute;
    width: var(--pz);
    height: calc(var(--pz) * 1.05);
    left: calc(47% - var(--pz) / 2);
    top: calc(56% - var(--pz) / 2);
    z-index: 25;
    transition: transform 0.55s cubic-bezier(0.55, 0.06, 0.4, 1);
    touch-action: none;
}
#cake-wrap.dragging { transition: none; }
#cake-stand { position: absolute; left: -5%; right: -5%; bottom: -4%; pointer-events: none; }
#cake-stand svg { width: 100%; display: block; filter: drop-shadow(0 8px 10px rgba(150, 50, 90, 0.25)); }

#cake {
    position: absolute; left: 4%; right: 4%; bottom: 9%;
    height: 86%;
    cursor: grab;
    transition: opacity 0.3s;
}
#cake.fresh { animation: ck-fresh 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes ck-fresh { from { transform: scale(0); } }
#cake.wobble #cake-stack { animation: ck-wobble 0.5s ease-in-out; transform-origin: 50% 100%; }
@keyframes ck-wobble {
    25% { transform: scale(1.04, 0.94); }
    60% { transform: scale(0.97, 1.04) rotate(0.8deg); }
}
#cake.bitten { animation: ck-bit 0.3s ease-out; }
@keyframes ck-bit {
    30% { transform: translateX(-7px) rotate(-2deg) scale(0.99); }
}

/* layers stack up from the plate */
#cake-stack {
    position: absolute; left: 0; right: 0; bottom: 0; top: 0;
    pointer-events: none;
}
.cake-layer {
    position: absolute; left: 0; right: 0;
    height: 26%;
    bottom: calc((var(--idx, 1) - 1) * 22%);
    transform: translateY(-120vh);
}
.cake-layer:nth-child(1) { --idx: 1; }
.cake-layer:nth-child(2) { --idx: 2; }
.cake-layer:nth-child(3) { --idx: 3; }
.cake-layer.land { transform: none; transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
.layer-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 5px 6px rgba(150, 50, 90, 0.22)); }

/* frosting cap + decorations ride on the top layer */
#cake-frost, #cake-deco {
    position: absolute; left: 0; right: 0;
    bottom: calc(var(--stack, 0) * 22% + 3%);
    pointer-events: none;
    transition: bottom 0.45s cubic-bezier(0.3, 1.3, 0.5, 1);
}
#cake-frost { height: 24%; opacity: 0; transform: scale(0.6); transition: all 0.4s cubic-bezier(0.2, 1.5, 0.4, 1); transform-origin: 50% 100%; }
#cake-frost svg { width: 100%; height: 100%; display: block; }
#cake.baked #cake-frost { opacity: 1; transform: scale(1); }

#cake-deco { height: 0; }
.placed-deco {
    position: absolute;
    width: 19%; height: auto; aspect-ratio: 60 / 66;
    bottom: calc(var(--dy) * -1px - 8px);
    bottom: 0;
    transform: translate(-50%, calc(-100% + var(--dy) * 1px + 14px)) rotate(var(--rot));
    pointer-events: auto;
    cursor: pointer;
}
.placed-deco.is-candle { width: 17%; }
.placed-deco svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 3px rgba(150, 50, 90, 0.25)); }
.placed-deco { opacity: 0; }
.placed-deco.arrive { opacity: 1; animation: deco-drop 0.45s cubic-bezier(0.3, 1.5, 0.45, 1); }
@keyframes deco-drop {
    0% { transform: translate(-50%, calc(-100% + var(--dy) * 1px - 110px)) rotate(var(--rot)) scale(0.7); opacity: 0.5; }
    70% { transform: translate(-50%, calc(-100% + var(--dy) * 1px + 18px)) rotate(var(--rot)) scale(1.12, 0.86); opacity: 1; }
    100% { transform: translate(-50%, calc(-100% + var(--dy) * 1px + 14px)) rotate(var(--rot)) scale(1); opacity: 1; }
}
.placed-deco.depart { animation: deco-pop 0.4s ease-in forwards; pointer-events: none; }
@keyframes deco-pop {
    40% { transform: translate(-50%, calc(-100% + var(--dy) * 1px - 40px)) rotate(var(--rot)) scale(1.05); opacity: 1; }
    100% { transform: translate(-50%, calc(-100% + var(--dy) * 1px - 90px)) rotate(var(--rot)) scale(0.4); opacity: 0; }
}

/* candle flames: hidden until the cake is baked & lit; smoke on blow-out */
.candle-flame { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; }
.lit .placed-deco:not(.out) .candle-flame { opacity: 1; animation: flame-dance 0.55s ease-in-out infinite alternate; }
@keyframes flame-dance {
    from { transform: rotate(-6deg) scaleY(1); }
    to   { transform: rotate(6deg) scaleY(1.12); }
}
.placed-deco.out .candle-flame { opacity: 0 !important; animation: none; }
.placed-deco.out .candle-smoke { opacity: 1; animation: smoke-rise 0.9s ease-out forwards; transform-box: fill-box; }
@keyframes smoke-rise {
    from { opacity: 0.9; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-22px); }
}

/* crumbs left on the stand after the feast */
#crumb-plate { position: absolute; left: 10%; right: 10%; bottom: 6%; height: 10px; z-index: 2; }
.plate-crumb {
    position: absolute; bottom: 0;
    height: 6px; border-radius: 3px;
    background: #E8B48C;
    animation: crumb-settle 0.4s ease-out both;
}
@keyframes crumb-settle { from { transform: translateY(-30px); opacity: 0; } }

/* ── bins ── */

#bins {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: clamp(8px, 1.2vw, 16px); z-index: 28;
}
.bin {
    position: relative;
    width: clamp(84px, 8.4vw, 108px); height: clamp(86px, 12vh, 100px);
    border: none; cursor: pointer;
    border-bottom: 6px solid #A83A60;
    border-radius: 12px 12px 14px 14px;
    background: linear-gradient(#FBD9E5, #F0A8C2);
    box-shadow: inset 0 8px 12px rgba(150, 40, 80, 0.18), 0 6px 12px rgba(150, 40, 80, 0.3);
    transition: transform 0.12s;
}
.bin:active { transform: scale(0.93); }
.bin-layer .bin-slab { position: absolute; left: 6%; right: 6%; top: 24%; pointer-events: none; }
.bin-slab svg { width: 100%; display: block; }
.bin .bp { position: absolute; width: 44%; height: 50%; pointer-events: none; }
.bp svg { width: 100%; height: 100%; display: block; }
.bp1 { left: 7%; bottom: 6%; }
.bp2 { right: 7%; bottom: 14%; transform: rotate(9deg); }
.bin.shake { animation: bin-shake 0.4s ease-in-out; }
@keyframes bin-shake {
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ── customer window ── */

#cust-window {
    position: absolute; right: 2%; top: 8%;
    width: 24%; height: 48%;
    z-index: 15;
}
.cust-sky { position: absolute; inset: 10px; overflow: hidden; border-radius: 10px; }
.cust-sky svg { width: 100%; height: 100%; }
.cust-frame {
    position: absolute; inset: 0;
    border: 12px solid var(--wood-dark);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(150, 50, 90, 0.28), inset 0 0 0 4px var(--wood-deep);
    pointer-events: none; z-index: 4;
}
.cust-sill {
    position: absolute; left: -5%; right: -5%; bottom: -16px; height: 24px;
    background: linear-gradient(#E2B27E, var(--wood));
    border: 4px solid var(--wood-dark);
    border-radius: 8px;
    z-index: 5;
    box-shadow: 0 5px 10px rgba(150, 50, 90, 0.28);
}
#cust-slot {
    position: absolute; left: 5%; right: 5%; bottom: 4px; top: 12%;
    overflow: hidden; z-index: 3;
}
.cust { position: absolute; left: 8%; right: 8%; bottom: 0; transform: translateX(135%); }
.cust.here { transform: none; transition: transform 0.8s cubic-bezier(0.2, 1.25, 0.4, 1); }
.cust.leave { transform: translateX(145%) !important; transition: transform 0.6s cubic-bezier(0.5, 0, 0.8, 0.4); }
.cust-svg { width: 100%; display: block; overflow: visible; }

.c-eye, .c-pupil, .c-body, .sig, .c-hat, .c-cheeks, .c-tongue { transform-box: fill-box; }
.c-m-o, .c-m-hmm, .c-m-full { display: none; }
.cust.wide .c-m-smile, .cust.hmm .c-m-smile, .cust.munching .c-m-smile, .cust.lean .c-m-smile { display: none; }
.cust.wide .c-m-o, .cust.lean .c-m-o { display: block; }
.cust.hmm .c-m-hmm { display: block; }
.cust.munching .c-m-full { display: block; }
.c-eye { transform-origin: center; transition: transform 0.2s; }
.cust.wide .c-eye, .cust.lean .c-eye { transform: scale(1.35); }

/* party hat: tips forward on every hop */
.c-hat { transform-origin: 50% 100%; }
.cust.dance .c-hat, .cust.chomp .c-hat { animation: hat-tip 0.4s ease-in-out; }
@keyframes hat-tip {
    40% { transform: rotate(-9deg) translateY(-3px); }
}

/* the munch face: puffed cheeks + blissful eyes while chewing */
.c-cheeks, .c-eyes-bliss, .c-tongue, .c-smear { opacity: 0; }
.cust.munching .c-cheeks { opacity: 1; animation: cheek-chew 0.22s ease-in-out 2 alternate; transform-origin: 50% 50%; }
@keyframes cheek-chew {
    from { transform: scale(1); }
    to   { transform: scale(1.14, 0.92); }
}
.cust.munching .c-eyes-bliss { opacity: 1; }
.cust.munching .c-eyes { opacity: 0; }
.cust.smeared .c-smear { opacity: 1; }
.cust.lick .c-tongue { opacity: 1; transform-origin: 50% 0; animation: tongue-sweep 0.7s ease-in-out; }
@keyframes tongue-sweep {
    0% { transform: rotate(-24deg) scaleY(0.4); }
    45% { transform: rotate(14deg) scaleY(1.1); }
    100% { transform: rotate(0) scaleY(1); }
}
.cust.lick .c-smear { opacity: 0; transition: opacity 0.5s 0.3s; }

/* anticipation lean before each bite */
.cust.lean .c-body { animation: c-leanin 0.28s ease-out both; }
@keyframes c-leanin { to { transform: translateX(-11px) rotate(-4deg) scale(1.03); } }
.cust.chomp .c-body { animation: c-chomp 0.34s ease-out; }
@keyframes c-chomp {
    30% { transform: translateX(-8px) translateY(7px) scale(1.07, 0.95); }
    70% { transform: translateY(-3px) scale(0.99, 1.03); }
}
.cust.hmm .c-pupil { transform: translate(2.5px, -1px); }
.cust.hmm .c-body { animation: c-lean 0.6s ease-out both; }
@keyframes c-lean { to { transform: translateY(7px) rotate(-3deg); } }
.cust.dance .c-body { animation: c-hop 0.5s ease-in-out 3; }
@keyframes c-hop {
    0%, 100% { transform: translateY(0) rotate(0); }
    30% { transform: translateY(-15px) rotate(-5deg); }
    70% { transform: translateY(-11px) rotate(5deg); }
}
/* the happy tummy-pat wiggle after the last bite */
.cust.tummy .c-body { animation: c-tummy 0.6s ease-in-out 2; transform-origin: 50% 90%; }
@keyframes c-tummy {
    30% { transform: rotate(-3deg) scale(1.04, 0.97); }
    70% { transform: rotate(3deg) scale(0.98, 1.02); }
}

/* signature parts (same friends, same charm) */
.bb-ear { transform-origin: 50% 92%; animation: bb-flop 3.4s ease-in-out infinite; }
.bb-ear-r { animation-delay: 1.2s; }
@keyframes bb-flop {
    0%, 70%, 100% { transform: rotate(0); }
    80% { transform: rotate(-16deg); }
    90% { transform: rotate(5deg); }
}
.gg-beard { transform-origin: 50% 8%; animation: gg-wig 2.8s ease-in-out infinite; }
@keyframes gg-wig {
    0%, 60%, 100% { transform: rotate(0); }
    72% { transform: rotate(-6deg); }
    86% { transform: rotate(6deg); }
}
.mm-whisk { animation: mm-twitch 3s ease-in-out infinite; }
@keyframes mm-twitch {
    0%, 74%, 100% { transform: translateY(0); }
    80% { transform: translateY(-2.5px); }
    88% { transform: translateY(1.5px); }
}
.tt-shell { animation: tt-bob 2.6s ease-in-out infinite; }
@keyframes tt-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}
.oo-bow { animation: oo-bow 3.5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes oo-bow {
    0%, 80%, 100% { transform: rotate(0); }
    88% { transform: rotate(8deg); }
}
.cust.dance .sig { animation: sig-flap 0.32s ease-in-out infinite alternate; }
@keyframes sig-flap {
    from { transform: rotate(-9deg); }
    to   { transform: rotate(9deg); }
}

#qbubble {
    position: absolute; top: 10%; left: -22px;
    width: 66px; height: 66px;
    background: #FFF;
    border: 4px solid #4A3B5C;
    border-radius: 50% 50% 12px 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; font-weight: bold; color: #4A3B5C;
    z-index: 8;
    box-shadow: 0 6px 14px rgba(60, 40, 90, 0.3);
}
#qbubble.pop { animation: q-pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes q-pop { from { transform: scale(0) rotate(-20deg); } }

/* ── order ticket ── */

#ticket-zone {
    position: absolute; left: 55%; top: 6%;
    width: 246px; height: 320px;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
}
#ticket {
    background: var(--paper);
    border-radius: 4px 4px 14px 14px;
    box-shadow: 0 10px 20px rgba(150, 60, 90, 0.25);
    padding: 16px 12px 10px;
    margin-top: 8px;
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
    position: relative;
}
#ticket.pop { transform: scale(1); }
.tucked #ticket { transform: translateY(-135%) scale(1); transition: transform 0.55s ease-in; }
#ticket.flash { animation: ticket-flash 0.9s ease-in-out; }
@keyframes ticket-flash {
    0%, 100% { box-shadow: 0 10px 20px rgba(150, 60, 90, 0.25); }
    40% { box-shadow: 0 10px 20px rgba(150, 60, 90, 0.25), 0 0 0 6px rgba(252, 191, 73, 0.75); transform: scale(1.04) rotate(-1.4deg); }
}
.t-tear {
    position: absolute; left: 0; right: 0; top: -7px; height: 8px;
    background:
        linear-gradient(135deg, var(--paper) 5px, transparent 0) 0 0 / 14px 8px repeat-x,
        linear-gradient(-135deg, var(--paper) 5px, transparent 0) 0 0 / 14px 8px repeat-x;
}
.t-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 4px;
    border-bottom: 2px dashed #F0DCE4;
    border-radius: 8px;
}
.t-row:last-child { border-bottom: none; }
.t-num {
    font-size: 2.7rem; font-weight: bold; color: #4A3B5C;
    width: 44px; text-align: center; flex: none;
    line-height: 1;
}
.t-icons { display: flex; gap: 3px; flex-wrap: wrap; max-width: 152px; }
.t-icon { width: 27px; height: 27px; opacity: 0.5; filter: grayscale(0.35); transition: opacity 0.2s, filter 0.2s, transform 0.2s; display: block; }
.t-icon svg { width: 100%; height: 100%; display: block; }
.t-icon-layer { width: 34px; }
.t-icon.filled { opacity: 1; filter: none; transform: scale(1.12); }
.t-check {
    margin-left: auto;
    font-size: 1.7rem; font-weight: bold; color: #7CB518;
    opacity: 0; transform: scale(0);
    transition: all 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.t-row.done .t-check { opacity: 1; transform: scale(1); }
.t-row.done { background: rgba(124, 181, 24, 0.12); }
.t-row.wobble { animation: row-wobble 0.55s ease-in-out 2; background: rgba(252, 191, 73, 0.25); }
@keyframes row-wobble {
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ── ear button ── */

#btn-ear {
    position: absolute; left: 48.5%; top: 7%;
    width: 74px; height: 74px;
    border: 5px solid #A83A60;
    border-radius: 50%;
    background: linear-gradient(#FBD9E5, #F0A8C2);
    font-size: 2.1rem;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(150, 40, 80, 0.3);
    z-index: 22;
    transition: transform 0.15s;
}
#btn-ear:active { transform: scale(0.9); }
#btn-ear.squish { animation: ear-squish 0.4s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes ear-squish {
    40% { transform: scale(0.82, 1.12); }
    70% { transform: scale(1.1, 0.92); }
}
#btn-ear.pulse { animation: ear-pulse 1s ease-in-out infinite; }
@keyframes ear-pulse {
    0%, 100% { box-shadow: 0 6px 14px rgba(150, 40, 80, 0.3); transform: scale(1); }
    50% { box-shadow: 0 6px 14px rgba(150, 40, 80, 0.3), 0 0 0 12px rgba(232, 126, 156, 0.35); transform: scale(1.08); }
}

/* ── fx: flying bits, puffs, crumbs, bubbles, hearts, balloons ── */

#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

.fly-wrong {
    position: fixed; width: 60px; height: 54px;
    animation: fly-wrong 0.68s cubic-bezier(0.3, 0.6, 0.6, 1) forwards;
}
.fly-wrong svg { width: 100%; height: 100%; display: block; }
@keyframes fly-wrong {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    45%  { transform: translate(var(--wx), calc(var(--wy) - 60px)) scale(0.95) rotate(20deg); opacity: 1; }
    100% { transform: translate(0, 0) scale(0.85) rotate(-14deg); opacity: 0.9; }
}

.puff {
    position: fixed; width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    animation: puff-drift 0.85s ease-out forwards;
}
@keyframes puff-drift {
    from { transform: translate(0, 0) scale(0.6); opacity: 0.95; }
    to   { transform: translate(26px, -34px) scale(1.7); opacity: 0; }
}

.crumb {
    position: fixed;
    border-radius: 40%;
    animation: crumb-fly ease-out forwards;
}
@keyframes crumb-fly {
    0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
    42%  { transform: translate(calc(var(--cx) * 0.55), var(--cy)) rotate(130deg); opacity: 1; }
    100% { transform: translate(var(--cx), 130px) rotate(260deg); opacity: 0; }
}

.yum-bubble {
    position: fixed;
    font-size: 1.25rem; font-weight: bold;
    color: #C9527A;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #E8A8C0;
    border-radius: 30px 30px 30px 8px;
    padding: 5px 14px;
    animation: yum-float 1.25s ease-out forwards;
    white-space: nowrap;
}
@keyframes yum-float {
    0%   { transform: translateY(8px) scale(0.4) rotate(-6deg); opacity: 0; }
    20%  { transform: translateY(0) scale(1.06) rotate(2deg); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(-46px) scale(0.95) rotate(-3deg); opacity: 0; }
}

.heart-fx {
    position: fixed;
    font-size: 1.6rem; color: #F26B8A;
    text-shadow: 0 2px 0 rgba(150, 30, 60, 0.25);
    animation: heart-rise 2s ease-out both;
}
@keyframes heart-rise {
    0%   { transform: translateY(0) scale(0.4); opacity: 0; }
    20%  { transform: translateY(-14px) scale(1.15); opacity: 1; }
    100% { transform: translateY(-90px) scale(0.9) rotate(14deg); opacity: 0; }
}

.balloon-fly {
    position: fixed; left: 0; top: 0;
    width: 48px; height: 64px;
    animation: balloon-arc 0.85s cubic-bezier(0.35, 0.1, 0.4, 1) forwards;
}
.balloon-fly svg { width: 100%; height: 100%; display: block; }
@keyframes balloon-arc {
    0%   { transform: translate(var(--sx), var(--sy)) scale(1.1); }
    50%  { transform: translate(calc(var(--sx) * 0.5 + var(--ex) * 0.5), calc(var(--sy) * 0.4 + var(--ey) * 0.4 - 90px)) scale(1) rotate(8deg); }
    100% { transform: translate(var(--ex), var(--ey)) scale(0.92); }
}

/* blow-the-candles hint */
#blow-hint {
    position: fixed;
    z-index: 65;
    font-size: 2.8rem;
    pointer-events: none;
    animation: blow-bounce 1.1s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(150, 40, 80, 0.3));
}
@keyframes blow-bounce {
    0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(12px) scale(1.14); opacity: 0.85; }
}

/* ── party finale ── */

#finale-stage {
    position: absolute; left: 0; right: 0; bottom: 26%;
    height: 34%;
    z-index: 30;
    pointer-events: none;
}
.finale-guest {
    position: absolute; bottom: 0;
    width: clamp(110px, 13vw, 170px);
    animation: guest-pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both, guest-boogie 0.5s ease-in-out 0.5s 5 alternate;
    animation-delay: calc(var(--i) * 0.14s), calc(0.5s + var(--i) * 0.14s);
}
@keyframes guest-pop { from { transform: translateY(120%) scale(0.6); } }
@keyframes guest-boogie {
    from { transform: translateY(0) rotate(-4deg); }
    to   { transform: translateY(-16px) rotate(4deg); }
}

/* ── grown-ups ── */

#grownups {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(90, 40, 70, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
}
.grownups-card {
    position: relative;
    max-width: 560px; width: 100%;
    max-height: 86vh; overflow-y: auto;
    padding: 26px 26px 22px;
}
.grownups-card h3 { margin: 0 0 12px; font-size: 1.5rem; color: #8E2F52; }
.grownups-card p { line-height: 1.55; color: #5B4632; margin: 0 0 12px; }
.close-btn {
    position: absolute; top: 10px; right: 10px;
    width: 48px; height: 48px;
    border: none; border-radius: 50%;
    background: #FBE3EC;
    font-size: 1.2rem; font-weight: bold; color: #8E2F52;
    cursor: pointer;
}
.close-btn:active { transform: scale(0.92); }
.tip-row { display: flex; gap: 12px; align-items: flex-start; background: #FBF1F5; border-radius: 14px; padding: 12px; }
.tip-icons { font-size: 1.6rem; }
.tip-row p { margin: 0; font-size: 0.95rem; }

/* ═══ small screens ═══ */

@media (max-width: 980px) {
    #shelf { display: none; }
    .play-cat { left: 36%; }
    #ticket-zone { left: 52%; }
}
@media (max-width: 820px) {
    #chalkboard { display: none; }
    #btn-ear { left: auto; right: 28%; }
    .cup-holder { display: none; }
    #ticket-zone { left: 47%; width: 220px; }
    .t-num { font-size: 2.2rem; width: 36px; }
    .t-icon { width: 23px; height: 23px; }
}
@media (prefers-reduced-motion: reduce) {
    .bunt-flag, .wn-petal, .wn-btf, .cat-body, .cat-zzz, .steam-a, .steam-b,
    .rail-slot svg, .oven-heart, .bb-ear, .gg-beard, .mm-whisk, .tt-shell, .oo-bow,
    #btn-start, .candle-flame { animation: none !important; }
}
