<!-- SOLIDABILITY-WORLD · part 56 -->
       new THREE.Vector3(position.x - size.width/2, fy, position.z + size.depth/2),
            new THREE.Vector3(position.x - size.width/2, fy, position.z - size.depth/2),
          ]);
          const floorLine = new THREE.Line(floorGeo, floorMat);
          scene.add(floorLine);
        }
        // Floor count label
        addLabel(scene, `${room.floors} floors`, position.x, height + 0.3,
                 position.z, 0x00ffcc, 0.9);
      }
      // Door frame (entrance)
      const doorGeo = new THREE.BoxGeometry(2, 3, 0.3);
      const doorMat = new THREE.MeshBasicMaterial({ color: 0x00ffcc });
      const door = new THREE.Mesh(doorGeo, doorMat);
      door.position.set(position.x, 1.5, position.z - size.depth / 2 - 0.2);
      door.userData.room = room;
      door.userData.isDoor = true;
      scene.add(door);
    }
  }

  function buildFloor(scene, floorNum, building) {
    const y = floorNum * building.floorHeight;
    const geo = new THREE.BoxGeometry(building.width, 0.5, building.depth);
    const mat = new THREE.MeshStandardMaterial({
      color: floorNum === 0 ? 0x3a3a4a : 0x33333f,
      transparent: true, opacity: 0.95
    });
    const floor = new THREE.Mesh(geo, mat);
    floor.position.set(0, y - 0.25, 0);
    floor.receiveShadow = true;
    scene.add(floor);

    // Floor label
    addLabel(scene, `FLOOR ${floorNum + 1}`, 0, y + 0.5, -19, 0x888899, 2);
  }

  function buildRoom(scene, room, worldData) {
    const { position, size } = room;
    const group = new THREE.Group();

    // Walls: visible semi-transparent (not ghost-faint)
    const wallMat = new THREE.MeshStandardMaterial({
      color: 0x5a5a6e, transparent: true, opacity: 0.45, side: THREE.DoubleSide
    });
    const wallGeo = new THREE.BoxGeometry(size.width, size.height, size.depth);
    const walls = new THREE.Mesh(wallGeo, wallMat);
    walls.position.set(position.x, position.y + size.height / 2, position.z);
    group.add(walls);

    // Floor pad: visible tint by verification status
    const statusColor = {
      'verified': 0x2a5a3a,   // green tint — healthy
      'untested': 0x4a4a2a,   // yellow tint — unknown
      'defect': 0x5a2a2a      // red tint — problem
    }[room.verification.status] || 0x3a3a3a;

    const padGeo = new THREE.PlaneGeometry(size.width - 1, size.depth - 1);
    const padMat = new THREE.MeshStandardMaterial({ color: statusColor });
    const pad = new THREE.Mesh(padGeo, padMat);
    pad.rotation.x = -Math.PI / 2;
    pad.position.set(position.x, position.y + 0.06, position.z);
    pad.receiveShadow = true;
    group.add(pad);

    // Label above door frame (eye level, not floating high)
    // Positioned at room entrance so it's readable from hallway
    const doorZ = position.z - size.depth / 2;
    addLabel(scene, room.label, position.x, position.y + 4.2, doorZ - 0.5, 0xffffff, 1.8);

    // Route count below the name
    addLabel(scene, `${room.routes.length} routes`, position.x, position.y + 3.4, doorZ - 0.5, 0xaaaabb, 1.2);

    // Door frame: glowing outline showing the entrance gap on hallway side
    const doorHalf = 2;
    const frameMat = new THREE.MeshBasicMaterial({ color: 0x00ffcc });
    const frameTop = new THREE.Mesh(new THREE.BoxGeometry(doorHalf * 2 + 0.4, 0.3, 0.3), frameMat);
    frameTop.position.set(position.x, position.y + 3, position.z - size.depth / 2);
    group.add(frameTop);
    const frameLeft = new THREE.Mesh(new THREE.BoxGeometry(0.3, 3, 0.3), frameMat);
    frameLeft.position.set(position.x - doorHalf, position.y + 1.5, position.z - size.depth / 2);
    group.add(frameLeft);
    const frameRight = new THREE.Mesh(new THREE.BoxGeometry(0.3, 3, 0.3), frameMat);
    frameRight.position.set(position.x + doorHalf, position.y + 1.5, position.z - size.depth / 2);
    group.add(frameRight);

    group.userData = { type: 'room', roomKey: room.key, room };
    interactables.push(walls);
    walls.userData = { type: 'room', roomKey: room.key, room };

    scene.add(group);
  }

  function buildDoor(scene, door) {
    const geo = new THREE.BoxGeometry(3, 5, 0.5);
    const mat = new THREE.MeshStandardMaterial({ color: 0x4a6a8a });
    const mesh = new THREE.Mesh(geo, mat);
    mesh.position.set(door.position.x, 2.5, door.position.z);
    mesh.castShadow = true;
    mesh.userData = { type: 'door', label: door.label, target: door.target };
    interactables.push(mesh);
    scene.add(mesh);

    addLabel(scene, door.label, door.position.x, 6, door.position.z, 0x88ccff, 1.2);
  }

  function buildAlarmLight(scene, light) {
    // Pole
    const poleGeo = new THREE.CylinderGeometry(0.1, 0.1, 2);
    const poleMat = new THREE.MeshStandardMaterial({ color: 0x333333 });
    const pole = new THREE.Mesh(poleGeo, poleMat);
    pole.position.set(light.position.x, light.position.y - 1, light.position.z);
    scene.add(pole);

    // Light bulb
    const bulbGeo = new THREE.SphereGeometry(0.4, 16, 16);
    const color = light.status === 'off' ?