<!-- SOLID CITY · part 3617 -->
the slope, ten hale with warm windows, a gathering hale with its fire, and a forest of giant trees — ancients 25 to 40 meters tall. The lookout faces the city lights, far below.' });
  if (H.regrid) H.regrid();
}
function watchStop() {
  var W = window.CityWatch, r = W && W.routes && W.routes.grand; if (!r || r._villageMauna) return;
  var orig = r.build; r._villageMauna = true;
  r.build = function () {
    var w = orig.apply(this, arguments);
    w.push({ x: POS.x - 500, z: POS.z + 300, y: M.gy + 260, v: 240, cap: { cap: 'KAUHALE MAUNA', sub: 'Mountain village \u00b7 giant trees \u00b7 terraces', say: 'Kauhale Mauna, the mountain village: terraces, warm windows, and giant trees rising into the mist.' }, agl: false });
    return w;
  };
}
function standY(x, z) {
  var best = -1000, i;
  if (M.tops) for (i = 0; i < M.tops.length; i++) {
    var t = M.tops[i];
    if (Math.hypot(x - (POS.x + t.x), z - (POS.z + t.z)) < t.r && M.gy + t.topY > best) best = M.gy + t.topY;
  }
  if (M.rects) for (i = 0; i < M.rects.length; i++) {
    var r = M.rects[i];
    if (x >= POS.x + r.x1 && x <= POS.x + r.x2 && z >= POS.z + r.z1 && z <= POS.z + r.z2 && M.gy + r.y > best) best = M.gy + r.y;
  }
  return best;
}
function load() {
  M.state = 'loading';
  M.gy = sampleGround() + 3;
  var p; try { p = import('/city/village-mauna.js?v=20261011b'); } catch (e) { p = Promise.reject(e); }
  p.then(function (mod) {
    var make = mod.createMaunaVillage || 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';
    M.tops = (g.userData && g.userData.terraceTops) || null;
    M.rects = (g.userData && g.userData.walkRects) || null;
    collide(g.userData || {}); hyperStop(); watchStop();
  }).catch(function (e) { M.state = 'failed'; try { console.warn('[city] Village Mauna 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 < 9000;
  if (d < 2600 && 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 < 320 && !M.said) { M.said = true; if (window.CityHyper && CityHyper.narrate) CityHyper.narrate('<b>Kauhale Mauna</b>: the mountain village. Warm windows among the giant trees.', 7); }
    else if (pd > 600) M.said = false;
  }
}
function radar(g, blip, fl) { if (M.state === 'ready') blip(POS.x, POS.z, '#4a8a3a', fl ? 3 : 6, fl ? '' : 'VILLAGE'); }
window.CityVillageMauna = { update: update, radar: radar, pos: POS, standY: standY, state: function () { return M.state; }, group: function () { return M.group; } };
})();


===== FILE: public/city/village-mauna.js =====
/* SOLID CITY — KAUHALE MAUNA, THE MOUNTAIN VILLAGE (2026-10-11, by order of the King)
 * "Drive me to a road up in the mountains where we can make a mountain village with trees."
 * A mountainside village on three terraces: gathering hale and fire above,
 * hale-huts mid and low, a lookout toward the city lights, and a forest of
 * GIANT trees — the King's wish: towering 25-40 m ancients, thick trunks,
 * broad canopies. The village nestles among them.
 * Self-contained ES module. Local frame: terrace tops at y=0 (A), -18 (B), -36 (C).
 *
 *   import { createMaunaVillage } from '/city/village-mauna.js';
 *   const g = createMaunaVillage({ THREE, position: {x, y, z} });
 *   // g.userData: footprint, update(t), terraceTops
 */
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; }; }
export function createMaunaVillage(o) {
  var T = o.THREE, P = o.position || { x: 0, y: 0, z: 0 };
  var root = new T.Group(); root.name = 'village-mauna'; root.position.set(P.x, P.y, P.z);
  var foot = [];
  var haleRef = { g: null };
  var R = mulberry(20261011);
  var C = {
    basalt: 0x1c1a20, wood: 0x5a4028, woodDark: 0x3a2a18, thatch: 0x8a6a3a,
    leaf: 0x1e4a24, leafDeep: 0x14331a, trunk: 0x4a3420,
    fire: 0xff9a30, warm: 0xffc060, gold: 0xd8aa48
  };
  var basaltMat = new T.MeshLambertMaterial({ color: C.basalt });
  var woodMat = new T.MeshLambertMaterial({ color: C.wood });
  var woodDarkMat = new T.MeshLambertMaterial({ color: C.woodDark });
  var thatchMat = new T.MeshLambertMaterial({ color: C.thatch });
  var leafMat = new T.MeshLambertMaterial({ color: C.leaf });
  var leafDeepMat = new T.MeshLambertMaterial({ color: C.leafDeep });
  var trunkMat = new T.MeshLambertMaterial({ color: C.trunk });
  var terraceMat = new T.MeshLambertMaterial({ color: 0x2e2a26 });

  // ---------- three terraces ----