<!-- SOLID CITY · part 2082 -->
: science grown into beautiful art — golden-ratio setbacks,
 * symmetrical crowns, the skyline a composition.
 * True names: THE HYPER CITY (district), THE HYPER SPIRE.
 * Self-contained ES module. Local frame: +X = east (city side), -X = west (ocean).
 */
/* RECOVERED + STRETCHED (2026-10-13, the King's word: "put that somewhere and stretch the skyline").
 * This is the Hyper City exactly as first built on 2026-10-11 — before the 2-stories
 * interiors, before retail, before the harbor — recovered from hyper-city.js.bak-interior-20261011
 * and stretched x2 along the shore as THE FIRST CITY. Tower craft unchanged. */
function mulberry(a){return function(){a|=0;a=a+0x6D2B79F5|0;var t=Math.imul(a^a>>>15,1|a);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296;};}
function textPlate(T, text, w){
  var c=document.createElement('canvas');c.width=512;c.height=128;
  var g=c.getContext('2d');
  g.fillStyle='#101418';g.fillRect(0,0,512,128);
  g.strokeStyle='#d8aa48';g.lineWidth=5;g.strokeRect(7,7,498,114);
  g.fillStyle='#e8c86a';g.textAlign='center';g.textBaseline='middle';
  g.font='bold 46px Georgia,serif';g.fillText(text,256,66);
  var t=new T.CanvasTexture(c);t.encoding=T.sRGBEncoding;t.anisotropy=4;return t;
}
function quietMarker(T,text){
  var grp=new T.Group();
  var stone=new T.Mesh(new T.BoxGeometry(4.4,0.6,2.2),new T.MeshLambertMaterial({color:0x1e2228}));
  stone.position.y=0.65;stone.rotation.x=-0.45;grp.add(stone);
  var face=new T.Mesh(new T.PlaneGeometry(4.0,1.0),new T.MeshBasicMaterial({map:textPlate(T,text)}));
  face.position.set(0,0.88,0.52);face.rotation.x=-0.45;grp.add(face);
  var base=new T.Mesh(new T.BoxGeometry(4.6,0.3,2.4),new T.MeshLambertMaterial({color:0x14171c}));
  base.position.y=0.15;grp.add(base);
  return grp;
}
// glass facade texture: daytime reflective blue-glass with window grid
function facadeTex(T, tint){
  var c=document.createElement('canvas');c.width=128;c.height=256;
  var g=c.getContext('2d');
  var gr=g.createLinearGradient(0,0,0,256);
  gr.addColorStop(0,'#9fc4e8');gr.addColorStop(0.5,'#7aa8d8');gr.addColorStop(1,'#5a88c0');
  g.fillStyle=gr;g.fillRect(0,0,128,256);
  g.fillStyle=tint||'rgba(20,40,70,0.55)';
  for(var y=6;y<256;y+=14)for(var x=4;x<128;x+=12){ g.fillRect(x,y,8,9); }
  g.fillStyle='rgba(255,255,255,0.25)';
  for(var y2=6;y2<256;y2+=14)for(var x2=4;x2<128;x2+=12){ g.fillRect(x2,y2,8,2); }
  var t=new T.CanvasTexture(c);t.encoding=T.sRGBEncoding;
  t.wrapS=t.wrapT=T.RepeatWrapping;return t;
}
export function createHyperCityFirst(o){
  var T=o.THREE,P=o.position||{x:0,y:0,z:0};
  var root=new T.Group();root.name='hyper-city';root.position.set(P.x,P.y,P.z);
  var foot=[];
  var R=mulberry(1379);
  var PHI=1.6180339887;
  // materials
  var glassA=new T.MeshLambertMaterial({map:facadeTex(T),emissive:0x1a2a40,emissiveIntensity:0.35});
  var glassB=new T.MeshLambertMaterial({map:facadeTex(T,'rgba(30,50,80,0.5)'),emissive:0x16263c,emissiveIntensity:0.35});
  var steel=new T.MeshLambertMaterial({color:0x3a4048});
  var darkSteel=new T.MeshLambertMaterial({color:0x23272e});
  var gold=new T.MeshLambertMaterial({color:0xd8aa48,emissive:0x4a2e08,emissiveIntensity:0.7});
  var deckM=new T.MeshLambertMaterial({color:0x2c313a});
  var roadM=new T.MeshLambertMaterial({color:0x1e2228});
  var goldTrim=new T.MeshBasicMaterial({color:0xd8aa48});

  // ---- podium: the district platform (420 x 380), skirted ----
  var pod=new T.Mesh(new T.BoxGeometry(420,10,760),deckM);
  pod.position.y=-5;root.add(pod);
  var podRim=new T.Mesh(new T.BoxGeometry(424,1.2,764),steel);
  podRim.position.y=0.1;root.add(podRim);
  foot.push([0,0,424,764,-10,0.4,0]); // walkable top is implicit (podium); block below

  // ---- streets: grid avenues (visual strips on the podium) ----
  var i;
  for(i=-3;i<=3;i+=2){
    var av=new T.Mesh(new T.BoxGeometry(420,0.3,14),roadM);
    av.position.set(0,0.35,i*90);root.add(av);
  }
  for(i=-1;i<=1;i++){
    var av2=new T.Mesh(new T.BoxGeometry(14,0.3,760),roadM);
    av2.position.set(i*110,0.35,0);root.add(av2);
  }
  // streetlights along avenues
  var lampG=new T.CylinderGeometry(0.3,0.4,9,6);
  var lampM=new T.MeshLambertMaterial({color:0x444a54});
  var bulbM=new T.MeshBasicMaterial({color:0xffe8a0});
  for(i=-3;i<=3;i++){
    [-135,-45,45,135].forEach(function(z){
      var lx=i*60;
      if(Math.abs(lx)<25&&Math.abs(z)<25)return; // not in plaza
      var pole=new T.Mesh(lampG,lampM);pole.position.set(lx,4.5,z);root.add(pole);
      var bulb=new T.Mesh(new T.SphereGeometry(0.7,8,6),bulbM);bulb.position.set(lx,9.2,z);root.add(bulb);
      foot.push([lx,z,1,1,0,9,0]);
    });
    [-100,0,100].forEach(function(x){
      var lz=i*60;
      if(Math.abs(x)<25&&Math.abs(lz)<25)return;
      var pole2=new T.Mesh(lampG,lampM);pole2.position.set(x,4.5,lz);root.add(pole2);
      var bulb2=new T.Mesh(new T.SphereGeometry(0.7,8,6),bulbM);bulb2.position.set(x,9.2,lz);root.add(bulb2);
      foot.push([x,lz,1,1,0,9,