:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-panel: #161b22;
  --bg-input: #0d1117;
  --green: #00ff41;
  --green-dim: #00cc33;
  --green-glow: rgba(0, 255, 65, 0.3);
  --amber: #ffb000;
  --amber-dim: #cc8e00;
  --amber-glow: rgba(255, 176, 0, 0.3);
  --red: #ff4444;
  --red-glow: rgba(255, 68, 68, 0.3);
  --cyan: #58a6ff;
  --magenta: #f778ba;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-dim: #484f58;
  --text-muted: #30363d;
  --border: #30363d;
  --border-dim: #21262d;
  --highlight-line: rgba(0, 255, 65, 0.15);
  --yellow-flash: rgba(255, 220, 0, 0.4);
}

/* CRT scanline overlay — VERY subtle, never blocks content */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 4px
  );
  opacity: 1;
}

.crt-vignette {
  pointer-events: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.3) 100%);
}

/* Glow text */
.glow-green {
  color: var(--green) !important;
  text-shadow: 0 0 10px var(--green-glow), 0 0 20px var(--green-glow), 0 0 40px rgba(0, 255, 65, 0.1);
}

.glow-amber {
  color: var(--amber) !important;
  text-shadow: 0 0 10px var(--amber-glow), 0 0 20px var(--amber-glow);
}

/* LED indicators */
.led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.led-on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green), 0 0 12px var(--green-glow);
}

.led-off {
  background: #1a2a1a;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Register flash animation */
@keyframes regFlash {
  0% { background: var(--yellow-flash); box-shadow: 0 0 8px rgba(255, 220, 0, 0.3); }
  100% { background: transparent; box-shadow: none; }
}

.reg-flash {
  animation: regFlash 0.6s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Boot screen cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.cursor-blink {
  animation: blink 1s step-end infinite;
}

/* Control buttons */
.ctrl-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--text-primary);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 4px;
  white-space: nowrap;
}

.ctrl-btn:hover {
  border-color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  color: var(--green);
}

.ctrl-btn:active {
  transform: scale(0.97);
}

.ctrl-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ctrl-btn-run {
  border-color: var(--green-dim);
  color: var(--green);
}

.ctrl-btn-stop {
  border-color: #661111;
  color: var(--red);
}

.ctrl-btn-stop:hover {
  border-color: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

/* Textarea styling */
.code-textarea {
  background: transparent;
  color: transparent;
  caret-color: var(--green);
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  line-height: 22px;
  resize: none;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 2;
}

.code-display {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  line-height: 22px;
  white-space: pre;
  pointer-events: none;
  color: var(--text-primary);
}

/* Speed slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  box-shadow: 0 0 6px var(--green-glow);
}

select {
  background: #21262d;
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

select:focus {
  border-color: var(--green);
}

/* Tooltip */
.tooltip-container {
  position: relative;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1c2128;
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  z-index: 100;
  border: 1px solid var(--border);
  transition: opacity 0.2s;
  margin-bottom: 4px;
  pointer-events: none;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Responsive layout */
@media (max-width: 900px) {
  .desktop-layout {
    flex-direction: column !important;
  }
  .left-panel, .right-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-dim) !important;
  }
  .left-panel {
    min-height: 300px !important;
    max-height: 400px !important;
  }
}