<!-- SAGA · part 59 -->
rBody !== 'undefined' && playerBody && playerBody.position){
        var dx = playerBody.position.x - vx;
        var dz = playerBody.position.z - vz;
        var dist = Math.sqrt(dx*dx + dz*dz);
        var now = Date.now();
        if(dist < 80 && now > burnCooldown){
          burnCooldown = now + 2000;
          // Flash red
          var flash = document.createElement('div');
          flash.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;' +
            'background:rgba(255,50,0,0.5);z-index:99999;pointer-events:none;';
          document.body.appendChild(flash);
          setTimeout(function(){ document.body.removeChild(flash); }, 300);
          // Message
          if(typeof say === 'function') say('THE COIN BURNS THIEVES');
          if(typeof codeStatus === 'function') codeStatus('🔥 THE COIN BURNS — thieves burn 🔥');
          // Knockback (push away from coin)
          var push = 150;
          var ang = Math.atan2(dz, dx);
          playerBody.position.x += Math.cos(ang) * push;
          playerBody.position.z += Math.sin(ang) * push;
        }
      }
    }catch(e){}
    requestAnimationFrame(animateCoin);
  }
  animateCoin();
  if(typeof trackNewThing === 'function') trackNewThing('thecoin', 'The Coin at LAT 100.0, LON 0.0 — flips forever, thieves burn');
})();


/* VOLCANO — LAT 100.0, LON 0.0 — Hawaiian lava rock, for the King */
(function(){
  var vx = 0, vz = 5556; // LAT 100.0 (z/55.56), LON 0.0 (x/62.5)
  var lavaRock = new THREE.MeshStandardMaterial({color:0x2a1a1a, roughness:0.95, metalness:0.05});
  var darkBasalt = new THREE.MeshStandardMaterial({color:0x1a1a1a, roughness:1.0, metalness:0.0});
  var lavaGlow = new THREE.MeshStandardMaterial({color:0xff4400, roughness:0.6, metalness:0.0, emissive:0xff2200, emissiveIntensity:1.5});
  // FLAT lava field — takes over the surrounding area (no tall cone)
  var field = new THREE.Mesh(new THREE.CylinderGeometry(1200, 1200, 30, 48), lavaRock);
  field.position.set(vx, 15, vz);
  field.receiveShadow = true;
  scene.add(field);
  // Raised rim (low shield edge)
  var rim = new THREE.Mesh(new THREE.TorusGeometry(1100, 40, 12, 48), darkBasalt);
  rim.rotation.x = Math.PI/2;
  rim.position.set(vx, 25, vz);
  scene.add(rim);
  // Lava lake — glowing pool in the flat field
  var lava = new THREE.Mesh(new THREE.CircleGeometry(200, 32), lavaGlow);
  lava.rotation.x = -Math.PI/2;
  lava.position.set(vx, 32, vz);
  scene.add(lava);
  // Point light from lava (glow)
  var lavaLight = new THREE.PointLight(0xff4400, 2.0, 2000);
  lavaLight.position.set(vx, 100, vz);
  scene.add(lavaLight);
  // Valley — rift running down the side (real Hawaiian valley style)
  for(var i=0; i<8; i++){
    var r = new THREE.Mesh(new THREE.BoxGeometry(60, 30, 200), darkBasalt);
    var ang = (i/8)*Math.PI*2;
    r.position.set(vx + Math.cos(ang)*450, 120, vz + Math.sin(ang)*450);
    r.rotation.y = -ang;
    scene.add(r);
  }
  // Lava rocks scattered (Hawaiian lava rock field)
  for(var j=0; j<20; j++){
    var rock = new THREE.Mesh(new THREE.DodecahedronGeometry(15+Math.random()*25, 0), lavaRock);
    var ra = Math.random()*Math.PI*2, rd = 700+Math.random()*400;
    rock.position.set(vx + Math.cos(ra)*rd, 15, vz + Math.sin(ra)*rd);
    rock.rotation.set(Math.random()*3, Math.random()*3, Math.random()*3);
    rock.castShadow = true;
    scene.add(rock);
  }
  if(typeof trackNewThing === 'function') trackNewThing('volcano', 'Volcano at LAT 100.0, LON 0.0 — Hawaiian lava rock');
})();


var sun = new THREE.DirectionalLight(0xffffff, 1.2);
sun.position.set(100, 200, 100);
scene.add(sun);
scene.add(new THREE.AmbientLight(0xffffff, 0.5));

var groundY = 0;
var ground = new THREE.Mesh(
  new THREE.PlaneGeometry(20000, 20000),
  new THREE.MeshStandardMaterial({color: 0x000000, roughness: 0.9})
);
ground.rotation.x = -Math.PI/2;
ground.position.y = 0.13;
scene.add(ground);

var grid = new THREE.GridHelper(20000, 100, 0xff0000, 0xff0000);
grid.position.y = 0.14;
grid.material.opacity = 0.3;
grid.material.transparent = true;
scene.add(grid);

/* ===== MATERIALS ===== */
var goldMat = new THREE.MeshStandardMaterial({color: 0xffd700, emissive: 0xffd700, emissiveIntensity: 0.5, roughness: 0.3, metalness: 0.7});
var roadMat = new THREE.MeshStandardMaterial({color: 0x2a2a2a, roughness: 0.8});

/* ===== CAMERA ===== */
var camYaw = 0, camPitch = 0.5, camDist = 40;
var kingPos = new THREE.Vector3(0, 0, 0);
/* Load King's saved spawn — from our story */
try{
  var _ss = JSON.parse(localStorage.getItem('saga-spawn'));
  if(_ss && isFinite(_ss.x) && isFinite(_ss.z)){
    kingPos.set(_ss.x, 0, _ss.z);
  }
}catch(e){}
var playerBody = null;
function updateCamera(){
  if(window._freecam) return; /* Free camera — don't follow */
  camera.position.set(
    kingPos.x + Math.cos(camYaw) * Math.cos(camPitch) * camDist,
    kingPos.y + Math.sin(camPitch) * camDist + 2,
    kingPos.z + Math.sin(camYaw) * Math.cos(camPitch) * camDist
  );
  camera.lookAt(