:root {
  --green: #00ff41;
  --green-dim: #00aa2a;
  --amber: #ffb000;
  --cyan: #00d4ff;
  --red: #ff4444;
  --bg: #0a0a0a;
  --panel: #0d1117;
  --panel-border: #1a2332;
  --text-dim: #4a5568;
  --white: #e0e0e0;
}

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

body {
  background: var(--bg);
  color: var(--green);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

/* CRT Scanline overlay */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  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 rgba(0, 255, 65, 0.4), 0 0 20px rgba(0, 255, 65, 0.15);
}

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

.glow-cyan {
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: inset 0 0 30px rgba(0, 255, 65, 0.02), 0 0 10px rgba(0, 0, 0, 0.5);
}

.led-on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green), 0 0 12px rgba(0, 255, 65, 0.3);
  color: #000;
}

.led-off {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #444;
}

.led-flash {
  animation: ledFlash 0.5s ease-out;
}

@keyframes ledFlash {
  0% { box-shadow: 0 0 12px var(--cyan), 0 0 24px rgba(0, 212, 255, 0.6); }
  100% { box-shadow: none; }
}

.reg-changed {
  animation: regChange 0.6s ease-out;
}

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

.btn-retro {
  background: #1a1a2e;
  border: 1px solid var(--green-dim);
  color: var(--green);
  padding: 6px 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 3px;
}

.btn-retro:hover {
  background: rgba(0, 255, 65, 0.1);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.2);
}

.btn-retro:active {
  background: rgba(0, 255, 65, 0.2);
}

.btn-retro:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.code-editor {
  background: #080c10;
  color: var(--green);
  border: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  width: 100%;
  tab-size: 8;
}

.code-editor::selection {
  background: rgba(0, 212, 255, 0.3);
}

.hex-byte {
  display: inline-block;
  width: 24px;
  text-align: center;
  font-size: 12px;
}

.hex-read { color: var(--cyan); }
.hex-write { color: var(--red); }

.ip-line {
  background: rgba(0, 255, 65, 0.12) !important;
  border-left: 3px solid var(--green) !important;
}

.bp-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 4px var(--red);
}

.console-output {
  background: #000;
  color: var(--green);
  font-family: 'Share Tech Mono', 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px;
  min-height: 80px;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid #1a2332;
  border-radius: 3px;
}

.chip-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  animation: chipPulse 0.3s ease-out;
}

@keyframes chipPulse {
  0% { opacity: 1; box-shadow: 0 0 8px var(--green); }
  100% { opacity: 0.3; box-shadow: none; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #2a2a3e; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a5e; }

select {
  background: #1a1a2e;
  border: 1px solid var(--panel-border);
  color: var(--green);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="text"], input[type="number"] {
  background: #080c10;
  border: 1px solid var(--panel-border);
  color: var(--green);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  outline: none;
}

input[type="range"] {
  accent-color: var(--green);
}

/* Mobile tabs */
@media (max-width: 768px) {
  .desktop-layout { display: none !important; }
  .mobile-layout { display: flex !important; }
}

@media (min-width: 769px) {
  .desktop-layout { display: flex !important; }
  .mobile-layout { display: none !important; }
}