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

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

html, body {
  overflow-x: hidden;
}

body {
  background: #0c0c10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  color: #ddd;
  padding: 20px;
}

/* Scale the gameboy to fit narrow screens (mobile portrait). Leave generous
   side padding so the gameboy isn't flush against the screen edge. */
@media (max-width: 500px) {
  body {
    padding: 16px 96px;
    justify-content: flex-start;
  }
  .gameboy {
    transform: scale(calc((100vw - 192px) / 440));
    transform-origin: top center;
    margin-bottom: calc(((100vw - 192px) / 440 - 1) * 700px);
  }
  .hint {
    transform: scale(calc((100vw - 192px) / 440));
    transform-origin: top center;
  }
}

/* ---------- GameBoy Color Shell — Casino Red ---------- */
.gameboy {
  width: 440px;
  background: linear-gradient(160deg, #c8203a 0%, #7a0a1a 100%);
  border-radius: 18px 18px 50px 18px;
  padding: 22px 22px 26px;
  box-shadow:
    inset 0 -4px 0 rgba(0,0,0,0.25),
    inset 0 4px 0 rgba(255,255,255,0.15),
    0 20px 40px rgba(0,0,0,0.7);
  position: relative;
}

.gb-top { margin-bottom: 20px; }

.gb-screen-frame {
  background: #1a1a1a;
  border-radius: 10px 10px 38px 10px;
  padding: 44px 22px 34px;
  box-shadow: inset 0 3px 0 #050505, inset 0 -3px 0 #2a2a2a;
  position: relative;
}

.gb-power {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 6px;
  color: #ccc;
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffcc44 0%, #663300 80%);
  box-shadow: 0 0 8px #ffcc44;
}

.gb-screen {
  width: 100%;
  aspect-ratio: 10 / 9;
  background: #000;
  border: 3px solid #111;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

#game {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: block;
}

.labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 6px;
  color: #ddd;
}
.brand { font-weight: bold; font-style: italic; font-size: 9px; }
.brand .color {
  color: #ffcc44;
  font-size: 8px;
}
.dot-matrix { letter-spacing: 1px; color: #d8b860; }

/* ---------- Controls ---------- */
.gb-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  margin-bottom: 20px;
}

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

.dpad-btn, .dpad-center {
  position: absolute;
  background: #0a0a0a;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition: all 0.1s;
}

.dpad-btn.up { top: 0; left: 32px; width: 32px; height: 32px; border-radius: 4px 4px 0 0; }
.dpad-btn.down { bottom: 0; left: 32px; width: 32px; height: 32px; border-radius: 0 0 4px 4px; }
.dpad-btn.left { top: 32px; left: 0; width: 32px; height: 32px; border-radius: 4px 0 0 4px; }
.dpad-btn.right { top: 32px; right: 0; width: 32px; height: 32px; border-radius: 0 4px 4px 0; }
.dpad-center { top: 32px; left: 32px; width: 32px; height: 32px; background: #0a0a0a; }

.dpad-btn:active {
  background: #000;
}

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

.btn-ab {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffcc44;
  color: #5a3a00;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 0 #8a6a00;
  transition: all 0.08s;
}

.btn-ab:active {
  box-shadow: 0 1px 0 #8a6a00;
  transform: translateY(3px);
}

/* ---------- Start/Select ---------- */
.gb-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.start-select {
  display: flex;
  gap: 26px;
  transform: rotate(-25deg);
}

.ss-btn {
  background: #2a2a2a;
  color: #ddd;
  font-size: 6px;
  padding: 4px 16px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 0 #111;
}

.ss-btn:active { transform: translateY(2px); box-shadow: 0 0 0 #111; }

.speaker {
  display: flex;
  gap: 6px;
  transform: rotate(-25deg);
}
.speaker span {
  width: 4px;
  height: 26px;
  background: rgba(0,0,0,0.45);
  border-radius: 2px;
}

.hint {
  margin-top: 20px;
  font-size: 9px;
  color: #aaa;
  text-align: center;
  line-height: 1.7;
  font-family: 'Courier New', monospace;
}
