/* Shop basket (shop-basket.js): price coins · basket · green buy button, sitting on the shop floor above the menu. */
#sq-basket{position:fixed;left:50%;bottom:var(--sqb-bottom,96px);z-index:40;display:none;align-items:center;justify-content:center;gap:clamp(8px,2.4vw,18px);transform:translateX(-50%);pointer-events:none;width:max-content;max-width:calc(100vw - 24px)}
#sq-basket.on{display:flex}
dialog[open]~#sq-basket,body:has(dialog[open]) #sq-basket{visibility:hidden}
#sq-basket>*{pointer-events:auto}

/* basket: back · toy · front, so the squishy sits inside it */
.sqb-basket{position:relative;width:clamp(150px,42vw,200px);aspect-ratio:var(--sqb-ar,1.887);transform-origin:50% 100%;transition:scale .18s ease,filter .18s ease}
.sqb-basket img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none;-webkit-user-drag:none}
.sqb-back{z-index:0}.sqb-front{z-index:2}
.sqb-toy{position:absolute;z-index:1;left:24%;right:24%;bottom:calc(100% - var(--sqb-floor,53%));aspect-ratio:1.15;display:flex;align-items:flex-end;justify-content:center}
.sqb-toy .dumpling-box-art{display:block;width:100%;height:100%;position:relative;filter:drop-shadow(0 4px 4px #6b4a6530)}.sqb-toy .dumpling-box-art img{width:100%;height:100%;object-fit:contain;object-position:50% 100%}
.sqb-ghost.dumpling-box-art img{width:100%;height:100%;object-fit:contain}
.sqb-toy .toy{width:100%!important;height:100%!important;max-width:none!important;margin:0!important;position:relative!important;inset:auto!important;transform:none!important;filter:drop-shadow(0 4px 4px #6b4a6530)}
.sqb-basket::after{content:"";position:absolute;z-index:-1;left:10%;right:10%;bottom:-4%;height:14%;border-radius:50%;background:#6b4a6526;filter:blur(3px)}
#sq-basket[data-state=empty] .sqb-basket{animation:sqb-idle 3.6s ease-in-out infinite}
@keyframes sqb-idle{0%,80%,100%{rotate:0deg}86%{rotate:-3deg}93%{rotate:3deg}}

/* while dragging: the basket glows and opens up; over it, it grows */
#sq-basket.sqb-dragging .sqb-basket{animation:none;filter:drop-shadow(0 0 14px #fff6b0) drop-shadow(0 0 4px #ffd56a);scale:1.08}
#sq-basket.sqb-over .sqb-basket{scale:1.2}

/* price: one coin per coin it costs, grey ghosts for the ones you don't have */
.sqb-price{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:flex-end;gap:2px;width:clamp(64px,18vw,104px);min-height:40px}
.sqb-coin{width:clamp(30px,8vw,40px);height:clamp(30px,8vw,40px);object-fit:contain;filter:drop-shadow(0 2px 2px #b8801f55);-webkit-user-drag:none}
.sqb-coin.ghost{filter:grayscale(1) brightness(1.25);opacity:.38}
.sqb-coin.waiting{opacity:0}
#sq-basket[data-state=empty] .sqb-price{visibility:hidden}

/* buy: big green coin-check button, only once a squishy is in the basket */
.sqb-buy{width:clamp(64px,17vw,84px);height:clamp(64px,17vw,84px);margin:0;border:3px solid #fff;border-radius:50%;background:linear-gradient(#8fe0b5,#5cc492);box-shadow:0 5px 0 #3e9a6c,0 8px 16px #2e7a5240;display:grid;place-items:center;position:relative;cursor:pointer;padding:0;-webkit-tap-highlight-color:transparent;transition:scale .12s ease,opacity .2s ease}
.sqb-buy img{width:58%;height:58%;object-fit:contain;-webkit-user-drag:none}
.sqb-buy svg{position:absolute;right:-6px;bottom:-6px;width:42%;height:42%;padding:3px;border-radius:50%;background:#fff;fill:none;stroke:#3e9a6c;stroke-width:3.6;stroke-linecap:round;stroke-linejoin:round;box-shadow:0 2px 4px #2e7a5240}
.sqb-buy:active{scale:.92;box-shadow:0 2px 0 #3e9a6c}
#sq-basket[data-state=full] .sqb-buy{animation:none}
@keyframes sqb-ready{0%,100%{scale:1}50%{scale:1.08}}
#sq-basket[data-state=empty] .sqb-buy{visibility:hidden}
#sq-basket[data-state=short] .sqb-buy{background:linear-gradient(#e4dde9,#cfc6d8);box-shadow:0 5px 0 #b3a8bf}
#sq-basket[data-state=short] .sqb-buy svg{stroke:#b3a8bf}
#sq-basket[data-state=short] .sqb-buy img{filter:grayscale(1);opacity:.6}
#sq-basket[data-state=paying] .sqb-buy{opacity:0;scale:.6;pointer-events:none;animation:none;transition:opacity .22s ease,scale .22s ease}

/* shelf: draggable toys, the one lifted, the one already in the basket */
body[data-place=shop] .toy-card.sqb-draggable{touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
body[data-place=shop] .toy-card.sqb-draggable .toy{-webkit-user-drag:none}
.toy-card.sqb-lifting .toy,.toy-card.sqb-in-basket .toy{opacity:.28;filter:grayscale(.5)}
.sqb-ghost{position:fixed!important;z-index:60;pointer-events:none;margin:0!important;transform-origin:50% 50%;filter:drop-shadow(0 12px 10px #6b4a6540);will-change:transform}

/* flying coins, the hero squishy and its sparkle ring */
.sqb-fly{position:fixed;z-index:61;pointer-events:none;object-fit:contain;filter:drop-shadow(0 3px 3px #b8801f55)}
.sqb-hero{position:fixed!important;z-index:62;pointer-events:none;margin:0!important;max-width:none!important;filter:drop-shadow(0 10px 14px #6b4a6540)}
.sqb-ring{position:fixed;z-index:61;width:10px;height:10px;margin:-5px 0 0 -5px;border-radius:50%;pointer-events:none;box-shadow:0 0 0 6px #ffe27a,0 0 0 14px #fff6c8;animation:sqb-ring .7s ease-out forwards}
.sqb-ring::before,.sqb-ring::after{content:"✦";position:absolute;left:50%;top:50%;font-size:34px;color:#ffd24a;translate:-50% -50%;animation:sqb-spark .7s ease-out forwards}
.sqb-ring::after{content:"✧";color:#ff9cc8;animation-delay:.08s}
@keyframes sqb-ring{0%{scale:1;opacity:1}100%{scale:32;opacity:0}}
@keyframes sqb-spark{0%{translate:-50% -50%;opacity:1}100%{translate:-50% -900%;opacity:0}}

/* first visits: a finger shows the drag */
.sqb-finger{position:fixed;z-index:63;width:54px;height:auto;margin:-6px 0 0 -14px;pointer-events:none;filter:drop-shadow(0 4px 6px #0003)}

@media(prefers-reduced-motion:reduce){#sq-basket .sqb-basket,#sq-basket .sqb-buy{animation:none!important}}

/* Room for both: while the basket is out, the treasure case moves to the left of the floor and the basket to the right. */
html body.ui2[data-place=shop]:has(#sq-basket.on) .shop-scene .tr-case{left:3%!important;right:auto!important;transform:none!important;width:min(30%,300px)!important;max-width:none!important}
/* the basket always stands in the middle of the floor: price | basket | buy, with the basket in the centre column */
#sq-basket{left:0;right:0;width:auto;max-width:none;transform:none;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);column-gap:clamp(8px,2.4vw,18px)}
#sq-basket.on{display:grid}
#sq-basket>.sqb-price{grid-area:1/1/2/2;justify-self:end}
#sq-basket>.sqb-basket{grid-area:1/2/2/3}
#sq-basket>.sqb-act{grid-area:1/3/2/4;justify-self:start}
/* phones: no room for the price coins beside the basket, so they sit on its front rim */
@media(max-width:600px){
 #sq-basket>.sqb-price{position:absolute;grid-area:1/2/2/3;justify-self:stretch;left:0;right:0;bottom:8%;width:auto;justify-content:center;z-index:3}
}

/* The toy close-up's buy button (drops the toy in the basket) is the one obvious thing to press: the same green as the basket's coin button, bigger than Details, with a gentle "ready" bounce. */
html body.ui2 dialog#modal[open] .squish-playground .squish-dock .btn[data-action=collect]:not(:disabled){background:linear-gradient(#8fe0b5,#5cc492)!important;color:#fff!important;border:3px solid #fff!important;box-shadow:0 6px 0 #3e9a6c,0 10px 18px #2e7a5233!important;font-weight:800!important;transform-origin:50% 100%;animation:none}
html body.ui2 dialog#modal[open] .squish-playground .squish-dock .btn[data-action=collect]:not(:disabled) svg{color:#fff;stroke:#fff;scale:1.25}
html body.ui2 dialog#modal[open] .squish-playground .squish-dock .btn[data-action=collect]:not(:disabled) small{color:#fff!important;font-size:22px!important}
html body.ui2 dialog#modal[open] .squish-playground .squish-dock .btn[data-action=collect]:not(:disabled):active{translate:0 4px;box-shadow:0 2px 0 #3e9a6c!important}
@media(prefers-reduced-motion:reduce){html body.ui2 dialog#modal[open] .squish-playground .squish-dock .btn[data-action=collect]{animation:none!important}}

/* Counting coins in: dashed spots wait for a coin; counted coins are gold; a number pops up for each one. */
.sqb-coin.spot{opacity:.28;filter:none;border-radius:50%;outline:2.5px dashed #e0a92a;outline-offset:-2px;cursor:pointer;animation:sqb-spot 1.4s ease-in-out infinite}
.sqb-coin.spot~.sqb-coin.spot{animation-delay:.2s}
.sqb-coin.incoming{animation:none}
@keyframes sqb-spot{0%,100%{scale:1}50%{scale:1.1}}
.sqb-count{position:fixed;z-index:60;pointer-events:none;font:900 clamp(26px,5vw,38px)/1 var(--display-font,ui-rounded,system-ui,sans-serif);color:#fff;-webkit-text-stroke:2px #c9851a;text-shadow:0 3px 0 #c9851a;paint-order:stroke fill}
.sqb-coin-drag{position:fixed;width:44px;height:44px;z-index:60;pointer-events:none;filter:drop-shadow(0 6px 6px #6b4a6555)}
body[data-place=shop]:has(#sq-basket[data-state=full]:not(.sqb-counted)) .ui2-coins{animation:sqb-wallet 1.6s ease-in-out infinite}
@keyframes sqb-wallet{0%,100%{scale:1}50%{scale:1.08;filter:drop-shadow(0 0 8px #ffe28a)}}
#sq-basket[data-state=full]:not(.sqb-counted) .sqb-buy{animation:none}
#sq-basket.sqb-counted[data-state=full] .sqb-buy{animation:none}

/* Not enough coins: the buy button becomes Squishy Rain (the quickest coins) */
.sqb-act{position:relative;display:grid}
.sqb-act>*{grid-area:1/1}
.sqb-earn{display:none;width:clamp(64px,17vw,84px);height:clamp(64px,17vw,84px);margin:0;padding:0;border:3px solid #fff;border-radius:22px;background:#fff8e6;box-shadow:0 5px 0 #e3c78f,0 8px 16px #6b4a6533;position:relative;cursor:pointer;animation:none}
.sqb-earn>img:first-child{width:100%;height:100%;object-fit:contain;border-radius:18px;padding:9%;box-sizing:border-box;background:radial-gradient(circle at 50% 40%,#fffbe6,#ffe8a3)}
.sqb-earn-coin{position:absolute;right:-8px;bottom:-8px;width:42%;height:42%;object-fit:contain;filter:drop-shadow(0 2px 2px #b8801f66)}
#sq-basket[data-state=short] .sqb-earn{display:block}
#sq-basket[data-state=short] .sqb-buy{visibility:hidden}
@media(prefers-reduced-motion:reduce){.sqb-coin.spot,.sqb-earn,body[data-place=shop] .ui2-coins{animation:none!important}}
html body.ui2 dialog#modal[open] .squish-playground .squish-dock .btn[data-action=collect].sqb-short{animation:none!important}

/* Premium touches: the basket wiggles while a toy hovers over it, a shine sweeps across it when it's ready to buy,
   shop-themed puffs when a toy lands, and the shop's bag for the trip home. */
#sq-basket.sqb-dragging.sqb-over .sqb-basket{animation:sqb-wiggle .45s ease-in-out infinite}
@keyframes sqb-wiggle{0%,100%{rotate:0deg}25%{rotate:-4deg}75%{rotate:4deg}}
.sqb-shine{position:absolute;inset:0;z-index:3;pointer-events:none;opacity:0;background:linear-gradient(105deg,transparent 30%,#ffffffb8 45%,#fff 50%,#ffffffb8 55%,transparent 70%) no-repeat;background-size:250% 100%;background-position:150% 0;
 -webkit-mask:var(--sqb-mask,url(./assets/baskets/toy-front.webp)) center/contain no-repeat;mask:var(--sqb-mask,url(./assets/baskets/toy-front.webp)) center/contain no-repeat;mix-blend-mode:soft-light}
#sq-basket[data-state=full] .sqb-shine{animation:sqb-shine 2.8s ease-in-out infinite}
@keyframes sqb-shine{0%{opacity:1;background-position:150% 0}45%,100%{opacity:1;background-position:-60% 0}}
.sqb-p{position:fixed;z-index:61;pointer-events:none;border-radius:50%}
.sqb-p-sprinkles{border-radius:99px}
.sqb-p-steam{filter:blur(4px)}
.sqb-p-flour{filter:blur(1px);box-shadow:0 0 6px #fff}
.sqb-p-bubbles{background:radial-gradient(circle at 32% 30%,#fff 0 14%,#ffffff40 16%,#c9e9ff55 60%,#ffd6f055 100%)!important;border:1.5px solid #ffffffcc}
.sqb-p-stars{border-radius:2px;clip-path:polygon(50% 0,61% 38%,100% 50%,61% 62%,50% 100%,39% 62%,0 50%,39% 38%)}
.sqb-bag{position:fixed;z-index:62;pointer-events:none;object-fit:contain;filter:drop-shadow(0 12px 14px #6b4a6545)}
.sqb-bag-shine{animation:sqb-bag-glow .7s ease-out}
@keyframes sqb-bag-glow{0%{filter:drop-shadow(0 12px 14px #6b4a6545) brightness(1)}40%{filter:drop-shadow(0 0 18px #fff6b0) brightness(1.12)}100%{filter:drop-shadow(0 12px 14px #6b4a6545) brightness(1)}}
@media(prefers-reduced-motion:reduce){#sq-basket .sqb-shine{animation:none!important}}

/* Unwrap on the shelf: a shop buy waits in its tile as the shop's bag until it's tapped (sizes and place: the #sq-dock rules below) */
.sqb-gift{margin:0;padding:0;border:0;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;transform-origin:50% 100%}
.sqb-gift img{position:relative;z-index:1;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 12px 12px #6b4a6545);pointer-events:none;-webkit-user-drag:none}
.sqb-p-tissue{border-radius:3px}
.sqb-unwrapped{position:fixed;z-index:62;pointer-events:none;display:flex;align-items:center;justify-content:center}
.sqb-unwrapped>*{width:100%!important;height:100%!important;max-width:none!important;margin:0!important;position:relative!important;inset:auto!important;transform:none!important;filter:drop-shadow(0 10px 14px #6b4a6540)}
.sqb-unwrapped img{width:100%;height:100%;object-fit:contain}
/* Squishy economics: prices above 5 show as real coin stacks of five (first coin at the bottom), so 20 coins still fit by the basket. */
#sq-basket .sqb-price:has(.sqb-coin:nth-child(6)):not(:has(.sqb-five)){display:grid;grid-template-rows:repeat(5,7px);grid-auto-flow:column;grid-auto-columns:clamp(30px,8vw,36px);gap:0 4px;justify-content:center;align-content:end;min-height:62px;transform:scaleY(-1)}
#sq-basket .sqb-price:has(.sqb-coin:nth-child(6)):not(:has(.sqb-five)) .sqb-coin{width:clamp(28px,7.5vw,34px);height:clamp(28px,7.5vw,34px);transform:scaleY(-1);align-self:start}
#sq-basket .sqb-price:has(.sqb-coin:nth-child(6)):not(:has(.sqb-five)) .sqb-coin.spot{outline:0;opacity:.42;filter:saturate(.7)}
@media(max-width:600px){#sq-basket .sqb-price:has(.sqb-coin:nth-child(6)):not(:has(.sqb-five)){grid-template-rows:repeat(5,4px);grid-auto-columns:26px;min-height:42px}
#sq-basket .sqb-price:has(.sqb-coin:nth-child(6)):not(:has(.sqb-five)) .sqb-coin{width:24px;height:24px}}
/* iPad: a bigger basket (and buy button) to suit the full-screen shop */
@media(min-width:700px) and (min-height:600px){
 #sq-basket .sqb-basket{width:clamp(200px,min(34vw,26vh),380px)}
 html body.ui2[data-place=shop]:has(.tr-case) #sq-basket .sqb-basket{width:clamp(190px,min(30vw,24vh),340px)}
 #sq-basket .sqb-buy{width:clamp(84px,10vw,108px);height:clamp(84px,10vw,108px)}
}
/* paying: the dashed spots hold still (no pulse) so kids can watch each coin drop into its place */
#sq-basket[data-state=paying] .sqb-coin.spot{animation:none;opacity:.4}
/* big coins worth five: the star coin with a 5 on it, a little bigger than a single coin */
.sqb-five{position:relative;display:inline-grid;place-items:center}
.sqb-five>img{width:100%;height:100%;object-fit:contain;-webkit-user-drag:none;pointer-events:none}
.sqb-five>b{position:absolute;inset:0;display:grid;place-items:center;padding-top:6%;font:900 clamp(17px,4.6vw,24px)/1 "Grandstander",ui-rounded,system-ui,sans-serif;color:#fff;-webkit-text-stroke:2.5px #b8701a;paint-order:stroke fill;text-shadow:0 2px 0 #b8701a;pointer-events:none}
#sq-basket .sqb-coin.sqb-five{width:clamp(38px,10vw,50px);height:clamp(38px,10vw,50px)}
#sq-basket .sqb-coin.sqb-five.ghost>b{-webkit-text-stroke-color:#8f8f8f;text-shadow:0 2px 0 #8f8f8f}
.sqb-fly.sqb-five>b{font-size:clamp(17px,4.6vw,24px)}
#sq-basket .sqb-price:has(.sqb-five){width:auto;max-width:min(92vw,300px);flex-wrap:nowrap;gap:3px}
#sq-basket .sqb-coin.sqb-ten{width:clamp(42px,11vw,56px);height:clamp(42px,11vw,56px)}
.sqb-ten>b{font-size:clamp(15px,4vw,21px)!important;letter-spacing:-.04em}
/* the squishy in the basket can be dragged back out (shop-basket.js, 10/18) */
#sq-basket:not([data-state=empty]):not([data-state=paying]) :is(.sqb-basket,.sqb-toy){touch-action:none;cursor:grab}
#sq-basket.sqb-leaving .sqb-basket{opacity:.75;transition:opacity .15s}

/* Reversible tap alternative to dragging a toy out of the basket. */
#sq-basket .sqb-remove{position:absolute;z-index:5;left:calc(50% + 36px);top:-44px;width:48px;height:48px;border:2px solid white;border-radius:50%;background:#fff8eb;color:#654735;font-size:30px;box-shadow:0 3px 6px #65473533}
#sq-basket[data-state=empty] .sqb-remove,#sq-basket[data-state=paying] .sqb-remove{display:none}
#sq-basket button:focus-visible{outline:3px solid #553728;outline-offset:3px}
/* only the coin spots you can tap catch fingers; the rest of the price lets a drag reach the basket under it (10/19) */
#sq-basket .sqb-price{pointer-events:none}#sq-basket .sqb-price .sqb-coin.spot{pointer-events:auto}

html body #sq-dock .sqb-gift{position:relative;inset:auto;display:block;width:100%;height:100%;min-width:0;padding:0;z-index:1;touch-action:pan-x;animation:none}
html body #sq-dock .sqb-gift>img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 3px #6b4a6533)}
html body #sq-dock .sqb-gift-label{display:block!important;z-index:3;position:absolute;bottom:0;left:50%;transform:translateX(-50%);padding:2px 7px;border-radius:12px;background:#fff8e9;color:#5b3782;font-size:12px;font-weight:800;line-height:1.2}
html body #sq-dock .sqb-gift-preview{position:absolute;right:0;top:0;width:40%;height:40%;border-radius:50%;background:#fff8e9;pointer-events:none}
html body #sq-dock .sqb-gift-preview .toy{width:100%!important;height:100%!important}
