<!-- SOLID CITY · part 2633 -->
 3.1; wallColor = 0xe2dbc8; roofColor = 0x6a5138; }
    else { w = 9.5; d = 7.5; wh = 3.0; wallColor = 0xded5c2; roofColor = C.shingle; }  // mission
    w *= scale; d *= scale;
    var lanaiDepth = style === 'plantation' ? 2.6 : style === 'dickey' ? 3.2 : style === 'mission' ? 1.8 : 3.0;
    var padY = lotHeight(x, z, Math.max(w, d) * 0.62);
    setHome(x, z, padY, ry);
    // --- foundation: stone platform from the slope up to floor level (lava-rock building stone) ---
    var gMin = Math.min(groundAt(x - w / 2, z - d / 2), groundAt(x + w / 2, z + d / 2), groundAt(x - w / 2, z + d / 2), groundAt(x + w / 2, z - d / 2));
    var baseDepth = Math.min(7, Math.max(1.6, padY - gMin + 0.7));
    var padW = w + 2.4, padD = d + lanaiDepth + 2.2;
    var padCz = (lanaiDepth - 0.6) / 2;   // pad center shifts toward the lanai side
    box(solid, padW, baseDepth, padD, 0, -baseDepth / 2, padCz, C.stone);
    box(solid, padW + 0.5, 0.3, padD + 0.5, 0, -0.15, padCz, C.stoneDark);   // platform cap edge
    footprint(0, padCz, padW, padD, -baseDepth, 0.15);
    if (style === 'plantation' || style === 'dickey') {   // post-and-pier hint: stone piers proud at corners
      [[-w / 2, -d / 2], [w / 2, -d / 2], [-w / 2, d / 2], [w / 2, d / 2]].forEach(function (p) {
        box(solid, 0.9, 1.1, 0.9, p[0], -0.55, p[1], C.stoneDark);
      });
    }
    // --- floor (warm wood inside) ---
    box(solid, w, 0.18, d, 0, 0.02, 0, C.lanaiWood);
    box(solid, w + 0.6, 0.14, lanaiDepth, 0, 0.0, d / 2 + lanaiDepth / 2, C.lanaiWood);   // lanai deck
    stand(0, padCz, padW, padD, 0.12);   // the whole stone platform is walkable
    // --- walls + door + windows ---
    wallSegs(w, d, wh, wallColor, 0.85, true);
    // --- roof ---
    if (style === 'waa') {
      var rise = d * 0.85;    // A-frame steepness from the King's Hilo photos
      gableRoof(w, d, wh, rise, roofColor, 1.15);
      gableEnds(w, d, wh, rise, wallColor);
      // post-and-beam: corner posts stand proud (lashed-frame look)
      [[-w / 2, -d / 2], [w / 2, -d / 2], [-w / 2, d / 2], [w / 2, d / 2]].forEach(function (p) {
        cyl(solid, 0.2, 0.24, wh + rise * 0.4, 6, p[0], (wh + rise * 0.4) / 2, p[1], C.woodDark);
      });
    } else if (style === 'noa') {
      gableRoof(w, d, wh, d * 0.62, roofColor, 1.0);
      gableEnds(w, d, wh, d * 0.62, wallColor);
    } else if (style === 'dickey') {
      dickeyRoof(w, d, wh, roofColor);
    } else if (style === 'mission') {
      gableRoof(w, d, wh, d * 0.55, roofColor, 0.7);
      gableEnds(w, d, wh, d * 0.55, wallColor);
    } else {   // plantation: honest gable, generous eaves
      gableRoof(w, d, wh, d * 0.42, roofColor, 1.1);
      gableEnds(w, d, wh, d * 0.42, wallColor);
    }
    // --- lanai (not for waa — its door opens to a small stone stoop instead) ---
    if (style !== 'waa') lanaiBuild(w, d, wh, lanaiDepth, style === 'dickey');
    else { box(solid, 3.4, 0.16, 1.6, 0, 0.02, d / 2 + 0.8, C.stone); }
    stepsDown(2, padCz + padD / 2 - 0.4);
    // --- interior ---
    furnish(interior === 'full' ? 'full' : 'simple', w, d);
    // --- the land around the home is dressed by dressHome() (plants sit on the terrain) ---
    clearHome();
    STYLE_COUNT[style]++;
    var rec = { x: x, z: z, y: padY, ry: ry, style: style, w: w, d: d, lanaiDepth: lanaiDepth, padW: padW, padD: padD, padCz: padCz };
    homes.push(rec);
    return rec;
  }
  // dressing that needs world-frame placement (plants sit on the terrain, not the pad)
  function dressHome(rec, opts) {
    opts = opts || {};
    var dx = Math.sin(rec.ry), dz = Math.cos(rec.ry);          // front direction (local +z in world)
    var sx = Math.cos(rec.ry), sz = -Math.sin(rec.ry);         // right direction (local +x in world)
    function at(lx, lz) { return [rec.x + lx * sx + lz * dx, rec.z + lx * sz + lz * dz]; }
    function onGround(lx, lz, fn) {
      var p = at(lx, lz), gy = groundAt(p[0], p[1]);
      BASE = M4(p[0], gy - 0.15, p[1], R() * Math.PI * 2, 0, 0); fn(); BASE = new T.Matrix4();
    }
    // flowering shrubs against the front wall corners
    onGround(-rec.w / 2 - 1.2, rec.d / 2 + rec.lanaiDepth + 0.6, function () { shrub(C.flower1); });
    onGround(rec.w / 2 + 1.1, rec.d / 2 + rec.lanaiDepth + 0.5, function () { shrub(R() < 0.5 ? C.flower2 : C.flower3); });
    // a fruit tree beside the home — banana or breadfruit, woven into the green
    onGround((R() < 0.5 ? -1 : 1) * (rec.w / 2 + 3.4), 1.5, function () { if (R() < 0.55) banana(); else breadfruit(0.9 + R() * 0.4); });
    if (opts.taro) {   // a lo'i kalo at the compound's low side
      onGround(opts.taro[0], opts.taro[1], function () { taroPatch(7.5, 5); });
    }
    if (opts.palm) onGround(rec.w / 2 + 5.5, rec.d / 2 + 4, function () { palm(0.9 + R() * 0.3); });
  }

  /* ================= APARTMENT BLOCKS (the base flats) =================
   * 3 floors x 2 units, balcony corridors, exterior stair, ground lobby.
   * Corridor slabs are standY-on