/* Zumi's Mail Run — game styles. GameKit tokens loaded first. */

:root {
    --rm-sky-top: #C8E8FA;
    --rm-sky-bot: #FFF8EC;
    --rm-grass-a: #A2D149;
    --rm-grass-b: #7CB518;
    --rm-sand: #F5E1A0;
    --rm-wood: #C68B59;
    --rm-wood-dark: #A9714B;
    --rm-mint: #6FD6C3;
}

html, body { overflow: hidden; }
body { background: var(--rm-sky-top); }

.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* ═══════════ Backdrop — layered Maple Lane scene ═══════════ */

#backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

.bk-sky {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, var(--rm-sky-top) 0%, #DDF1FC 55%, var(--rm-sky-bot) 100%);
}

.bk-sun { position: absolute; top: -30px; left: 4vw; width: clamp(120px, 16vw, 190px); }
.sun-svg { width: 100%; animation: rm-sunspin 80s linear infinite; }

.bk-cloud {
    position: absolute;
    width: 150px; height: 44px;
    background: #fff; border-radius: 44px;
    opacity: .9;
    filter: drop-shadow(0 4px 6px rgba(120, 150, 190, .12));
    animation: rm-drift linear infinite;
}
.bk-cloud::before, .bk-cloud::after {
    content: ''; position: absolute; background: #fff; border-radius: 50%;
}
.bk-cloud::before { width: 62px; height: 62px; left: 22px; top: -30px; }
.bk-cloud::after  { width: 44px; height: 44px; right: 26px; top: -20px; }
.bc1 { top: 7%;  transform: scale(.9);  animation-duration: 95s;  animation-delay: -30s; }
.bc2 { top: 16%; transform: scale(1.2); animation-duration: 130s; animation-delay: -80s; opacity: .75; }
.bc3 { top: 3%;  transform: scale(.62); animation-duration: 75s;  animation-delay: -55s; opacity: .6; }
@keyframes rm-drift { from { left: -220px; } to { left: 105vw; } }
@keyframes rm-sunspin { to { transform: rotate(360deg); } }

.bk-bird { position: absolute; width: 42px; animation: rm-fly linear infinite; }
.bb-1 { top: 12%; animation-duration: 52s; animation-delay: -14s; }
.bb-2 { top: 21%; animation-duration: 67s; animation-delay: -40s; transform: scale(.7); }
.bird-svg { width: 100%; animation: rm-flap 1.1s ease-in-out infinite; }
@keyframes rm-fly { from { left: -60px; } to { left: 108vw; } }
@keyframes rm-flap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px) scaleY(.82); } }

.bk-hills { position: absolute; left: 0; right: 0; }
.bk-far  { bottom: 18%; height: 30%; }
.bk-near { bottom: 0;   height: 34%; }
.bk-hills svg { width: 100%; height: 100%; display: block; }

.bk-cottages {
    position: absolute; bottom: 33%; left: 0; right: 0;
    display: flex; justify-content: space-evenly; align-items: flex-end;
    opacity: .92; filter: saturate(.8);
}
.bk-cottage { width: clamp(54px, 7vw, 86px); }

.bk-fence { position: absolute; bottom: 0; left: 0; right: 0; height: 110px; opacity: .96; }

.bk-flora { position: absolute; bottom: -6px; width: clamp(150px, 20vw, 240px); }
.bk-fl-l { left: -18px; }
.bk-fl-r { right: -18px; transform: scaleX(-1); }
.tulips-svg { width: 100%; }
.tulip { animation: rm-sway 4.2s ease-in-out infinite; }
.tulip.sway-b { animation-duration: 5.1s; animation-delay: -1.4s; }
@keyframes rm-sway { 0%, 100% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }

/* butterflies */
.bk-btf { position: absolute; width: 32px; height: 24px; animation: rm-btf-path ease-in-out infinite; }
.bt1 { animation-duration: 26s; animation-delay: -6s; }
.bt2 { animation-duration: 34s; animation-delay: -20s; }
.btf-w { position: absolute; top: 2px; width: 14px; height: 18px; border-radius: 55% 55% 45% 60%; }
.bt1 .btf-w { background: #FF9FBE; } .bt2 .btf-w { background: #CE93E8; }
.bt1 .btf-w::after, .bt2 .btf-w::after {
    content: ''; position: absolute; left: 3px; top: 4px; width: 7px; height: 8px;
    border-radius: 50%; background: rgba(255,255,255,.55);
}
.btf-w.wl { left: 2px;  transform-origin: right center; animation: rm-flapL .4s ease-in-out infinite alternate; }
.btf-w.wr { right: 2px; transform-origin: left center;  animation: rm-flapR .4s ease-in-out infinite alternate; }
.btf-b { position: absolute; left: 14px; top: 3px; width: 4px; height: 17px; border-radius: 3px; background: #4A3B5C; }
@keyframes rm-flapL { from { transform: rotateY(6deg); } to { transform: rotateY(48deg); } }
@keyframes rm-flapR { from { transform: rotateY(-6deg); } to { transform: rotateY(-48deg); } }
@keyframes rm-btf-path {
    0%   { left: -30px; top: 58%; }
    25%  { left: 30vw;  top: 40%; }
    50%  { left: 55vw;  top: 62%; }
    75%  { left: 80vw;  top: 44%; }
    100% { left: 105vw; top: 56%; }
}

/* Play screen: hide backdrop's bottom dressing (tray becomes the foreground) */
body.on-play .bk-fence, body.on-play .bk-flora { display: none; }
body.on-play .bk-cottages { opacity: .55; }

/* ═══════════ Title screen ═══════════ */

.title-inner {
    flex: 1;
    display: grid;
    grid-template-areas: "top zumi" "controls zumi";
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: center;
    justify-items: center;
    padding: clamp(10px, 4vh, 40px) 4vw;
    row-gap: 8px;
}

.t-top { grid-area: top; text-align: center; align-self: end; }
.t-zumi { grid-area: zumi; align-self: center; }
.t-controls { grid-area: controls; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.game-title {
    font-size: clamp(2.6rem, 7vw, 4.6rem);
    line-height: 1.02;
    background: linear-gradient(100deg, #E63946 5%, #F77F00 30%, #FCBF49 48%, #7CB518 64%, #00B4D8 82%, #B565D8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 3px 0 rgba(255,255,255,.9)) drop-shadow(0 6px 14px rgba(90,60,130,.28));
}

.tagline {
    margin-top: 10px;
    font-size: clamp(1rem, 2.4vw, 1.3rem);
    font-weight: bold;
    color: var(--gk-text);
    background: rgba(255,255,255,.72);
    border-radius: 30px;
    padding: 6px 18px;
    display: inline-block;
    box-shadow: 0 3px 10px rgba(90,60,130,.12);
}

#title-zumi { width: clamp(190px, 26vw, 320px); animation: gk-bob 2.6s ease-in-out infinite; }
#title-zumi .zumi-svg { width: 100%; }

.start-btn {
    min-height: 88px;
    padding: 18px 64px;
    font-size: clamp(1.7rem, 4.6vw, 2.4rem);
    font-weight: bold;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 60px;
    background: linear-gradient(135deg, #FF7BAC 0%, #F0558F 100%);
    box-shadow: 0 10px 26px rgba(240, 85, 143, .5), inset 0 -5px 0 rgba(0,0,0,.12);
    transition: transform .15s;
}
.start-btn .btn-pulse { display: inline-block; animation: rm-pulse 1.6s ease-in-out infinite; }
.start-btn:active { transform: scale(.94); }
@keyframes rm-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.055); } }

.title-row { display: flex; gap: 14px; align-items: center; }

.star-pill {
    min-height: 52px;
    display: flex; align-items: center;
    padding: 6px 20px;
    font-size: 1.25rem; font-weight: bold;
    background: rgba(255,255,255,.9);
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(90,60,130,.16);
}

.album-btn {
    min-height: 52px;
    padding: 6px 18px;
    font-size: 1.15rem; font-weight: bold;
    color: var(--gk-text);
    background: linear-gradient(135deg, #FFF3D6, #FFE3A9);
    border: 3px solid #E8A828;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(232,168,40,.3);
    transition: transform .15s;
}
.album-btn:active { transform: scale(.93); }

#level-row { display: flex; gap: 16px; }

.lvl-btn {
    position: relative;
    width: 92px; height: 96px;
    border: none; cursor: pointer;
    border-radius: 22px;
    background: linear-gradient(160deg, #FFFFFF, #F3EAFB);
    box-shadow: 0 6px 16px rgba(90,60,130,.2), inset 0 -4px 0 rgba(90,60,130,.08);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    transition: transform .15s;
}
.lvl-btn:active { transform: scale(.93); }
.lvl-num { font-size: 1.3rem; font-weight: bold; color: var(--gk-purple); line-height: 1; }
.lvl-ic { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.lvl-ic svg { width: 100%; height: 100%; }
.lvl-stars { font-size: .8rem; letter-spacing: 1px; }
.lvl-stars .dim { filter: grayscale(1) opacity(.4); }
.lvl-btn.locked { filter: grayscale(.85); opacity: .75; }
.lvl-btn.locked .lvl-lock {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    background: rgba(255,255,255,.45);
    border-radius: 22px;
}
.lvl-btn .lvl-lock { display: none; }
.lvl-btn.locked .lvl-lock { display: flex; }
.lvl-btn.just-unlocked { animation: rm-unlock 1s ease-in-out 3; }
@keyframes rm-unlock {
    0%, 100% { box-shadow: 0 6px 16px rgba(90,60,130,.2); transform: scale(1); }
    50% { box-shadow: 0 0 30px 8px rgba(252,191,73,.8); transform: scale(1.12); }
}
.lvl-btn.shake { animation: rm-headshake .5s ease-in-out; }
@keyframes rm-headshake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-7px) rotate(-3deg); } 75% { transform: translateX(7px) rotate(3deg); }
}

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

/* ═══════════ Zumi rig animation ═══════════ */

.zumi-svg { display: block; overflow: visible; }
.z-eyes { animation: rm-blink 3.4s infinite; transform-box: fill-box; transform-origin: center 40%; }
@keyframes rm-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
.z-bulb-glow { animation: rm-bulb 2.2s ease-in-out infinite; }
@keyframes rm-bulb { 0%, 100% { opacity: .16; } 50% { opacity: .48; } }
.z-antenna { transform-box: fill-box; transform-origin: bottom center; animation: rm-antenna 3.1s ease-in-out infinite; }
@keyframes rm-antenna { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
.z-wheel { transform-box: fill-box; transform-origin: center; }
.rolling .z-wheel { animation: rm-spin .5s linear infinite; }
@keyframes rm-spin { to { transform: rotate(360deg); } }

.z-face { visibility: hidden; }
.f-happy  .z-face-happy  { visibility: visible; }
.f-o      .z-face-o      { visibility: visible; }
.f-giggle .z-face-giggle { visibility: visible; }
.f-giggle .z-eyes { visibility: hidden; }
.f-giggle .z-head { animation: rm-giggle .55s ease-in-out 2; transform-box: fill-box; transform-origin: center; }
@keyframes rm-giggle { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-5deg); } 70% { transform: rotate(5deg); } }

/* ═══════════ Play screen layout ═══════════ */

#playtop {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 200px 4px 14px; /* right space for the GameKit HUD */
    min-height: 68px;
}

#tracker {
    display: flex; gap: 8px;
    background: rgba(255,255,255,.85);
    padding: 8px 12px;
    border-radius: 40px;
    box-shadow: 0 4px 12px rgba(90,60,130,.15);
}
.trk-slot {
    width: 44px; height: 40px;
    border-radius: 12px;
    background: #F0E9DA;
    box-shadow: inset 0 2px 5px rgba(90,60,130,.18);
    display: flex; align-items: center; justify-content: center;
}
.trk-slot svg { width: 34px; opacity: .28; filter: grayscale(1); }
.trk-slot.done svg { opacity: 1; filter: none; animation: rm-trk-pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes rm-trk-pop { from { transform: scale(.2) rotate(-20deg); } to { transform: scale(1) rotate(0); } }

#target-banner {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.9);
    padding: 6px 18px;
    border-radius: 40px;
    box-shadow: 0 4px 12px rgba(90,60,130,.15);
    animation: rm-banner-in .5s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes rm-banner-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#target-banner .env-svg { width: 46px; }
#target-banner .mini-house { width: 52px; height: 52px; animation: gk-wiggle 1.8s ease-in-out infinite; }
.banner-arrow { font-size: 1.5rem; font-weight: bold; color: var(--gk-purple); }

#board-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
}

#board { position: relative; }

.lawn {
    position: absolute;
    inset: -14px;
    border-radius: 26px;
    background: linear-gradient(to bottom, #AEDA5E 0%, #8FC93A 60%, #7CB518 100%);
    box-shadow: 0 12px 30px rgba(74, 110, 20, .35), inset 0 -6px 0 rgba(0,0,0,.1), inset 0 3px 0 rgba(255,255,255,.25);
}

.cell {
    position: absolute;
    border-radius: 12px;
}
.cell.light { background: #ABDA57; box-shadow: inset 0 2px 0 rgba(255,255,255,.14); }
.cell.dark  { background: #8DC22E; box-shadow: inset 0 2px 0 rgba(255,255,255,.1); }

#board > * { pointer-events: none; }

.sprite { position: absolute; }
.sprite > svg, .sprite .z-inner > svg { width: 100%; height: 100%; display: block; overflow: visible; }

.decor { position: absolute; opacity: .9; }

/* target house wiggle + envelope bubble */
.sprite.house.target .house-rock { animation: rm-house-wiggle 1.7s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom center; }
@keyframes rm-house-wiggle { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }

.env-bubble {
    position: absolute;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    border-radius: 50% 50% 50% 14%;
    box-shadow: 0 5px 14px rgba(90,60,130,.28);
    animation: rm-bubble 1.1s ease-in-out infinite;
    z-index: 400;
}
.env-bubble .env-svg { width: 74%; }
@keyframes rm-bubble { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-26%) scale(1.06); } }

/* house delivery states */
.house-svg .door { transition: transform .45s ease-in-out; transform-box: fill-box; transform-origin: left center; }
.house-svg.delivered .door { transform: scaleX(.12); }
.house-svg .flag { transform-box: fill-box; transform-origin: 50% 6%; transform: rotate(0deg); transition: transform .45s cubic-bezier(.2, 1.8, .4, 1); }
.house-svg.delivered .flag { transform: rotate(-158deg); }
.house-svg.delivered .house-rock { animation: none; }
.house-svg .animal-slot { opacity: 0; }
.house-svg.delivered .animal-slot { opacity: 1; transition: opacity .3s .35s; }
.animal-svg { animation: rm-neighbor-in .5s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes rm-neighbor-in { from { transform: translateY(30px); } to { transform: translateY(0); } }
.wave-arm { transform-box: fill-box; transform-origin: bottom left; animation: rm-wave .5s ease-in-out infinite alternate; }
@keyframes rm-wave { from { transform: rotate(-14deg); } to { transform: rotate(36deg); } }

.smoke .sm { opacity: 0; }
.smoke .sm1 { animation: rm-smoke 3.6s linear infinite; }
.smoke .sm2 { animation: rm-smoke 3.6s linear 1.2s infinite; }
.smoke .sm3 { animation: rm-smoke 3.6s linear 2.4s infinite; }
@keyframes rm-smoke {
    0% { opacity: 0; transform: translateY(6px) scale(.5); }
    25% { opacity: .75; }
    100% { opacity: 0; transform: translateY(-34px) translateX(6px) scale(1.5); }
}

/* bush reactions */
.bush-eyes { opacity: 0; transition: opacity .3s; }
.bush-svg.peek .bush-eyes { opacity: 1; }
.bush-svg.shake .bush-body { animation: rm-shake .6s ease-in-out; transform-box: fill-box; transform-origin: bottom center; }
@keyframes rm-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-6deg); } 40% { transform: rotate(6deg); }
    60% { transform: rotate(-4deg); } 80% { transform: rotate(4deg); }
}
.bush-bflies .bb { opacity: 0; }
.bush-svg.burst .bb1 { animation: rm-bfly1 1.5s ease-out forwards; }
.bush-svg.burst .bb2 { animation: rm-bfly2 1.5s ease-out .1s forwards; }
.bush-svg.burst .bb3 { animation: rm-bfly3 1.5s ease-out .2s forwards; }
@keyframes rm-bfly1 { 0% { opacity: 1; transform: translate(62px, 55px); } 100% { opacity: 0; transform: translate(8px, -32px) rotate(-30deg); } }
@keyframes rm-bfly2 { 0% { opacity: 1; transform: translate(66px, 50px); } 100% { opacity: 0; transform: translate(70px, -42px) rotate(20deg); } }
@keyframes rm-bfly3 { 0% { opacity: 1; transform: translate(70px, 58px); } 100% { opacity: 0; transform: translate(118px, -18px) rotate(38deg); } }

/* pond reaction */
.ripple { transform-box: fill-box; transform-origin: center; animation: rm-ripple 3s ease-in-out infinite; }
@keyframes rm-ripple { 0%, 100% { transform: scale(.8); opacity: .55; } 50% { transform: scale(1.15); opacity: .2; } }
.pond-duck { animation: rm-duckbob 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes rm-duckbob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
.pond-svg.splashy .pond-duck { animation: rm-ducksplash .45s ease-in-out 3; }
@keyframes rm-ducksplash { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(-10deg); } }
.reeds path { animation: rm-sway 4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom center; }

/* charging pad */
.pad-bolt { animation: rm-boltpulse 1.8s ease-in-out infinite; }
@keyframes rm-boltpulse { 0%, 100% { opacity: .95; } 50% { opacity: .45; } }

/* coin */
.coin-svg { animation: rm-coinspin 1.8s ease-in-out infinite; }
@keyframes rm-coinspin {
    0%, 100% { transform: scaleX(1) translateY(0); }
    50% { transform: scaleX(.35) translateY(-8%); }
}

/* footprints hint */
.footprint {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #FFFDF0 0%, #FFE083 45%, #F0AC1B 78%, transparent 88%);
    box-shadow: 0 0 14px 5px rgba(252, 191, 73, .85), inset 0 0 4px rgba(255,255,255,.9);
    opacity: 0;
    animation: rm-foot-in .4s ease-out forwards, rm-glimmer 1.4s ease-in-out .4s infinite;
    z-index: 350;
}
@keyframes rm-glimmer { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.82); } }
@keyframes rm-foot-in { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
.target-glow {
    position: absolute;
    border-radius: 18px;
    border: 4px dashed #FFF3B0;
    box-shadow: 0 0 16px 4px rgba(252, 191, 73, .5), inset 0 0 16px rgba(252,191,73,.4);
    animation: gk-twinkle 1.6s ease-in-out infinite;
    z-index: 340;
}

/* Zumi on the board */
.sprite.zumi-sprite { transition: transform .48s cubic-bezier(.45, .05, .55, .95); will-change: transform; }
.zumi-sprite .z-all { transform-box: fill-box; transform-origin: bottom center; }
.zumi-sprite.hop .z-all { animation: rm-hop .48s ease-in-out; }
@keyframes rm-hop {
    0%, 100% { transform: translateY(0) scaleY(1) scaleX(1); }
    30% { transform: translateY(-26px) scaleY(1.1) scaleX(.94); }
    75% { transform: translateY(2px) scaleY(.88) scaleX(1.1); }
}
.zumi-sprite.zip { transition-duration: .55s; transition-timing-function: cubic-bezier(.3, 0, .2, 1); }
.zumi-sprite.zip .z-all { transform: rotate(-6deg); }
.zumi-sprite .z-inner { display: block; width: 100%; height: 100%; }
.zumi-sprite.face-left .z-inner { transform: scaleX(-1); }
.zumi-sprite.look .z-head { animation: rm-look 1.3s ease-in-out; transform-box: fill-box; transform-origin: center; }
@keyframes rm-look {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-7px) rotate(-4deg); }
    70% { transform: translateX(7px) rotate(4deg); }
}
.zumi-sprite.idle .z-all { animation: rm-idle 2.8s ease-in-out infinite; }
@keyframes rm-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* dust puff + hearts + fx */
.dust {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,248,236,.95) 0%, rgba(214,190,140,.55) 55%, transparent 75%);
    animation: rm-dust .5s ease-out forwards;
    z-index: 320;
}
@keyframes rm-dust { from { opacity: .9; transform: scale(.3); } to { opacity: 0; transform: scale(1.4) translateY(6px); } }

.heart-fx {
    position: absolute;
    font-size: 22px;
    color: #FF6F91;
    text-shadow: 0 2px 4px rgba(90,60,130,.3);
    animation: rm-heart 1.3s ease-out forwards;
    z-index: 420;
}
@keyframes rm-heart {
    0% { opacity: 0; transform: translateY(0) scale(.4); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-64px) scale(1.15); }
}

.fly-env { position: fixed; z-index: 930; width: 60px; pointer-events: none; }
.fly-stamp { position: fixed; z-index: 960; width: 110px; pointer-events: none; filter: drop-shadow(0 8px 18px rgba(90,60,130,.4)); }

.thought {
    position: absolute;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 16px rgba(90,60,130,.3);
    padding: 8px;
    z-index: 430;
    animation: gk-pop-in .35s cubic-bezier(.2, 1.4, .4, 1);
}
.thought::after {
    content: '';
    position: absolute;
    left: 14px; bottom: -12px;
    border: 8px solid transparent;
    border-top-color: #fff;
    border-left-color: #fff;
}
.thought .mini-house { width: 52px; height: 52px; display: block; }
.thought .q { position: absolute; top: 0; right: 4px; font-size: 1.3rem; font-weight: bold; color: var(--gk-purple); }

/* ═══════════ Program tray ═══════════ */

#tray {
    flex: none;
    position: relative;
    margin: 0 auto 10px;
    width: min(96vw, 880px);
    padding: 12px 16px 14px;
    border-radius: 24px;
    background:
        repeating-linear-gradient(90deg, transparent 0 88px, rgba(0,0,0,.07) 88px 92px),
        linear-gradient(to bottom, #D19A66 0%, var(--rm-wood) 40%, var(--rm-wood-dark) 100%);
    box-shadow: 0 14px 34px rgba(90, 50, 20, .4), inset 0 3px 0 rgba(255,255,255,.35), inset 0 -6px 0 rgba(0,0,0,.18);
    z-index: 20;
}
.tray-wheel {
    position: absolute;
    bottom: -12px;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 42%, #8A6B4F 0 30%, #5C4634 31% 100%);
    box-shadow: inset 0 0 0 4px #4E4038, 0 4px 8px rgba(0,0,0,.3);
    z-index: -1;
}
.tw-l { left: 26px; } .tw-r { right: 26px; }

#strip {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}
#strip.wobble { animation: rm-headshake .45s ease-in-out; }

.socket {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: rgba(62, 40, 18, .35);
    box-shadow: inset 0 3px 8px rgba(0,0,0,.4), inset 0 -2px 0 rgba(255,255,255,.14);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.socket::after {
    content: '';
    position: absolute; inset: 7px;
    border-radius: 11px;
    border: 2.5px dashed rgba(255, 245, 220, .3);
}
.socket.filled::after { display: none; }

.tile, .pal-btn {
    border: none; cursor: pointer;
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s;
    box-shadow: 0 5px 12px rgba(60, 35, 10, .35), inset 0 -4px 0 rgba(0,0,0,.2), inset 0 2px 0 rgba(255,255,255,.3);
}
.tile { width: 58px; height: 58px; }
.pal-btn { width: 78px; height: 78px; border-radius: 19px; }
.pal-btn:active:not(:disabled) { transform: scale(.9); }
.tile:active { transform: scale(.9); }

.dir-up    { background: linear-gradient(160deg, #2FC6E8, #009DBD); }
.dir-right { background: linear-gradient(160deg, #96CE3A, #6AA30E); }
.dir-down  { background: linear-gradient(160deg, #FF9A2E, #E06F00); }
.dir-left  { background: linear-gradient(160deg, #C77FE0, #9E4EC2); }

.arrow-ic { width: 72%; height: 72%; }
.dir-up    .arrow-ic { transform: rotate(0deg); }
.dir-right .arrow-ic { transform: rotate(90deg); }
.dir-down  .arrow-ic { transform: rotate(180deg); }
.dir-left  .arrow-ic { transform: rotate(-90deg); }

.tile.spring { animation: rm-spring .35s cubic-bezier(.2, 1.7, .4, 1); }
@keyframes rm-spring { 0% { transform: scale(.2) rotate(-15deg); } 100% { transform: scale(1) rotate(0); } }
.tile.exec {
    animation: rm-exec .55s ease-in-out;
    box-shadow: 0 0 18px 5px rgba(255, 243, 176, .9), inset 0 -4px 0 rgba(0,0,0,.2);
}
@keyframes rm-exec { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18); } }

.poof {
    position: absolute;
    width: 54px; height: 54px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,255,255,.4) 55%, transparent 75%);
    animation: rm-dust .4s ease-out forwards;
    pointer-events: none;
}

#controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
#palette { display: flex; gap: 14px; }

#btn-undo {
    width: 70px; height: 70px;
    border: none; cursor: pointer;
    border-radius: 50%;
    background: linear-gradient(160deg, #FFD75E, #F0AC1B);
    box-shadow: 0 5px 12px rgba(60, 35, 10, .35), inset 0 -4px 0 rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s;
}
#btn-undo svg { width: 64%; height: 64%; }
#btn-undo:active:not(:disabled) { transform: scale(.9) rotate(-20deg); }

#btn-go {
    min-width: 136px; height: 84px;
    border: none; cursor: pointer;
    border-radius: 26px;
    background: linear-gradient(160deg, #8ACB2E, #5D9210);
    box-shadow: 0 6px 16px rgba(70, 110, 10, .45), inset 0 -5px 0 rgba(0,0,0,.2), inset 0 2px 0 rgba(255,255,255,.35);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem; font-weight: bold; color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 2px 0 rgba(0,0,0,.2);
    transition: transform .12s;
}
#btn-go .btn-pulse { display: flex; align-items: center; gap: 6px; }
#btn-go svg { width: 40px; height: 40px; }
#btn-go:active:not(:disabled) { transform: scale(.93); }
#btn-go.armed .btn-pulse { animation: rm-pulse 1.1s ease-in-out infinite; }
#btn-go:disabled .btn-pulse { animation: none; }

#tray.disabled .pal-btn, #tray.disabled .tile, #tray.disabled #btn-undo, #tray.disabled #btn-go {
    opacity: .45;
    pointer-events: none;
}

/* play flora corners */
.play-flora {
    position: absolute;
    bottom: -8px;
    width: clamp(110px, 13vw, 170px);
    pointer-events: none;
    z-index: 15;
}
.pf-left { left: -12px; }
.pf-right { right: -12px; transform: scaleX(-1); }

/* ═══════════ Ghost hand ═══════════ */

#ghost-hand {
    position: fixed;
    z-index: 800;
    width: 74px;
    pointer-events: none;
    filter: drop-shadow(0 6px 14px rgba(120, 90, 180, .45));
    animation: rm-hand-bounce .8s ease-in-out infinite;
    transition: left .4s ease-in-out, top .4s ease-in-out;
}
#ghost-hand .hand-svg { width: 100%; transform: rotate(-10deg); }
#ghost-hand::after {
    content: '';
    position: absolute;
    left: 50%; bottom: -4px;
    width: 34px; height: 34px;
    margin-left: -17px;
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(181, 101, 216, .5), inset 0 0 6px rgba(181, 101, 216, .35);
    animation: rm-tapring .9s ease-out infinite;
}
@keyframes rm-tapring {
    0% { transform: scale(.35); opacity: .95; }
    100% { transform: scale(1.35); opacity: 0; }
}
@keyframes rm-hand-bounce { 0%, 100% { margin-top: 0; } 50% { margin-top: 16px; } }

/* ═══════════ Overlays (album + grown-ups) ═══════════ */

.overlay {
    position: fixed; inset: 0;
    z-index: 920;
    display: flex; align-items: center; justify-content: center;
    background: rgba(74, 59, 92, .5);
    animation: gk-fade-in .25s ease-out;
    padding: 16px;
}
.overlay-card {
    position: relative;
    max-width: min(560px, 94vw);
    max-height: 86vh;
    overflow-y: auto;
    padding: 24px 26px;
    animation: gk-pop-in .35s cubic-bezier(.2, 1.4, .4, 1);
}
.overlay-card h3 { font-size: 1.5rem; margin-bottom: 12px; color: var(--gk-purple); padding-right: 56px; }
.overlay-card p { font-size: 1.02rem; line-height: 1.5; margin-bottom: 10px; }
.close-btn {
    position: absolute;
    top: 12px; right: 12px;
    width: 52px; height: 52px;
    border: none; border-radius: 50%;
    background: #F3EAFB;
    color: var(--gk-purple);
    font-size: 1.4rem; font-weight: bold;
    cursor: pointer;
    transition: transform .15s;
}
.close-btn:active { transform: scale(.9); }

.tip-row { display: flex; gap: 12px; align-items: flex-start; background: #FFF6E5; border-radius: 16px; padding: 12px 14px; }
.tip-icons { font-size: 1.7rem; line-height: 1.2; }
.tip-row p { margin: 0; font-size: .95rem; }

#info-flow {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #F3F9E8;
    border-radius: 16px;
    padding: 10px;
    margin-bottom: 12px;
}
#info-flow .flow-tile {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
#info-flow .arrow-ic { width: 30px; height: 30px; }
#info-flow .flow-eq { font-size: 1.4rem; font-weight: bold; color: var(--gk-text); }
#info-flow .mini-house { width: 40px; height: 40px; }
#info-flow .env-svg { width: 34px; }

#stamp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    justify-items: center;
}
.stamp-cell { text-align: center; }
.stamp-cell .stamp-svg { width: min(120px, 24vw); display: block; }
.stamp-cell.dim .stamp-svg { filter: grayscale(1) opacity(.4) contrast(.6); }
.stamp-cell .stamp-name { font-size: .85rem; font-weight: bold; margin-top: 4px; color: var(--gk-text); }
.stamp-cell.dim .stamp-name { opacity: .45; }

/* ═══════════ Responsive ═══════════ */

@media (orientation: portrait) {
    .title-inner {
        grid-template-areas: "top" "zumi" "controls";
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }
    #title-zumi { width: clamp(160px, 30vw, 250px); }
    #playtop { padding-right: 14px; padding-top: 76px; flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 900px) {
    .pal-btn { width: 72px; height: 72px; }
    .socket { width: 58px; height: 58px; }
    .tile { width: 52px; height: 52px; }
    #btn-go { min-width: 118px; height: 78px; font-size: 1.6rem; }
    #playtop { gap: 10px; }
}

@media (max-height: 760px) {
    #tray { padding: 8px 12px 10px; }
    #strip { margin-bottom: 7px; }
    .socket { width: 54px; height: 54px; }
    .tile { width: 48px; height: 48px; }
    .pal-btn { width: 68px; height: 68px; }
    #btn-go { height: 72px; }
    #btn-undo { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
    .bk-cloud, .bk-bird, .bird-svg, .bk-btf, .btf-w, .sun-svg, .tulip,
    .reeds path, .pond-duck, .smoke .sm, .start-btn, #btn-go.armed,
    #title-zumi, .z-antenna, .zumi-sprite.idle .z-all, .coin-svg,
    .sprite.house.target .house-rock, .env-bubble, #target-banner .mini-house {
        animation: none;
    }
}
