<!-- SOLID-PLAYTIME · part 194 -->
w,0,hd),new T.Vector3(-hw,0,hd),new T.Vector3(-hw,0,-hd)];
  var line=new T.Line(new T.BufferGeometry().setFromPoints(pts),
    new T.LineBasicMaterial({color:0xffd700,transparent:true,opacity:0.95}));
  footFill=new T.Mesh(new T.PlaneGeometry(FOOT_W,FOOT_D),
    new T.MeshBasicMaterial({color:0xffd700,transparent:true,opacity:0.10,depthWrite:false,side:T.DoubleSide}));
  footFill.rotation.x=-Math.PI/2; footFill.position.y=0.02;
  foot.add(line); foot.add(footFill);
  foot.visible=false;
  Kt.scene.add(foot);
  return foot;
}
window.consoleAim=function(x,z,hk){
  var f=ensureFoot();
  if(hk!=='console'){ f.visible=false; return; }
  f.position.set(x,groundY(x,z)+0.12,z);
  f.visible=true;
};
window.consoleAimHide=function(){ if(foot) foot.visible=false; };
window.consoleAimGlow=function(on){
  if(footFill) footFill.material.opacity=on?0.28:0.10;
};

/* ---------- crosshair: invisible until it locks ---------- */
function ensureCross(){
  if(cross) return cross;
  cross=document.createElement('div');
  cross.style.cssText='position:fixed;left:50%;top:50%;width:46px;height:46px;margin:-23px 0 0 -23px;border:3px solid #ffd700;border-radius:50%;box-shadow:0 0 20px #ffd700,inset 0 0 14px rgba(255,215,0,.65);opacity:0;transition:opacity .18s;z-index:9995;pointer-events:none;';
  var dot=document.createElement('div');
  dot.style.cssText='position:absolute;left:50%;top:50%;width:8px;height:8px;margin:-4px 0 0 -4px;background:#ffd700;border-radius:50%;box-shadow:0 0 12px #ffd700;';
  cross.appendChild(dot);
  document.body.appendChild(cross);
  return cross;
}
var aimRayc=null, aimPlane=null, aimZero=null, aimPt=null;
function cellValid(x,z){
  if(Math.abs(x)>250||Math.abs(z)>250) return false;
  var hw=FOOT_W/2, hd=FOOT_D/2;
  var ys=[groundY(x-hw,z-hd),groundY(x+hw,z-hd),groundY(x-hw,z+hd),groundY(x+hw,z+hd)];
  var mn=Math.min.apply(null,ys), mx=Math.max.apply(null,ys);
  return (mx-mn)<=5;
}
var lastCell='x';
function aimTick(){
  var locked=false;
  try{
    var bm=false; try{ bm=window.isBuildMode(); }catch(e){}
    var hk=null; try{ hk=window.invState&&window.invState.held; }catch(e){}
    if(bm&&hk==='console'&&Kt.camera){
      if(!aimRayc){ aimRayc=new T.Raycaster(); aimPlane=new T.Plane(new T.Vector3(0,1,0),0); aimZero=new T.Vector2(0,0); aimPt=new T.Vector3(); }
      aimRayc.setFromCamera(aimZero,Kt.camera);
      if(aimRayc.ray.intersectPlane(aimPlane,aimPt)){
        if(aimPt.distanceTo(Kt.camera.position)<160){
          var cx=Math.round(aimPt.x/CELL)*CELL, cz=Math.round(aimPt.z/CELL)*CELL;
          if(cellValid(cx,cz)){
            locked=true;
            var key=cx+','+cz;
            if(key!==lastCell){ lastCell=key; try{ window.buildAimAt(cx,cz); }catch(e){} }
          }
        }
      }
    }
  }catch(e){ locked=false; }
  if(!locked) lastCell='x';
  try{ ensureCross().style.opacity=locked?'1':'0'; }catch(e){}
  try{ window.consoleAimGlow(locked); }catch(e){}
}

/* ---------- console buttons ---------- */
function setVariant(v){ curVariant=v; refreshBorders(); toast(v.toUpperCase()+' — NOW PICK A SHAPE',VCSS[v]); }
function pickShape(s){
  var key=curVariant+'-'+s, n=0;
  try{ n=window.invState.counts[key]||0; }catch(e){}
  if(n<=0){ toast('NONE YET — HARVEST '+curVariant.toUpperCase()+' NODES','#888'); return; }
  try{
    window.invState.held=key;
    localStorage.setItem('solid-inv-v1',JSON.stringify({counts:window.invState.counts,equipped:window.invState.equipped,held:window.invState.held}));
  }catch(e){}
  curShape=s; refreshBorders();
  toast('HELD: '+(curVariant+' '+s).toUpperCase()+' ×'+n,VCSS[curVariant]);
}
function fnBuild(){ try{ window.syncBuildAPI.setBuild(true); toast('BUILD MODE','#ffd700'); }catch(e){} }
function fnVisit(){
  if(!buildersCache.length){ toast('NO BUILDERS YET — RAISE THE FIRST STONE','#888'); refreshBuilders(); return; }
  var b=buildersCache[visitIdx%buildersCache.length]; visitIdx++;
  var gy=groundY(b.x,b.z), hy=0;
  try{ hy=Kt.hero.position.y; }catch(e){}
  if(!isFinite(gy)||(isFinite(hy)&&hy-gy>25)) gy=hy-1;
  try{ Kt.hero.position.set(b.x,gy+2,b.z+8); }catch(e){}
  toast('VISITING '+String(b.name).toUpperCase().slice(0,14),b.color||'#9ad');
  try{ Kt.burst(b.x,gy+2,b.z,0xffd700); }catch(e2){}
}
function fnHome(){
  if(!deployed.length){ toast('NO CONSOLE STANDING YET','#888'); return; }
  var hx=0,hz=0; try{ hx=Kt.hero.position.x; hz=Kt.hero.position.z; }catch(e){}
  var best=deployed[0], bd=1e18;
  for(var i=0;i<deployed.length;i++){
    var d=Math.hypot(deployed[i].x-hx,deployed[i].z-hz);
    if(d<bd){ bd=d; best=deployed[i]; }
  }
  var gy=groundY(best.x,best.z);
  try{ Kt.hero.position.set(best.x,gy+2,best.z+12); }catch(e){}
  toast('BACK AT THE CONSOLE','#ffd700');
}
function refreshBuilders(){
  callAction('buildersBoard',{}).then(function(d){ buildersCache=(d&&d.builders)||[]; }).catch(function(){});
}
function drawBtn(b){
  var c=b.ctx;
  c.fillStyle='#101018'; c.fillRect(0,0,256,128);
  c.fillStyle=b.colo