<!-- SOLID CITY · part 3704 -->
</div>
      </section>
    </aside>
  </main>

  <footer class="console">
    <div class="crewline"><strong id="ownershipSummary">YOU 0 · AI 4</strong><span id="handoffText">All stations crewed. Independent control channels nominal.</span></div>
    <div class="console-actions"><button class="flat" id="eventBtn" type="button">EVENTS</button><button class="flat" id="statsBtn" type="button">STATS</button></div>
  </footer>
</div>

<div class="overlay" id="briefing">
  <div class="card">
    <p style="margin:0 0 8px;font:800 11px ui-monospace,monospace;color:var(--cyan)">MERIDIAN RUN · COMMAND BRIEFING</p>
    <h1>Break the blockade.<br>Bring the ship home.</h1>
    <p>Your AI crew already holds every station. Take only what you want: the helm, either four-gun battery, or defense. The crew continues fighting everywhere else.</p>
    <div class="brief-grid">
      <div class="brief"><b>One touch takes command</b><span>Ownership changes instantly. Other AI stations continue uninterrupted.</span></div>
      <div class="brief"><b>Two independent batteries</b><span>Battery A and B select and fire on different threats.</span></div>
      <div class="brief"><b>Arrival wins the mission</b><span>Keep moving toward Meridian Gate through four hostile waves.</span></div>
      <div class="brief"><b>Advice never overrides</b><span>AI warnings are visible, but your active station remains yours.</span></div>
    </div>
    <button class="deploy" id="deployBtn" type="button">DEPLOY WARSHIP</button>
  </div>
</div>

<div class="overlay" id="pauseOverlay" hidden>
  <div class="card pause-card" role="dialog" aria-modal="true" aria-labelledby="pauseTitle">
    <h2 id="pauseTitle">Game paused.</h2>
    <div class="pause-actions">
      <button class="pause-action" id="resumeBtn" type="button">RESUME</button>
      <a class="pause-action" href="/city/?back=strike">QUIT TO CITY</a>
    </div>
  </div>
</div>

<div class="modal" id="statsModal" hidden>
  <div class="modal-panel">
    <div class="modal-head"><h2>Event-derived combat STATS</h2><button class="close" data-close="statsModal" type="button" aria-label="Close">×</button></div>
    <div class="stats-grid" id="statsGrid"></div>
    <div class="tables"><section><h3>BATTERY PERFORMANCE</h3><div id="batteryStats"></div><h3>METHOD</h3><p class="evidence">Every value is reduced from the in-session event ledger below. Shots are recorded per shell (four per salvo); hits only when a shell intersects a live threat; handoff latency is measured with <code>performance.now()</code>. No displayed number is simulated narration.</p></section><section><h3>RECENT EVIDENCE</h3><div class="log" id="statsLog"></div></section></div>
  </div>
</div>
<div class="modal" id="eventsModal" hidden>
  <div class="modal-panel"><div class="modal-head"><h2>Coordination & interference log</h2><button class="close" data-close="eventsModal" type="button" aria-label="Close">×</button></div><p class="evidence">Accepted ownership changes, safe handoffs, and any rejected stale, duplicated, delayed, disconnected, or overloaded commands appear here. AI advisories use a separate channel and cannot actuate human-held stations.</p><div class="log" id="coordLog"></div></div>
</div>
<div class="overlay" id="debrief" hidden><div class="card"><p style="margin:0 0 8px;font:800 11px ui-monospace,monospace;color:var(--cyan)" id="resultKicker">MISSION COMPLETE</p><h2 id="resultTitle">Meridian Gate reached.</h2><p id="resultText"></p><div class="stats-grid" id="resultStats"></div><button class="deploy" id="againBtn" type="button">FLY AGAIN</button></div></div>

<script>
(function(){
'use strict';
/* Reuse seam: ControlCoordination knows nothing about ships. Swarm can register
   unit tasks, Rescue can register protection/extraction, and Siege can register
   emplacements. The game only consumes claim/release/command/advisory events. */
class ControlCoordination{
  constructor(names,emit){this.emit=emit;this.tasks={};this.seen=new Set();this.queue=[];names.forEach(n=>this.tasks[n]={owner:'ai',epoch:1,status:'ACTIVE',claimedAt:0});this.connected=true;}
  claim(name){const t=this.tasks[name],start=performance.now();if(paused||ended||!t)return;t.owner='human';t.epoch++;t.status='ACTIVE';t.claimedAt=start;this.emit('ownership',{task:name,owner:'human',epoch:t.epoch});const latency=performance.now()-start;this.emit('handoff',{task:name,to:'human',latency:+latency.toFixed(2),epoch:t.epoch});return t.epoch;}
  release(name){const t=this.tasks[name];if(paused||ended||!t||t.owner!=='human')return;t.status='HANDOFF';const epoch=++t.epoch,start=gameClock;this.emit('handoff_start',{task:name,to:'ai',epoch});const complete=()=>{if(ended)return;const activeElapsed=gameClock-start;if(paused||activeElapsed<72){setTimeout(complete,16);return;}if(t.epoch!==epoch||t.owner!=='human'){this.emit('command_rejected',{task:name,reason:'interrupted handoff',epoch});return;}t.owner='ai';t.status='ACTIVE';this.emit('ownersh