<!-- SOLID CITY · part 2088 -->
r 'HYPER CITY', a Hyper Controller stop,
   and a Watch (GRAND TOUR) caption. */
(function () {
'use strict';
if (!window.SC || !SC.api) return;
var A = SC.api, S = A.S;
var POS = { x: -1300, z: -150 };
var M = { state: 'idle', group: null, wait: 7.0, gy: 20, said: false };
function sampleGround() {
  var g = (typeof groundAt === 'function') ? groundAt : null;
  if (!g) return 20;
  var max = -1000, h, ix, iz;
  for (ix = -3; ix <= 3; ix++) for (iz = -3; iz <= 3; iz++) {
    try { h = g(POS.x + ix * 70, POS.z + iz * 70); } catch (e) { h = 20; }
    if (h > max) max = h;
  }
  return max + 1.0;
}
function addBox(cx, cz, w, d, rot, y0, y1) {
  var nx = Math.max(1, Math.ceil(w / 2.5)), nz = Math.max(1, Math.ceil(d / 2.5)), cw = w / nx, cd = d / nz, c = Math.cos(rot), s = Math.sin(rot);
  var hx = cw / 2 * Math.abs(c) + cd / 2 * Math.abs(s), hz = cw / 2 * Math.abs(s) + cd / 2 * Math.abs(c);
  for (var i = 0; i < nx; i++) for (var j = 0; j < nz; j++) {
    var ox = -w / 2 + cw * (i + 0.5), oz = -d / 2 + cd * (j + 0.5), lx = cx + ox * c + oz * s, lz = cz - ox * s + oz * c;
    A.solids.push({ x0: POS.x + lx - hx, x1: POS.x + lx + hx, z0: POS.z + lz - hz, z1: POS.z + lz + hz, y0: M.gy + y0, y1: M.gy + y1, hyperCity: true });
  }
}
function collide(ud) { (ud.footprint || []).forEach(function (b) { addBox(b[0], b[1], b[2], b[3], b[6] || 0, b[4], b[5]); }); }
function hyperStop() {
  var H = window.CityHyper; if (!H || !H.pois || H.pois.some(function (p) { return p.id === 'hyper-city'; })) return;
  H.pois.push({ id: 'hyper-city', name: 'The Hyper City', short: 'HYPER CITY', x: POS.x, z: POS.z, stand: { x: POS.x + 260, z: POS.z },
    alias: 'hyper city megatowers towers downtown skyscrapers waterfront',
    text: 'The Hyper City, on the west coast: twenty-four megatowers and the 460-meter Hyper Spire. A new downtown rising from the shore.' });
  if (H.regrid) H.regrid();
}
function watchStop() {
  var W = window.CityWatch, r = W && W.routes && W.routes.grand; if (!r || r._hypercity) return;
  var orig = r.build; r._hypercity = true;
  r.build = function () {
    var w = orig.apply(this, arguments);
    w.push({ x: POS.x + 320, z: POS.z, y: M.gy + 420, v: 200, cap: { cap: 'THE HYPER CITY', sub: 'A new downtown on the west coast', say: 'The Hyper City: twenty-four megatowers, the Hyper Spire at four hundred sixty meters, and the waterfront.' }, agl: false });
    return w;
  };
}
function load() {
  M.state = 'loading';
  M.gy = sampleGround();
  var p; try { p = import('/city/hyper-city.js?v=20261011a'); } catch (e) { p = Promise.reject(e); }
  p.then(function (mod) {
    var make = mod.createHyperCity || mod.default;
    var g = make({ THREE: A.T, position: { x: POS.x, y: M.gy, z: POS.z } });
    A.world.add(g); M.group = g; M.state = 'ready';
    collide(g.userData || {}); hyperStop(); watchStop();
  }).catch(function (e) { M.state = 'failed'; try { console.warn('[city] Hyper City skipped:', e && e.message); } catch (x) {} });
}
function update(dt) {
  if (M.state === 'idle') { if (A.isBuilt && !A.isBuilt()) return; M.wait -= dt; if (M.wait <= 0) load(); return; }
  if (M.state !== 'ready' || document.hidden) return;
  var c = A.camera.position, d = Math.hypot(c.x + A.origin.x - POS.x, c.z + A.origin.z - POS.z);
  M.group.visible = d < 8000;
  if (d < 2500 && M.group.userData.update) try { M.group.userData.update(S.t, dt, A); } catch (e) {}
  if (S.mode === 'walk') {
    var pd = Math.hypot(S.p.x - POS.x, S.p.z - POS.z);
    if (pd < 240 && !M.said) { M.said = true; if (window.CityHyper && CityHyper.narrate) CityHyper.narrate('<b>The Hyper City</b>: twenty-four megatowers on the shore. The Spire stands four hundred sixty meters.', 9); }
    else if (pd > 500) M.said = false;
  }
}
function radar(g, blip, fl) { if (M.state === 'ready') blip(POS.x, POS.z, '#7ab8e8', fl ? 3 : 6, fl ? '' : 'HYPER CITY'); }
function standY(x, z) {
  if (M.state !== 'ready' || !M.group) return -1000;
  var fl = M.group.userData.standFloors; if (!fl) return -1000;
  var best = -1000;
  for (var i = 0; i < fl.length; i++) {
    var f = fl[i];
    var inside = false;
    if (f.cyl) {
      inside = Math.hypot(x - f.cx, z - f.cz) < f.r;
    } else {
      inside = x > f.x0 && x < f.x1 && z > f.z0 && z < f.z1;
    }
    // only count if player is at or slightly above the floor (not below it)
    if (inside && S.p.y > M.gy + f.y - 3 && M.gy + f.y > best) best = M.gy + f.y;
  }
  return best;
}
function actHere(x, z) {
  if (M.state !== 'ready' || !M.group) return null;
  try { return M.group.userData.actHere(x, z); } catch (e) { return null; }
}
function boardElevator() {
  if (M.state !== 'ready' || !M.group) return;
  try { M.group.userData.boardElevator(S.p.x, S.p.z); } catch (e) {}
}
window.CityHyperCity = { update: update, radar: radar, pos: POS, standY: standY, actHere: actHere, boardElevator: boardElevator, state: function () { return M.state; } };
})();


===== FILE: public/city/hyper-city-place.js.bak-