<!-- SOLID CITY · part 1992 -->
         // its gold lip
  box(0.09, 1.15, 0.09, stone, -1.05, 0.75, -0.55);      // plate posts
  box(0.09, 1.15, 0.09, stone, 1.05, 0.75, -0.55);
  var plate = new T.Mesh(new T.PlaneGeometry(2.2, 0.55),
    new T.MeshBasicMaterial({ map: labelTex(name || 'HOVER BOARD', sub || 'THE FLEET · EST. 2026'), side: T.DoubleSide }));
  plate.position.set(0, 1.32, -0.55); g.add(plate);
  var jewel = new T.Mesh(new T.OctahedronGeometry(0.09), gold);
  jewel.position.set(0, 1.78, -0.55); g.add(jewel);
  g.userData.parts = { jewel: jewel };
  return g;
}

/* ---------------- the space ship's shape ----------------
 * A winged atmospheric ship in the house law: dark titanium hull,
 * brushed-silver wing, glass canopy, gold only as trim, and the teal
 * heart-glow underneath where the ground can see it. Her origin is
 * her gear line — the point her physics calls home. Span 9.6 m,
 * length 7 m: the core recipe's light craft (S 16 m²), drawn true. */
export function createSpaceShipMesh(T) {
  var g = new T.Group(); g.name = 'space-ship';
  var titanium = new T.MeshLambertMaterial({ color: 0x232c3d });
  var silver = new T.MeshLambertMaterial({ color: 0x9aa4b5 });
  var gold = new T.MeshLambertMaterial({ color: 0xd8a833, emissive: 0x332200 });
  var glow = new T.MeshBasicMaterial({ color: 0x2affd8 });
  var glass = new T.MeshLambertMaterial({ color: 0x7fc4d8, emissive: 0x14313a });
  function box(w, h, d, mat, x, y, z) {
    var m = new T.Mesh(new T.BoxGeometry(w, h, d), mat); m.position.set(x, y, z); g.add(m); return m;
  }
  box(1.6, 0.9, 5.6, titanium, 0, 1.15, 0);              // the hull
  box(1.0, 0.62, 1.5, titanium, 0, 1.08, 3.35);          // the nose
  box(0.9, 0.5, 1.7, glass, 0, 1.78, 0.9);               // the canopy — architectural glass
  box(9.6, 0.08, 1.5, silver, 0, 1.05, 0.2);             // the wing
  box(0.5, 0.10, 1.5, gold, -4.65, 1.05, 0.2);           // gold wingtips
  box(0.5, 0.10, 1.5, gold, 4.65, 1.05, 0.2);
  box(0.08, 1.15, 1.0, titanium, 0, 2.0, -2.85);         // the fin
  box(0.10, 0.22, 1.0, gold, 0, 2.62, -2.85);            // the fin's gold crown
  box(3.2, 0.07, 0.9, silver, 0, 1.35, -2.9);            // the tailplane
  box(1.2, 0.06, 3.8, glow, 0, 0.64, 0);                 // the heart-glow, worn underneath
  var engine = new T.Mesh(new T.OctahedronGeometry(0.30), glow);
  engine.position.set(0, 1.15, -3.05); g.add(engine);   // the engine jewel
  box(0.18, 0.55, 3.4, silver, -0.7, 0.28, 0);           // the skids
  box(0.18, 0.55, 3.4, silver, 0.7, 0.28, 0);
  var jewel = new T.Mesh(new T.OctahedronGeometry(0.09), gold);
  jewel.position.set(0, 1.95, 3.35); g.add(jewel);       // the nose jewel
  g.userData.parts = { glow: glow, engine: engine };
  return g;
}

/* ---------------- the berth she waits on ----------------
 * Not a plinth — a ship is not racked. A gold ring on the apron,
 * four corner posts, and her name on a plate. */
export function createShipBerth(T, labelTex) {
  var g = new T.Group(); g.name = 'ship-berth';
  var dark = new T.MeshLambertMaterial({ color: 0x232c3d });
  var gold = new T.MeshLambertMaterial({ color: 0xd8a833, emissive: 0x332200 });
  var stone = new T.MeshLambertMaterial({ color: 0x8f96a3 });
  function box(w, h, d, mat, x, y, z) {
    var m = new T.Mesh(new T.BoxGeometry(w, h, d), mat); m.position.set(x, y, z); g.add(m); return m;
  }
  var ring = new T.Mesh(new T.TorusGeometry(7.2, 0.07, 8, 48), gold);
  ring.rotation.x = Math.PI / 2; ring.position.set(0, 0.06, 0); g.add(ring); // lying flat on the apron
  [[-6.4, -6.4], [6.4, -6.4], [-6.4, 6.4], [6.4, 6.4]].forEach(function (c) { box(0.14, 0.9, 0.14, stone, c[0], 0.45, c[1]); });
  box(0.09, 1.15, 0.09, stone, -1.05, 0.75, -7.6);
  box(0.09, 1.15, 0.09, stone, 1.05, 0.75, -7.6);
  var plate = new T.Mesh(new T.PlaneGeometry(2.2, 0.55),
    new T.MeshBasicMaterial({ map: labelTex('SPACE SHIP', 'BERTH 1 · THE FLEET'), side: T.DoubleSide }));
  plate.position.set(0, 1.32, -7.6); g.add(plate);
  var jewel = new T.Mesh(new T.OctahedronGeometry(0.09), gold);
  jewel.position.set(0, 1.78, -7.6); g.add(jewel);
  g.userData.parts = { jewel: jewel };
  return g;
}

/* ---------------- the ship's flight-state machine ----------------
 * VECTOR's correction 4, built around his FLIGHT stepper, which stays
 * unmodified inside the core. The core flies the air; this machine
 * owns the ground and the law between:
 *
 *   PARKED -> LAUNCH -> FREE_FLIGHT <-> ASSISTED_FLIGHT -> APPROACH
 *          -> FLARE -> LANDING -> PARKED, and EMERGENCY_RECOVERY from any
 *          airborne state — a go-around first (the pilot's answer),
 *          a settle where she can only if the sky refuses her thrice.
 *
 * Two honesties are kept. (1) TRANSACTIONAL POSITION: the core mutates
 * attitude before its sweep can refuse (VECTOR named this defect
 * himself); velocity it assigns only after the sweep passes. So the
 * machine snapshots position and velocity before each frame's steps
 * and re