:root {
  --bg-deep: #0f0f23; --bg-panel: #1a1a2e; --bg-darker: #0a0a1a;
  --cyan: #00fff7; --green: #39ff14; --magenta: #ff00ff; --red: #ff3333;
  --text: #e0e0e0; --border: #2a2a4e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top, #16163a 0%, #0f0f23 45%, #07070f 100%) fixed;
  color: var(--text); font-family: 'JetBrains Mono', monospace; min-height: 100vh; overflow-x: hidden;
}
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.08) 2px 3px);
}
.pixel-font { font-family: 'Press Start 2P', monospace; }
.scanlines { position: relative; }
.scanlines::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
}
.panel {
  background: linear-gradient(180deg, #1c1c34, #16162a); border: 2px solid var(--border);
  border-top-color: #34345c; border-bottom-color: #121224; border-radius: 3px;
  box-shadow: 0 0 18px rgba(0,255,247,0.04), inset 0 1px 0 rgba(255,255,255,0.03);
  animation: rise 0.4s ease both;
}
.cart-label { background: linear-gradient(135deg, #1e1e3a 0%, #191930 60%, #22152e 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.slide-in { animation: rise 0.25s ease both; }

.pixel-btn {
  font-family: 'Press Start 2P', monospace; font-size: 10px; padding: 8px 14px;
  border: 3px solid; border-color: #555 #222 #222 #555; background: #333; color: var(--text);
  cursor: pointer; transition: all 0.05s; text-transform: uppercase;
}
.pixel-btn:hover { background: #444; }
.pixel-btn:active { border-color: #222 #555 #555 #222; transform: translateY(1px); }
.pixel-btn.active { background: var(--cyan); color: #000; border-color: #7ffffa #006666 #006666 #7ffffa; }

.rate-badge {
  font-family: 'Press Start 2P', monospace; font-size: 8px; padding: 7px 9px;
  border: 2px solid #39ff14; color: #39ff14; background: #0c1f0c;
}
.rate-badge.custom {
  border-color: var(--magenta); color: var(--magenta); background: #200a20;
  box-shadow: 0 0 10px rgba(255,0,255,0.5); animation: pulse-glow 1.4s infinite;
}
.chip { font-size: 11px; padding: 3px 8px; background: #111122; border: 1px solid #2a2a4e; }
.speed-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 11px;
  padding: 5px 8px; border-left: 3px solid transparent; margin-bottom: 3px;
}
.speed-row.active { border-left-color: var(--cyan); background: rgba(0,255,247,0.05); }
.tag { font-family: 'Press Start 2P', monospace; font-size: 7px; padding: 3px 5px; border: 1px solid; }
.tag-standard { color: #39ff14; border-color: #39ff1466; }
.tag-custom { color: #ff00ff; border-color: #ff00ff88; box-shadow: 0 0 6px #ff00ff55; }
.tag-zero { color: #ff3333; border-color: #ff333388; cursor: help; }
.lbl { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.timing-box { font-size: 11px; color: #999; line-height: 1.8; background: #0b0b18; border: 1px solid #2a2a4e; padding: 8px 10px; }
.timing-box b { color: #00fff7; font-weight: 700; }
.retro-input { background: #0b0b16; color: #00fff7; border: 1px solid #3a3a5e; font-family: 'JetBrains Mono', monospace; outline: none; }
.retro-input:focus { border-color: var(--cyan); }

.led { width: 8px; height: 8px; border-radius: 50%; display: inline-block; transition: all 0.1s; }
.led.active { box-shadow: 0 0 6px currentColor, 0 0 12px currentColor; }

.cartridge-slot {
  background: linear-gradient(180deg, #111 0%, #1a1a1a 10%, #0d0d0d 90%, #000 100%);
  border: 3px solid #333; border-top: 5px solid #444; border-bottom: 5px solid #222; position: relative;
  transition: box-shadow 0.2s;
}
.cartridge-slot.drag, .cartridge-slot:hover { box-shadow: 0 0 24px rgba(0,255,247,0.25); }
.cartridge-slot::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 4px; background: linear-gradient(90deg, transparent, #555, transparent);
}
.boot-box { width: 64px; height: 48px; animation: nes-boot 0.5s steps(4) infinite; border: 2px solid #333; }
@keyframes pulse-glow { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes nes-boot { 0% { background: #000; } 25% { background: #ff0000; } 50% { background: #0000ff; } 75% { background: #39ff14; } }

.bounce-bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.bounce-bars span { display: block; width: 3px; background: var(--green); animation: bounce-bar 0.6s ease-in-out infinite; }
.bounce-bars span:nth-child(2) { animation-delay: 0.1s; }
.bounce-bars span:nth-child(3) { animation-delay: 0.2s; }
.bounce-bars span:nth-child(4) { animation-delay: 0.3s; }
@keyframes bounce-bar { 0%, 100% { height: 3px; } 50% { height: 12px; } }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; background: #333; outline: none; border: 1px solid #555; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 18px; background: #666; border: 2px solid; border-color: #999 #333 #333 #999; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 18px; background: #666; border: 2px solid; border-color: #999 #333 #333 #999; cursor: pointer; border-radius: 0; }

.viz-canvas { background: #000; border: 2px solid #333; display: block; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-darker); }
::-webkit-scrollbar-thumb { background: #333; border: 1px solid #555; }
.track-list-item { padding: 6px 10px; cursor: pointer; border: 1px solid transparent; font-size: 11px; }
.track-list-item:hover { background: rgba(0,255,247,0.05); border-color: rgba(0,255,247,0.2); }
.track-list-item.active { background: rgba(0,255,247,0.1); border-color: var(--cyan); box-shadow: 0 0 10px rgba(0,255,247,0.15); }