/* Town plaza (town-plaza.js): the Plaza | Street switch and the whole-town plaza view */
.tp-switch{position:absolute;z-index:30;left:50%;translate:-50% 0;top:6px;display:flex;gap:2px;padding:5px;border-radius:26px;
 background:radial-gradient(90% 140% at 50% -20%,#fffefb 0%,#fdf5ea 50%,#f6e7d3 100%);
 box-shadow:inset 0 3px 0 #fff,inset 0 -3px 0 #f0dcc0,0 5px 0 #e4c9a4,0 6px 0 #d8b88f,0 14px 22px -10px #6b452680}
/* the stitch, like the menu trays */
.tp-switch::after{content:"";position:absolute;z-index:0;inset:3px;border-radius:inherit;border:2px dashed #e9d3b3;pointer-events:none}
.tp-bead{position:absolute;z-index:1;left:0;top:5px;bottom:5px;border-radius:21px;pointer-events:none;
 background:radial-gradient(80% 120% at 50% 0%,#a46be0 0%,#8743cc 55%,#7432b8 100%);box-shadow:inset 0 2px 0 #c49bf0,inset 0 -3px 0 #5e2799,0 3px 0 #5a2290,0 6px 10px -4px #5a229099;
 transition:translate .36s cubic-bezier(.3,1.35,.5,1),width .36s}
.tp-bead.tp-land{animation:tp-squish .34s ease-out}
@keyframes tp-squish{30%{scale:1.1 .86}65%{scale:.96 1.06}100%{scale:1}}
.tp-switch button{position:relative;z-index:2;display:grid;place-items:center;width:58px;height:46px;padding:0;border:0;border-radius:21px;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
.tp-switch button img{width:40px;height:40px;object-fit:contain;pointer-events:none;transition:scale .3s cubic-bezier(.3,1.6,.5,1),filter .3s,opacity .3s;filter:saturate(.75) drop-shadow(0 2px 1px #6b452633);opacity:.8}
.tp-switch button.on img{scale:1.14;filter:drop-shadow(0 3px 2px #2a104466);opacity:1}
.tp-switch button:active img{scale:.9}
html body.calm-mode .tp-switch{background:#2a2140;box-shadow:0 4px 0 #1a1428}
html body.calm-mode .tp-switch::after{border-color:#ffffff30}
@media (prefers-reduced-motion:reduce){.tp-bead{transition:none}.tp-bead.tp-land{animation:none}}
/* #main is the town's box; in plaza view everything else in it rests */
body[data-place=town] #main:has(>.tp-switch){position:relative}
body.tp-on[data-place=town] #main>*:not(.tp-plaza):not(.tp-switch){visibility:hidden!important;pointer-events:none!important}
.tp-plaza{position:fixed;inset:0;z-index:20;overflow:hidden}
/* the dock shelf and the walking pet belong to the street */
body.tp-on[data-place=town] .sq-dock,body.tp-on[data-place=town] .v2q-pet{visibility:hidden!important;pointer-events:none!important}
.tp-art{position:absolute;background-size:100% 100%;transition:filter .6s}
.tp-lots{position:absolute;inset:0}
.tp-shop{position:absolute;translate:-50% -100%;padding:0;margin:0;border:0;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:scale .18s}
.tp-shop:active{scale:.94}
.tp-build{position:relative;display:block}
.tp-build>img{display:block;width:100%;height:auto;filter:drop-shadow(0 7px 5px #5a301c55);pointer-events:none}
body[data-daylight=night] .tp-build>img{filter:drop-shadow(0 7px 5px #0006) brightness(.9)}
.tp-logo{position:absolute;left:50%;bottom:100%;translate:-50% 24%;width:var(--lw,100%);max-width:none;height:auto;z-index:2;pointer-events:none;filter:drop-shadow(0 2px 2px #5a301c40)}
/* locked shops: dark, with a big padlock on the door */
.tp-locked .tp-build>img{filter:saturate(.4) brightness(.94) drop-shadow(0 7px 5px #2a103455)}
body[data-daylight=night] .tp-locked .tp-build>img{filter:saturate(.35) brightness(.78) drop-shadow(0 7px 5px #0006)}
.tp-locked .tp-logo{filter:saturate(.45) opacity(.85)}
.tp-lock{position:absolute;left:50%;top:56%;translate:-50% -50%;display:grid;place-items:center;width:clamp(30px,3.2vw,42px);aspect-ratio:1;border-radius:50%;
 background:linear-gradient(#fffaf2,#f1e4f6);border:3px solid #fff;color:#7a34be;box-shadow:0 4px 0 #b79ad6,0 8px 14px #2a103466;pointer-events:none}
.tp-lock svg{width:58%;height:58%}
@media (prefers-reduced-motion:reduce){.tp-shop,.tp-art{transition:none}}

/* Tablet controls remain easy to recognize without covering the skyline. */
@media(min-width:700px){
 .tp-switch{position:fixed;top:max(10px,env(safe-area-inset-top));padding:6px;gap:4px}
 .tp-switch button{width:60px;height:48px}
 .tp-switch button img{width:40px;height:40px;opacity:.95}
 .tp-switch button.on{box-shadow:inset 0 0 0 2px #fff5cf}
 .tp-bead{top:6px;bottom:6px}
}
.tp-switch button:focus-visible{outline:3px solid #7742a4;outline-offset:3px}

/* A delivery remains reachable without covering a shop entrance or logo. */
@media(min-width:700px){body.tp-on[data-place=town] .v2q-delivery{left:auto!important;right:20px!important;top:auto!important;bottom:110px!important}}

/* The tablet switch shares the toolbar row. Empty toolbar space must not catch its taps. */
@media(min-width:700px){
 html body[data-place=town]:has(.tp-switch) .topbar,
 html body[data-place=town]:has(.tp-switch) .ui2-bar{pointer-events:none!important}
 html body[data-place=town]:has(.tp-switch) .topbar :is(button,a,input,[role=button],[role=switch]){pointer-events:auto!important}
}

/* Ambient motion stays on the scenery; it never receives a tap. */
.tp-breeze{position:absolute;inset:0;transform-origin:0 0;pointer-events:none}
.tp-breeze i{position:absolute;display:block;background-image:var(--tp-scene);background-size:var(--tp-scene-size);background-repeat:no-repeat;pointer-events:none}
.tp-flag{clip-path:polygon(0 0,100% 0,60% 100%,40% 100%);transform-origin:50% 0;animation:tp-flag-sway 3.8s ease-in-out infinite}
.tp-leaves{mask-image:radial-gradient(ellipse,#000 25%,transparent 70%);transform-origin:50% 100%;animation:tp-leaf-sway 6s ease-in-out infinite}
.tp-smoke{position:absolute;left:80%;top:5%;width:12%;height:0;pointer-events:none;z-index:-1}
.tp-smoke i{position:absolute;left:0;bottom:0;width:100%;aspect-ratio:1;border-radius:50%;background:radial-gradient(ellipse,#fff8 0 25%,#fff4 45%,transparent 72%);opacity:0;animation:tp-puff 5.4s ease-out infinite}
.tp-smoke i:nth-child(2){animation-delay:-1.8s}.tp-smoke i:nth-child(3){animation-delay:-3.6s}
@keyframes tp-flag-sway{0%,100%{transform:skewX(-3deg) scaleY(.96)}50%{transform:skewX(4deg) scaleY(1.03)}}
@keyframes tp-leaf-sway{0%,100%{transform:rotate(-.6deg) translateX(-1px)}50%{transform:rotate(.8deg) translateX(1.5px)}}
@keyframes tp-puff{0%{transform:translate(0,0) scale(.6);opacity:0}15%{opacity:.65}80%{opacity:.18}100%{transform:translate(110%,-380%) scale(2.5);opacity:0}}
body.tp-paused .tp-breeze i,body.tp-paused .tp-smoke i,body:has(dialog[open]) .tp-breeze i,body:has(dialog[open]) .tp-smoke i{animation-play-state:paused}
body.calm-mode .tp-breeze i,body.calm-mode .tp-smoke{display:none}
@media(prefers-reduced-motion:reduce){.tp-breeze,.tp-smoke{display:none}}

.tp-progress{position:absolute;left:50%;bottom:-7px;translate:-50% 0;display:flex;align-items:center;gap:3px;white-space:nowrap;padding:3px 7px;border:2px solid #fffdf5;border-radius:18px;background:#fff6df;color:#654082;box-shadow:0 3px 5px #36204830;font:800 clamp(11px,1.2vw,16px)/1.1 "Grandstander",sans-serif;pointer-events:none}
.tp-progress img{width:20px;height:20px;object-fit:contain}
/* locks + counts always readable (Mac, 10/24): smaller, the lock tucked into the count pill, drawn above every sign */
.tp-locked{z-index:6}
.tp-lock{width:clamp(22px,2.4vw,30px);top:auto;bottom:calc(-7px + clamp(16px,1.6vw,20px));translate:-50% -55%;z-index:8;border-width:2px;box-shadow:0 2px 0 #b79ad6,0 4px 8px #2a103455}
.tp-progress{z-index:8;bottom:-6px;gap:2px;padding:2px 6px;font-size:clamp(10px,1vw,13px);border-width:1.5px}
.tp-progress img{width:14px;height:14px}
body[data-daylight=night] .tp-progress,body:is(.night-time,.calm-mode):not(.sq-newplayer) .tp-progress{background:#2c2347;color:#f3e8ff;border-color:#5b4b8a;box-shadow:0 3px 6px #0007}
body[data-daylight=night] .tp-lock,body:is(.night-time,.calm-mode):not(.sq-newplayer) .tp-lock{background:linear-gradient(#4d3f7a,#2c2347);border-color:#8c78c8;color:#e7d8ff;box-shadow:0 2px 0 #140e27,0 4px 8px #0007}
.tp-lots>.tp-shop.tp-locked{z-index:150!important}
