<!-- SOLID CITY · part 3186 -->
h.min(2,window.devicePixelRatio||1),W=0,H=0,last=0,raf=0;
  var tasks={
    fleet:{owner:'AI',epoch:1,admiral:'ADMIRAL RHEA'},
    bombard:{owner:'AI',epoch:1,admiral:'ADMIRAL VELA'},
    wings:{owner:'AI',epoch:1,admiral:'MARSHAL KITE'},
    aegis:{owner:'AI',epoch:1,admiral:'WARDEN SOL'}
  };
  var state,events=[],sessionStart=0,lastSignal=0,selectedTarget=null,nextId=1,stars=[];
  var phaseData=[
    {name:'SILENCE THE RING',objective:'Outer turret ring',text:'Destroy all outer turrets before the fleet is broken.',count:8,hp:34,type:'turret'},
    {name:'SHATTER THE SHIELD',objective:'Shield generators',text:'Punch through four generators while interceptor wings close in.',count:4,hp:72,type:'generator'},
    {name:'BREACH THE CORE',objective:'Fortress core',text:'The core is exposed. Commit everything to the final breach.',count:1,hp:360,type:'core'}
  ];
  function initialState(){return {running:false,ended:false,won:false,phase:0,time:0,ship:{x:.18,y:.52,hp:420,max:420,shield:180,maxShield:180,vx:0,vy:0},wings:12,maxWings:12,targets:[],shots:[],enemyShots:[],particles:[],targetPulse:0,bombardCooldown:0,wingCooldown:0,enemyCooldown:1.5,aegisBurst:0,formation:'SCREEN',killsBy:{HUMAN:0,AI:0},fps:0,frameSamples:[],lastInput:0};}
  function record(type,data){events.push(Object.assign({id:nextId++,type:type,t:state?state.time:0,at:performance.now()},data||{}));if(events.length>600)events.shift();updateTicker(type,data||{});}
  function fmt(t){var m=Math.floor(t/60),s=Math.floor(t%60);return String(m).padStart(2,'0')+':'+String(s).padStart(2,'0');}
  function spawnPhase(){
    var p=phaseData[state.phase];state.targets=[];selectedTarget=null;
    for(var i=0;i<p.count;i++){
      var a=(Math.PI*2*i/p.count)-Math.PI/2,rad=p.type==='turret'?.23:p.type==='generator'?.15:0;
      state.targets.push({id:nextId++,type:p.type,x:.73+Math.cos(a)*rad,y:.5+Math.sin(a)*rad,hp:p.hp,max:p.hp,alive:true,angle:a});
    }
    record('PHASE_STARTED',{phase:state.phase+1,label:p.name});
    advise(state.phase===0?'Outer ring acquired. I can hold bombardment unless you claim it.':state.phase===1?'Shield harmonics located. Generators are vulnerable after each cannon strike.':'Core exposed. Fortress reinforcements inbound — commit all stations.',state.phase===2);
  }
  function startGame(){
    state=initialState();events=[];nextId=1;sessionStart=performance.now();state.running=true;spawnPhase();record('SIEGE_STARTED',{});document.getElementById('intro').classList.add('hidden');document.getElementById('ending').classList.add('hidden');updateStations();last=performance.now();cancelAnimationFrame(raf);raf=requestAnimationFrame(loop);
  }
  function resize(){var r=canvas.getBoundingClientRect();DPR=Math.min(2,window.devicePixelRatio||1);W=Math.max(320,r.width);H=Math.max(280,r.height);canvas.width=Math.round(W*DPR);canvas.height=Math.round(H*DPR);ctx.setTransform(DPR,0,0,DPR,0,0);if(!stars.length){for(var i=0;i<150;i++)stars.push({x:Math.random(),y:Math.random(),s:.3+Math.random()*1.3,a:.25+Math.random()*.7});}}
  function addShot(from,to,kind,owner,damage){state.shots.push({x:from.x,y:from.y,tx:to.x,ty:to.y,t:0,d:kind==='bombard'?.7:.28,kind:kind,owner:owner,damage:damage,target:to});}
  function fireBombard(owner){
    if(state.bombardCooldown>0||!state.running)return;
    var t=selectedTarget&&selectedTarget.alive?selectedTarget:firstAlive();if(!t)return;
    state.bombardCooldown=1.65;addShot({x:state.ship.x+.03,y:state.ship.y},t,'bombard',owner,52);record('BOMBARDMENT_FIRED',{owner:owner,target:t.type,epoch:tasks.bombard.epoch});
  }
  function strikeWings(owner){
    if(state.wingCooldown>0||state.wings<=0||!state.running)return;
    var t=selectedTarget&&selectedTarget.alive?selectedTarget:firstAlive();if(!t)return;
    state.wingCooldown=.72;addShot({x:state.ship.x+.045,y:state.ship.y+.02},t,'wing',owner,9+Math.min(13,state.wings*.8));record('WING_STRIKE',{owner:owner,target:t.type,epoch:tasks.wings.epoch});
  }
  function firstAlive(){for(var i=0;i<state.targets.length;i++)if(state.targets[i].alive)return state.targets[i];return null;}
  function hitTarget(shot){
    var t=shot.target;if(!t||!t.alive)return;t.hp-=shot.damage;burst(t.x,t.y,shot.kind==='bombard'?'#ffb33b':'#2de2d5',shot.kind==='bombard'?18:7);
    if(shot.kind==='bombard')record('BOMBARDMENT_HIT',{owner:shot.owner,target:t.type,damage:shot.damage});
    if(t.hp<=0){t.hp=0;t.alive=false;record('TARGET_DESTROYED',{owner:shot.owner,target:t.type,phase:state.phase+1});advise((shot.owner==='HUMAN'?'Direct hit. ':'AI strike confirmed. ')+t.type.toUpperCase()+' destroyed.');checkPhase();}
  }
  function checkPhase(){
    if(state.targets.some(function(t){return t.alive}))return;
    record('PHASE_COMPLETED',{phase:state.phase+1,duration:state.time});
    if(state.phase===2){endGame(true);return;}
    state.phase++;state.ship.shield=Math.min(state.ship.maxShield,state.ship.shield+70);setTimeout(function(){if(state.running)spawnPhase()