<!-- SOLID CITY · part 3172 -->
sePath();ctx.fill();ctx.stroke();ctx.fillStyle='#f0ad31';ctx.fillRect(-24,-7,5,4);ctx.fillRect(-24,3,5,4);if(state.aegisBurst>0){ctx.strokeStyle='rgba(56,225,211,.8)';ctx.lineWidth=3;ctx.beginPath();ctx.ellipse(0,0,50,28,0,0,Math.PI*2);ctx.stroke()}ctx.restore();
    // projectiles
    state.shots.forEach(function(s){ctx.strokeStyle=s.kind==='bombard'?'#ffb43b':'#4bf1e5';ctx.lineWidth=s.kind==='bombard'?4:2;ctx.beginPath();ctx.moveTo((s.x-.018)*W,s.y*H);ctx.lineTo(s.x*W,s.y*H);ctx.stroke()});
    state.enemyShots.forEach(function(s){ctx.strokeStyle='#ff5038';ctx.lineWidth=2;ctx.beginPath();ctx.moveTo((s.x+.012)*W,s.y*H);ctx.lineTo(s.x*W,s.y*H);ctx.stroke()});
    state.particles.forEach(function(p){ctx.globalAlpha=Math.max(0,1-p.t/p.d);ctx.fillStyle=p.c;ctx.fillRect(p.x*W,p.y*H,3,3)});ctx.globalAlpha=1;
    // fleet bars
    bar(12,H-12,Math.min(180,W*.25),5,state.ship.hp/state.ship.max,'#ff5a43');bar(12,H-20,Math.min(180,W*.25),4,state.ship.shield/state.ship.maxShield,'#35d5cb');
  }
  function drawTarget(t){if(!t.alive)return;var x=t.x*W,y=t.y*H,isSel=t===selectedTarget,r=t.type==='core'?18:t.type==='heart'?14:t.type==='generator'?11:8;ctx.save();ctx.translate(x,y);if(isSel){ctx.strokeStyle='#fff';ctx.lineWidth=1;ctx.beginPath();ctx.arc(0,0,r+7+Math.sin(state.targetPulse*5)*2,0,Math.PI*2);ctx.stroke()}
    if(t.type==='turret'){ctx.rotate(t.angle);ctx.fillStyle='#d84b36';ctx.fillRect(-6,-6,12,12);ctx.fillStyle='#ffb33b';ctx.fillRect(3,-2,10,4)}
    else if(t.type==='generator'){ctx.rotate(state.time);ctx.strokeStyle='#36d9cc';ctx.lineWidth=3;ctx.strokeRect(-8,-8,16,16);ctx.fillStyle='#b8fff8';ctx.fillRect(-3,-3,6,6)}
    else if(t.type==='heart'){var hp2=Math.sin(state.time*4)*2;ctx.fillStyle='#f0ae31';ctx.beginPath();ctx.arc(0,0,13,0,Math.PI*2);ctx.fill();ctx.fillStyle='#ff5a2a';ctx.beginPath();ctx.arc(0,0,6+hp2*.6,0,Math.PI*2);ctx.fill();ctx.strokeStyle='#ffe9b0';ctx.lineWidth=2;ctx.beginPath();ctx.arc(0,0,17+hp2,0,Math.PI*2);ctx.stroke()}
    else{ctx.fillStyle='#e6a62d';ctx.beginPath();ctx.arc(0,0,r,0,Math.PI*2);ctx.fill();ctx.strokeStyle='#fff2bf';ctx.lineWidth=3;ctx.beginPath();ctx.arc(0,0,r+5+Math.sin(state.time*3)*3,0,Math.PI*2);ctx.stroke()}
    ctx.restore();bar(x-r,y+r+7,r*2,3,t.hp/t.max,t.type==='generator'?'#36d9cc':'#ff5a43');}
  function bar(x,y,w,h,p,c){ctx.fillStyle='rgba(255,255,255,.15)';ctx.fillRect(x,y,w,h);ctx.fillStyle=c;ctx.fillRect(x,y,Math.max(0,w*p),h);}
  function loop(ts){if(!state||!state.running||state.paused)return;var dt=Math.min(.05,(ts-last)/1000||.016);last=ts;resize();update(dt);draw();if(state&&state.running&&!state.paused)raf=requestAnimationFrame(loop);}
  function updateHud(){
    var p=state.summit?summitData[state.summitPhase]:phaseData[state.phase],alive=state.targets.filter(function(t){return t.alive}).length,total=p.count,progress=(total-alive)/total*100;document.getElementById('objective').textContent=p.objective;document.getElementById('objectiveMeter').style.width=progress+'%';document.getElementById('targetCount').innerHTML=alive+' / '+total+' <small>ACTIVE</small>';var strength=Math.max(0,Math.round(((state.ship.hp/state.ship.max)*.75+(state.wings/state.maxWings)*.25)*100));document.getElementById('fleetStrength').textContent=strength+'%';document.getElementById('fleetMeter').style.width=strength+'%';document.getElementById('siegeClock').textContent=fmt(state.time);document.getElementById('phaseLabel').textContent=(state.summit?'SUMMIT · ':'PHASE '+(state.phase+1)+' · ')+p.name;document.getElementById('phaseText').textContent=p.text;var maxEpoch=Math.max.apply(null,Object.keys(tasks).map(function(k){return tasks[k].epoch}));document.getElementById('epochReadout').textContent='4 TASKS · EPOCH '+maxEpoch;
    var lag=performance.now()-lastSignal,ok=lag<500;document.getElementById('signalText').textContent=ok?'LINK NOMINAL':'LINK DEGRADED';document.getElementById('signalDot').style.background=ok?'var(--good)':'var(--hot)';
    updateStanceBar();
  }
  function updateStations(){Object.keys(tasks).forEach(function(k){var t=tasks[k],el=document.getElementById('station-'+k),owner=el.querySelector('.owner'),btn=el.querySelector('.claim'),c=el.querySelector('[data-controls]');el.classList.toggle('human',t.owner==='HUMAN');owner.textContent=t.owner==='HUMAN'?'HUMAN · EPOCH '+t.epoch:'AI · '+t.admiral;btn.textContent=t.owner==='HUMAN'?'RELEASE TO AI':'TAKE CONTROL';c.innerHTML='';if(t.owner!=='HUMAN'){c.innerHTML='<span class="label">AUTO</span>';return;}if(k==='fleet')c.innerHTML='<div class="dpad"><button class="control up" data-move="0,-.035">▲</button><button class="control left" data-move="-.035,0">◀</button><button class="control down" data-move="0,.035">▼</button><button class="control right" data-move=".035,0">▶</button></div>';if(k==='bombard')c.innerHTML='<button class="control fire" data-action="fire">FIRE</button>';if(k==='wings')c.innerHTML='<button class="control" data-action="formation">'+state.formation+'</button><but