<!-- RUBY-BACKUP · part 511 -->
:46px;height:46px;background:#1a1a1a;color:#ffd700;border:1px solid #ffd700;border-radius:50%;font-size:22px;line-height:1;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;';
  _expBtn.onclick = function(){
    var target = window._highlighted || window._selectedBlock;
    if(!target){
      _expBtn.style.border = '2px solid #ff4444';
      setTimeout(function(){ _expBtn.style.border = '1px solid #ffd700'; }, 500);
      if(typeof codeStatus==='function') codeStatus('tap a block first!');
      return;
    }
    if(typeof exportOBJ==='function') exportOBJ();
  };
  document.body.appendChild(_expBtn);
  /* home button — house, takes him back to spawn */
  var _homeBtn = document.createElement('button');
  _homeBtn.id = 'homebtn';
  _homeBtn.textContent = '\u2302';
  _homeBtn.title = 'Home';
  _homeBtn.style.cssText = 'position:fixed;bottom:195px;left:10px;z-index:10000;width:46px;height:46px;background:#d8a920;color:#111;border:1px solid #d8a920;border-radius:50%;font-size:22px;line-height:1;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;';
  _homeBtn.onclick = function(){
    try{
      if(typeof goHome==='function'){ goHome(); }
      else if(typeof codeStatus==='function'){ codeStatus('home'); }
      // fallback: teleport to spawn via B1 logic if available
      if(typeof handleCheatCode==='function'){
        try{ handleCheatCode('b1'); }catch(e){}
      }
    }catch(e){}
  };
  document.body.appendChild(_homeBtn);
  /* grab button — pick up, twist, turn, install */
  var _grabBtn = document.createElement('button');
  _grabBtn.id = 'grabbtn';
  _grabBtn.textContent = '\u270B';
  _grabBtn.title = 'Grab';
  _grabBtn.style.cssText = 'position:fixed;bottom:195px;left:125px;z-index:10000;width:46px;height:46px;background:#d8a920;color:#111;border:1px solid #d8a920;border-radius:50%;font-size:22px;line-height:1;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;';
  _grabBtn.onclick = function(){
    try{
      if(typeof toggleGrabMode==='function') toggleGrabMode();
    }catch(e){}
  };
  document.body.appendChild(_grabBtn);
  _camBtn = document.createElement('button');
  _camBtn.id = 'camerabtn';
  _camBtn.textContent = '\u25CE';
  _camBtn.title = 'Camera';
  _camBtn.style.cssText = 'position:fixed;bottom:320px;left:14px;z-index:10000;width:46px;height:46px;background:#d8a920;color:#111;border:1px solid #d8a920;border-radius:50%;font-size:24px;line-height:1;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;';
  document.body.appendChild(_camBtn);
  var _clickCount = 0;
  var _clickTimer = null;
  _camBtn.onclick = function(){
    if(_camLocked){ codeStatus('camera button locked — slide to unlock'); return; }
    _clickCount++;
    if(_clickTimer) clearTimeout(_clickTimer);
    _clickTimer = setTimeout(function(){
      if(_clickCount >= 3){
        /* triple-click: instant photo */
        takeScreenshot();
      } else {
        /* single/double: toggle panel */
        toggleCameraPanel();
      }
      _clickCount = 0;
    }, 400);
  };
  /* long-press: screenshot to phone — only once per press */
  var _pressTimer = null;
  var _shotFired = false;
  _camBtn.addEventListener('touchstart', function(e){
    _shotFired = false;
    _pressTimer = setTimeout(function(){
      if(!_shotFired){
        _shotFired = true;
        takeScreenshot();
        /* don't open the panel */
        if(_camOpen) toggleCameraPanel();
      }
    }, 5000);
  }, {passive:true});
  _camBtn.addEventListener('touchend', function(){
    if(_pressTimer){ clearTimeout(_pressTimer); _pressTimer = null; }
    _shotFired = false;
  });
  var _slideStartY = 0;
  var _camLocked = false;
  _camBtn.addEventListener('touchstart', function(e){
    try{ _slideStartY = e.touches[0].clientY; }catch(err){}
  }, {passive:true});
  _camBtn.addEventListener('touchmove', function(e){
    if(_pressTimer){ clearTimeout(_pressTimer); _pressTimer = null; }
    /* slide up = unlock, slide down = lock */
    try{
      var dy = e.touches[0].clientY - _slideStartY;
      if(Math.abs(dy) > 40 && !_camBtn._slideFired){
        _camBtn._slideFired = true;
        if(dy > 0){
          /* slide down: lock */
          _camLocked = true;
        } else {
          /* slide up: unlock */
          _camLocked = false;
        }
        _camBtn.style.opacity = _camLocked ? '0.5' : '1';
        _camBtn.style.border = _camLocked ? '2px solid #ff5555' : '1px solid #d8a920';
        codeStatus(_camLocked ? 'camera button locked' : 'camera button unlocked');
      }
    }catch(err){}
  }, {passive:true});
  _camBtn.addEventListener('touchend', function(){
    _camBtn._slideFired = false;
  });
  document.body.appendChild(_camBtn);
  /* the camera panel */
  _camPanel = document.createElement('div');
  _camPanel.id = 'camerapanel';
  _camPanel.style.cssText = 'position:fixed;bottom:72px;left:14px;z-index:9999;display:none;flex-direction:column;gap:8px;align-items:stretch;m