:root {
  --bg-deep: #0a0a1a;
  --bg-panel: #1a1a2e;
  --bg-panel-light: #22224a;
  --cyan: #00ffd5;
  --green: #39ff14;
  --amber: #ffb347;
  --red: #ff4757;
  --text: #c0c0e0;
  --text-dim: #6a6a8a;
  --border: #2a2a4e;
}

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

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

.font-pixel { font-family: 'Press Start 2P', cursive; }
.font-mono { font-family: 'Share Tech Mono', monospace; }

/* CRT Screen Effect */
.crt-bezel {
  background: #0d0d0d;
  border-radius: 16px;
  padding: 12px;
  box-shadow:
    0 0 30px rgba(0, 255, 213, 0.15),
    inset 0 0 60px rgba(0, 0, 0, 0.8),
    0 4px 20px rgba(0, 0, 0, 0.6);
  position: relative;
}

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

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

.scanlines {
  pointer-events: none;
  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
  );
  z-index: 2;
}

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

.phosphor-glow {
  box-shadow: 0 0 40px rgba(0, 255, 213, 0.12), 0 0 80px rgba(57, 255, 20, 0.06);
}

/* Buttons */
.emu-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: linear-gradient(180deg, #2a2a4e, #1a1a2e);
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

.emu-btn:hover {
  background: linear-gradient(180deg, #3a3a5e, #2a2a4e);
  box-shadow: 0 0 10px rgba(0, 255, 213, 0.2);
  border-color: var(--cyan);
}

.emu-btn:active {
  transform: scale(0.96);
  background: linear-gradient(180deg, #1a1a2e, #0a0a1a);
}

.emu-btn.active {
  background: linear-gradient(180deg, rgba(0,255,213,0.2), rgba(0,255,213,0.05));
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 255, 213, 0.3);
}

.emu-btn.danger { color: var(--red); }
.emu-btn.danger:hover { border-color: var(--red); box-shadow: 0 0 10px rgba(255,71,87,0.2); }

.emu-btn.warn { color: var(--amber); }

/* Cartridge Slot */
.cartridge-slot {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  background: rgba(26, 26, 46, 0.5);
}

.cartridge-slot:hover,
.cartridge-slot.drag-over {
  border-color: var(--cyan);
  background: rgba(0, 255, 213, 0.03);
  box-shadow: 0 0 20px rgba(0, 255, 213, 0.1);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* Panel */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}

/* Keypad button */
.keypad-btn {
  width: 40px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: linear-gradient(180deg, #2a2a4e, #1a1a2e);
  color: var(--green);
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  user-select: none;
}

.keypad-btn:active, .keypad-btn.pressed {
  transform: scale(0.92);
  background: linear-gradient(180deg, rgba(57,255,20,0.2), rgba(57,255,20,0.05));
  border-color: var(--green);
}

/* Volume slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,255,213,0.4);
}

/* Oscilloscope */
.oscilloscope {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Power on animation */
@keyframes powerOn {
  0% { opacity: 0; filter: brightness(3) contrast(2); }
  30% { opacity: 1; filter: brightness(2) contrast(1.5); }
  50% { filter: brightness(0.5); }
  70% { filter: brightness(1.5); }
  100% { filter: brightness(1) contrast(1); opacity: 1; }
}

.power-on {
  animation: powerOn 0.6s ease-out;
}

/* Status LED */
.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.led-green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.led-amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.led-red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.led-off { background: #333; }

/* Hex dump */
.hex-dump {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
  color: var(--green);
  white-space: pre;
  overflow-x: auto;
}

/* Mobile */
@media (max-width: 768px) {
  .crt-bezel { padding: 6px; border-radius: 10px; }
  .emu-btn { font-size: 8px; padding: 6px 10px; }
  .keypad-btn { width: 36px; height: 32px; font-size: 12px; }
}

/* Footer */
.footer-link {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px dotted var(--cyan);
}
.footer-link:hover {
  color: var(--green);
  border-color: var(--green);
}