:root {
  --coco-green: #33ff33;
  --coco-amber: #ffaa00;
  --coco-blue: #4488ff;
  --bg-dark: #0a0a0a;
  --panel-bg: #1a1a1a;
  --panel-border-light: #333;
  --panel-border-dark: #111;
  --text-dim: #666;
  --text-label: #aaa;
}

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

body {
  background: var(--bg-dark);
  color: #ccc;
  font-family: 'VT323', monospace;
  font-size: 16px;
  overflow-x: hidden;
}

.font-pixel { font-family: 'Press Start 2P', monospace; }
.font-vt { font-family: 'VT323', monospace; }

.panel {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border-light);
  border-bottom-color: var(--panel-border-dark);
  border-right-color: var(--panel-border-dark);
  border-radius: 4px;
  position: relative;
}

.panel-label {
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--panel-bg);
  padding: 0 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--coco-amber);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.crt-screen {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(51, 255, 51, 0.15),
    0 0 80px rgba(51, 255, 51, 0.05),
    inset 0 0 60px rgba(0,0,0,0.4);
}

.crt-screen canvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  display: block;
  width: 100%;
  height: 100%;
}

.crt-screen::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
  z-index: 2;
}

.crt-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
  z-index: 3;
}

.bezel {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border: 3px solid #333;
  border-bottom-color: #111;
  border-right-color: #111;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: background-color 0.2s, box-shadow 0.2s;
  border: 1px solid rgba(255,255,255,0.1);
}

.led-on-green { background: #33ff33; box-shadow: 0 0 6px #33ff33; }
.led-on-red { background: #ff3333; box-shadow: 0 0 6px #ff3333; }
.led-on-amber { background: #ffaa00; box-shadow: 0 0 6px #ffaa00; }
.led-on-blue { background: #4488ff; box-shadow: 0 0 6px #4488ff; }
.led-off { background: #333; box-shadow: none; }

.btn-emu {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 10px;
  border: 2px solid #555;
  border-bottom-color: #222;
  border-right-color: #222;
  background: linear-gradient(180deg, #3a3a3a, #2a2a2a);
  color: #ccc;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.1s;
  white-space: nowrap;
}
.btn-emu:hover { background: linear-gradient(180deg, #4a4a4a, #3a3a3a); color: #fff; }
.btn-emu:active { border-color: #222; border-top-color: #222; border-left-color: #222; border-bottom-color: #555; border-right-color: #555; }
.btn-emu.active { background: linear-gradient(180deg, #2a4a2a, #1a3a1a); border-color: #33ff33; color: #33ff33; }

.flag-bit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid #444;
  border-radius: 2px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  transition: all 0.2s;
}
.flag-set { background: #1a3a1a; color: #33ff33; border-color: #33ff33; }
.flag-clear { background: #1a1a1a; color: #444; border-color: #333; }

.hex-input {
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: #111;
  border: 1px solid #444;
  color: var(--coco-green);
  padding: 4px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}
.hex-input:focus { outline: none; border-color: var(--coco-green); box-shadow: 0 0 4px rgba(51,255,51,0.3); }

.hex-dump {
  font-family: 'VT323', monospace;
  font-size: 16px;
  line-height: 1.4;
}
.hex-dump .addr { color: var(--coco-amber); }
.hex-dump .byte { color: var(--coco-green); cursor: pointer; padding: 0 1px; }
.hex-dump .byte:hover { background: #333; }
.hex-dump .ascii { color: #888; }

.rainbow-text {
  background: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tab-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 12px;
  background: #222;
  color: #888;
  border: 1px solid #333;
  border-bottom: none;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
}
.tab-btn.active { background: var(--panel-bg); color: var(--coco-amber); border-color: var(--panel-border-light); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

.mmu-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 36px;
  border: 1px solid #555;
  border-radius: 3px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  margin: 2px;
  transition: all 0.2s;
}
.mmu-rom { background: #3a2a00; color: var(--coco-amber); border-color: var(--coco-amber); }
.mmu-ram { background: #0a2a0a; color: var(--coco-green); border-color: #2a5a2a; }

.io-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-bottom: 1px solid #222; }
.io-row:hover { background: #222; }

.toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
  background: #333;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-switch.on { background: #33ff33; }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.3s;
}
.toggle-switch.on::after { left: 22px; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.blink { animation: blink 1s infinite; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }