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

:root {
  --green: #33ff33;
  --green-dim: #1a8a1a;
  --green-glow: #33ff3355;
  --amber: #ffaa00;
  --amber-dim: #8a5500;
  --red: #ff3333;
  --bg: #0a0a0a;
  --bg-panel: #111111;
  --bg-panel-lighter: #1a1a1a;
  --border: #2a2a2a;
  --metal: #1e1e1e;
}

body {
  background: var(--bg);
  color: var(--green);
  font-family: 'Fira Code', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

#scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

.glow-text {
  text-shadow: 0 0 8px var(--green-glow), 0 0 20px rgba(51, 255, 51, 0.15);
}

.glow-amber {
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.4), 0 0 20px rgba(255, 170, 0, 0.15);
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 2px 8px rgba(0,0,0,0.5);
}

.panel-header {
  background: linear-gradient(180deg, #222 0%, #1a1a1a 100%);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green-dim);
}

.btn-retro {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 50%, #111 100%);
  border: 1px solid #3a3a3a;
  border-bottom: 2px solid #000;
  color: var(--green);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.05s;
  border-radius: 3px;
}

.btn-retro:hover {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 50%, #1a1a1a 100%);
  border-color: #4a4a4a;
}

.btn-retro:active {
  background: linear-gradient(180deg, #111 0%, #1a1a1a 50%, #2a2a2a 100%);
  border-bottom: 1px solid #000;
  border-top: 2px solid #000;
  transform: translateY(1px);
}

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

.btn-retro.halt {
  color: var(--red);
  border-color: #8a1a1a;
}

.btn-retro.active {
  background: var(--green-dim);
  color: #000;
  box-shadow: 0 0 10px var(--green-glow);
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.1);
}

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

.led-red {
  background: var(--red);
  box-shadow: 0 0 6px var(--red), 0 0 12px rgba(255, 51, 51, 0.4);
}

.led-amber {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber), 0 0 12px rgba(255, 170, 0, 0.4);
}

.led-off {
  background: #333;
  box-shadow: none;
}

.memory-row:hover {
  background: rgba(51, 255, 51, 0.05);
}

.memory-row.pc-row {
  background: rgba(51, 255, 51, 0.1);
  border-left: 3px solid var(--green);
}

.memory-row.loaded-row {
  background: rgba(255, 170, 0, 0.06);
}

.memory-row.breakpoint-row {
  background: rgba(255, 51, 51, 0.08);
}

.register-flash {
  animation: regFlash 0.3s ease-out;
}

@keyframes regFlash {
  0% { background: rgba(51, 255, 51, 0.3); }
  100% { background: transparent; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.blink {
  animation: blink 1s infinite;
}

.dropzone {
  border: 2px dashed var(--green-dim);
  transition: all 0.2s;
}

.dropzone.dragover {
  border-color: var(--green);
  background: rgba(51, 255, 51, 0.05);
  box-shadow: 0 0 20px var(--green-glow);
}

input[type="text"], input[type="number"] {
  background: #0a0a0a;
  border: 1px solid var(--border);
  color: var(--green);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 2px;
  outline: none;
}

input[type="text"]:focus, input[type="number"]:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 5px var(--green-glow);
}

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

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

.terminal-output {
  white-space: pre-wrap;
  word-break: break-all;
}

.instruction-ref-table td, .instruction-ref-table th {
  padding: 2px 8px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}