/* ═══════════════════════════════════════════════════════════════════════════
   Pippa's Seesaw Park — original IP kids math game.
   Mascot: Pippa the Flamingo. Friends: Bibi, Quill, Puddle, Hopps, Mimi.
   Built on the shared GameKit tokens.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --wood: #C9822E;
    --wood-dark: #A8641F;
    --wood-grain: #8A5015;
    --pippa: #FF7BAC;
    --pippa-wing: #E85A96;
    --ink: #4A3B5C;
}

/* level colour variants — only the far layers change ───────────────────────── */
body.lv1 { --sky-top:#C8E8FA; --sky-mid:#DFF1FB; --sky-bot:#FFF8EC;
    --hill-back:#A2D149; --hill-front:#7CB518; --hill-front2:#6BA015;
    --tree:#5D9E12; --tree-dark:#4C820E; --sun:#FCBF49; --sun-glow:rgba(252,191,73,.35);
    --pond:#9BDDEF; --stage-glow:rgba(255,255,255,.0); }
body.lv2 { --sky-top:#FFB07A; --sky-mid:#FFCf9E; --sky-bot:#FFEBD2;
    --hill-back:#C88BC8; --hill-front:#9B5FA8; --hill-front2:#824C90;
    --tree:#7A4A86; --tree-dark:#653C72; --sun:#F77F00; --sun-glow:rgba(247,127,0,.32);
    --pond:#E4A6C6; --stage-glow:rgba(255,180,120,.12); }
body.lv3 { --sky-top:#2C2552; --sky-mid:#453A6E; --sky-bot:#6A5A96;
    --hill-back:#332C5A; --hill-front:#251F45; --hill-front2:#1C1836;
    --tree:#211B3C; --tree-dark:#171230; --sun:#FCE07A; --sun-glow:rgba(252,224,122,.30);
    --pond:#4A6FA5; --stage-glow:rgba(90,70,150,.18); }

body { overflow: hidden; }

/* ══════════════════════ Scene (far → mid layers) ══════════════════════════ */

#scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; }

#sky {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 46%, var(--sky-bot) 100%);
    transition: background 0.8s ease;
}

/* twinkle stars (firefly-evening) */
#stars { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s ease; }
body.lv3 #stars { opacity: 1; }
#stars i {
    position: absolute; background: #FFF3B0; border-radius: 50%;
    box-shadow: 0 0 6px #FFE58A; animation: gk-twinkle 3s ease-in-out infinite;
}

#sun-wrap {
    position: absolute; width: 340px; height: 340px; top: -70px; left: 4%;
    overflow: visible; transition: left 0.8s ease, top 0.8s ease;
}
body.lv2 #sun-wrap { left: auto; right: 6%; top: 2%; }
body.lv3 #sun-wrap { left: auto; right: 8%; top: 3%; width: 210px; height: 210px; }
#sun-disc { fill: var(--sun); }
#sun-glow { fill: none; stroke: var(--sun); stroke-opacity: .28; stroke-width: 22; filter: blur(3px); }
#sun-ray-group { transform-origin: 100px 100px; animation: spin 60s linear infinite; }
.sun-ray { fill: var(--sun); opacity: .55; }

/* drifting clouds */
#clouds { position: absolute; inset: 0; }
.cloud { position: absolute; opacity: .95; will-change: transform; }
.cloud::before, .cloud::after,
.cloud > i { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud {
    width: 150px; height: 54px; background: #fff; border-radius: 40px;
    box-shadow: 46px 8px 0 -6px #fff, -46px 10px 0 -8px #fff;
}
.cloud::before { content:""; width: 70px; height: 70px; left: 24px; top: -30px; }
.cloud::after  { content:""; width: 54px; height: 54px; left: 74px; top: -18px; }
body.lv2 .cloud, body.lv2 .cloud::before, body.lv2 .cloud::after { background: #FFF0E0; }
body.lv3 .cloud, body.lv3 .cloud::before, body.lv3 .cloud::after { background: #6D5F9B; opacity: .5; }
.cloud-a { top: 12%;  left: -220px; transform: scale(1);   animation: drift-a 78s linear infinite; }
.cloud-b { top: 24%;  left: -260px; transform: scale(.7);  animation: drift-b 112s linear infinite; opacity: .8; }
.cloud-c { top: 6%;   left: -300px; transform: scale(1.25);animation: drift-c 140s linear infinite; opacity: .9; }

/* rolling hills / trees / pond (svg drawn in JS) */
#hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 56%; }
.tree-sway { transform-box: fill-box; transform-origin: bottom center; animation: sway 6s ease-in-out infinite; }
.pond-glint { animation: gk-twinkle 4s ease-in-out infinite; }

/* fireflies (lv3) */
#fireflies { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
body.lv3 #fireflies { opacity: 1; }
#fireflies i {
    position: absolute; width: 7px; height: 7px; border-radius: 50%;
    background: #FCE07A; box-shadow: 0 0 10px 3px rgba(252,224,122,.8);
    animation: firefly 9s ease-in-out infinite;
}

/* ══════════════════════ Foreground fringe ══════════════════════════════════ */

#foreground { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.fringe { position: absolute; bottom: 0; width: 230px; height: 230px; }
#fringe-left { left: -8px; }
#fringe-right { right: -8px; }
.blade-sway { transform-box: fill-box; transform-origin: bottom center; animation: sway 5s ease-in-out infinite; }
#butterfly {
    position: absolute; width: 34px; height: 30px; left: -60px; bottom: 40%;
    background:
        radial-gradient(circle at 30% 40%, #F77F00 0 42%, transparent 44%) left/50% 100% no-repeat,
        radial-gradient(circle at 70% 40%, #FCBF49 0 42%, transparent 44%) right/50% 100% no-repeat;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.15));
    animation: flutter 26s linear infinite;
}
#butterfly::after {
    content:""; position: absolute; left: 48%; top: 20%; width: 4px; height: 60%;
    background: var(--ink); border-radius: 3px; transform: translateX(-50%);
}

/* ══════════════════════ Screens ═══════════════════════════════════════════ */

.screen {
    position: relative; z-index: 5;
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}

/* ── TITLE ──────────────────────────────────────────────────────────────── */

#title-inner {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 12px; max-width: 96vw;
}
#title-scene {
    position: relative; width: min(88vw, 460px); height: min(34vh, 260px);
    margin-bottom: 6px;
}
#title-seesaw { position: absolute; inset: 0; }
#title-pippa {
    position: absolute; left: 50%; bottom: 8px; width: 150px; height: 200px;
    transform: translateX(-118px); z-index: 3;
}
#wordmark {
    line-height: .96; margin-top: 2px;
    filter: drop-shadow(0 3px 0 rgba(74,59,92,.18));
}
.wm-top {
    display: block; font-size: clamp(1.3rem, 5vw, 2.1rem); font-weight: 800;
    color: var(--gk-pink); letter-spacing: .5px;
    transform: rotate(-3deg); margin-bottom: -2px;
}
.wm-main {
    display: block; font-size: clamp(2.3rem, 9vw, 4rem); font-weight: 900;
    letter-spacing: .5px;
    background: linear-gradient(92deg, #E63946, #F77F00, #FCBF49, #7CB518, #00B4D8, #B565D8);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    filter: drop-shadow(0 2px 1px rgba(74,59,92,.22));
}
#tagline {
    font-size: clamp(.95rem, 3vw, 1.25rem); color: var(--ink);
    margin: 8px 0 4px; max-width: 30ch; font-weight: 600;
}
#title-stars {
    display: flex; gap: 6px; min-height: 30px; margin: 4px 0 10px;
    font-size: 1.5rem; align-items: center;
}
#title-stars .ts { filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
#title-stars .ts.dim { filter: grayscale(1) opacity(.35); }
#btn-play {
    min-height: 82px; font-size: clamp(1.4rem, 5vw, 1.9rem);
    padding: 16px 56px; animation: breathe 2.2s ease-in-out infinite;
}
.btn-inner { display: inline-block; }

/* ── SETUP ──────────────────────────────────────────────────────────────── */

#screen-setup { justify-content: flex-start; padding: 22px 12px 12px; overflow-y: auto; }
#setup-title, #level-heading {
    font-size: clamp(1.15rem, 3.6vw, 1.7rem); color: var(--ink);
    font-weight: 800; text-align: center; margin: 2px 0 10px;
    text-shadow: 0 2px 0 rgba(255,255,255,.55);
}
#level-heading { margin-top: 14px; }

#mode-cards { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.mode-card {
    position: relative; width: clamp(150px, 30vw, 210px); height: clamp(130px, 22vh, 172px);
    border: 5px solid #fff; border-radius: 26px; cursor: pointer;
    background: linear-gradient(160deg, #FFFDF8, #FFE9F2);
    box-shadow: var(--gk-shadow); overflow: hidden;
    transition: transform .22s cubic-bezier(.3,1.5,.4,1), box-shadow .2s, border-color .2s;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    padding-bottom: 12px;
}
.mode-card[data-mode="coop"] { background: linear-gradient(160deg, #FFFDF8, #E4F3FF); }
.mode-card:active { transform: scale(.97); }
.mode-card.sel {
    transform: scale(1.06) translateY(-4px); border-color: var(--gk-green);
    box-shadow: 0 14px 34px rgba(124,181,24,.4);
}
.mode-art { position: absolute; inset: 10px 10px 42px; }
.mode-label {
    font-size: clamp(.95rem, 2.6vw, 1.2rem); font-weight: 800; color: var(--ink);
    background: rgba(255,255,255,.85); padding: 3px 14px; border-radius: 20px;
    z-index: 2;
}
.mode-check {
    position: absolute; top: 8px; right: 8px; width: 40px; height: 40px;
    border-radius: 50%; background: var(--gk-green); color: #fff;
    font-size: 1.5rem; font-weight: 900; display: none;
    align-items: center; justify-content: center; z-index: 3;
    box-shadow: 0 4px 10px rgba(124,181,24,.5);
}
.mode-card.sel .mode-check { display: flex; animation: check-pop .4s cubic-bezier(.2,1.7,.4,1); }

#level-signs { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.level-sign {
    position: relative; width: clamp(140px, 27vw, 194px); height: clamp(150px, 25vh, 196px);
    border: none; cursor: pointer; background: none; padding: 0;
    transition: transform .2s cubic-bezier(.3,1.5,.4,1);
}
.level-sign:active { transform: scale(.96); }
.level-sign:not(.locked):hover { transform: translateY(-4px); }
.level-sign.locked { cursor: pointer; }
.level-sign .ls-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.level-sign.wobble { animation: sign-wobble .6s ease; }
.level-sign .ls-stars {
    position: absolute; left: 0; right: 0; bottom: 10px; text-align: center;
    font-size: 1.15rem; z-index: 3; pointer-events: none;
}
.level-sign .ls-stars .s { filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.level-sign .ls-stars .s.dim { filter: grayscale(1) opacity(.32); }
.level-sign .zzz {
    position: absolute; top: 6px; right: 10px; font-weight: 900; color: var(--ink);
    font-size: 1.1rem; z-index: 4; opacity: .8;
}
.level-sign.locked .ls-svg { filter: saturate(.55) brightness(.96); }

#btn-back {
    position: fixed; left: 12px; bottom: 12px; z-index: 30;
    width: 60px; height: 60px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.92); font-size: 1.7rem; cursor: pointer;
    box-shadow: 0 4px 12px rgba(90,60,130,.25);
}
#btn-back:active { transform: scale(.92); }

/* ══════════════════════ PLAY ══════════════════════════════════════════════ */

#screen-play { justify-content: space-between; padding: 8px 0 6px; }

#round-tracker {
    display: flex; gap: 12px; align-items: center;
    padding: 8px 20px; border-radius: 40px; margin-top: 4px;
    background: rgba(255,255,255,.55); box-shadow: 0 4px 12px rgba(90,60,130,.12);
}
.flower-badge {
    width: 40px; height: 40px; position: relative;
    transition: transform .4s cubic-bezier(.2,1.6,.4,1);
}
.flower-badge svg { width: 100%; height: 100%; display: block; overflow: visible; }
.flower-badge.lit { transform: scale(1.18); }

#coop-banner {
    position: absolute; top: 0; left: 0; right: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center; gap: 14px;
    padding: 14px; font-size: clamp(1.1rem, 3.4vw, 1.6rem); font-weight: 800; color: #fff;
    background: linear-gradient(180deg, var(--gk-purple), #9a4fc0);
    box-shadow: 0 8px 22px rgba(90,60,130,.35);
    transform: translateY(-120%); transition: transform .45s cubic-bezier(.3,1.4,.4,1);
}
#coop-banner.show { transform: translateY(0); }
#coop-banner-icon { font-size: 1.7em; }

#stage {
    position: relative; flex: 1 1 auto; width: 100%;
    display: flex; align-items: center; justify-content: center;
    min-height: 0;
}

/* Pippa on her podium (right of pivot) */
#pippa-play {
    position: absolute; z-index: 8; width: 142px; height: 200px;
    right: max(1vw, 6px); bottom: 12px;
}
.pippa-holder svg { width: 100%; height: 100%; display: block; overflow: visible; }

#pippa-bubble {
    position: absolute; z-index: 15; max-width: 258px;
    right: max(1vw, 6px); bottom: 192px;
    background: #fff; color: var(--ink); font-weight: 800;
    font-size: clamp(.9rem, 2.4vw, 1.1rem); padding: 12px 16px; border-radius: 20px;
    box-shadow: 0 8px 22px rgba(90,60,130,.28); border: 3px solid #FFE0EC;
    animation: bubble-pop .3s cubic-bezier(.2,1.6,.4,1);
}
#pippa-bubble::after {
    content:""; position: absolute; right: 30px; bottom: -14px;
    border: 12px solid transparent; border-top-color: #fff;
    filter: drop-shadow(0 3px 0 #FFE0EC);
}

/* ── Seesaw rig ─────────────────────────────────────────────────────────── */

#seesaw {
    position: relative;
    width: min(90vw, 660px); height: 260px;
}
#fulcrum {
    position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 150px; height: 112px; z-index: 3;
    filter: drop-shadow(0 6px 8px rgba(0,0,0,.18));
}
#fulcrum svg { width: 100%; height: 100%; display: block; overflow: visible; }

#plank {
    position: absolute; left: 50%; bottom: 96px;
    width: 100%; height: 0;
    transform: translateX(-50%) rotate(var(--tilt, 0deg));
    transform-origin: 50% 50%;
    transition: transform .8s cubic-bezier(.3,1.55,.4,1);
    z-index: 4;
}
#plank-bar {
    position: absolute; left: 0; right: 0; top: -15px; height: 30px;
    border-radius: 16px;
    background:
        repeating-linear-gradient(90deg, transparent 0 46px, rgba(138,80,21,.35) 46px 49px),
        linear-gradient(180deg, #E0A05A 0%, var(--wood) 42%, var(--wood-dark) 100%);
    box-shadow: 0 8px 14px rgba(0,0,0,.2), inset 0 3px 0 rgba(255,255,255,.28),
                inset 0 -4px 0 rgba(0,0,0,.16);
    border: 3px solid #A8641F;
}
#plank-bar::before, #plank-bar::after { /* bolt caps at ends */
    content:""; position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFE1A8, #B87A2A);
    transform: translateY(-50%); box-shadow: inset 0 -2px 2px rgba(0,0,0,.3);
}
#plank-bar::before { left: 12px; } #plank-bar::after { right: 12px; }

.platform {
    position: absolute; bottom: 12px; width: 150px; height: 40px;
    transform: rotate(calc(-1 * var(--tilt, 0deg)));
    transform-origin: 50% 100%;
    transition: transform .8s cubic-bezier(.3,1.55,.4,1);
}
.platform.left  { left: -6px; }
.platform.right { right: -6px; }
.platform-basket {
    position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 128px; height: 34px; z-index: 2;
    background: linear-gradient(180deg, #E0A05A, var(--wood) 55%, var(--wood-dark));
    border: 3px solid #A8641F; border-radius: 8px 8px 20px 20px;
    box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 6px 10px rgba(0,0,0,.16);
}
.platform-basket::before { /* rope to plank */
    content:""; position: absolute; left: 50%; bottom: 100%; width: 6px; height: 14px;
    background: #8A5015; transform: translateX(-50%);
}
.platform-pile {
    position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
    width: 152px; z-index: 3;
    display: flex; flex-wrap: wrap-reverse; justify-content: center; align-items: flex-end;
    gap: 1px 2px;
}

/* animal on a platform */
.pile-animal {
    width: 48px; height: 48px; position: relative;
    animation: hop-in .42s cubic-bezier(.24,1.5,.4,1) backwards;
}
.pile-animal.leaving { animation: hop-out .3s ease-in forwards; }
.pile-animal svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pile-animal.tappable { cursor: pointer; }
.pile-animal.glow::after {
    content:""; position: absolute; inset: -4px; border-radius: 50%;
    animation: tap-glow 1.1s ease-in-out infinite;
}
.pile-animal.cheer { animation: cheer-hop .6s ease-in-out; }
.pile-animal.wobble .a-body { animation: wobble-shake .5s ease-in-out 2; }

/* ── Sign posts ─────────────────────────────────────────────────────────── */

.sign-post {
    position: absolute; bottom: 0; z-index: 6; width: 88px; text-align: center;
}
#sign-post-left  { left: max(1vw, 6px); }
#sign-post-right { right: calc(max(1vw, 6px) + 152px); }
.sign-pole {
    position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 12px; height: 64px; z-index: -1;
    background: linear-gradient(90deg, #B87A2A, #E0A05A 50%, #A8641F);
    border-radius: 4px;
}
.sign-plate {
    width: 80px; height: 62px; margin: 0 auto;
    background: linear-gradient(180deg, #FCD37A, var(--gk-yellow) 60%, #E8A828);
    border: 4px solid #C98A1E; border-radius: 12px;
    box-shadow: 0 5px 10px rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.4);
    display: flex; align-items: center; justify-content: center;
    position: relative; z-index: 2;
}
.sign-numeral {
    font-size: 2.5rem; font-weight: 900; color: #7A4A0E;
    text-shadow: 0 2px 0 rgba(255,255,255,.4);
}
.sign-plate.flash { animation: sign-flash .6s ease 2; }
.ten-frame {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px;
    width: 78px; margin: 5px auto 0; padding: 4px;
    background: rgba(255,255,255,.75); border-radius: 8px;
    border: 2px solid #C98A1E; position: relative; z-index: 2;
}
.tf-dot {
    width: 100%; aspect-ratio: 1; border-radius: 50%;
    background: #EAD9B8; box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
    transition: background .25s, transform .25s;
}
.tf-dot.on {
    background: radial-gradient(circle at 34% 30%, #FF9EC2, var(--gk-pink));
    transform: scale(1.04); box-shadow: 0 1px 3px rgba(230,57,120,.4);
}
#sign-post-right .tf-dot.on {
    background: radial-gradient(circle at 34% 30%, #7FD0EA, var(--gk-blue));
}
.sign-cloud {
    position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
    width: 78px; height: 60px; z-index: 5;
    background:
        radial-gradient(circle at 30% 60%, #fff 0 40%, transparent 42%) 6px 12px/44px 44px no-repeat,
        radial-gradient(circle at 70% 55%, #fff 0 42%, transparent 44%) 34px 8px/50px 50px no-repeat,
        radial-gradient(circle at 50% 70%, #fff 0 50%, transparent 52%) 14px 14px/56px 44px no-repeat;
    color: #9AA6C4; font-size: 2rem; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,.15));
}
.sign-cloud.puff { animation: cloud-puff .55s ease-out forwards; }

/* ── Supply row ─────────────────────────────────────────────────────────── */

#supply-zone {
    width: 100%; display: flex; justify-content: center;
    padding: 6px 8px 4px; position: relative; z-index: 7;
}
#supply-row {
    display: flex; gap: clamp(1px, 0.7vw, 10px); justify-content: center;
    align-items: flex-end; flex-wrap: nowrap; max-width: 100%;
    background: rgba(124,181,24,.22); border-radius: 44px;
    padding: 8px clamp(4px, 1.4vw, 14px);
    border: 3px solid rgba(255,255,255,.4);
}
.supply-animal {
    width: clamp(64px, 8vw, 76px); height: clamp(64px, 8vw, 76px);
    min-width: 64px; min-height: 64px;
    border: none; background: none; padding: 0; cursor: pointer; position: relative;
    animation: idle-bob 2.6s ease-in-out infinite;
    transition: transform .15s;
}
.supply-animal svg { width: 100%; height: 100%; display: block; overflow: visible; }
.supply-animal:active { transform: scale(.9); }
.supply-animal.used { visibility: hidden; pointer-events: none; }
.supply-animal.wiggle-once { animation: supply-wiggle .6s ease; }
.supply-animal::after { /* soft grass shadow */
    content:""; position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%);
    width: 60%; height: 8px; background: rgba(0,0,0,.14); border-radius: 50%; z-index: -1;
}

/* ── Done paddle (co-op) ────────────────────────────────────────────────── */

#done-paddle {
    position: absolute; right: 20px; bottom: 130px; z-index: 18;
    min-width: 120px; min-height: 84px; padding: 10px 22px;
    border: none; border-radius: 24px; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, var(--gk-green), #A2D149);
    box-shadow: 0 8px 20px rgba(124,181,24,.5);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    animation: breathe 1.8s ease-in-out infinite;
}
#done-paddle:active { transform: scale(.95); }
.paddle-check { font-size: 2.1rem; font-weight: 900; line-height: 1; }
.paddle-text { font-size: 1.1rem; font-weight: 800; }
/* Before any friend is loaded the check is calm & dimmed — it does not beckon
   a tap that would start an unwinnable round. It brightens once loading begins. */
#done-paddle.paddle-wait {
    animation: none; filter: grayscale(.5) opacity(.6);
    box-shadow: 0 5px 12px rgba(124,181,24,.28);
}
#done-paddle.paddle-nudge { animation: sign-wobble .5s ease; }

/* ── Ghost hand tutorial ────────────────────────────────────────────────── */

#ghost-hand {
    position: absolute; z-index: 19; font-size: 3rem; pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,.25));
    animation: ghost-tap 2.4s ease-in-out infinite;
}

/* ── Info popover ───────────────────────────────────────────────────────── */

#info-btn {
    position: fixed; left: 12px; top: 12px; z-index: 30;
    width: 56px; height: 56px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.92); font-size: 1.5rem; cursor: pointer;
    box-shadow: 0 4px 12px rgba(90,60,130,.25);
}
#info-btn:active { transform: scale(.92); }
#info-overlay {
    position: fixed; inset: 0; z-index: 960;
    background: rgba(74,59,92,.5); display: flex; align-items: center; justify-content: center;
    padding: 18px; animation: gk-fade-in .25s ease;
}
#info-card { max-width: min(94vw, 520px); max-height: 92vh; overflow-y: auto; text-align: left; }
#info-card h2 { color: var(--gk-purple); font-size: clamp(1.3rem, 4vw, 1.7rem); margin-bottom: 10px; }
#info-card p { font-size: clamp(.95rem, 2.6vw, 1.1rem); line-height: 1.5; margin-bottom: 10px; }
#howto-row { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.howto-step {
    display: flex; align-items: center; gap: 12px; background: #FFF3F8;
    border-radius: 16px; padding: 10px 14px; font-weight: 600; font-size: .98rem;
}
.howto-ic { font-size: 1.6rem; }
.info-tip { background: #FFF8E6; border-radius: 14px; padding: 10px 14px; }
#info-close { display: block; margin: 6px auto 0; }

/* ══════════════════════ Keyframes ══════════════════════════════════════════ */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe {
    0%,100% { transform: scale(1); } 50% { transform: scale(1.05); }
}
@keyframes drift-a { from { transform: translateX(0) scale(1); } to { transform: translateX(calc(100vw + 480px)) scale(1); } }
@keyframes drift-b { from { transform: translateX(0) scale(.7); } to { transform: translateX(calc(100vw + 520px)) scale(.7); } }
@keyframes drift-c { from { transform: translateX(0) scale(1.25); } to { transform: translateX(calc(100vw + 620px)) scale(1.25); } }
@keyframes sway { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes firefly {
    0%,100% { transform: translate(0,0); opacity: .2; }
    25% { transform: translate(24px,-18px); opacity: 1; }
    50% { transform: translate(-16px,-30px); opacity: .5; }
    75% { transform: translate(18px,-12px); opacity: .9; }
}
@keyframes flutter {
    0%   { transform: translate(0,0) rotate(0); }
    25%  { transform: translate(30vw,-14vh) rotate(8deg); }
    50%  { transform: translate(58vw,4vh) rotate(-8deg); }
    75%  { transform: translate(84vw,-10vh) rotate(8deg); }
    100% { transform: translate(112vw,2vh) rotate(0); }
}
@keyframes idle-bob {
    0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); }
}
@keyframes supply-wiggle {
    0%,100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); }
}
@keyframes hop-in {
    0%   { transform: translateY(-70px) scale(.7); opacity: 0; }
    60%  { transform: translateY(6px) scaleX(1.15) scaleY(.85); opacity: 1; }
    80%  { transform: translateY(-4px) scaleX(.94) scaleY(1.08); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes hop-out {
    0%   { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-64px) scale(.6); opacity: 0; }
}
@keyframes cheer-hop {
    0%,100% { transform: translateY(0); }
    30% { transform: translateY(-22px) scale(1.08); }
    55% { transform: translateY(0) scaleY(.9); }
    75% { transform: translateY(-8px); }
}
@keyframes wobble-shake {
    0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); }
}
@keyframes tap-glow {
    0%,100% { box-shadow: 0 0 0 3px rgba(230,57,70,.35), 0 0 14px 5px rgba(255,203,73,.55); }
    50%     { box-shadow: 0 0 0 5px rgba(230,57,70,.6), 0 0 22px 9px rgba(255,203,73,.85); }
}
@keyframes bubble-pop {
    from { transform: scale(.6) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes sign-flash {
    0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5) saturate(1.3); }
}
@keyframes cloud-puff {
    0%   { transform: translateX(-50%) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1.8); opacity: 0; }
}
@keyframes check-pop {
    from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); }
}
@keyframes sign-wobble {
    0%,100% { transform: rotate(0); } 20% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); } 80% { transform: rotate(-3deg); }
}
@keyframes ghost-tap {
    0%,100% { transform: translateY(0); opacity: .9; }
    45% { transform: translateY(-40px); opacity: .9; }
    55% { transform: translateY(-40px) scale(.86); }
    65% { transform: translateY(0) scale(.86); opacity: 1; }
    80% { transform: translateY(0) scale(1); }
}
.pippa-holder.hop { animation: pippa-hop .5s cubic-bezier(.3,1.5,.4,1); }
@keyframes pippa-hop {
    0%,100% { transform: translateY(0); } 40% { transform: translateY(-26px); } 70% { transform: translateY(0) scaleY(.94); }
}

/* Pippa animated bits (inside svg) */
.pip-eyelid { transform-origin: center; transform: scaleY(0); animation: pip-blink 4s infinite; }
@keyframes pip-blink { 0%,92%,100% { transform: scaleY(0); } 95% { transform: scaleY(1); } }
.pip-neck { transform-origin: 66px 150px; animation: pip-bob 4.5s ease-in-out infinite; }
@keyframes pip-bob { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-3deg); } }

/* generic animal blink lid */
.a-lid { transform-origin: center; transform: scaleY(0); animation: a-blink 4s infinite; }
@keyframes a-blink { 0%,93%,100% { transform: scaleY(0); } 96% { transform: scaleY(1); } }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-height: 780px) {
    #pippa-play { width: 116px; height: 168px; }
    #seesaw { height: 232px; }
    .pile-animal { width: 42px; height: 42px; }
}
@media (max-width: 820px) {
    #sign-post-right { right: calc(max(2vw, 8px) + 100px); }
    #pippa-play { width: 112px; height: 160px; }
}

/* Below the supported viewport range (phone-portrait), let the 10 supply
   friends wrap onto a second row instead of forcing horizontal page scroll —
   they stay at the 64px touch-target minimum. No effect at/above 768px, where
   all ten fit on one row. */
@media (max-width: 767px) {
    #supply-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    #sun-ray-group, .cloud, #butterfly, .tree-sway, .blade-sway,
    .supply-animal, #fireflies i, #stars i, .pip-neck, .pip-eyelid, .a-lid,
    #btn-play, #done-paddle, #ghost-hand { animation: none !important; }
}
