/* Pepo's Pizza Parlor — cozy penguin-town pizzeria. */

:root {
    --pz: min(29vw, 300px);
    --wall1: #F2A87E;
    --wall2: #E8956D;
    --wood: #C68B59;
    --wood-dark: #8E5A33;
    --wood-deep: #6E4226;
    --paper: #FFF9EE;
}

body {
    background: var(--wall2);
    overscroll-behavior: none;
}

.screen { position: absolute; inset: 0; overflow: hidden; }

/* ═══ Shared: cozy snow windows ═══ */

.cozy-window {
    position: absolute;
    border: 12px solid var(--wood-dark);
    border-radius: 16px;
    overflow: hidden;
    background: #CBEFFA;
    box-shadow: 0 10px 24px rgba(90, 40, 10, 0.3), inset 0 0 0 4px var(--wood-deep);
}
.cozy-window::before {
    content: '';
    position: absolute; left: 50%; top: 0; bottom: 0;
    width: 8px; margin-left: -4px; background: var(--wood-dark); z-index: 3;
}
.win-sky { position: absolute; inset: 0; background: linear-gradient(#9EDCF2, #CBEFFA 65%, #EAF7FD); }
.win-hills { position: absolute; inset: 0; width: 100%; height: 100%; }
.snow-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.snowflake {
    position: absolute; top: -10px;
    background: #FFF; border-radius: 50%; opacity: 0.9;
    animation: snowfall linear infinite;
}
@keyframes snowfall {
    from { transform: translateY(-12px); }
    to   { transform: translateY(360px); }
}

/* ═══ String lights ═══ */

#start-lights, #play-lights {
    position: absolute; top: 0; left: 0; right: 0; height: 46px;
    z-index: 6; pointer-events: none;
}
.lights-rope {
    position: absolute; top: -8px; left: -2%; right: -2%; height: 22px;
    border-bottom: 4px solid var(--wood-deep);
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.lights-row {
    position: absolute; top: 14px; left: 1%; right: 1%;
    display: flex; justify-content: space-around;
}
.bulb {
    width: 13px; height: 19px;
    border-radius: 42% 42% 50% 50%;
    animation: bulb-twinkle 2.4s ease-in-out infinite;
}
@keyframes bulb-twinkle {
    0%, 100% { opacity: 1; filter: brightness(1.2) drop-shadow(0 0 6px rgba(255, 220, 120, 0.9)); }
    50%      { opacity: 0.5; filter: none; }
}

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

#screen-start {
    background:
        radial-gradient(ellipse at 50% -20%, rgba(255, 240, 200, 0.5), transparent 55%),
        linear-gradient(var(--wall1), var(--wall2) 55%, #D9855F);
}
#screen-start::after { /* wooden floor */
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0; height: 9vh;
    background: #B5794A repeating-linear-gradient(90deg, rgba(110, 66, 38, 0.28) 0 6px, transparent 6px 150px);
    border-top: 6px solid #D9A870;
}
#start-window { left: 5%; top: 13%; width: 27%; height: 33%; }
#start-chalk { position: absolute; right: 5%; top: 12%; width: clamp(170px, 17vw, 225px); }
#start-chalk svg { width: 100%; display: block; transform: rotate(2deg); }
#start-shelf { position: absolute; right: 6.5%; top: 38%; width: clamp(180px, 18vw, 240px); }
#start-shelf svg { width: 100%; display: block; }

.start-inner { position: absolute; inset: 0; }

#start-sign {
    position: absolute; left: 50%; top: 3.5%; transform: translateX(-50%) rotate(-1deg);
    background: linear-gradient(#C68B59, #B5794A);
    border: 6px solid var(--wood-dark);
    border-radius: 20px;
    padding: 10px 34px 12px;
    text-align: center;
    color: var(--paper);
    box-shadow: 0 10px 24px rgba(90, 40, 10, 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(90, 40, 10, 0.4);
}
#start-sign .tagline { font-size: clamp(0.9rem, 2vw, 1.15rem); margin-top: 4px; opacity: 0.95; }

#start-pepo {
    position: absolute; left: 9%; bottom: 8vh;
    width: clamp(150px, 19vw, 220px);
    z-index: 4;
}

#btn-start {
    position: absolute; left: 50%; top: 53%;
    transform: translate(-50%, -50%);
    width: clamp(180px, 24vw, 240px);
    height: clamp(180px, 24vw, 240px);
    border: none; background: none; cursor: pointer;
    animation: start-pulse 1.7s ease-in-out infinite;
    filter: drop-shadow(0 12px 22px rgba(120, 50, 0, 0.4));
    z-index: 5;
}
@keyframes start-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.06); }
}
#start-pizza-art { position: absolute; inset: 0; }
#start-pizza-art > svg { width: 100%; height: 100%; display: block; }
.spa { position: absolute; width: 21%; height: 21%; }
.spa svg { width: 100%; height: 100%; display: block; }
.spa1 { left: 24%; top: 26%; }
.spa2 { left: 56%; top: 38%; transform: rotate(15deg); }
.spa3 { left: 36%; top: 58%; transform: rotate(-12deg); }
.start-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding-left: 10px;
    font-size: clamp(3.4rem, 7vw, 5rem);
    color: #FFF;
    text-shadow: 0 4px 0 rgba(120, 40, 0, 0.45), 0 8px 22px rgba(90, 30, 0, 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 var(--wood-dark);
    background: linear-gradient(#E2B27E, var(--wood));
    cursor: pointer;
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    box-shadow: 0 8px 16px rgba(90, 40, 10, 0.32), inset 0 3px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.15s;
}
.door:hover { transform: translateY(-4px); }
.door:active { transform: scale(0.95); }
.door-num {
    width: 42px; height: 42px; line-height: 42px;
    border-radius: 50%;
    background: var(--wood-dark);
    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: #5C3A1E; padding: 0 4px; }
.door-stars { font-size: 1.05rem; color: #FFB800; letter-spacing: 2px; text-shadow: 0 1px 0 rgba(120, 60, 0, .4); }
.door-stars i { font-style: normal; color: rgba(255, 255, 255, 0.55); text-shadow: none; }
.door-lock { font-size: 1.35rem; }
.door.locked { filter: grayscale(0.6) brightness(0.85); }
.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(90, 40, 10, 0.32), 0 0 0 0 rgba(255, 215, 0, 0.7); }
    50%      { box-shadow: 0 8px 16px rgba(90, 40, 10, 0.32), 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(#C68B59, #B5794A);
    border: 5px solid var(--wood-dark);
    border-radius: 16px;
    padding: 10px 20px;
    font-size: 1.45rem; font-weight: bold;
    color: var(--paper);
    box-shadow: 0 8px 16px rgba(90, 40, 10, 0.32);
    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(90, 60, 30, 0.3);
    transition: transform 0.15s;
    z-index: 6;
}
.info-btn:hover { transform: scale(1.08); }
.info-btn:active { transform: scale(0.92); }

/* ═══ KITCHEN SCENE ═══ */

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

.bg-wall {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 50% -30%, rgba(255, 240, 200, 0.45), transparent 55%),
        linear-gradient(var(--wall1), var(--wall2) 50%, #D9855F);
}

#bg-window { left: 3%; top: 5%; width: 29%; height: 26%; z-index: 1; }

#shelf { position: absolute; left: 34.5%; top: 19%; width: 215px; z-index: 2; }
#shelf svg { width: 100%; display: block; }

#paddle { position: absolute; left: 31%; top: 15.5%; width: 46px; z-index: 2; }
#paddle svg { width: 100%; display: block; }

#chalkboard { position: absolute; left: 54%; top: 2.5%; width: 212px; z-index: 2; }
#chalkboard svg { width: 100%; display: block; }

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

/* ── score rail ── */

#rail {
    position: absolute; top: 52px; left: 33%;
    display: flex; gap: 8px; z-index: 8;
}
.rail-slot {
    width: 42px; height: 42px; border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.14);
}
.rail-slot.filled {
    border: none;
    background: none;
    animation: coin-land 0.45s 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(90, 40, 10, .4)); }
@keyframes coin-land { from { transform: scale(1.7); } to { transform: scale(1); } }

/* ── 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(60, 30, 5, 0.28);
}
.counter-front {
    position: absolute; inset: 36px 0 0 0;
    background: #B5794A repeating-linear-gradient(90deg, rgba(110, 66, 38, 0.28) 0 6px, transparent 6px 148px);
    box-shadow: inset 0 16px 26px rgba(60, 30, 5, 0.3);
}

/* ── oven ── */

#oven-wrap {
    position: absolute; left: 1.2%; bottom: 25%;
    width: clamp(190px, 19vw, 250px);
    z-index: 5;
}
.oven-svg { width: 100%; display: block; overflow: visible; }
.fl { transform-box: fill-box; transform-origin: 50% 100%; }
.fl1 { animation: flick 0.5s ease-in-out infinite alternate; }
.fl2 { animation: flick 0.38s ease-in-out infinite alternate 0.1s; }
.fl3 { animation: flick 0.45s ease-in-out infinite alternate 0.2s; }
.fl4 { animation: flick 0.3s ease-in-out infinite alternate; }
@keyframes flick {
    from { transform: scaleY(1); }
    to   { transform: scaleY(0.75) scaleX(1.08); }
}
.ov-door { transform: translateY(-142px); transition: transform 0.4s ease-in; }
.baking .ov-door { transform: translateY(0); }
.ov-glowfill { transition: opacity 0.4s; }
.glowing .ov-glowfill, .baking .ov-glowfill { opacity: 0.95; }
.glowing .ov-glowfill { animation: glow-pulse 0.9s ease-in-out infinite alternate; }
@keyframes glow-pulse { from { opacity: 0.5; } to { opacity: 1; } }
.glowing .oven-svg { filter: drop-shadow(0 0 26px rgba(255, 170, 40, 0.9)); }
.ov-puff { transform-box: fill-box; }
.baking .ov-puff1 { animation: puff 1.1s ease-out infinite; }
.baking .ov-puff2 { animation: puff 1.1s ease-out 0.5s infinite; }
@keyframes puff {
    0%   { opacity: 0; transform: translateY(8px) scale(0.5); }
    30%  { opacity: 0.85; }
    100% { opacity: 0; transform: translateY(-46px) scale(1.5); }
}
#oven-arrow {
    position: absolute; top: 6%; 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(-14px); }
}
#oven-tap {
    position: absolute; inset: 0;
    background: transparent; border: none; cursor: pointer; z-index: 6;
}

/* ── Pepo placement ── */

#pepo { position: absolute; left: 19.5%; bottom: 24.5%; width: clamp(130px, 13.5vw, 175px); z-index: 26; }
.pepo-holder { pointer-events: none; }
.pepo-svg { width: 100%; display: block; overflow: visible; }

/* ── Pepo rig ── */

.pp-all, .pp-body, .pp-head, .pp-hat, .pp-arm, .pp-lid, .pp-pupil { transform-box: fill-box; }
.pp-arm-l { transform-origin: 50% 5%; transform: rotate(17deg); }
.pp-arm-r { transform-origin: 50% 5%; transform: rotate(-17deg); }
.pp-lid { transform-origin: 50% 0; transform: scaleY(0); transition: transform 0.05s; }
.blink .pp-lid { transform: scaleY(1); }
.pp-crescent, .pp-blush { opacity: 0; transition: opacity 0.2s; }
.happy .pp-crescent, .happy .pp-blush { opacity: 1; }
.happy .pp-pupil, .happy .pp-spark, .happy .pp-lid { opacity: 0; }
.pp-head { transform-origin: 50% 92%; transition: transform 0.25s; }
.curious .pp-head { transform: rotate(-9deg); }
.nod .pp-head { transform: translateY(4px); }
.pp-pupil { transition: transform 0.25s; }
.glance .pp-pupil { transform: translate(3px, -2px); }
.pp-body { transform-origin: 50% 100%; animation: pp-breathe 3.2s ease-in-out infinite; }
@keyframes pp-breathe {
    0%, 100% { transform: scaleY(1); }
    50%      { transform: scaleY(1.018); }
}
.pp-hat { transform-origin: 50% 85%; animation: pp-hatfidget 9s ease-in-out infinite; }
@keyframes pp-hatfidget {
    0%, 84%, 100% { transform: rotate(0); }
    89% { transform: rotate(-7deg); }
    95% { transform: rotate(4deg); }
}
.giggle .pp-body { animation: pp-giggle 0.6s ease-in-out; }
@keyframes pp-giggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
    75% { transform: rotate(-2deg); }
}
.walking .pp-all { animation: pp-waddle 0.3s ease-in-out infinite alternate; }
@keyframes pp-waddle {
    from { transform: rotate(-5deg) translateY(0); }
    to   { transform: rotate(5deg) translateY(-7px); }
}
.entering { animation: pepo-enter 1.15s cubic-bezier(0.45, 0.05, 0.35, 1) both; }
@keyframes pepo-enter {
    from { transform: translateX(-46vw); }
    to   { transform: translateX(0); }
}
.slip .pp-all { animation: pp-slip 0.85s ease-in-out; }
@keyframes pp-slip {
    0%   { transform: rotate(0); }
    20%  { transform: rotate(-14deg) translateY(4px); }
    45%  { transform: rotate(12deg); }
    70%  { transform: rotate(-5deg); }
    100% { transform: rotate(0); }
}
.slip .pp-hat { animation: pp-hatpop 0.85s ease-in-out; }
@keyframes pp-hatpop {
    0%   { transform: translateY(0) rotate(0); }
    28%  { transform: translateY(-18px) rotate(-15deg); }
    58%  { transform: translateY(3px) rotate(5deg); }
    100% { transform: translateY(0) rotate(0); }
}
.slip .pp-arm-l { animation: pp-windmill-l 0.85s linear; }
@keyframes pp-windmill-l {
    0% { transform: rotate(17deg); }
    30% { transform: rotate(150deg); }
    60% { transform: rotate(60deg); }
    100% { transform: rotate(17deg); }
}
.slip .pp-arm-r { animation: pp-windmill-r 0.85s linear; }
@keyframes pp-windmill-r {
    0% { transform: rotate(-17deg); }
    30% { transform: rotate(-150deg); }
    60% { transform: rotate(-60deg); }
    100% { transform: rotate(-17deg); }
}
.wave .pp-arm-r { animation: pp-wave 0.5s ease-in-out 3; }
@keyframes pp-wave {
    0%, 100% { transform: rotate(-17deg); }
    50%      { transform: rotate(-150deg); }
}
.dance .pp-all { animation: pp-dance 1.5s ease-in-out; }
@keyframes pp-dance {
    0%, 33%, 66%, 100% { transform: translateY(0) rotate(0); }
    16% { transform: translateY(-15px) rotate(-6deg); }
    50% { transform: translateY(-15px) rotate(6deg); }
    83% { transform: translateY(-15px) rotate(-6deg); }
}
.dance .pp-arm-l { animation: pp-arm-dl 0.5s ease-in-out 3; }
@keyframes pp-arm-dl {
    0%, 100% { transform: rotate(17deg); }
    50%      { transform: rotate(130deg); }
}
.dance .pp-arm-r { animation: pp-arm-dr 0.5s ease-in-out 3 0.25s; }
@keyframes pp-arm-dr {
    0%, 100% { transform: rotate(-17deg); }
    50%      { transform: rotate(-130deg); }
}
.drum .pp-arm-l { animation: pp-drum 0.42s ease-in-out 2; }
@keyframes pp-drum {
    0%, 100% { transform: rotate(17deg); }
    50%      { transform: rotate(48deg); }
}

/* ── pizza ── */

#pizza-wrap {
    position: absolute;
    width: var(--pz); height: var(--pz);
    left: calc(47% - var(--pz) / 2);
    top: calc(60% - var(--pz) / 2);
    z-index: 25;
    transition: transform 0.55s cubic-bezier(0.55, 0.06, 0.4, 1);
    touch-action: none;
}
#pizza-wrap.dragging { transition: none; }
#peel { position: absolute; width: 138%; left: -44%; top: -3%; pointer-events: none; }
#peel svg { width: 100%; display: block; }
#pizza { position: absolute; inset: 0; cursor: grab; transition: transform 0.28s ease-in, opacity 0.3s; }
#pizza-base { position: absolute; inset: 0; }
#pizza-base svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 10px rgba(90, 40, 10, 0.3)); }
.pz-brown { opacity: 0; transition: opacity 0.5s; }
#pizza.baked .pz-brown { opacity: 0.55; }
#pizza.baked .pz-rim { fill: #D89A4E; }
#pizza.fresh { animation: pz-fresh 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes pz-fresh { from { transform: scale(0); } }
#pizza.wiggle { animation: pz-wiggle 0.4s ease-in-out; }
@keyframes pz-wiggle {
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}
#pizza-toppings { position: absolute; inset: 0; }

.placed {
    position: absolute; width: 22%; height: 22%;
    transform: translate(-50%, -50%) rotate(var(--rot));
    cursor: pointer;
}
.placed svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 3px rgba(90, 40, 10, 0.3)); }
.placed.arrive { animation: top-arc 0.45s cubic-bezier(0.3, 0.7, 0.4, 1); }
@keyframes top-arc {
    0%   { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(0.7); }
    55%  { transform: translate(calc(-50% + var(--dx) * 0.25), calc(-50% + var(--dy) * 0.25 - 48px)) rotate(var(--rot)) scale(1.06); }
    80%  { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.18, 0.8); }
    100% { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); }
}
.placed.depart {
    animation: top-hop 0.45s cubic-bezier(0.5, 0, 0.7, 0.4) forwards;
    pointer-events: none;
}
@keyframes top-hop {
    0%   { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); }
    40%  { transform: translate(calc(-50% + var(--dx) * 0.3), calc(-50% + var(--dy) * 0.3 - 44px)) rotate(var(--rot)) scale(0.9); }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(0.5); opacity: 0.4; }
}

/* ── topping bins ── */

#bins {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 18px; z-index: 28;
}
.bin {
    position: relative;
    width: clamp(96px, 9.5vw, 118px); height: clamp(88px, 12vh, 100px);
    border: none; cursor: pointer;
    border-top: 9px solid var(--bc);
    border-bottom: 6px solid var(--wood-dark);
    border-radius: 10px 10px 14px 14px;
    background: linear-gradient(#D9A870, #B5794A);
    box-shadow: inset 0 10px 14px rgba(60, 30, 5, 0.3), 0 6px 12px rgba(60, 30, 5, 0.35);
    transition: transform 0.12s;
}
.bin:active { transform: scale(0.93); }
.bin .bp { position: absolute; width: 46%; height: 52%; pointer-events: none; }
.bp svg { width: 100%; height: 100%; display: block; }
.bp1 { left: 4%; bottom: 4%; }
.bp2 { right: 4%; bottom: 4%; }
.bp3 { left: 27%; bottom: 30%; }
.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-frame {
    position: absolute; inset: 0;
    border: 12px solid var(--wood-dark);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(90, 40, 10, 0.3), 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(90, 40, 10, 0.3);
}
#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 { transform-box: fill-box; }
.c-m-o, .c-m-hmm { display: none; }
.cust.wide .c-m-smile, .cust.hmm .c-m-smile { display: none; }
.cust.wide .c-m-o { display: block; }
.cust.hmm .c-m-hmm { display: block; }
.c-eye { transform-origin: center; transition: transform 0.2s; }
.cust.wide .c-eye { transform: scale(1.35); }
.c-pupil { transition: transform 0.25s; }
.cust.hmm .c-pupil-l { transform: translate(2.5px, -1px); }
.cust.hmm .c-pupil-r { 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); }
}
.cust.chomp .c-body { animation: c-chomp 0.3s ease-out; }
@keyframes c-chomp { 40% { transform: translateY(6px) scale(1.05); } }

/* signature parts */
.bb-ear-l { transform-origin: 50% 92%; transform: rotate(-8deg); animation: bb-flop 3.4s ease-in-out infinite; }
.bb-ear-r { transform-origin: 50% 92%; transform: rotate(8deg); animation: bb-flop 3.4s ease-in-out 1.2s infinite; }
@keyframes bb-flop {
    0%, 70%, 100% { rotate: 0deg; }
    80% { rotate: -16deg; }
    90% { 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); }
}
.rr-lid { transform-origin: 50% 0; transform: scaleY(0); animation: rr-blink 4.2s infinite; }
@keyframes rr-blink {
    0%, 91%, 97%, 100% { transform: scaleY(0); }
    94% { transform: scaleY(1); }
}
.tt-shell { animation: tt-bob 2.6s ease-in-out infinite; }
@keyframes tt-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}
.oo-glint { animation: oo-glint 3.5s ease-in-out infinite; }
@keyframes oo-glint {
    0%, 78%, 100% { opacity: 0.4; transform: translate(0, 0); }
    86% { opacity: 1; transform: translate(3px, 3px); }
}
.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: 300px;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
}
#ticket {
    background: var(--paper);
    border-radius: 4px 4px 14px 14px;
    box-shadow: 0 10px 20px rgba(90, 50, 20, 0.3);
    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; }
.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 #E8D9C0;
    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.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 .t-num { color: #7CB518; }
.t-row.over { background: #FFECEC; }
.t-row.over .t-num { color: #E63946; }
.t-row.wobble { animation: row-wobble 0.5s ease-in-out 3; }
@keyframes row-wobble {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

#btn-ear {
    position: absolute; left: calc(54.5% + 84px); top: 40.5%;
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 4px solid var(--wood);
    background: radial-gradient(circle at 35% 30%, #FFFDF6, #F5E3C8);
    font-size: 2.4rem;
    cursor: pointer;
    z-index: 35;
    box-shadow: 0 6px 14px rgba(90, 50, 20, 0.35);
    transition: transform 0.15s;
}
#btn-ear:active { transform: scale(0.9); }
#btn-ear.pulse { animation: ear-pulse 1s ease-in-out infinite; }
@keyframes ear-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 14px rgba(90, 50, 20, 0.35); }
    50%      { transform: scale(1.13); box-shadow: 0 0 0 14px rgba(252, 191, 73, 0.35); }
}
/* every tap answers back, even when the replay itself is on cooldown */
#btn-ear.squish { animation: ear-squish 0.4s cubic-bezier(0.3, 1.6, 0.4, 1); }
@keyframes ear-squish {
    0%   { transform: scale(1); }
    35%  { transform: scale(0.8) rotate(-6deg); }
    70%  { transform: scale(1.08) rotate(3deg); }
    100% { transform: scale(1); }
}
/* the ticket glow-wiggles while the order is being repeated */
#ticket.flash { animation: ticket-flash 0.9s ease-in-out; }
@keyframes ticket-flash {
    0%, 100% { transform: scale(1) rotate(0); box-shadow: 0 10px 20px rgba(90, 50, 20, 0.3); }
    15% { transform: scale(1.03) rotate(-2deg); box-shadow: 0 0 0 7px rgba(252, 191, 73, 0.55), 0 10px 24px rgba(90, 50, 20, 0.3); }
    40% { transform: scale(1.03) rotate(2deg);  box-shadow: 0 0 0 10px rgba(252, 191, 73, 0.65), 0 10px 24px rgba(90, 50, 20, 0.3); }
    65% { transform: scale(1.02) rotate(-1deg); box-shadow: 0 0 0 5px rgba(252, 191, 73, 0.45), 0 10px 24px rgba(90, 50, 20, 0.3); }
}

/* ── fx layer ── */

#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.fly-wrong {
    position: fixed; width: 54px; height: 54px;
    animation: wrong-boing 0.6s cubic-bezier(0.4, 0.2, 0.6, 0.9);
}
.fly-wrong svg { width: 100%; height: 100%; display: block; }
@keyframes wrong-boing {
    0%   { transform: translate(0, 0) scale(0.8); }
    45%  { transform: translate(var(--wx), var(--wy)) rotate(25deg); }
    62%  { transform: translate(calc(var(--wx) * 0.75), calc(var(--wy) * 0.75 - 34px)) rotate(60deg); }
    100% { transform: translate(0, 0) scale(0.9) rotate(90deg); }
}
.coin-fly {
    position: fixed; left: 0; top: 0; width: 48px; height: 48px;
    animation: coin-arc 0.75s cubic-bezier(0.4, 0.1, 0.5, 1) both;
}
.coin-fly svg { width: 100%; height: 100%; display: block; }
@keyframes coin-arc {
    0%   { transform: translate(var(--sx), var(--sy)) scale(0.5); }
    45%  { transform: translate(calc((var(--sx) + var(--ex)) / 2), calc(var(--ey) - 150px)) scale(1.2) rotate(180deg); }
    100% { transform: translate(var(--ex), var(--ey)) scale(1) rotate(360deg); }
}

/* ── grown-ups popover ── */

#grownups {
    position: fixed; inset: 0; z-index: 960;
    background: rgba(74, 59, 92, 0.5);
    display: flex; align-items: center; justify-content: center;
    animation: gk-fade-in 0.25s ease-out;
}
.grownups-card {
    position: relative;
    max-width: min(92vw, 570px);
    max-height: 86vh; overflow-y: auto;
    padding: 26px 32px;
    animation: gk-pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.grownups-card h3 { color: #F77F00; font-size: 1.4rem; margin-bottom: 10px; padding-right: 70px; }
.grownups-card p { font-size: 1rem; line-height: 1.5; margin-bottom: 10px; }
.tip-row { display: flex; gap: 12px; align-items: flex-start; background: #FFF4DC; border-radius: 14px; padding: 12px 14px; }
.tip-row .tip-icons { font-size: 1.8rem; }
.tip-row p { margin: 0; }
.close-btn {
    position: absolute; top: 10px; right: 10px;
    width: 64px; height: 64px;
    border: none; border-radius: 50%;
    background: #FFE3EC;
    color: #C4527E;
    font-size: 1.6rem; font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s;
}
.close-btn:hover { transform: scale(1.08); }

/* ═══ PORTRAIT ═══ */

@media (orientation: portrait) {
    :root { --pz: min(40vw, 300px); }

    #start-window { left: 4%; top: 15%; width: 38%; height: 20%; }
    #start-chalk { right: 4%; top: 16%; width: clamp(150px, 24vw, 200px); }
    #start-shelf { right: 6%; top: 33%; width: clamp(160px, 26vw, 210px); }
    #start-pepo { left: 6%; bottom: 7vh; width: clamp(130px, 22vw, 180px); }
    #btn-start { top: 45%; width: clamp(190px, 36vw, 260px); height: clamp(190px, 36vw, 260px); }
    #level-doors { bottom: 13vh; }
    #start-sign h1 { font-size: clamp(1.5rem, 5.5vw, 2.2rem); }

    #bg-window { left: 3%; top: 4%; width: 34%; height: 13.5%; border-width: 9px; }
    #shelf { left: 40%; top: 6.5%; width: 130px; }
    #paddle { display: none; }
    #chalkboard { left: 2.5%; top: 24.5%; width: 175px; }
    #cust-window { right: 2%; top: 7%; width: 42%; height: 26%; }
    #ticket-zone { left: 3%; top: 26%; width: 226px; height: 264px; }
    .t-num { font-size: 2.2rem; width: 36px; }
    .t-icon { width: 24px; height: 24px; }
    .t-icons { max-width: 138px; }
    #btn-ear { left: 240px; top: 32.5%; width: 76px; height: 76px; }
    #oven-wrap { left: 2%; bottom: 27.5%; width: clamp(165px, 25vw, 200px); }
    #oven-arrow { font-size: 2.5rem; margin-left: -21px; }
    #pepo { left: 25%; bottom: 27%; width: 100px; z-index: 26; }
    #pizza-wrap { left: calc(57.5% - var(--pz) / 2); top: calc(63% - var(--pz) / 2); }
    #peel { width: 132%; left: -34%; top: -1%; }
    #counter { height: 26%; }
    #bins { gap: 12px; bottom: 10px; }
    .bin { width: clamp(90px, 11.5vw, 108px); }
    #rail { top: 20%; left: 3%; }
    .rail-slot { width: 36px; height: 36px; }
    .cust { left: 10%; right: 10%; }
}

/* narrow landscape tweaks */
@media (orientation: landscape) and (max-width: 1100px) {
    #bg-window { width: 24%; }
    #paddle { left: 29.5%; }
    #shelf { left: 33%; width: 190px; }
    #ticket-zone { left: 52%; width: 224px; }
    .t-icon { width: 24px; height: 24px; }
    .t-icons { max-width: 138px; }
    .t-num { font-size: 2.3rem; width: 38px; }
    #btn-ear { left: calc(52% + 72px); top: 40%; }
    #chalkboard { left: 51.5%; width: 196px; }
    #rail { left: 31%; }
    .rail-slot { width: 36px; height: 36px; }
}

/* ═══ Reduced motion ═══ */

@media (prefers-reduced-motion: reduce) {
    .snowflake, .bulb, .pp-body, .pp-hat, .sig,
    .bb-ear-l, .bb-ear-r, .rr-lid { animation: none !important; }
    #btn-start { animation: none; }
    .dance .pp-all { animation-duration: 0.6s; }
    .cust.dance .c-body { animation-iteration-count: 1; }
    #oven-arrow { animation: none; }
}
