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

body {
  background: #0d0d1a;
  font-family: 'IBM Plex Mono', monospace;
}

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

.crt-glow {
  box-shadow:
    inset 0 0 60px rgba(45, 27, 105, 0.3),
    0 0 20px rgba(45, 27, 105, 0.2);
}

/* CRT Bezel */
.crt-bezel {
  background: linear-gradient(145deg, #2a2a3e, #1a1a28);
  border-radius: 16px;
  padding: 16px;
  box-shadow:
    inset 2px 2px 4px rgba(255,255,255,0.05),
    inset -2px -2px 4px rgba(0,0,0,0.5),
    0 8px 32px rgba(0,0,0,0.6);
}

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

/* Drop zone styles */
.drop-zone {
  border: 2px dashed rgba(155, 89, 182, 0.4);
  transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: rgba(155, 89, 182, 0.9);
  background: rgba(45, 27, 105, 0.15);
  box-shadow: 0 0 20px rgba(155, 89, 182, 0.2);
}

/* Neon glow effect */
.neon-glow {
  box-shadow: 0 0 10px rgba(155, 89, 182, 0.3), 0 0 20px rgba(155, 89, 182, 0.1);
}

.neon-glow-green {
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.4), 0 0 20px rgba(76, 175, 80, 0.2);
}

/* Gamepad button styles */
.gamepad-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: white;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.1s, box-shadow 0.1s;
  border: 2px solid rgba(255,255,255,0.1);
}

.gamepad-btn:active, .gamepad-btn.pressed {
  transform: scale(0.9);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5) !important;
}

.dpad-btn {
  width: 40px;
  height: 40px;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s;
  border: 1px solid rgba(255,255,255,0.05);
}

.dpad-btn:active, .dpad-btn.pressed {
  background: #555;
}

/* Rainbow bar animation */
@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.rainbow-bar {
  height: 4px;
  background: linear-gradient(90deg, #e74c3c, #e67e22, #f1c40f, #2ecc71, #3498db, #9b59b6, #e74c3c);
  background-size: 200% 100%;
  animation: rainbowShift 3s linear infinite;
}

/* Insert cartridge animation */
@keyframes colorCycle {
  0% { color: #9b59b6; }
  25% { color: #3498db; }
  50% { color: #1abc9c; }
  75% { color: #f1c40f; }
  100% { color: #9b59b6; }
}

.color-cycle {
  animation: colorCycle 4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.blink-slow {
  animation: blink 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.float-anim {
  animation: float 3s ease-in-out infinite;
}

/* Cartridge insert animation */
@keyframes cartridgeInsert {
  0% { transform: translateY(-30px) rotate(-5deg); opacity: 0; }
  60% { transform: translateY(5px) rotate(1deg); opacity: 1; }
  100% { transform: translateY(0) rotate(0); opacity: 1; }
}

.cartridge-insert {
  animation: cartridgeInsert 0.5s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #2D1B69; border-radius: 3px; }

/* History list item */
.history-item {
  transition: background 0.2s;
}
.history-item:hover {
  background: rgba(45, 27, 105, 0.3);
}

/* Settings toggle */
.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: #333;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track.active {
  background: #2D1B69;
}
.toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}
.toggle-track.active .toggle-thumb {
  left: 18px;
}

/* Pulse animation for play button */
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 10px rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.7); }
}
.pulse-green {
  animation: pulse-green 2s ease-in-out infinite;
}

/* Konami easter egg */
@keyframes konamiSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.5); }
  100% { transform: rotate(360deg) scale(1); }
}
.konami-spin {
  animation: konamiSpin 1s ease-in-out;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .gamepad-btn {
    width: 48px;
    height: 48px;
  }
  .dpad-btn {
    width: 44px;
    height: 44px;
  }
}

/* Startup chime visual */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}