#tool-body {
  --bg: #0d0f14;
  --bg2: #13161e;
  --bg3: #1a1e2a;
  --bg4: #222636;
  --border: #2a2f42;
  --border2: #363d56;
  --accent: #f0a500;
  --accent2: #ff6b35;
  --green: #4ade80;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-ui: 'Syne', sans-serif;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.theme-light-mode #tool-body {
  --bg: #f8f9fc;
  --bg2: #ffffff;
  --bg3: #f0f2f7;
  --bg4: #e8ebf4;
  --border: #dde1ee;
  --border2: #c8cde0;
  /*   --accent: #d4900a;
  --accent2: #e05520; */
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --purple: #7c3aed;
  --cyan: #0891b2;
  --text: #1e2433;
  --text2: #4a5568;
  --text3: #718096;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-ui: 'Syne', sans-serif;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}
#tool-body * { box-sizing: border-box; /*margin: 0; padding: 0;*/ }

#tool-body  {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

/* ── TOP BAR ── */
#tool-body .topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#tool-body .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  color: var(--text);
}
#tool-body .logo-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; color: #000; font-family: var(--font-mono);
}

#tool-body .topbar-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

/* Tabs */
#tool-body .tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
#tool-body .tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  transition: all .15s;
  background: transparent;
  border: 1px solid transparent;
  position: relative;
}
#tool-body .tab:hover { background: var(--bg3); color: var(--text); }
#tool-body .tab.active { background: var(--bg3); color: var(--text); border-color: var(--border2); }
#tool-body .tab .tab-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: 0; transition: opacity .2s;
}
#tool-body .tab.modified .tab-dot { opacity: 1; }
#tool-body .tab .tab-close {
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; opacity: 0; transition: opacity .15s; font-size: 11px;
  color: var(--text3);
}
#tool-body .tab:hover .tab-close { opacity: 1; }
#tool-body .tab .tab-close:hover { background: var(--bg4); color: var(--red); }

#tool-body .btn-new-tab {
  padding: 6px 10px; border-radius: var(--radius);
  background: transparent; border: 1px dashed var(--border2);
  color: var(--text3); cursor: pointer; font-size: 16px;
  transition: all .15s; white-space: nowrap;
}
#tool-body .btn-new-tab:hover { border-color: var(--accent); color: var(--accent); background: rgba(240,165,0,.06); }

/* Action buttons */
#tool-body .topbar-actions { display: flex; gap: 8px; margin-left: auto; }
#tool-body .btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s;
}
#tool-body .btn-run {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000;
  box-shadow: 0 2px 12px rgba(240,165,0,.3);
}
#tool-body .btn-run:hover { filter: brightness(1.1); box-shadow: 0 4px 20px rgba(240,165,0,.4); transform: translateY(-1px); }
#tool-body .btn-run:active { transform: translateY(0); }
#tool-body .btn-run:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#tool-body .btn-stop-active {
  background: linear-gradient(135deg, var(--red), #c0392b) !important;
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(248,113,113,.35) !important;
  border: none !important;
}
#tool-body .btn-stop-active:hover { filter: brightness(1.1); transform: translateY(-1px); }
#tool-body .btn-secondary {
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border2);
}
#tool-body .btn-secondary:hover { background: var(--bg4); color: var(--text); border-color: var(--border); }
#tool-body .btn-danger { background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.25); }
#tool-body .btn-danger:hover { background: rgba(248,113,113,.2); }

/* ── MAIN LAYOUT ── */
#tool-body .main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#tool-body .sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: width .2s;
  overflow: hidden;
}
#tool-body .sidebar.collapsed { width: 0; }
#tool-body .sidebar-section { padding: 10px 12px 4px; }
#tool-body .sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--text3); text-transform: uppercase; padding: 0 4px;
  margin-bottom: 6px;
}
#tool-body .sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--text2);
  transition: all .12s;
}
#tool-body .sidebar-item:hover { background: var(--bg3); color: var(--text); }
#tool-body .sidebar-item.active { background: rgba(240,165,0,.1); color: var(--accent); }
#tool-body .sidebar-item svg { flex-shrink: 0; opacity: .7; }
#tool-body .sidebar-item.active svg { opacity: 1; }

/* ── EDITOR PANEL ── */
#tool-body .editor-panel {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

#tool-body .editor-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#tool-body .editor-toolbar-group { display: flex; gap: 4px; }
#tool-body .tbtn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; cursor: pointer; color: var(--text2);
  background: transparent; border: none; transition: all .12s; font-size: 13px;
}
#tool-body .tbtn:hover { background: var(--bg3); color: var(--text); }
#tool-body .tbtn.active { background: var(--bg4); color: var(--accent); }

#tool-body .editor-info {
  margin-left: auto; display: flex; align-items: center; gap: 12px;
  font-size: 11px; color: var(--text3); font-family: var(--font-mono);
}
#tool-body .editor-info span { display: flex; align-items: center; gap: 4px; }

/* ── SEARCH BAR ── */
#tool-body .search-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#tool-body .search-bar.visible { display: flex; }
#tool-body .search-bar input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 5px; padding: 4px 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  outline: none; min-width: 0;
}
#tool-body .search-bar input:focus { border-color: var(--accent); }
#tool-body .search-count { font-size: 11px; color: var(--text3); white-space: nowrap; font-family: var(--font-mono); min-width: 50px; }
#tool-body .search-bar .sbtn {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 5px; color: var(--text2); cursor: pointer;
  padding: 3px 8px; font-size: 12px; transition: all .12s;
}
#tool-body .search-bar .sbtn:hover { background: var(--bg4); color: var(--text); }

#tool-body .editor-wrap {
  flex: 1; position: relative; overflow: hidden;
  background: var(--bg);
}
#tool-body .editor-wrap * {
  margin: 0;
}
/* CodeMirror override */
#tool-body .CodeMirror {
  height: 100% !important;
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
  line-height: 1.65 !important;
  background: var(--bg) !important;
  color: var(--text) !important;
}
#tool-body .CodeMirror-scroll { padding-bottom: 40px; }
#tool-body .CodeMirror-gutters {
  background: var(--bg) !important;
  border-right: 1px solid var(--border) !important;
}
#tool-body .CodeMirror-linenumber { color: var(--text3) !important; font-size: 12px; }
#tool-body .CodeMirror-cursor { border-left: 2px solid var(--accent) !important; }
#tool-body .CodeMirror-selected { background: rgba(240,165,0,.12) !important; }
#tool-body .CodeMirror-activeline-background { background: rgba(255,255,255,.03) !important; }
#tool-body .CodeMirror-matchingbracket { color: var(--accent) !important; font-weight: bold; outline: 1px solid var(--accent); }

/* Syntax colors */
#tool-body .cm-keyword { color: #c792ea !important; }
#tool-body .cm-atom { color: #f78c6c !important; }
#tool-body .cm-number { color: #f78c6c !important; }
#tool-body .cm-def { color: #82aaff !important; }
#tool-body .cm-variable { color: var(--text) !important; }
#tool-body .cm-variable-2 { color: #eeffff !important; }
#tool-body .cm-variable-3, .cm-type { color: var(--cyan) !important; }
#tool-body .cm-comment { color: #546e7a !important; font-style: italic; }
#tool-body .cm-string { color: var(--green) !important; }
#tool-body .cm-string-2 { color: var(--green) !important; }
#tool-body .cm-qualifier { color: var(--cyan) !important; }
#tool-body .cm-builtin { color: var(--cyan) !important; }
#tool-body .cm-bracket { color: #89ddff !important; }
#tool-body .cm-tag { color: #f07178 !important; }
#tool-body .cm-attribute { color: #c792ea !important; }
#tool-body .cm-header { color: var(--accent) !important; }
#tool-body .cm-meta { color: #80cbc4 !important; }
#tool-body .cm-operator { color: #89ddff !important; }
#tool-body .cm-property { color: #b2ccd6 !important; }
#tool-body .cm-error { color: var(--red) !important; text-decoration: underline wavy; }

/* ── RESIZE HANDLE ── */
#tool-body .resize-handle {
  width: 5px; cursor: col-resize;
  background: var(--border);
  transition: background .2s;
  flex-shrink: 0;
  position: relative;
}
#tool-body .resize-handle:hover, .resize-handle.dragging { background: var(--accent); }
#tool-body .resize-handle::after {
  content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 2px; height: 32px; border-radius: 2px;
  background: rgba(255,255,255,.2);
}

#tool-body .resize-handle-h {
  height: 5px; cursor: row-resize;
  background: var(--border);
  transition: background .2s;
  flex-shrink: 0;
}
#tool-body .resize-handle-h:hover, .resize-handle-h.dragging { background: var(--accent); }

/* ── OUTPUT PANEL ── */
#tool-body .output-panel {
  width: 420px;
  min-width: 280px; max-width: 60vw;
  display: flex; flex-direction: column;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

#tool-body .output-tabs {
  display: flex; gap: 0;
  background: var(--bg); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#tool-body .output-tab {
  padding: 9px 16px; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--text3); transition: all .15s;
  border-bottom: 2px solid transparent; letter-spacing: .4px;
  text-transform: uppercase;
}
#tool-body .output-tab:hover { color: var(--text2); }
#tool-body .output-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

#tool-body .output-content { flex: 1; overflow: hidden; position: relative; display: flex; flex-direction: column; }

#tool-body .output-section { display: none; flex: 1; flex-direction: column; overflow: hidden; }
#tool-body .output-section.visible { display: flex; }

/* Console */
#tool-body .console-wrap {
  flex: 1; overflow-y: auto; padding: 12px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
}
#tool-body .console-wrap::-webkit-scrollbar { width: 6px; }
#tool-body .console-wrap::-webkit-scrollbar-track { background: transparent; }
#tool-body .console-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
#tool-body .console-entry { display: flex; gap: 8px; padding: 2px 0; }
#tool-body .console-entry:hover { background: rgba(255,255,255,.02); border-radius: 4px; padding: 2px 4px; margin: 0 -4px; }
#tool-body .console-ts { color: var(--text3); font-size: 11px; flex-shrink: 0; padding-top: 2px; }
#tool-body .console-msg { word-break: break-all; flex: 1; }
#tool-body .console-msg.stdout { color: var(--text); }
#tool-body .console-msg.stderr { color: var(--red); }
#tool-body .console-msg.info { color: var(--blue); }
#tool-body .console-msg.success { color: var(--green); }
#tool-body .console-msg.warn { color: var(--accent); }
#tool-body .console-msg.sys { color: var(--text3); font-style: italic; }

#tool-body .stdin-bar {
  display: flex; gap: 8px; padding: 8px 12px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  background: var(--bg);
}
#tool-body .stdin-prompt { color: var(--accent); font-family: var(--font-mono); font-size: 13px; padding: 6px 0; }
#tool-body .stdin-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 6px; padding: 6px 10px;
  font-family: var(--font-mono); font-size: 13px; color: var(--text);
  outline: none; transition: border-color .15s;
}
#tool-body .stdin-input:focus { border-color: var(--accent); }
#tool-body .stdin-send {
  padding: 6px 14px; background: var(--accent);
  border: none; border-radius: 6px; color: #000; font-weight: 700;
  cursor: pointer; font-size: 12px; font-family: var(--font-ui);
  transition: all .15s;
}
#tool-body .stdin-send:hover { filter: brightness(1.1); }

/* Variables / Docs */
#tool-body .side-section { padding: 12px; flex: 1; overflow-y: auto; }
#tool-body .var-title { font-size: 12px; font-weight: 600; color: var(--text3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .8px; }
#tool-body .var-row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; }
#tool-body .var-name { color: var(--blue); min-width: 100px; }
#tool-body .var-type { color: var(--purple); min-width: 60px; }
#tool-body .var-val { color: var(--text); word-break: break-all; }

/* Docs */
#tool-body .doc-search {
  display: flex; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
#tool-body .doc-search input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 6px; padding: 6px 10px;
  font-size: 13px; color: var(--text); outline: none;
  transition: border-color .15s; font-family: var(--font-ui);
}
#tool-body .doc-search input:focus { border-color: var(--accent); }
#tool-body .doc-list { padding: 8px 12px; overflow-y: auto; flex: 1; }
#tool-body .doc-item {
  padding: 8px; border-radius: 6px; cursor: pointer;
  transition: background .12s; margin-bottom: 2px;
}
#tool-body .doc-item:hover { background: var(--bg3); }
#tool-body .doc-item-name { font-family: var(--font-mono); font-size: 13px; color: var(--blue); margin-bottom: 2px; }
#tool-body .doc-item-desc { font-size: 12px; color: var(--text2); line-height: 1.4; }
#tool-body .doc-item-sig { font-family: var(--font-mono); font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── STATUS BAR ── */
#tool-body .statusbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 26px;
  background: var(--bg2); border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text3); flex-shrink: 0;
  font-family: var(--font-mono);
}
#tool-body .statusbar .status-item { display: flex; align-items: center; gap: 5px; }
#tool-body .status-dot { width: 6px; height: 6px; border-radius: 50%; }
#tool-body .status-dot.ready { background: var(--green); box-shadow: 0 0 6px var(--green); }
#tool-body .status-dot.running { background: var(--accent); animation: pulse 1s infinite; }
#tool-body .status-dot.error { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

#tool-body .statusbar .sep { color: var(--border2); }
#tool-body .statusbar-right { margin-left: auto; display: flex; gap: 12px; }

/* ── LOADING OVERLAY ── */
#tool-body .loading-overlay { 
  position: absolute;
  inset: 0;
  opacity: 0.9;
  z-index: 2;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
}
#tool-body .loading-overlay.hidden { display: none; }
#tool-body .loading-logo { font-size: 42px; font-weight: 900; font-family: var(--font-ui); letter-spacing: -2px; text-align: center;}
#tool-body .loading-logo span { background: linear-gradient(135deg,var(--accent),var(--accent2)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
#tool-body .loading-bar-wrap { width: 280px; height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
#tool-body .loading-bar { height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent2)); border-radius: 2px; transition: width .3s; }
#tool-body .loading-text { font-size: 13px; color: var(--text3); font-family: var(--font-mono); }

/* ── MODAL ── */
#tool-body .modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
#tool-body .modal-backdrop.hidden { display: none; }
#tool-body .modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 24px; min-width: 340px; max-width: 500px;
  box-shadow: var(--shadow);
}
#tool-body .modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
#tool-body .modal-row { margin-bottom: 14px; }
#tool-body .modal-row label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
#tool-body .modal-row input, .modal-row select, .modal-row textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2)!important;
  border-radius: 6px; padding: 8px 12px; color: var(--text);
  font-family: var(--font-ui); font-size: 13px; outline: none;
  transition: border-color .15s;
}
#tool-body .modal-row input:focus, .modal-row select:focus, .modal-row textarea:focus { border-color: var(--accent); }
#tool-body .modal-row select option { background: var(--bg3); }
#tool-body .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── NOTIFICATIONS ── */
#tool-body .notifications { position: fixed; top: 60px; right: 16px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
#tool-body .notif {
  padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow); animation: slideIn .2s ease;
  max-width: 300px; display: flex; align-items: center; gap: 8px;
}
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes slideOut { to{transform:translateX(120%);opacity:0} }
#tool-body .notif.success { background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.3); color: var(--green); }
#tool-body .notif.error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3); color: var(--red); }
#tool-body .notif.info { background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.3); color: var(--blue); }
#tool-body .notif.warn { background: rgba(240,165,0,.12); border: 1px solid rgba(240,165,0,.3); color: var(--accent); }

.theme-light-mode #tool-body .notif.info { background: rgb(182 214 255 / 48%); }

/* ── AUTOCOMPLETE ── */
#tool-body .CodeMirror-hints {
  background: var(--bg2) !important; border: 1px solid var(--border2) !important;
  border-radius: 8px !important; padding: 4px !important;
  font-family: var(--font-mono) !important; font-size: 13px !important;
  box-shadow: var(--shadow) !important; z-index: 200;
}
#tool-body .CodeMirror-hint {
  color: var(--text) !important; padding: 4px 10px !important;
  border-radius: 5px !important;
}
#tool-body .CodeMirror-hint-active { background: rgba(240,165,0,.15) !important; color: var(--accent) !important; }
#tool-body .search-match { background: rgba(255,213,79,.2); border-radius: 2px; }
#tool-body .search-match-current { background: rgba(255,213,79,.6); border-radius: 2px; outline: 1px solid var(--accent); }

/* ── SNIPPET PANEL ── */
#tool-body .snippet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; justify-content: space-evenly;}
#tool-body .snippet-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; cursor: pointer;
  transition: all .15s;
}
#tool-body .snippet-card:hover { border-color: var(--accent); background: rgba(240,165,0,.05); }
#tool-body .snippet-card-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
#tool-body .snippet-card-desc { font-size: 11px; color: var(--text3); }

/* Run spinner */
#tool-body .spin { display: inline-block; animation: rotate 1s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

/* scrollbar global */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

@media (max-width: 1000px) {  
  #tool-body .logo-text { display: none; }
}
/* ── MOBILE LAYOUT ── */
@media (max-width: 768px) {

  /* ── 顶栏 ── */
  #tool-body .topbar {
    padding: 0 6px;
    gap: 4px;
    height: 48px;
    flex-shrink: 0;
  }
  #tool-body .logo-icon { width: 24px; height: 24px; font-size: 12px; flex-shrink: 0; }
  #tool-body .logo { gap: 0; }
  #tool-body .topbar-sep { display: none; }
  #tool-body .tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  #tool-body .tabs::-webkit-scrollbar { display: none; }
  #tool-body .tab { font-size: 12px; padding: 4px 8px; }
  #tool-body .tab .tab-close { opacity: 1; }
  #tool-body .btn-new-tab { padding: 4px 8px; font-size: 14px; }
  #tool-body .topbar-actions { gap: 4px; }
  #tool-body .topbar-actions .btn { padding: 5px 8px; font-size: 12px; gap: 3px; }

  /* ── 侧栏 ── */
  #tool-body .sidebar {
    position: absolute;
    top: 48px;
    left: 0;
    bottom: 56px;
    z-index: 1;
    width: 240px;
    transition: transform .25s ease;
    transform: translateX(0);
    box-shadow: 1px 0 10px rgb(0 0 0 / 10%);
  }
  #tool-body .sidebar.collapsed {
    width: 240px;
    transform: translateX(-100%);
  }

  /* ── 主区域：编辑器 + 输出 上下排列 ── */
  #tool-body .main {
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
  }

  /* ── 编辑器 ── */
  #tool-body .editor-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  #tool-body .editor-toolbar {
    padding: 3px 6px;
    gap: 2px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  #tool-body .editor-toolbar > div:last-child { display: none; }

  /* ── 水平分割线隐藏 ── */
  #tool-body .resize-handle { display: none; }

  /* ── 输出面板 ── */
  #tool-body .output-panel {
    flex: none;
    height: 42vh;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    border-left: none;
    border-top: 1px solid var(--border);
    overflow: hidden;
  }
  #tool-body .output-content { overflow: hidden; }
  #tool-body .console-wrap {
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  #tool-body .console-entry { max-width: 100%; }
  #tool-body .console-msg { word-break: break-all; overflow-wrap: break-word; min-width: 0; }

  /* ── 顶栏 Run/Stop：移动端由底部接管 ── */
/*   #tool-body #runBtn { display: none !important; }
  #tool-body #stopBtn { display: none !important; } */

  /* ── 状态栏 ── */
  #tool-body .statusbar {
    font-size: 10px;
    padding: 0 8px;
    height: 22px;
    padding-bottom: 0;
  }
  #tool-body .statusbar-right { display: none; }

  /* ── 底部固定 Run 按钮 ── */
/*   #tool-body #mobileRunBar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 12px;
    height: 56px;
    align-items: center;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    gap: 8px;
    z-index: 200;
  } */
  #tool-body #mobileRunBar .btn {
    flex: 1;
    justify-content: center;
    height: 40px;
  }
}

/* @media (min-width: 769px) { */
  #tool-body #mobileRunBar { display: none; }
/* } */

/* Fold gutter */
#tool-body .CodeMirror-foldgutter { width: 14px; }
#tool-body .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded {
  color: var(--text3); cursor: pointer; font-size: 12px;
}
#tool-body .CodeMirror-foldgutter-open:hover, .CodeMirror-foldgutter-folded:hover { color: var(--accent); }