* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0d0d0d;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle {
  padding: 4px 12px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #222;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.view-toggle:hover {
  background: #333;
  border-color: #666;
  color: #e0e0e0;
}

.view-toggle.active {
  background: #1a3a5c;
  border-color: #2a6cb0;
  color: #6cb4ff;
}

.status {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #2a2a2a;
  color: #888;
}

.status.ready {
  color: #4caf50;
}

.status.running {
  color: #ff9800;
}

.status.error {
  color: #f44336;
}

main {
  display: flex;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 53px);
}

/* Left column: LED display + console */
.display-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

#led-canvas {
  background: #111;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

.console-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  overflow: hidden;
}

.console-header {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#console-output {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #ccc;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Right column: controls + editor */
.editor-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.controls {
  display: flex;
  gap: 8px;
}

.controls button {
  padding: 8px 18px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #222;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.controls button:hover:not(:disabled) {
  background: #333;
  border-color: #666;
}

.controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#btn-run {
  background: #1b5e20;
  border-color: #2e7d32;
}

#btn-run:hover:not(:disabled) {
  background: #2e7d32;
}

#btn-stop {
  background: #b71c1c;
  border-color: #c62828;
}

#btn-stop:hover:not(:disabled) {
  background: #c62828;
}

/* CodeMirror overrides */
.CodeMirror {
  flex: 1;
  height: auto !important;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.CodeMirror-scroll {
  min-height: 100%;
}
