#sim-panel {
  width: 300px;
  min-width: 180px;
  max-width: 60vw;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  transition: width 0.2s;
}

#sim-panel.collapsed { width: 32px !important; min-width: 32px; overflow: hidden; }
#sim-panel.collapsed #sim-header,
#sim-panel.collapsed #sim-body { display: none; }

.sim-stub {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
  gap: 8px;
  width: 32px;
  height: 100%;
}
#sim-panel.collapsed .sim-stub { display: flex; }
.sim-stub-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-green);
  letter-spacing: 1px;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
}
.sim-stub-icon { font-size: 14px; color: var(--accent-green); cursor: pointer; }

#sim-header {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 35px;
  background: var(--tab-inactive-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.sim-tab {
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  border-right: 1px solid var(--border);
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
  user-select: none;
}
.sim-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.sim-tab.active {
  color: var(--text-bright);
  background: #1a1a1a;
  border-bottom-color: var(--accent-green);
}

#sim-header h3 { font-size: 12px; font-weight: 500; color: var(--text-primary); margin: 0; letter-spacing: 0.3px; }

.sim-toggle-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent-green);
  font-size: 13px;
  transition: background 0.12s;
}
.sim-toggle-btn:hover { background: var(--bg-active); }

.sim-run-btn {
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
#btn-sim-run { background: #16825d; color: #fff; border-color: #1f9b70; }
#btn-sim-run.running { background: #8b1a1a; border-color: #b02626; }
#btn-sim-stop { background: var(--bg-input); color: var(--text-primary); border-color: var(--border); }

#sim-speed { font-size: 10.5px; color: var(--text-muted); }
#sim-speed select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  padding: 2px 5px;
  outline: none;
}

#sim-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.sim-section { margin-bottom: 14px; }
.sim-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* Board SVG */
#board-svg-wrap { display: flex; justify-content: center; padding: 8px 0 12px; position: relative; }
#board-svg-wrap svg { max-width: 100%; height: auto; }

/* Pin rows */
.pin-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.pin-row:hover { background: var(--bg-hover); }
.pin-num  { width: 22px; font-size: 10.5px; font-weight: 700; color: #569cd6; text-align: right; flex-shrink: 0; font-family: var(--font-mono); }
.pin-name { width: 50px; font-size: 10.5px; color: var(--text-secondary); flex-shrink: 0; }

.pin-mode-badge {
  width: 44px;
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  text-align: center;
  flex-shrink: 0;
}
.pin-mode-out { background: rgba(78,201,176,0.12); color: #4ec9b0; }
.pin-mode-in  { background: rgba(156,220,254,0.12); color: var(--accent-cyan); }
.pin-mode-pwm { background: rgba(206,145,120,0.12); color: var(--accent-orange); }
.pin-mode-off { background: rgba(255,255,255,0.04); color: #555; }

.pin-toggle {
  width: 38px;
  height: 18px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  transition: all 0.15s;
  flex-shrink: 0;
}
.pin-toggle.high  { background: #16825d; color: #fff; }
.pin-toggle.low   { background: var(--bg-active); color: #666; }
.pin-toggle.input-mode { background: #1a2a3a; color: var(--accent-cyan); cursor: default; }

.pin-bar-wrap { flex: 1; height: 5px; background: var(--bg-active); border-radius: 3px; overflow: hidden; }
.pin-bar { height: 100%; border-radius: 3px; transition: width 0.2s, background 0.2s; }
.pin-bar.high { background: #4ec9b0; }
.pin-bar.pwm  { background: var(--accent-orange); }
.pin-bar.low  { background: var(--bg-active); }
.pin-val { width: 30px; font-size: 9.5px; color: var(--text-muted); text-align: right; flex-shrink: 0; font-family: var(--font-mono); }

/* Analog sliders */
.analog-row  { display: flex; align-items: center; gap: 7px; padding: 4px 6px; }
.analog-label{ width: 24px; font-size: 10.5px; font-weight: 700; color: var(--accent-orange); text-align: right; flex-shrink: 0; font-family: var(--font-mono); }
.analog-name { width: 48px; font-size: 10px; color: var(--text-secondary); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analog-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-active);
  outline: none;
  cursor: pointer;
}
.analog-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-orange);
  cursor: pointer;
}
.analog-num  { width: 30px; font-size: 10px; color: var(--accent-orange); text-align: right; font-family: var(--font-mono); }
.analog-volt { width: 30px; font-size: 10px; color: var(--text-muted); text-align: right; font-family: var(--font-mono); }

/* Serial monitor */
#serial-monitor {
  height: 130px;
  background: #141414;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #4ec9b0;
  line-height: 1.65;
}
.serial-rx  { color: #4ec9b0; }
.serial-tx  { color: var(--accent-cyan); }
.serial-sys { color: var(--text-muted); font-style: italic; }
.serial-err { color: var(--accent-red); }
.serial-ts  { color: #444; font-size: 9.5px; margin-right: 6px; }
#serial-input-row { display: flex; gap: 6px; margin-top: 7px; }
#serial-input {
  flex: 1;
  background: #141414;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11.5px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-mono);
  transition: border-color 0.15s;
}
#serial-input:focus { border-color: var(--border-focus); }
.btn-serial-send {
  padding: 4px 10px;
  background: #007acc;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.12s;
}
.btn-serial-send:hover { opacity: 0.88; }

/* ── Mode-switch modal ── */
#mode-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999; align-items: center; justify-content: center; }
#mode-modal-overlay.open { display: flex; }
#mode-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: modalPop 0.15s ease;
}
@keyframes modalPop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#mode-modal-header {
  background: #2c2c2c;
  padding: 14px 18px;
  border-radius: 5px 5px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
#mode-modal-header h2 { font-size: 13px; font-weight: 600; color: var(--text-bright); margin: 0; }
#mode-modal-header .modal-icon { font-size: 17px; }
#mode-modal-body { padding: 18px; }
#mode-modal-body p { font-size: 12.5px; color: var(--text-primary); line-height: 1.65; margin-bottom: 12px; }
#mode-modal-body .modal-note {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: #141414;
  border-left: 3px solid var(--accent-blue);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
#mode-modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 0 18px 18px; }
.modal-btn { padding: 6px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 12px; font-family: var(--font-ui); font-weight: 500; cursor: pointer; transition: filter 0.1s; }
.modal-btn:hover { filter: brightness(1.1); }
.modal-btn-cancel  { background: var(--bg-input); color: var(--text-primary); border-color: var(--border); }
.modal-btn-confirm { background: var(--accent-blue); color: #fff; border-color: #0095f0; }

/* ── Component simulator panel (bottom) ── */
/* comp-panel removed — components now live in sim panel Components tab */

/* Blockly toolbox */
.blocklyFlyoutLabelText { fill: var(--text-muted) !important; font-size: 10px !important; font-weight: 700 !important; letter-spacing: 0.5px !important; }
.blocklyTreeLabel { font-size: 12px !important; }

.editor-error { color: var(--accent-red); }

/* ── Component widget styles ── */
.comp-widget { background: #141414; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; margin-bottom: 8px; }
.comp-title  { font-size: 9.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 7px; }

.sim-lcd { background: #1a3a0a; border: 1px solid #3a7a2a; border-radius: var(--radius-sm); padding: 7px 9px; font-family: var(--font-mono); }
.sim-lcd-row { font-size: 12.5px; color: #4ec9b0; letter-spacing: 1px; min-height: 17px; white-space: pre; }

.sim-oled { background: #000; border: 1px solid #2a4a6a; border-radius: var(--radius-sm); padding: 6px 8px; }
.sim-oled canvas { display: block; border-radius: 2px; }

.sim-servo-wrap { display: flex; align-items: center; gap: 10px; }
.sim-servo-deg  { font-size: 11.5px; color: #c586c0; font-family: var(--font-mono); min-width: 38px; }

.sim-neo-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.sim-neo-px    { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); transition: background 0.1s; }

.sim-dht-val   { font-size: 13px; font-family: var(--font-mono); color: var(--accent-cyan); }
.sim-dht-label { font-size: 9.5px; color: #555; margin-top: 2px; }

.sim-tm { background: #0a0a0a; border: 1px solid #5a3d12; border-radius: var(--radius-sm); padding: 5px 12px; font-family: var(--font-mono); font-size: 21px; color: var(--accent-orange); letter-spacing: 5px; min-width: 84px; text-align: center; }

.sim-stepper-arc { position: relative; width: 62px; height: 62px; }

.sim-buzzer { width: 38px; height: 38px; border-radius: 50%; border: 2px solid #5a3d12; display: flex; align-items: center; justify-content: center; font-size: 17px; transition: all 0.15s; }
.sim-buzzer.active { background: #2a1a00; border-color: var(--accent-orange); box-shadow: 0 0 10px rgba(206,145,120,0.3); }

.sim-ultra-val { font-size: 13px; font-family: var(--font-mono); color: var(--accent-green); }
.sim-active-line { background: rgba(78,201,176,0.06); border-left: 2px solid var(--accent-green); padding-left: 6px; border-radius: 2px; }

/* Push button widget */
.sim-push-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid #444; background: #2a2a2a;
  color: #666; font-size: 18px; cursor: pointer;
  transition: all 0.08s; user-select: none;
  display: flex; align-items: center; justify-content: center;
  outline: none;
}
.sim-push-btn:hover { border-color: #666; background: #333; }
.sim-push-btn.pressed {
  background: #4ec9b0; border-color: #4ec9b0;
  color: #fff; box-shadow: 0 0 10px rgba(78,201,176,0.5);
  transform: scale(0.92);
}

#sim-clock { font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono); }

/* ── Real Serial Monitor (bottom overlay) ── */
#real-serial-monitor {
  position: fixed;
  bottom: 22px; /* above status bar */
  left: 0;
  right: 0;
  transition: left 0.18s ease, right 0.18s ease;
  height: 240px;
  min-height: 80px;
  max-height: 80vh;
  background: #131313;
  border-top: 2px solid #007acc;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: height 0.0s;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
}
#real-serial-monitor.rsm-hidden {
  display: none;
}
#rsm-resize-handle {
  height: 5px;
  background: transparent;
  cursor: row-resize;
  flex-shrink: 0;
  position: relative;
  z-index: 51;
  transition: background 0.15s;
}
#rsm-resize-handle:hover,
#rsm-resize-handle.dragging { background: var(--accent-blue); }
#rsm-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.15s;
}
#rsm-resize-handle:hover::after,
#rsm-resize-handle.dragging::after { background: var(--accent-blue); }

#rsm-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  background: #1a1a2e;
  border-bottom: 1px solid #2a2a4a;
  flex-shrink: 0;
  user-select: none;
}
#rsm-header .rsm-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #7aa2f7;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
#rsm-header .rsm-title .rsm-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}
#rsm-header .rsm-title .rsm-dot.connected {
  background: #4ec9b0;
  box-shadow: 0 0 5px rgba(78,201,176,0.6);
}
#rsm-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
  flex: 1;
}
#rsm-port-select {
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 3px;
  font-size: 11px;
  padding: 2px 5px;
  outline: none;
  max-width: 130px;
  cursor: pointer;
}
#rsm-baud-select {
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 3px;
  font-size: 11px;
  padding: 2px 5px;
  outline: none;
  cursor: pointer;
}
.rsm-btn {
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 10.5px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.1s;
  line-height: 18px;
}
.rsm-btn:hover { filter: brightness(1.15); }
.rsm-btn-connect    { background: #16825d; color: #fff; border-color: #1f9b70; }
.rsm-btn-disconnect { background: #8b1a1a; color: #fff; border-color: #b02626; }
.rsm-btn-clear      { background: #2a2a2a; color: #aaa;  border-color: #444; }
.rsm-btn-close      { background: transparent; color: #666; border-color: transparent; font-size: 13px; padding: 0 5px; margin-left: 2px; }
.rsm-btn-close:hover { color: #ccc; }

/* Blocks mode: left = right edge of Blockly category sidebar (~175px) */
#real-serial-monitor.rsm-blocks-mode {
  left: 175px !important;
  right: 0px !important;
}

/* Text editor mode: full width */
#real-serial-monitor.rsm-text-mode {
  left: 0px !important;
  right: 0px !important;
}

/* When RSM is inside editor/blocks area (both right panels collapsed) */
#real-serial-monitor.rsm-editor-mode {
  border-top-color: #4a4a6a;
  background: rgba(15, 15, 22, 0.97);
  box-shadow: 0 -3px 18px rgba(0,0,0,0.7);
}
#real-serial-monitor.rsm-editor-mode #rsm-header {
  background: #16162a;
  border-bottom-color: #2a2a4a;
}
#real-serial-monitor.rsm-editor-mode .rsm-title {
  color: #9a9acf;
}
.rsm-line-end-sel {
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 3px;
  font-size: 10.5px;
  padding: 2px 4px;
  outline: none;
  cursor: pointer;
}
#rsm-status-text {
  font-size: 10px;
  color: #555;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
#rsm-toggle-btn {
  background: #1a1a2e;
  border: 1px solid #2a2a5a;
  border-radius: 3px;
  color: #7aa2f7;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  margin-left: auto;
}
#rsm-toggle-btn:hover { background: #22224a; }

#rsm-output {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #4ec9b0;
  line-height: 1.6;
  background: #0d0d0d;
  scroll-behavior: smooth;
}
#rsm-output::-webkit-scrollbar { width: 6px; }
#rsm-output::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.rsm-line-rx  { color: #4ec9b0; }
.rsm-line-tx  { color: #79c0ff; }
.rsm-line-sys { color: #555; font-style: italic; }
.rsm-line-err { color: #f85149; }
.rsm-ts { color: #333; font-size: 9.5px; margin-right: 5px; }

#rsm-input-row {
  display: flex;
  gap: 5px;
  padding: 5px 8px;
  background: #131313;
  border-top: 1px solid #2a2a2a;
  flex-shrink: 0;
}
#rsm-input {
  flex: 1;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 3px;
  padding: 4px 9px;
  font-size: 11.5px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-mono);
  transition: border-color 0.15s;
}
#rsm-input:focus { border-color: #007acc; }
#rsm-input:disabled { opacity: 0.4; }
#rsm-send-btn {
  padding: 4px 12px;
  background: #007acc;
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.12s;
}
#rsm-send-btn:hover { opacity: 0.88; }
#rsm-send-btn:disabled { opacity: 0.35; cursor: default; }
#rsm-autoscroll-label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #555;
  white-space: nowrap;
  cursor: pointer;
}
#rsm-rx-tx-bar {
  display: flex;
  gap: 8px;
  padding: 2px 10px 3px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: #333;
  background: #0d0d0d;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}
#rsm-rx-tx-bar span { color: #444; }
#rsm-rx-count { color: #4ec9b0 !important; }
#rsm-tx-count { color: #79c0ff !important; }

/* Toggle button in topbar for real serial monitor */
#btn-toggle-real-serial {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
#btn-toggle-real-serial:hover { color: #7aa2f7; border-color: #7aa2f7; }
#btn-toggle-real-serial.active { color: #7aa2f7; border-color: #7aa2f7; background: #1a1a2e; }

/* ── Resize handles ── */
.resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: background 0.15s;
}
.resize-handle:hover, .resize-handle.dragging { background: var(--accent-blue); }
.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 36px;
  width: 2px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.15s;
}
.resize-handle:hover::after, .resize-handle.dragging::after { background: var(--accent-blue); }

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  top: 48px;
  right: 16px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: var(--font-ui);
  font-weight: 500;
  min-width: 220px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  border: 1px solid transparent;
  pointer-events: all;
  animation: toastIn 0.18s ease;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.hiding { opacity: 0; transform: translateX(16px); }
.toast-ok    { background: #1a2e1a; border-color: #3fb950; color: #3fb950; }
.toast-error { background: #2a0e0e; border-color: #f85149; color: #f85149; }
.toast-warn  { background: #2a1e08; border-color: #d29922; color: #d29922; }
.toast-icon  { font-size: 15px; flex-shrink: 0; }
.toast-msg   { flex: 1; line-height: 1.4; color: var(--text-primary); }
.toast-close { background: none; border: none; color: var(--text-muted);
               cursor: pointer; font-size: 14px; padding: 0; flex-shrink: 0;
               opacity: 0.6; transition: opacity 0.12s; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
} */
/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  top: 48px;
  right: 16px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: var(--font-ui);
  min-width: 220px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  border-left: 3px solid transparent;
  pointer-events: all;
  animation: toastIn 0.18s ease;
  transition: opacity 0.3s, transform 0.3s;
  background: #252526;
  border-color: transparent;
}
.toast.hiding { opacity: 0; transform: translateX(16px); }
.toast-ok    { border-left-color: #3fb950; }
.toast-error { border-left-color: #f85149; }
.toast-warn  { border-left-color: #d29922; }
.toast-icon  { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.toast-ok   .toast-icon { color: #3fb950; }
.toast-error .toast-icon { color: #f85149; }
.toast-warn  .toast-icon { color: #d29922; }
.toast-msg   { flex: 1; line-height: 1.45; color: #cccccc; font-size: 12px; }
.toast-title { font-weight: 600; font-size: 12.5px; margin-bottom: 2px; }
.toast-close { background: none; border: none; color: var(--text-muted);
               cursor: pointer; font-size: 13px; padding: 0 0 0 4px; flex-shrink: 0;
               opacity: 0.5; transition: opacity 0.12s; line-height: 1; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #424242; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #525252; }

/* ── Input field for render URL ── */
#render-url {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-ui);
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
#render-url:focus { border-color: var(--border-focus); }
#render-url::placeholder { color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 900px) {
  #main { flex-direction: column; }
  #left-pane { min-height: 240px; flex: 1 1 240px; }
  #panel { width: 100% !important; min-width: unset; max-width: unset; border-left: none; border-top: 1px solid var(--border); flex-shrink: 0; height: 220px; min-height: 80px; max-height: 50vh; }
  #panel.collapsed { width: 100% !important; height: 32px !important; min-height: 32px; }
  #panel.collapsed .panel-stub { display: none; }
  #panel.collapsed .panel-stub-horiz { display: flex; }
  #sim-panel { width: 100% !important; min-width: unset; max-width: unset; border-left: none; border-top: 1px solid var(--border); flex-shrink: 0; height: 220px; min-height: 80px; max-height: 50vh; }
  #sim-panel.collapsed { width: 100% !important; height: 32px !important; min-height: 32px; }
  #sim-panel.collapsed .sim-stub { display: none; }
  #sim-panel.collapsed .sim-stub-horiz { display: flex; }
  .resize-handle { width: 100%; height: 4px; cursor: row-resize; }
  .resize-handle::after { height: 2px; width: 36px; }
  #topbar { flex-wrap: wrap; height: auto; padding: 6px 12px; }
}

@media (max-width: 600px) {
  .btn { padding: 4px 8px; font-size: 11px; }
  #topbar h1 { display: none; }
}

/* Horizontal stub for mobile */
.panel-stub-horiz, .sim-stub-horiz {
  display: none;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px;
  gap: 8px;
  width: 100%;
  height: 32px;
  cursor: pointer;
}
.panel-stub-horiz span { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.sim-stub-horiz span   { font-size: 11px; font-weight: 600; color: var(--accent-green); }
