* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0a0a0f; color: #c8c8d0; font-family: 'JetBrains Mono', monospace; overflow-x: hidden; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0a0a0f; }
::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a4a; }

.crt-monitor {
  position: relative;
  background: linear-gradient(145deg, #1a1a2e 0%, #0d0d1a 50%, #1a1a2e 100%);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 60px rgba(0,0,0,0.3), 0 0 2px rgba(255,176,0,0.1);
}

.crt-screen {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.crt-screen canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

.crt-glow {
  pointer-events: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  box-shadow: inset 0 0 80px rgba(255,176,0,0.03);
  border-radius: 8px;
  z-index: 3;
}

.led { width: 8px; height: 8px; border-radius: 50%; transition: all 0.15s; }
.led-off { background: #333; box-shadow: none; }
.led-green { background: #00ff88; box-shadow: 0 0 6px #00ff88; }
.led-amber { background: #FFB000; box-shadow: 0 0 6px #FFB000; }
.led-red { background: #ff4444; box-shadow: 0 0 6px #ff4444; }
.led-blue { background: #4488ff; box-shadow: 0 0 6px #4488ff; }

@keyframes led-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.led-blink { animation: led-blink 0.15s ease-in-out infinite; }

@keyframes crt-off {
  0% { transform: scale(1,1); opacity: 1; filter: brightness(1); }
  30% { transform: scale(1.02, 0.01); opacity: 1; filter: brightness(3); }
  60% { transform: scale(0.5, 0.005); opacity: 0.8; filter: brightness(2); }
  100% { transform: scale(0, 0); opacity: 0; filter: brightness(0); }
}

@keyframes crt-on {
  0% { transform: scale(0, 0); opacity: 0; }
  30% { transform: scale(0.5, 0.005); opacity: 0.5; filter: brightness(3); }
  60% { transform: scale(1.02, 0.01); opacity: 0.8; filter: brightness(2); }
  80% { transform: scale(1, 0.8); opacity: 1; filter: brightness(1.2); }
  100% { transform: scale(1, 1); opacity: 1; filter: brightness(1); }
}

.crt-power-off { animation: crt-off 0.4s ease-in forwards; }
.crt-power-on { animation: crt-on 0.5s ease-out forwards; }

.flag-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  transition: all 0.2s;
}
.flag-set {
  background: rgba(0,255,136,0.15);
  border-color: #00ff88;
  color: #00ff88;
  text-shadow: 0 0 4px rgba(0,255,136,0.5);
}
.flag-clear {
  background: rgba(42,42,58,0.3);
  border-color: #1a1a2a;
  color: #444;
}

.tab-btn {
  padding: 6px 14px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover { color: #999; background: rgba(42,42,58,0.3); }
.tab-btn.active {
  color: #FFB000;
  background: #15151e;
  border-color: #2a2a3a;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  background: #15151e;
  color: #c8c8d0;
  cursor: pointer;
  transition: all 0.15s;
}
.toolbar-btn:hover { background: #1f1f2e; border-color: #3a3a4a; }
.toolbar-btn:active { transform: scale(0.97); }
.toolbar-btn.primary { border-color: #FFB000; color: #FFB000; }
.toolbar-btn.primary:hover { background: rgba(255,176,0,0.1); }
.toolbar-btn.danger { border-color: #ff4444; color: #ff4444; }
.toolbar-btn.danger:hover { background: rgba(255,68,68,0.1); }

.reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; }
.reg-item { display: flex; justify-content: space-between; align-items: center; padding: 3px 8px; background: rgba(10,10,15,0.5); border-radius: 3px; border: 1px solid #1a1a2a; }
.reg-label { color: #888; font-size: 10px; font-weight: 700; }
.reg-value { color: #00ff88; font-size: 12px; font-weight: 500; }
.reg-value.seg { color: #00ccff; }

.hex-row { display: flex; gap: 0; font-size: 11px; line-height: 1.6; }
.hex-addr { color: #00ccff; min-width: 70px; }
.hex-byte { color: #FFB000; width: 24px; text-align: center; }
.hex-byte.changed { color: #ff6644; background: rgba(255,102,68,0.1); }
.hex-ascii { color: #666; margin-left: 8px; }

.disasm-line { display: flex; gap: 8px; padding: 1px 8px; font-size: 11px; line-height: 1.7; border-left: 3px solid transparent; cursor: pointer; }
.disasm-line:hover { background: rgba(42,42,58,0.3); }
.disasm-line.current { background: rgba(255,176,0,0.08); border-left-color: #FFB000; }
.disasm-line .addr { color: #00ccff; min-width: 80px; }
.disasm-line .bytes { color: #555; min-width: 80px; }
.disasm-line .mnemonic { font-weight: 700; min-width: 60px; }
.disasm-line .operands { color: #8899bb; }
.disasm-line .bp { width: 12px; display: flex; align-items: center; }

.cat-misc .mnemonic { color: #6688cc; }
.cat-jump .mnemonic { color: #00ff88; }
.cat-move .mnemonic { color: #cccc44; }
.cat-string .mnemonic { color: #00cccc; }
.cat-arith .mnemonic { color: #ff8844; }
.cat-group .mnemonic { color: #bb66dd; }
.cat-prefix .mnemonic { color: #666; }

.io-chip { margin-bottom: 12px; }
.io-chip-title { font-size: 11px; font-weight: 700; color: #FFB000; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #1a1a2a; }
.io-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 10px; }
.io-label { color: #888; }
.io-val { color: #00ff88; }

.speed-select {
  background: #15151e;
  border: 1px solid #2a2a3a;
  color: #c8c8d0;
  padding: 4px 8px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  border-radius: 4px;
  cursor: pointer;
}

.video-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: #FFB000;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 10;
  font-family: 'JetBrains Mono', monospace;
}

.irq-dots { display: flex; gap: 3px; align-items: center; }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
}