:root {
  --bg-primary: #0a0a12;
  --bg-panel: #0f0f1a;
  --bg-header: #141425;
  --border: #1e1e3a;
  --text: #c8c8e0;
  --text-dim: #555577;
  --accent-cyan: #00e5c8;
  --accent-blue: #4488ff;
  --accent-green: #33ff33;
  --accent-yellow: #ffcc00;
  --accent-red: #ff4444;
  --accent-orange: #ff8844;
  --highlight-row: #0d1f3a;
  --mem-read: #1a2a44;
  --mem-write: #3a1a1a;
  --flag-set: #00dd00;
  --flag-clear: #333355;
  --console-bg: #050508;
}

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

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

#root { min-height: 100vh; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a2a4a; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.panel-header {
  background: var(--bg-header);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  border-bottom: 1px solid var(--border);
  font-family: 'IBM Plex Sans', sans-serif;
}

.panel-body {
  padding: 8px;
  overflow: auto;
}

.reg-value {
  color: var(--accent-cyan);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 2px;
  transition: all 0.15s;
  display: inline-block;
  min-width: 48px;
  text-align: right;
}

.reg-value:hover {
  background: rgba(0, 229, 200, 0.1);
}

.reg-value.changed {
  animation: flash-change 0.6s ease-out;
}

@keyframes flash-change {
  0% { background: rgba(255, 204, 0, 0.4); color: #ffcc00; }
  100% { background: transparent; color: var(--accent-cyan); }
}

.flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.flag-badge.set {
  background: rgba(0, 221, 0, 0.2);
  color: var(--flag-set);
  border: 1px solid rgba(0, 221, 0, 0.4);
}

.flag-badge.clear {
  background: rgba(51, 51, 85, 0.3);
  color: var(--flag-clear);
  border: 1px solid rgba(51, 51, 85, 0.5);
}

.flag-badge:hover {
  transform: scale(1.1);
}

.disasm-line {
  display: flex;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.6;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.disasm-line.current {
  background: var(--highlight-row);
  border-left-color: var(--accent-blue);
}

.disasm-line.breakpoint {
  border-left-color: var(--accent-red);
}

.disasm-line .addr { color: var(--text-dim); min-width: 90px; }
.disasm-line .bytes { color: #666688; min-width: 100px; }
.disasm-line .mnemonic { color: var(--accent-blue); min-width: 60px; font-weight: 600; }
.disasm-line .operands { color: var(--accent-cyan); }

.hex-byte {
  display: inline-block;
  width: 22px;
  text-align: center;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s;
}

.hex-byte:hover { background: rgba(68, 136, 255, 0.15); }
.hex-byte.read { background: var(--mem-read); }
.hex-byte.written { background: var(--mem-write); }

.console-output {
  background: var(--console-bg);
  color: var(--accent-green);
  font-size: 13px;
  min-height: 120px;
  padding: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-y: auto;
  border: 1px solid #111122;
  border-radius: 3px;
}

.console-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--accent-green);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  50% { opacity: 0; }
}

.btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-header);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn:hover { background: #1e1e3a; border-color: var(--accent-cyan); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: rgba(0, 229, 200, 0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-primary:hover {
  background: rgba(0, 229, 200, 0.2);
}

.btn-danger {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: rgba(255, 68, 68, 0.1);
}

.input-hex {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent-cyan);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  padding: 3px 6px;
  outline: none;
  width: 60px;
}

.input-hex:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 4px rgba(0, 229, 200, 0.2);
}

textarea.code-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  padding: 8px;
  outline: none;
  resize: vertical;
  width: 100%;
  min-height: 80px;
}

textarea.code-input:focus {
  border-color: var(--accent-cyan);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.running { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.halted { background: var(--accent-yellow); box-shadow: 0 0 6px var(--accent-yellow); }
.status-dot.error { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }

.tab-btn {
  padding: 4px 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
}

.stack-line {
  font-size: 12px;
  padding: 1px 6px;
  display: flex;
  gap: 8px;
}

.stack-line.current {
  background: var(--highlight-row);
  color: var(--accent-yellow);
}

.scanlines {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

.footer-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
}

.footer-link:hover {
  color: var(--accent-cyan);
}