* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #0a0a0e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  user-select: none;
}

#game-gear-shell {
  background: linear-gradient(145deg, #2a2a30 0%, #1a1a1e 40%, #111115 100%);
  border-radius: 24px 24px 20px 20px;
  padding: 14px 16px 10px 16px;
  box-shadow:
    0 0 0 3px #0d0d10,
    0 8px 32px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.06);
  max-width: 520px;
  width: 96vw;
  position: relative;
}

#gg-top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 8px 8px;
}

.gg-logo {
  color: #4488cc;
  font-size: 10px;
  letter-spacing: 3px;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(68,136,204,0.4);
}

.gg-model {
  color: #555;
  font-size: 7px;
  letter-spacing: 2px;
}

#screen-bezel {
  background: #111;
  border-radius: 8px;
  padding: 10px;
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.9),
    0 1px 0 rgba(255,255,255,0.04);
}

#screen-area {
  position: relative;
  width: 100%;
  aspect-ratio: 10 / 9;
  background: #0a1a12;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 20px rgba(40,180,80,0.08),
    0 0 60px rgba(40,180,80,0.04);
}

#scene-container {
  width: 100%;
  height: 100%;
}

#scene-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  image-rendering: auto;
}

#scanlines {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.12) 2px,
    rgba(0,0,0,0.12) 4px
  );
  pointer-events: none;
  z-index: 10;
}

#screen-vignette {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0,0,0,0.5) 100%
  );
  pointer-events: none;
  z-index: 11;
}

#hud-top-left, #hud-top-right, #hud-stars {
  position: absolute;
  z-index: 12;
  color: #88ccaa;
  font-size: 8px;
  text-shadow: 0 0 4px rgba(100,200,150,0.5);
  pointer-events: none;
}

#hud-top-left {
  top: 8px; left: 8px;
}

#hud-top-right {
  top: 8px; right: 8px;
  text-align: right;
}

#hud-stars {
  top: 22px; right: 8px;
  font-size: 10px;
}

#target-preview {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 12;
  pointer-events: none;
}

#target-preview canvas {
  border: 1px solid rgba(100,200,150,0.3);
  border-radius: 2px;
  image-rendering: pixelated;
}

#menu-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#menu-overlay.active {
  pointer-events: auto;
  background: rgba(5,15,10,0.92);
}

#menu-overlay .menu-content {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#menu-overlay.active .menu-content {
  display: flex;
}

.menu-title {
  color: #44ddaa;
  font-size: 16px;
  text-shadow: 0 0 12px rgba(68,221,170,0.6);
  margin-bottom: 8px;
  text-align: center;
  line-height: 1.6;
}

.menu-subtitle {
  color: #cc3366;
  font-size: 8px;
  text-shadow: 0 0 8px rgba(204,51,102,0.5);
}

.menu-item {
  color: #88ccaa;
  font-size: 9px;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.menu-item:hover, .menu-item.selected {
  color: #ccaa33;
  border-color: #ccaa33;
  text-shadow: 0 0 6px rgba(204,170,51,0.5);
}

.menu-item.locked {
  color: #445544;
  cursor: default;
}

.menu-item.locked:hover {
  color: #445544;
  border-color: transparent;
  text-shadow: none;
}

.blink {
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Controls */
#controls-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 8px 6px 8px;
}

#dpad-container {
  display: grid;
  grid-template-columns: 32px 32px 32px;
  grid-template-rows: 32px 32px 32px;
  gap: 0;
}

.dpad-btn {
  background: #222228;
  border: 1px solid #333;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.4);
  transition: all 0.1s;
}

.dpad-btn:active {
  background: #333;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.4);
  transform: scale(0.95);
}

#dpad-up { grid-column: 2; grid-row: 1; }
#dpad-left { grid-column: 1; grid-row: 2; }
.dpad-center { grid-column: 2; grid-row: 2; background: #1a1a1e; border-radius: 2px; }
#dpad-right { grid-column: 3; grid-row: 2; }
#dpad-down { grid-column: 2; grid-row: 3; }

#start-btn-container {
  display: flex;
  align-items: center;
}

#start-btn {
  background: #333;
  border: 1px solid #444;
  color: #888;
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.4);
  letter-spacing: 1px;
}

#start-btn:active {
  background: #444;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.4);
}

#action-btns-container {
  display: flex;
  gap: 12px;
  align-items: center;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #333, #1a1a1e);
  border: 2px solid #2a2a2e;
  color: #666;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  box-shadow:
    0 3px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.05);
  transition: all 0.1s;
}

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

#gg-bottom-bar {
  padding: 4px 8px;
  display: flex;
  justify-content: flex-end;
}

.gg-speaker-grille {
  display: flex;
  gap: 3px;
}

.gg-speaker-grille span {
  width: 2px;
  height: 16px;
  background: #222;
  border-radius: 1px;
}

#footer-link {
  margin-top: 12px;
  padding: 8px;
}

#footer-link a {
  color: #446655;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  text-decoration: none;
  letter-spacing: 1px;
}

#footer-link a:hover {
  color: #88ccaa;
  text-shadow: 0 0 8px rgba(100,200,150,0.4);
}

/* Responsive */
@media (max-height: 700px) {
  #game-gear-shell {
    padding: 8px 10px 6px 10px;
    border-radius: 16px;
  }
  #screen-bezel { padding: 6px; }
  #controls-area { padding: 8px 6px 4px 6px; }
  .dpad-btn { width: 28px; height: 28px; }
  #dpad-container {
    grid-template-columns: 28px 28px 28px;
    grid-template-rows: 28px 28px 28px;
  }
  .action-btn { width: 34px; height: 34px; font-size: 8px; }
}

@media (max-width: 360px) {
  .dpad-btn { width: 26px; height: 26px; font-size: 10px; }
  #dpad-container {
    grid-template-columns: 26px 26px 26px;
    grid-template-rows: 26px 26px 26px;
  }
  .action-btn { width: 32px; height: 32px; font-size: 8px; }
}