/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Page ── */
body {
  font-family: Arial, sans-serif;
  background: #f6f7fb;
  height: 100vh;
  overflow: hidden;
}

/* ── Two-pane layout ── */
#container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ════════════════════════
   LEFT PANE
   ════════════════════════ */
#left-pane {
  width: 40%;
  min-width: 280px;
  border-right: 2px solid #ddd;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

#left-pane h2 {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
}

/* ── Mode toggle ── */
#mode-toggle {
  display: flex;
  flex-shrink: 0;
  border: 1px solid #aaa;
  border-radius: 4px;
  overflow: hidden;
}

#mode-toggle button {
  flex: 1;
  border: none;
  border-radius: 0;
  background: #f0f0f0;
  color: #333;
  font-size: 11px;
  padding: 5px 4px;
  cursor: pointer;
  white-space: nowrap;
}

#mode-toggle button + button {
  border-left: 1px solid #aaa;
}

#mode-toggle button.active {
  background: #007bff;
  color: #fff;
}

#mode-toggle button:hover:not(.active) {
  background: #ddd;
}

/* ── Editor (line numbers + textarea) ── */
#editor-wrap {
  flex: 1;
  display: flex;
  border: 1px solid #aaa;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  min-height: 0;
}

#line-numbers {
  width: 38px;
  min-width: 38px;
  background: #f0f0f0;
  border-right: 1px solid #ddd;
  padding: 8px 0;
  text-align: right;
  font-family: monospace;
  font-size: 14px;
  line-height: 20px;
  color: #999;
  user-select: none;
  overflow: hidden;
}

#line-numbers span {
  display: block;
  padding-right: 6px;
}

#netlistBox {
  flex: 1;
  font-family: monospace;
  font-size: 14px;
  line-height: 20px;
  border: none;
  outline: none;
  resize: none;
  padding: 8px;
  background: #fff;
  overflow-y: auto;
}

/* ── DOT preview panel ── */
#dot-preview {
  display: none;
  flex-shrink: 0;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 8px;
  font-family: monospace;
  font-size: 11px;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre;
  color: #444;
}

/* ── Error message ── */
#error-msg {
  display: none;
  flex-shrink: 0;
  color: #c0392b;
  font-size: 12px;
  font-family: monospace;
  white-space: pre-wrap;
  background: #fff5f5;
  border: 1px solid #f5c6c6;
  border-radius: 4px;
  padding: 5px 8px;
}

/* ── Buttons ── */
#buttons {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

button {
  background: #007bff;
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

button:hover  { background: #005fcc; }
button:active { opacity: 0.85; }

#btn-convert { background: #28a745; }
#btn-convert:hover { background: #1e7e34; }

/* ════════════════════════
   RIGHT PANE
   ════════════════════════ */
#right-pane {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  overflow: hidden;
}

#circuitCanvas {
  border: 1px solid #ccc;
  background: #fafafa;
  display: block;
}