<!-- RUBY-BACKUP · part 406 -->
 + '),'
            + p.bg + ';';
          try{ wheel.value = p.bg; lineWheel.value = p.line; }catch(e){}
          codeStatus('Preset: ' + p.n + '.');
        }catch(e){}
      };
      presetRow.appendChild(b);
    });
    lwBar.appendChild(presetRow);
    // LINE PATTERNS — grid, dots, cross
    var patRow = document.createElement('div');
    patRow.style.cssText = 'display:flex;gap:6px;margin-top:8px;align-items:center;';
    patRow.innerHTML = '<span style="color:#666;font-size:12px;">Pattern:</span>';
    var patterns = [
      {icon:'▦', n:'grid'},
      {icon:'⋮⋮', n:'dots'},
      {icon:'╬', n:'cross'}
    ];
    patterns.forEach(function(pt){
      var b = document.createElement('button');
      b.textContent = pt.icon;
      b.style.cssText = 'padding:6px 12px;font-size:16px;background:#fff;border:1px solid #333;border-radius:6px;cursor:pointer;';
      b.onclick = function(){
        try{
          var sz = '20px';
          var m2 = body.style.background.match(/(\d+)px/);
          if(m2) sz = m2[1]+'px';
          var bgM = body.style.background.match(/#[0-9a-fA-F]{6}(?!.*#[0-9a-fA-F]{6})/);
          var bgCol = '#ffffff';
          try{ bgCol = wheel.value; }catch(e){ if(bgM) bgCol = bgM[0]; }
          var lc = '#000000';
          try{ lc = lineWheel.value; }catch(e){}
          var lr = parseInt(lc.substr(1,2),16), lg = parseInt(lc.substr(3,2),16), lb = parseInt(lc.substr(5,2),16);
          var lineCol = 'rgba('+lr+','+lg+','+lb+',0.4)';
          var szi = parseInt(sz);
          if(pt.n==='grid'){
            body.style.background = 'repeating-linear-gradient(0deg,transparent,transparent '+(szi-1)+'px,'+lineCol+' '+sz+'),'
              + 'repeating-linear-gradient(90deg,transparent,transparent '+(szi-1)+'px,'+lineCol+' '+sz+'),'+bgCol+';';
          }else if(pt.n==='dots'){
            body.style.background = 'radial-gradient(circle,'+lineCol+' 1.5px,transparent 2px),'+bgCol+';'
              + 'background-size:'+sz+' '+sz+';';
          }else if(pt.n==='cross'){
            body.style.background = 'repeating-linear-gradient(0deg,transparent,transparent '+(szi-1)+'px,'+lineCol+' '+sz+'),'
              + 'repeating-linear-gradient(90deg,transparent,transparent '+(szi-1)+'px,'+lineCol+' '+sz+'),'
              + 'repeating-linear-gradient(45deg,transparent,transparent '+(szi-1)+'px,'+lineCol+' '+sz+'),'
              + 'repeating-linear-gradient(-45deg,transparent,transparent '+(szi-1)+'px,'+lineCol+' '+sz+'),'+bgCol+';';
          }
          codeStatus('Pattern: ' + pt.n + '.');
        }catch(e){}
      };
      patRow.appendChild(b);
    });
    lwBar.appendChild(patRow);
    // Os — collapse linework and close, dynamic
    var osBtn = document.createElement('button');
    osBtn.textContent = '\u2715';
    osBtn.title = 'Os';
    osBtn.style.cssText = 'margin-top:8px;padding:8px 16px;font-size:18px;background:#d8a920;color:#111;border:1px solid #d8a920;border-radius:50%;cursor:pointer;width:46px;height:46px;';
    osBtn.onclick = function(){
      try{
        lwBar.style.display = 'none';
        osBtn.style.display = 'none';
        codeStatus('Os: linework collapsed.');
      }catch(e){}
    };
    lwBar.appendChild(osBtn);
    body.appendChild(lwBar);
    // SAVE — writes back to the original block, returns to map with new look
    var saveBtn = document.createElement('button');
    saveBtn.textContent = '💾 Save';
    saveBtn.style.cssText = 'padding:12px;font-size:16px;background:rgba(0,255,136,0.15);border:2px solid #00ff88;border-radius:8px;color:#00ff88;cursor:pointer;margin-top:8px;';
    saveBtn.onclick = function(){
      try{
        var blk = window._selectedBlock;
        if(blk){
          // save look to the block itself — code intact, description added
          if(!blk.userData) blk.userData = {};
          blk.userData.builderDesc = 'Modified in creator';
          blk.userData.savedLook = true;
          blk.userData.savedAt = Date.now();
          // gold ONLY if new (unknown) — otherwise keep as is
          // user can render again if they prefer not gold
          if(window._pulseTimer) clearInterval(window._pulseTimer);
          codeStatus('Saved to the block. Code intact.');
        }else{
          codeStatus('No block selected.');
        }
        if(typeof warpFixStation==='function') warpFixStation();
      }catch(e){}
    };
    body.appendChild(saveBtn);
    FIX_STATION.appendChild(body);
    document.body.appendChild(FIX_STATION);
    try{ codeStatus('Fix station open.'); }catch(e){}
  }catch(e){}
}

/* BLOCK CREATOR — warped into the game */
var BLOCK_CREATOR = null;
function warpBlockCreator(){
  try{
    if(BLOCK_CREATOR){
      document.body.removeChild(BLOCK_CREATOR);
      BLOCK_CREATOR = null;
      try{ codeStatus('block creator dismissed.'); }catch(e){}
      return;
    }
    BLOCK_CREATOR = document.createElement('div');
    BLOCK_CREATOR.style.cssText = 'position:fixed;bottom:0;left:0;right:0;height: