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

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

:root {
  --body: #d8d4d0;
  --body-light: #e8e4e0;
  --body-mid: #c4c0bc;
  --body-dark: #a8a4a0;
  --body-deep: #888480;
  --screen-green: #8a9a40;
  --screen-pixel: #3a4818;
  --dpad: #282624;
  --dpad-face: #323030;
  --button-pink: #d4286a;
  --button-pink-light: #e83880;
  --button-pink-shadow: #901848;
  --button-small: #b8b4b8;
  --button-small-dark: #888490;
  --logo-blue: #2838a8;
  --label-blue: #3848b8;
  --line-pink: #d03870;
  --line-blue: #2838a8;
}

body {
  background: radial-gradient(ellipse 60% 55% at 50% 44%, #363c4a, #0e1018);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gameboy {
  position: relative;
  width: 340px;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, 0.22)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.14));
}

.body-upper {
  background: var(--body);
  border-radius: 16px 16px 0 0;
  padding: 18px 18px 14px;
  position: relative;
}

.screen-housing {
  background: #a8a4a0;
  border-radius: 8px 8px 12px 12px;
  padding: 12px 14px 14px;
  position: relative;
}

.dot-matrix-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 10px;
}

.deco-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 28px;
}

.deco-line-pink {
  height: 1.5px;
  background: var(--line-pink);
  border-radius: 1px;
}

.deco-line-blue {
  height: 1.5px;
  background: var(--line-blue);
  border-radius: 1px;
}

.dot-matrix-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 4.5px;
  color: rgba(60, 56, 52, 0.6);
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.screen-inner {
  position: relative;
  border-radius: 4px;
  background: #a8a4a0;
  padding: 7px 26px;
}

.battery-indicator {
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.battery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff5050, #c01010);
  box-shadow: 0 0 6px rgba(200, 20, 20, 0.6);
  animation: led-pulse 2.4s ease-in-out infinite;
}

.battery-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 3.5px;
  color: rgba(60, 56, 52, 0.5);
  letter-spacing: 0.05em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

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

.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 10 / 9;
  border-radius: 3px;
  overflow: hidden;
  background: var(--screen-green);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.3),
    inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 1px,
    transparent 1px,
    transparent 3px);
  z-index: 2;
}

.screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 40% at 30% 28%,
    rgba(255, 255, 255, 0.14) 0%,
    transparent 65%);
  z-index: 3;
}

.screen-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.04em;
  line-height: 1;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.15));
}

.screen-title span {
  color: var(--screen-pixel);
}

.screen-bar-wrap {
  width: 70%;
  height: 8px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 14px;
}

.screen-bar {
  height: 100%;
  width: 72%;
  background: linear-gradient(to right, #3a5020, #5a7030);
  border-radius: 2px;
}

.logo-row {
  padding: 10px 2px 2px;
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.logo-nintendo {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--logo-blue);
  letter-spacing: -0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.logo-gameboy {
  font-family: 'Nunito', sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: 20px;
  color: var(--logo-blue);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.logo-tm {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 8px;
  color: var(--logo-blue);
  align-self: flex-start;
  margin-top: 4px;
}

.body-lower {
  background: var(--body);
  border-radius: 0 0 36px 36px;
  padding: 28px 20px 80px;
  position: relative;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dpad-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.dpad-arm {
  position: absolute;
  background: linear-gradient(160deg,
    var(--dpad-face) 0%,
    var(--dpad) 60%,
    #181616 100%);
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.dpad-h {
  width: 100px;
  height: 32px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  border-radius: 4px;
}

.dpad-v {
  width: 32px;
  height: 100px;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border-radius: 4px;
}

.dpad-centre {
  position: absolute;
  width: 32px;
  height: 32px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--dpad);
  border-radius: 50%;
  z-index: 2;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.ab-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(-12deg);
  flex-shrink: 0;
  margin-top: 4px;
}

.ab-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.button-ab-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.button-ab {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%,
    var(--button-pink-light),
    var(--button-pink) 55%,
    var(--button-pink-shadow));
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.25),
    inset 0 1px 3px rgba(255, 255, 255, 0.15);
}

.button-ab-label {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 10px;
  color: var(--label-blue);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.button-b-offset {
  margin-top: 32px;
}

.select-start-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  transform: rotate(-12deg);
  margin-top: 24px;
  margin-bottom: 4px;
}

.button-small-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.button-small {
  width: 36px;
  height: 13px;
  border-radius: 7px;
  background: linear-gradient(to bottom,
    var(--button-small),
    var(--button-small-dark));
  box-shadow:
    0 3px 5px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 2px rgba(0, 0, 0, 0.25);
}

.button-small-label {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 7px;
  letter-spacing: 0.04em;
  color: var(--label-blue);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.speaker-slits {
  position: absolute;
  bottom: 44px;
  right: 22px;
  display: flex;
  gap: 5px;
  transform: rotate(-12deg);
}

.slit {
  width: 5px;
  height: 30px;
  border-radius: 3px;
  background: linear-gradient(to bottom, #888, #606060);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.15);
}

#screenText {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--screen-pixel);
  text-align: center;
  line-height: 1.4;
}

#screenHint {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--screen-pixel);
  text-align: center;
  margin-top: 10px;
  line-height: 1.8;
}

.dpad-wrap {
  cursor: pointer;
}

.button-ab {
  cursor: pointer;
}

.button-ab:active,
.dpad-wrap:active {
  transform: scale(0.95);
}

.dpad-left,
.dpad-right {
    position: absolute;
    width: 33.33%;
    height: 33.33%;
    top: 33.33%;
    z-index: 20;
    cursor: pointer;
}

.dpad-left {
    left: 0;
}

.dpad-right {
    right: 0;
}

#screenImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    display: block;
}

