:root {
  --bg-deep: #060a14;
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1526;
  --bg-tertiary: #141c30;
  --bg-card: #111827;
  --cyan: #00ffd5;
  --green: #39ff14;
  --orange: #ff9f1c;
  --red: #ff3b5c;
  --purple: #b388ff;
  --yellow: #ffe156;
  --gold: #ffd700;
  --magenta: #ff00ff;
  --text: #e0e7ff;
  --text-dim: #7a86a8;
  --border: rgba(0,255,213,0.12);
  --border-bright: rgba(0,255,213,0.3);
}

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

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

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.03) 2px, rgba(0,0,0,0.03) 4px);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(0,255,213,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,255,213,0.4); }

.glow-text { text-shadow: 0 0 10px rgba(0,255,213,0.5), 0 0 20px rgba(0,255,213,0.3); }
.glow-gold { text-shadow: 0 0 10px rgba(255,215,0,0.5), 0 0 20px rgba(255,215,0,0.3); }
.glow-magenta { text-shadow: 0 0 10px rgba(255,0,255,0.5), 0 0 20px rgba(255,0,255,0.3); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes flash-register {
  0% { background: rgba(0,255,213,0.4); box-shadow: 0 0 15px rgba(0,255,213,0.5); }
  100% { background: transparent; box-shadow: none; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
@keyframes spin-berry {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes confetti-fall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes flash-border-yellow {
  0% { box-shadow: inset 0 0 0 2px rgba(255,225,86,0.8); }
  100% { box-shadow: inset 0 0 0 0px transparent; }
}
@keyframes flash-border-red {
  0% { box-shadow: inset 0 0 0 3px rgba(255,59,92,0.9); }
  100% { box-shadow: inset 0 0 0 0px transparent; }
}
@keyframes flash-border-magenta {
  0% { box-shadow: inset 0 0 0 3px rgba(255,0,255,0.8); }
  100% { box-shadow: inset 0 0 0 0px transparent; }
}
@keyframes lightning-flash {
  0%, 100% { opacity: 0; }
  10%, 30% { opacity: 1; }
  20% { opacity: 0.3; }
}
@keyframes pulse-nmi {
  0%, 100% { background: rgba(255,59,92,0.3); }
  50% { background: rgba(255,59,92,0.7); }
}

.animate-pulse-slow { animation: pulse 2s ease-in-out infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-spin-berry { animation: spin-berry 4s ease-in-out infinite; }
.flash-reg { animation: flash-register 0.6s ease-out; }
.flash-border-yellow { animation: flash-border-yellow 1s ease-out; }
.flash-border-red { animation: flash-border-red 1s ease-out; }
.flash-border-magenta { animation: flash-border-magenta 1s ease-out; }
.lightning-flash { animation: lightning-flash 0.5s ease-out; }
.pulse-nmi { animation: pulse-nmi 0.5s ease-in-out 3; }

.btn-cpu {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-cpu:hover { border-color: var(--border-bright); background: rgba(0,255,213,0.05); }
.btn-cpu:active { transform: scale(0.97); }
.btn-run { border-color: rgba(57,255,20,0.3); color: var(--green); }
.btn-run:hover { background: rgba(57,255,20,0.1); border-color: rgba(57,255,20,0.5); }
.btn-stop { border-color: rgba(255,59,92,0.3); color: var(--red); }
.btn-stop:hover { background: rgba(255,59,92,0.1); border-color: rgba(255,59,92,0.5); }
.btn-nmi { border-color: rgba(255,0,255,0.3); color: var(--magenta); }
.btn-nmi:hover { background: rgba(255,0,255,0.1); border-color: rgba(255,0,255,0.5); }
.btn-mce { border-color: rgba(255,59,92,0.3); color: var(--red); }
.btn-mce:hover { background: rgba(255,59,92,0.1); border-color: rgba(255,59,92,0.5); }

.register-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 5px;
  font-size: 10px;
  transition: all 0.2s;
  min-width: 0;
}
.register-card:hover { border-color: var(--border-bright); }

.status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

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

.panel-header {
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--cyan);
}

textarea.code-editor {
  background: transparent;
  color: var(--text);
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  width: 100%;
  tab-size: 4;
}

.hex-dump { font-size: 11px; line-height: 1.5; }

.confetti-piece {
  position: fixed;
  width: 10px; height: 10px;
  animation: confetti-fall 3s linear forwards;
  z-index: 10000;
  pointer-events: none;
}

.toast-notification {
  position: fixed;
  top: 20px; right: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 12px 20px;
  z-index: 10001;
  box-shadow: 0 0 20px rgba(0,255,213,0.2);
  font-size: 13px;
}

.tab-btn {
  padding: 4px 12px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: all 0.2s;
  position: relative;
}
.tab-btn.active {
  background: var(--bg-deep);
  color: var(--cyan);
  border-bottom-color: var(--bg-deep);
}
.tab-btn:hover { color: var(--text); }

.tab-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red);
  color: white;
  font-size: 8px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.mmu-panel {
  background: rgba(255,215,0,0.03);
  border: 1px dashed rgba(255,215,0,0.2);
  border-radius: 6px;
}

.sys-reg-section {
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 6px;
  background: rgba(255,215,0,0.03);
}

.exception-log-entry {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(0,255,213,0.05);
  font-size: 10px;
}

@media (max-width: 1024px) {
  .main-grid { grid-template-columns: 1fr !important; grid-template-rows: auto !important; }
}