<!-- SOLID CITY · part 17 -->
(); }, 1000);
})();


===== FILE: public/city/ancestor-roads-place.js =====
/* Solid City — places THE ANCESTRAL ROADS (public/city/ancestor-roads.js) south of the capital.
   Lazy: imported after the city is built; any import/build error is caught and the city carries on.
   The terrace height adapts to the terrain at runtime: samples groundAt over the
   district, takes the max, and sets the platform above it. Permanent at load.
   Adds: collision (userData.footprint), a radar marker 'ANCESTORS', 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: 0, z: -1600 }, NAME = 'The Ancestral Roads';
var M = { state: 'idle', group: null, wait: 3.5, said: false, gy: 22 };
function sampleGround() {
  var g = (typeof groundAt === 'function') ? groundAt : null;
  if (!g) return 22;
  var max = -1000, x, z, h;
  for (var i = -2; i <= 2; i++) for (var j = -2; j <= 2; j++) {
    x = POS.x + i * 260; z = POS.z + j * 260;
    try { h = g(x, z); } catch (e) { h = 22; }
    if (h > max) max = h;
  }
  return max;
}
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, ancestorRoads: 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 === 'ancestor-roads'; })) return;
  H.pois.push({ id: 'ancestor-roads', name: NAME, short: 'ANCESTORS', x: POS.x, z: POS.z, stand: { x: POS.x, z: POS.z + 620 },
    alias: 'ancestral roads ancestors hawaiian rings brick wilcox kailiwai kamaile',
    text: 'Five rings of brick road for fifty-five ancestors, Maui-Potiki to Kamaile — the oldest at the centre, his family on the outer ring, closest to the city. An eternal flame burns at the middle for them all.' });
  if (H.regrid) H.regrid();
}
function watchStop() {
  var W = window.CityWatch, r = W && W.routes && W.routes.grand; if (!r || r._ancestors) return;
  var orig = r.build; r._ancestors = true;
  r.build = function () {
    var w = orig.apply(this, arguments), at = Math.min(1, w.length);
    w.splice(at, 0, { x: POS.x - 700, z: POS.z + 400, y: M.gy + 320, v: 220, cap: { cap: 'THE ANCESTRAL ROADS', sub: '55 ancestors \u00b7 5 rings \u00b7 south terrace', say: 'The Ancestral Roads, south of the capital: fifty-five brick roads for fifty-five ancestors, five rings, an eternal flame at the centre.' }, agl: false });
    return w;
  };
}
function load() {
  M.state = 'loading';
  M.gy = sampleGround() + 4;
  var p; try { p = import('/city/ancestor-roads.js?v=20261012a'); } catch (e) { p = Promise.reject(e); }
  p.then(function (mod) {
    var make = mod.createAncestorRoads || 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] Ancestor roads 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); } catch (e) {}
  if (S.mode === 'walk') {
    var pd = Math.hypot(S.p.x - POS.x, S.p.z - POS.z);
    if (pd < 600 && !M.said) { M.said = true; if (window.CityHyper && CityHyper.narrate) CityHyper.narrate('<b>The Ancestral Roads</b>: fifty-five brick roads for fifty-five ancestors, Maui-Potiki to Kamaile. The oldest rest at the centre; his family holds the outer ring.', 10); }
    else if (pd > 900) M.said = false;
  }
}
function radar(g, blip, fl) { if (M.state === 'ready') blip(POS.x, POS.z, '#d8aa48', fl ? 3 : 6, fl ? '' : 'ANCESTORS'); }
window.CityAncestorRoads = { update: update, radar: radar, pos: POS, state: function () { return M.state; }, group: function () { return M.group; },
  topY: function () { return M.gy + 2; } };
})();


===== FILE: public/city/ancestor-roads-place.js.bak-oneroad-20261012 =====
/* Solid City — places THE ANCESTRAL ROADS (publ