@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
  background: #8b7355;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0,0,0,0.03) 19px, rgba(0,0,0,0.03) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0,0,0,0.03) 19px, rgba(0,0,0,0.03) 20px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  overflow-x: hidden;
  padding: 10px;
}

#gameboy-shell {
  background: linear-gradient(180deg, #c4bcaa 0%, #b8b0a0 50%, #a8a090 100%);
  border-radius: 12px 12px 12px 60px;
  padding: 15px 20px 30px 20px;
  box-shadow: 
    4px 4px 0px #706858,
    -2px -2px 0px #d8d0c0,
    inset 0 0 20px rgba(0,0,0,0.05);
  position: relative;
  width: 340px;
  user-select: none;
  -webkit-user-select: none;
}

#shell-top {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#power-led {
  width: 8px;
  height: 8px;
  background: #cc3333;
  border-radius: 50%;
  align-self: flex-start;
  margin-bottom: 4px;
  margin-left: 10px;
  box-shadow: 0 0 6px #cc3333;
}

#screen-bezel {
  background: #4a4558;
  border-radius: 8px;
  padding: 12px 14px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#screen-label {
  font-size: 5px;
  color: #8888aa;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

#screen-wrapper {
  background: #7b8c2a;
  padding: 4px;
  border-radius: 2px;
  box-shadow: inset 2px 2px 8px rgba(0,0,0,0.4);
}

#canvas {
  display: block;
  width: 480px;
  height: 432px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

#brand-text {
  font-size: 13px;
  color: #3a3580;
  text-align: center;
  margin: 10px 0 6px 0;
  letter-spacing: 2px;
  font-style: italic;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.3);
}

#controls-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  margin-top: 5px;
}

#dpad {
  position: relative;
  width: 80px;
  height: 80px;
}

#dpad .dpad-center {
  position: absolute;
  width: 26px; height: 26px;
  background: #2a2a2a;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 2px;
}

#dpad .dpad-up, #dpad .dpad-down {
  position: absolute;
  width: 26px; height: 28px;
  background: #2a2a2a;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
}

#dpad .dpad-up { top: 0; border-radius: 3px 3px 0 0; }
#dpad .dpad-down { bottom: 0; border-radius: 0 0 3px 3px; }

#dpad .dpad-left, #dpad .dpad-right {
  position: absolute;
  width: 28px; height: 26px;
  background: #2a2a2a;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 3px;
}

#dpad .dpad-left { left: 0; border-radius: 3px 0 0 3px; }
#dpad .dpad-right { right: 0; border-radius: 0 3px 3px 0; }

#ab-buttons {
  display: flex;
  gap: 12px;
  transform: rotate(-25deg);
}

.btn-a, .btn-b {
  width: 40px;
  height: 40px;
  background: #8b1a4a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a0a1a;
  font-size: 10px;
  font-family: 'Press Start 2P', monospace;
  box-shadow: 2px 2px 0 #5a1030, inset 0 -2px 4px rgba(0,0,0,0.3);
}

#start-select {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
}

.ss-btn {
  background: #6a6a6a;
  color: #3a3a3a;
  font-size: 6px;
  padding: 4px 14px;
  border-radius: 10px;
  transform: rotate(-5deg);
  box-shadow: 1px 1px 0 #444;
}

#speaker-grille {
  position: absolute;
  bottom: 35px;
  right: 25px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform: rotate(-25deg);
}

.speaker-line {
  width: 28px;
  height: 2px;
  background: #908878;
  border-radius: 1px;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.2);
}

#control-legend {
  margin-top: 12px;
  text-align: center;
  color: #d4c8a8;
  font-size: 7px;
  line-height: 1.8;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

#footer {
  margin-top: 10px;
  text-align: center;
  font-size: 7px;
  color: #a09070;
}

#footer a {
  color: #c8b888;
  text-decoration: underline;
}

@media (max-width: 520px) {
  #gameboy-shell {
    width: 95vw;
    max-width: 340px;
    padding: 10px 12px 25px 12px;
  }
  #canvas {
    width: calc(95vw - 70px);
    height: auto;
    aspect-ratio: 160/144;
    max-width: 480px;
  }
}