<!-- SOLID CITY · part 3633 -->
       new T.MeshBasicMaterial({ color: C.fire, transparent: true, opacity: 0.92 }));
      fl.position.set(p[0] + off, p[2] + 5.3, p[1]); fl.name = 'flame'; root.add(fl);
      var pl = new T.PointLight(0xff9a40, 1.0, 34);
      pl.position.set(p[0] + off, p[2] + 5.6, p[1]); root.add(pl);
      torches.push({ fl: fl, pl: pl, seed: R() * 10 });
      foot.push([p[0] + off, p[1], 0.9, 0.9, p[2], p[2] + 4.6, 0]);
    });
  });

  // ---------- fireflies of warm light: village glow ----------
  var glow = new T.PointLight(0xffb050, 1.4, 220, 1.2);
  glow.position.set(0, 14, 0); root.add(glow);

  root.userData = {
    footprint: foot, center: { x: 0, z: 0 }, radius: 320, height: 60,
    terraceTops: TER.map(function (t) { return { x: t.x, z: t.z, r: t.r, topY: t.y + 1.1 }; }),
    update: function (t) {
      var hale = haleRef.g;
      if (hale) {
        hale.userData.flame.scale.y = 1 + Math.sin(t * 5.2) * 0.16;
        hale.userData.fireLight.intensity = 2.1 + Math.sin(t * 5.2) * 0.5 + Math.sin(t * 13.7) * 0.2;
      }
      for (var k = 0; k < torches.length; k++) {
        var tc = torches[k];
        tc.fl.scale.y = 1 + Math.sin(t * 6 + tc.seed) * 0.18;
        tc.pl.intensity = 0.95 + Math.sin(t * 6 + tc.seed) * 0.22;
      }
      glow.intensity = 1.35 + Math.sin(t * 1.7) * 0.12;
    }
  };
  return root;
}
export default createMaunaVillage;


===== FILE: public/city/village-mauna.js.bak-infill-20261011 =====
/* 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 ----------
  // A upper (gathering hale), B mid (huts), C lower (huts + lookout)
  var TER = [
    { x: 0, z: -85, y: 0,   r: 58 },
    { x: 0, z: 0,   y: -18, r: 60 },
    { x: 0, z: 85,  y: -36, r: 58 }
  ];
  TER.forEach(function (t) {
    var disc = new T.Mesh(new T.CylinderGeometry(t.r, t.r + 6, 46, 40), terraceMat);
    disc.position.set(t.x, t.y - 23, t.z); root.add(disc);
    var top = new T.Mesh(new T.CylinderGeometry(t.r, t.r, 1.5, 40), new T.MeshLambertMaterial({ color: 0x3a332c }));
    top.position.set(t.x, t.y + 0.4, t.z); root.add(top);
  });

  // ---------- warm window glow material ----------
  var winMat = new T.MeshBasicMaterial({ color: C.warm });

  // ---------- huts (hale-style gabled) ----------
  function hut(x, z, ty, ry, s) {
    s = s || 1;
    var g = new T.Group();
    var w = 9 * s, d = 7 * s, h = 3.6 * s;
    var walls = new T.Mesh(new T.BoxGeometry(w, h, d), woodMat); walls.position.y = h / 2; g.add(walls);
    // pitched roof: two slabs
    var rl = Math.sqrt((w / 2 + 1) * (w / 2 + 1) + 4 * s * s);
    var ang = Math.atan2(2 * s, w / 2 + 1);
    [-1, 1].forEach(function (sd) {
      var slab = new T.Mesh(new T.BoxGeometry(rl, 0.5 * s, d + 1.5 * s), thatchMat);
      slab.position.set(sd * (w / 4 + 0.4 * s), h + 1.0 * s, 0);
      slab.rotation.z = sd * ang; g.add(slab);
    });
    // warm windows (front) + door glow
    var win = new T.Mesh(new T.PlaneGeometry(1.6 * s, 1.2 * s), winMat);
    win.position.set(-w / 4, h * 0.55, d / 2 + 0.06); g.add(win);
    var win2 = win.clone(); win2.position.x