/* ═══════════════════════════════════════════════════════════════
   GameBoy UI Shell — Birthday Edition
   ═══════════════════════════════════════════════════════════════ */

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

html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #1a1a2e;
  -webkit-user-select: none;
  user-select: none;
}

/* ── GameBoy device shell ──────────────────────────────────── */

#gameboy-device {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 420px;
  max-width: 100%;
  background: linear-gradient(145deg, #c8c0d8 0%, #b0a8c4 50%, #9890ac 100%);
  border-radius: 18px 18px 60px 18px;
  padding: 14px 14px 20px;
  box-shadow:
    0 8px 30px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

/* ── Header label ──────────────────────────────────────────── */

#gb-header {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 8px 8px;
}

.gb-logo {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 3px;
  color: #2c2654;
  text-transform: uppercase;
  font-style: italic;
}

.gb-sub {
  font-size: 9px;
  color: #5a5280;
  letter-spacing: 1px;
}

/* ── Screen bezel ──────────────────────────────────────────── */

#screen-bezel {
  width: 100%;
  background: #2a2a3e;
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  box-shadow:
    inset 0 3px 8px rgba(0,0,0,0.6),
    inset 0 -1px 0 rgba(255,255,255,0.08);
}

#screen-container {
  position: relative;
  z-index: 10;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: #0e0e1a;
}

/*
 * Let Phaser's ScaleManager (ENVELOPE mode) handle sizing.
 * We only fix the inline-element gap and ensure crisp pixel art.
 */
#screen-container canvas {
  display: block;
  margin: 0;
  padding: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Controls area ─────────────────────────────────────────── */

#controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 10px 4px;
}

/* ── D-pad ─────────────────────────────────────────────────── */

#dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dpad-mid-row {
  display: flex;
  align-items: center;
}

.dpad-btn {
  width: 44px;
  height: 44px;
  background: #3a3454;
  color: #bbb;
  border: none;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s;
}

.dpad-btn:active,
.dpad-btn.pressed {
  background: #5a50a0;
  color: #fff;
}

#dpad-up    { border-radius: 6px 6px 0 0; }
#dpad-down  { border-radius: 0 0 6px 6px; }
#dpad-left  { border-radius: 6px 0 0 6px; }
#dpad-right { border-radius: 0 6px 6px 0; }

.dpad-center {
  width: 44px;
  height: 44px;
  background: #3a3454;
}

/* ── Action buttons ────────────────────────────────────────── */

#action-buttons {
  display: flex;
  gap: 14px;
  align-items: center;
  transform: rotate(-25deg);
}

.action-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s, transform 0.08s;
  box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}

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

#btn-a {
  background: #cc3355;
  color: #fff;
}
#btn-a:active, #btn-a.pressed {
  background: #ee4477;
}

#btn-b {
  background: #cc3355;
  color: #fff;
}
#btn-b:active, #btn-b.pressed {
  background: #ee4477;
}

/* ── Footer / speaker grille ───────────────────────────────── */

#gb-footer {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 10px 24px 0;
}

.gb-speaker {
  display: flex;
  gap: 4px;
  transform: rotate(-25deg);
}

.gb-speaker span {
  display: block;
  width: 3px;
  height: 22px;
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  body {
    background: linear-gradient(145deg, #c8c0d8 0%, #b0a8c4 50%, #9890ac 100%);
  }

  #gameboy-device {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    padding: 8px 8px 16px;
    justify-content: center;
    box-shadow: none;
  }

  #screen-bezel {
    padding: 8px;
  }

  .dpad-btn {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }
  .dpad-center {
    width: 52px;
    height: 52px;
  }

  .action-btn {
    width: 58px;
    height: 58px;
    font-size: 18px;
  }
}
