@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

* {
  box-sizing: border-box;
}

body {
  font-family: 'Orbitron', monospace;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  overflow-x: auto;
}

.pixel-art {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.gba-sp {
  width: 320px;
  height: auto;
  position: relative;
  margin: 0 auto;
}

.gba-top, .gba-bottom {
  box-shadow: 
    0 4px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
}

.gba-screen {
  position: relative;
  background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.8),
    inset 0 -1px 1px rgba(255,255,255,0.1);
}

.gba-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.1) 0%,
    transparent 30%,
    transparent 70%,
    rgba(0,0,0,0.1) 100%
  );
  pointer-events: none;
  border-radius: 4px;
}

.speaker-grill {
  width: 20px;
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    #444,
    #444 1px,
    transparent 1px,
    transparent 3px
  );
  border-radius: 2px;
}

.dpad {
  position: relative;
  width: 60px;
  height: 60px;
}

.dpad-btn {
  position: absolute;
  background: linear-gradient(145deg, #666, #444);
  border: none;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.dpad-up, .dpad-down {
  width: 20px;
  height: 25px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 4px 4px 8px 8px;
}

.dpad-up {
  top: 0;
}

.dpad-down {
  bottom: 0;
  border-radius: 8px 8px 4px 4px;
}

.dpad-left, .dpad-right {
  width: 25px;
  height: 20px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 4px 8px 8px 4px;
}

.dpad-left {
  left: 0;
}

.dpad-right {
  right: 0;
  border-radius: 8px 4px 4px 8px;
}

.dpad-btn.pressed {
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.3);
  transform: translate(0, 1px);
}

.dpad-up.pressed { transform: translateX(-50%) translateY(1px); }
.dpad-down.pressed { transform: translateX(-50%) translateY(-1px); }
.dpad-left.pressed { transform: translateY(-50%) translateX(1px); }
.dpad-right.pressed { transform: translateY(-50%) translateX(-1px); }

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #8B5CF6, #7C3AED);
  color: white;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 
    0 3px 6px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

.action-btn:hover {
  background: linear-gradient(145deg, #9F7AEA, #8B5CF6);
}

.action-btn.pressed {
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.3);
  transform: translateY(1px);
}

.start-select-btn {
  padding: 4px 8px;
  border: none;
  background: linear-gradient(145deg, #555, #333);
  color: white;
  font-size: 8px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.start-select-btn.pressed {
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.3);
  transform: translateY(1px);
}

.power-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #DC2626, #B91C1C);
  color: white;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

.power-btn:hover {
  background: linear-gradient(145deg, #EF4444, #DC2626);
}

.volume-control {
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
}

.volume-slider {
  width: 60px;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 12px;
  background: #666;
  border-radius: 2px;
  cursor: pointer;
}

.glow-green {
  box-shadow: 0 0 8px #00ff00, 0 0 16px #00ff00;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.gba-sp.open .gba-top {
  animation: open-sp 0.5s ease-out forwards;
}

.gba-sp.closed .gba-top {
  animation: close-sp 0.5s ease-out forwards;
}

@keyframes open-sp {
  from { transform: rotateX(-120deg); }
  to { transform: rotateX(0deg); }
}

@keyframes close-sp {
  from { transform: rotateX(0deg); }
  to { transform: rotateX(-120deg); }
}

/* Responsive design */
@media (max-width: 768px) {
  .gba-sp {
    width: 280px;
  }
  
  .gba-screen {
    width: 200px !important;
    height: 133px !important;
  }
  
  .dpad {
    width: 50px;
    height: 50px;
  }
  
  .action-btn {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
}

/* High-DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .pixel-art {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
  background: #8B5CF6;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9F7AEA;
}