<!-- RUBY-BACKUP · part 407 -->
75%;z-index:20000;'
      + 'background:#0a0a0f;border-top:3px solid #ffd700;border-radius:16px 16px 0 0;'
      + 'box-shadow:0 -10px 40px rgba(0,0,0,0.8);display:flex;flex-direction:column;'
      + 'transform:translateY(100%);transition:transform 0.3s ease-out;';
    var bar = document.createElement('div');
    bar.style.cssText = 'padding:10px;text-align:center;border-bottom:1px solid #333;'
      + 'display:flex;justify-content:space-between;align-items:center;';
    bar.innerHTML = '<span style="color:#ffd700;font-size:14px;">Block Creator — warped to you</span>';
    var closeBtn = document.createElement('button');
    closeBtn.textContent = '✕';
    closeBtn.style.cssText = 'background:none;border:1px solid #666;border-radius:6px;color:#888;'
      + 'padding:6px 12px;cursor:pointer;font-size:16px;';
    closeBtn.onclick = function(){ warpBlockCreator(); };
    bar.appendChild(closeBtn);
    BLOCK_CREATOR.appendChild(bar);
    var frame = document.createElement('iframe');
    frame.src = '/panel';
    frame.style.cssText = 'flex:1;border:none;width:100%;';
    BLOCK_CREATOR.appendChild(frame);
    document.body.appendChild(BLOCK_CREATOR);
    try{ if(typeof addSwipeToWarp==='function') addSwipeToWarp(BLOCK_CREATOR, false); }catch(e){}
    setTimeout(function(){ BLOCK_CREATOR.style.transform = 'translateY(0)'; }, 50);
    try{ codeStatus('block creator warped in.'); }catch(e){}
  }catch(e){}
}


/* SWIPE: up for full calc, down for the part */
function addSwipeToWarp(el, isSolid){
  try{
    var startY = 0, currentH = 70;
    el.addEventListener('touchstart', function(e){
      startY = e.touches[0].clientY;
    }, {passive:true});
    el.addEventListener('touchmove', function(e){
      var dy = startY - e.touches[0].clientY;
      if(dy > 80 && currentH < 100){
        /* swipe up — full page */
        currentH = 100;
        el.style.height = '100%';
        el.style.borderRadius = '0';
        try{ codeStatus(isSolid ? 'Full calc — full page.' : 'Full builder — full page.'); }catch(e2){}
      }else if(dy < -80 && currentH > 40){
        /* swipe down — shrink or switch */
        if(isSolid && currentH === 100){
          currentH = 70;
          el.style.height = '70%';
          el.style.borderRadius = '16px 16px 0 0';
        }else{
          /* swipe down past — dismiss, offer the other */
          if(isSolid){
            try{ codeStatus('Swipe down again for the part builder.'); }catch(e2){}
          }
        }
      }
    }, {passive:true});
  }catch(e){}
}

/* /solid LOADS LIKE A KEYBOARD — warp it in, use it, send it back */
var SOLID_KEYBOARD = null;
function warpSolid(){
  try{
    if(SOLID_KEYBOARD){
      document.body.removeChild(SOLID_KEYBOARD);
      SOLID_KEYBOARD = null;
      try{ codeStatus('/solid dismissed.'); }catch(e){}
      return;
    }
    SOLID_KEYBOARD = document.createElement('div');
    SOLID_KEYBOARD.style.cssText = 'position:fixed;bottom:0;left:0;right:0;height:70%;z-index:20000;'
      + 'background:#0a0a0f;border-top:3px solid #ffd700;border-radius:16px 16px 0 0;'
      + 'box-shadow:0 -10px 40px rgba(0,0,0,0.8);display:flex;flex-direction:column;'
      + 'transform:translateY(100%);transition:transform 0.3s ease-out;';
    var bar = document.createElement('div');
    bar.style.cssText = 'padding:10px;text-align:center;border-bottom:1px solid #333;'
      + 'display:flex;justify-content:space-between;align-items:center;';
    bar.innerHTML = '<span style="color:#ffd700;font-size:14px;">/solid — warped to you</span>';
    var expandBtn = document.createElement('button');
    expandBtn.textContent = '⤢';
    expandBtn.style.cssText = 'background:none;border:1px solid #666;border-radius:6px;color:#888;padding:6px 12px;cursor:pointer;font-size:16px;margin-right:6px;';
    var solidExpanded = false;
    expandBtn.onclick = function(){
      solidExpanded = !solidExpanded;
      SOLID_KEYBOARD.style.height = solidExpanded ? '100%' : '70%';
      expandBtn.textContent = solidExpanded ? '⤡' : '⤢';
    };
    bar.appendChild(expandBtn);
    var closeBtn = document.createElement('button');
    closeBtn.textContent = '✕';
    closeBtn.style.cssText = 'background:none;border:1px solid #666;border-radius:6px;color:#888;'
      + 'padding:6px 12px;cursor:pointer;font-size:16px;';
    closeBtn.onclick = function(){ warpSolid(); };
    bar.appendChild(closeBtn);
    SOLID_KEYBOARD.appendChild(bar);
    var frame = document.createElement('iframe');
    frame.src = '/solid';
    frame.style.cssText = 'flex:1;border:none;width:100%;';
    SOLID_KEYBOARD.appendChild(frame);
    document.body.appendChild(SOLID_KEYBOARD);
    try{ if(typeof addSwipeToWarp==='function') addSwipeToWarp(SOLID_KEYBOARD, true); }catch(e){}
    // slide up like a keyboard
    setTimeout(function(){ SOLID_KEYBOARD.style.transform = 'translateY(0)'; }, 50);
    try{ codeStatus('/solid warped in.'); }catch(e){}
  }catch(e){}
}

/* THE SOLID INSTRUMENT PANEL — the touch 