/* ── Board bar ── */
#board-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 30px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#board-bar label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#board-select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
#board-select:focus { border-color: var(--border-focus); }
#board-select:hover { border-color: #666; }
#board-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}
.board-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: #1b3a5c;
  color: var(--accent-cyan);
  margin-left: 6px;
  letter-spacing: 0.3px;
}

/* ── Main layout ── */
#main { display: flex; flex: 1; overflow: hidden; min-height: 0; position: relative; }

/* ── Left pane ── */
#left-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 200px;
}

/* ── Mode bar (tab strip) ── */
#mode-bar {
  display: flex;
  background: var(--tab-inactive-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 35px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  cursor: pointer;
  font-size: 12px;
  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;
}
.mode-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.mode-btn.active {
  color: var(--text-bright);
  background: var(--tab-active-bg);
  border-bottom-color: var(--tab-border-top);
}

/* ── Blockly canvas ── */
#blockly-div {
  flex: 1;
  background: #1e1e1e;
  min-height: 120px;
  position: relative;
}

/* ── 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); }

/* ── 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); }
