<!-- SOLIDIVISM-STAGING · part 13 -->
nsity = 2.0 + Math.sin(t * 3 + 1) * 0.5;
    }
    // Subtle arm sway
    if (avatarParts.armL) avatarParts.armL.rotation.x = Math.sin(t * 2) * 0.05;
    if (avatarParts.armR) avatarParts.armR.rotation.x = Math.sin(t * 2 + Math.PI) * 0.05;
  }

  // ── DOOR TEXTURE: Visible entrance on front face ──
  function createDoorTexture(label) {
    const c = document.createElement('canvas');
    c.width = 256; c.height = 256;
    const x = c.getContext('2d');

    // Same black armor base
    x.fillStyle = '#0a0a0c';
    x.fillRect(0, 0, 256, 256);

    // Panel grid (subtle)
    x.strokeStyle = '#1e1e24';
    x.lineWidth = 2;
    for (let i = 0; i <= 256; i += 32) {
      x.beginPath(); x.moveTo(i, 0); x.lineTo(i, 256); x.stroke();
      x.beginPath(); x.moveTo(0, i); x.lineTo(256, i); x.stroke();
    }

    // THE DOOR: large central rectangle with glowing frame
    const dw = 100, dh = 180;
    const dx = (256 - dw) / 2, dy = 256 - dh - 10;

    // Door frame (bright red glow)
    x.fillStyle = '#FF0000';
    x.fillRect(dx - 6, dy - 6, dw + 12, dh + 12);

    // Door itself (dark with red edge light)
    x.fillStyle = '#1a0505';
    x.fillRect(dx, dy, dw, dh);

    // Door split line (double doors)
    x.strokeStyle = '#FF0000';
    x.lineWidth = 3;
    x.beginPath(); x.moveTo(128, dy); x.lineTo(128, dy + dh); x.stroke();

    // Door horizontal panels
    x.strokeStyle = '#660000';
    x.lineWidth = 2;
    for (let py = dy + 40; py < dy + dh; py += 40) {
      x.beginPath(); x.moveTo(dx, py); x.lineTo(dx + dw, py); x.stroke();
    }

    // "ENTRANCE" label above door
    x.fillStyle = '#FF0000';
    x.font = 'bold 16px monospace';
    x.textAlign = 'center';
    x.fillText('▼ ENTRANCE ▼', 128, dy - 16);

    // Building label at top
    if (label) {
      x.fillStyle = '#FFFFFF';
      x.font = 'bold 20px monospace';
      x.fillText(label.substring(0, 12).toUpperCase(), 128, 30);
    }

    // Red corner brackets
    x.strokeStyle = '#FF0000';
    x.lineWidth = 6;
    const B = 8, L = 36;
    x.beginPath(); x.moveTo(B, B+L); x.lineTo(B, B); x.lineTo(B+L, B); x.stroke();
    x.beginPath(); x.moveTo(256-B-L, B); x.lineTo(256-B, B); x.lineTo(256-B, B+L); x.stroke();

    return new THREE.CanvasTexture(c);
  }

  // ── TACTICAL TEXTURE: Futuristic fortification ──
  function createTacticalTexture(label) {
    const c = document.createElement('canvas');
    c.width = 256; c.height = 256;
    const x = c.getContext('2d');
    
    // Black armor base
    x.fillStyle = '#0a0a0c';
    x.fillRect(0, 0, 256, 256);
    
    // Panel lines
    x.strokeStyle = '#1e1e24';
    x.lineWidth = 2;
    for (let i = 0; i <= 256; i += 32) {
      x.beginPath(); x.moveTo(i, 0); x.lineTo(i, 256); x.stroke();
      x.beginPath(); x.moveTo(0, i); x.lineTo(256, i); x.stroke();
    }
    
    // Red corner brackets
    x.strokeStyle = '#FF0000';
    x.lineWidth = 8;
    const B = 12, L = 50;
    x.beginPath(); x.moveTo(B, B+L); x.lineTo(B, B); x.lineTo(B+L, B); x.stroke();
    x.beginPath(); x.moveTo(256-B-L, B); x.lineTo(256-B, B); x.lineTo(256-B, B+L); x.stroke();
    x.beginPath(); x.moveTo(B, 256-B-L); x.lineTo(B, 256-B); x.lineTo(B+L, 256-B); x.stroke();
    x.beginPath(); x.moveTo(256-B-L, 256-B); x.lineTo(256-B, 256-B); x.lineTo(256-B, 256-B-L); x.stroke();
    
    // Red data stripes
    x.fillStyle = '#FF0000';
    x.fillRect(0, 110, 256, 10);
    x.fillRect(0, 128, 256, 4);
    
    // Circuit traces
    x.strokeStyle = '#FF4444';
    x.lineWidth = 2;
    x.beginPath(); x.moveTo(24, 190); x.lineTo(90, 190); x.lineTo(90, 210); x.lineTo(170, 210); x.stroke();
    x.beginPath(); x.moveTo(232, 50); x.lineTo(170, 50); x.lineTo(170, 70); x.stroke();
    x.fillStyle = '#FF0000';
    x.beginPath(); x.arc(170, 210, 7, 0, 7); x.fill();
    x.beginPath(); x.arc(170, 70, 7, 0, 7); x.fill();
    
    // Hazard chevrons
    for (let i = 0; i < 8; i++) {
      x.fillStyle = (i % 2 === 0) ? '#FF0000' : '#0a0a0c';
      x.fillRect(i * 32, 240, 32, 16);
    }
    
    // Label
    if (label) {
      x.fillStyle = '#FFFFFF';
      x.font = 'bold 18px monospace';
      x.textAlign = 'center';
      x.fillText(label.substring(0, 12).toUpperCase(), 128, 100);
    }
    
    // Central diamond emblem
    x.strokeStyle = '#FF0000';
    x.lineWidth = 3;
    x.beginPath();
    x.moveTo(128, 30); x.lineTo(165, 67); x.lineTo(128, 104); x.lineTo(91, 67);
    x.closePath(); x.stroke();
    
    return new THREE.CanvasTexture(c);
  }

  // ── BUILDING: Solid and visible — ONE system ──
  function addBuilding(bx, bz, width, height, depth, label) {
    // FUTURE DESIGN: No walls. 4 corner posts + sloped rocket-ship canopy.
    // Open on all sides — walk under freely. Posts are the only solid parts.
    const group = new THREE.Group();
    const tex = createTacticalTexture(label);

    const postMat = new THREE.MeshStandardMaterial({
      map: tex, roughness: 0.5, metalness: 0.6,
      emissive: 0x330000, emissiveInt