<!-- SOLID CITY · part 3394 -->
ntListener("pointerleave",i=>{i.pointerType==="mouse"&&(Oe.mouse=null)});uc.addEventListener("pointerdown",i=>{i.pointerType==="mouse"&&i.button===0&&(Oe.mouseFire=!0)});addEventListener("pointerup",i=>{i.pointerType==="mouse"&&(Oe.mouseFire=!1)});document.addEventListener("touchmove",i=>{i.target.closest&&i.target.closest(".scroll")||i.preventDefault()},{passive:!1});document.addEventListener("gesturestart",i=>i.preventDefault());document.addEventListener("visibilitychange",()=>{document.hidden?(Oe.keys={},Oe.fire=Oe.boost=!1,ct.ctx&&ct.ctx.suspend()):ct.ctx&&y.running&&ct.ctx.resume()});function Gv(i){let e=Oe.keys,t=Oe.stickX,n=Oe.stickY;if((e.KeyA||e.ArrowLeft)&&(t-=1),(e.KeyD||e.ArrowRight)&&(t+=1),(e.KeyW||e.ArrowUp)&&(n+=1),(e.KeyS||e.ArrowDown)&&(n-=1),Oe.mouseAim&&Oe.mouse&&!Qn&&(y.phase==="battle"||y.phase==="return"||y.phase==="climb")){let o=Oe.mouse.x,l=Oe.mouse.y-.1;t+=Math.sign(o)*ht((Math.abs(o)-.07)/.55,0,1),n+=Math.sign(l)*ht((Math.abs(l)-.07)/.5,0,1)}let s=!!(Oe.fire||e.Space||Oe.mouseFire),r=!!(Oe.boost||e.ShiftLeft||e.ShiftRight);if(Pa.on){let a=xy();t=a.x,n=a.y,s=a.fire,r=a.boost}t=ht(t,-1,1),n=ht(n,-1,1),Oe.x=Yt(Oe.x,t,10,i),Oe.y=Yt(Oe.y,n,10,i),Oe.firing=s,Oe.boosting=r}function jn(i){y.phase=i,y.phaseT=0,document.body.dataset.phase=i}function ap(){y.pos.set(0,_s,0),y.yaw=Zf,y.pitch=0,y.roll=0,y.speed=0,y.vUp=0,y.boostMeter=1,y.shields=100,y.kills=0,y.hits=0,y.wave=0,y.runT=0,y.topSpeed=0,y.heat=0,y.lock=null,y.invuln=0,y.slowT=0,y.landing=null,y.homeShown=!1,y.result=null,y.saved=null,y.shots=0,gn.visible=!0,Zi.visible=!1,On.init=!1}function _u(){Hn.forEach(i=>{et.remove(i.mesh),i.hull.dispose()}),Hn.length=0,pc.forEach(i=>{i.on=!1}),mc.forEach(i=>{i.on=!1}),ap(),jn("pad"),Lt("result").hidden=!0,Lt("hud").hidden=!1,Ne["b-launch"].hidden=!1,Ne["h-mother"].hidden=!0,Ne["h-count"].hidden=!0,Bn("THE HANGAR PAD",Qn?"Tap LAUNCH to blast off":"Click LAUNCH or press Space",4)}var lu=0;function xc(){y.phase==="pad"&&(_c(),Ne["b-launch"].hidden=!0,jn("count"),lu=4,Ne["h-count"].hidden=!1)}function Wv(){jn("battle"),y.wave=0,y.waveT=1.2,Bn("SPACE","Alien fleet detected \xB7 hit them down",3.2),In("alarm")}function Xv(i){y.wave=i;let e=_n(new $e,y.yaw,0),t=new $e(-e.z,0,e.x),n=y.pos;y.checkpoint={pos:n.clone(),yaw:y.yaw};let s=(r,a)=>{let o=tp(r);return o.pos.copy(a),o.vel.copy(n).sub(a).normalize().multiplyScalar(o.vmax*.5),o.mesh.position.copy(o.pos),Hn.push(o),o};if(i===1){for(let r=0;r<6;r++){let a=Math.floor((r+1)/2),o=r===0?0:r%2?1:-1;s("scout",Je.copy(n).addScaledVector(e,1500+a*70).addScaledVector(t,o*a*55).add(Nt.set(0,60-a*10,0))).fireT=3+r*.5}Bn("WAVE 1 / 3","SWOOPERS \xB7 hold FIRE, aim close",3)}else if(i===2){for(let r=0;r<6;r++){let a=s("circler",Je.copy(n).addScaledVector(e,Math.cos(r*1.047)*700+400).addScaledVector(t,Math.sin(r*1.047)*700).add(Nt.set(0,r%2?80:-60,0)));a.orbit=r*1.047,a.fireT=2.5+r*.6}Bn("WAVE 2 / 3","CIRCLERS \xB7 they orbit you \xB7 turn and burn",3)}else{s("mother",Je.copy(n).addScaledVector(e,1300).add(Nt.set(0,120,0))).fireT=4;for(let r=0;r<4;r++){let a=s("diver",Je.copy(n).addScaledVector(e,1100).addScaledVector(t,(r-1.5)*160).add(Nt.set(0,200,0)));a.mode="hold",a.modeT=2+r*1.6}Bn("WAVE 3 / 3","MOTHERSHIP + DIVERS \xB7 take it down",3.2),Ne["h-mother"].hidden=!1}In("alarm")}function qv(){jn("return"),Ne["h-mother"].hidden=!0,y.homeShown=!0,Bn("RETURN HOME","All aliens down \xB7 follow the arrow, dive through re-entry",4.5),In("chime")}function Yv(){jn("landing");let i=_n(Je);y.landing={hv:new $e(i.x,0,i.z).multiplyScalar(y.speed),vy:i.y*y.speed},Bn("LANDING MODE",Qn?"Hover onto the glowing circle \xB7 stick steers":"Hover onto the glowing circle \xB7 WASD steers",3.2),In("zap")}function Zv(){jn("parked"),y.speed=0,y.pos.y=_s,y.pitch=0,y.roll=0,Zi.visible=!1,Bn("PARKED","Welcome home, pilot",2.2),In("chime"),y.result={timeMs:Math.round(y.runT*1e3),kills:y.kills,hits:y.hits,top:Math.round(y.topSpeed*xs)},setTimeout(()=>_y(y.result),1500)}function op(i,e){y.invuln>0||y.phase!=="battle"||Pa.god||(y.shields=Math.max(0,y.shields-i),y.hits++,y.hurt=1,y.shake=Math.max(y.shake,.9),y.slowT=1.1,y.sinceHit=0,$t.shield.material.opacity=.55,In("ouch"),e&&ip(e,Bt.green),y.shields<=0&&(oc(y.pos.clone(),1.4,Bt.red),In("bigboom"),gn.visible=!1,jn("respawn"),y.respawns=(y.respawns||0)+1,Bn("SHIELDS DOWN","Respawning at the last checkpoint\u2026",2.4)))}var lp=new $e(0,_s,0);function Jv(i){y.t+=i,y.phaseT+=i,Dt.time.value+=i,Gv(i);let e=y.phase;if((e==="climb"||e==="battle"||e==="return"||e==="landing"||e==="respawn")&&(y.runT+=i),e==="count"){let n=Math.ceil(3-y.phaseT);n!==lu&&(lu=n,Ne["h-count"].textContent=n>0?String(n):"GO",Ne["h-count"].classList.remove("pop"),Ne["h-count"].offsetWidth,Ne["h-count"].classList.add("pop"),In(n>0?"beep":"go")),y.shake=Math.max(y.shake,.1+y.phaseT*.08),y.phaseT>3.25&&(Ne["h-count"].hidden=!0,jn("climb"),y.vUp=0,Bn("BLAST OFF","Climb through the clouds into space",2.5))}if(e==="climb")$v(i);else if(e==="battl