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

body {
  background: linear-gradient(145deg, #1a1028 0%, #0d0a18 40%, #160e24 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
}

#game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#bezel {
  background: linear-gradient(180deg, #3a3a42 0%, #28282e 50%, #1e1e24 100%);
  border-radius: 18px;
  padding: 18px 22px 22px 22px;
  box-shadow:
    0 0 0 3px #111115,
    0 4px 20px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -2px 0 rgba(0,0,0,0.3);
  position: relative;
}

#bezel-top-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #666;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

#screen-container {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.8),
    0 0 1px rgba(100,120,200,0.3);
  background: #080c14;
}

#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

#mobile-controls {
  display: none;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  flex-wrap: wrap;
}

.ctrl-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  width: 64px;
  height: 56px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #444 0%, #2a2a2a 100%);
  color: #ccc;
  box-shadow: 0 4px 0 #111, 0 6px 12px rgba(0,0,0,0.4);
  cursor: pointer;
  touch-action: manipulation;
}

.ctrl-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #111, 0 3px 6px rgba(0,0,0,0.4);
}

.ctrl-fire {
  background: linear-gradient(180deg, #e04040 0%, #a02020 100%);
  color: #fff;
  width: 80px;
}

.ctrl-swap {
  background: linear-gradient(180deg, #4060e0 0%, #2040a0 100%);
  color: #fff;
}

#footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 520px;
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: #444;
}

#footer a {
  color: #556;
  text-decoration: none;
}

#footer a:hover {
  color: #88a;
}

@media (max-width: 600px) {
  #mobile-controls {
    display: flex;
  }
  #bezel {
    padding: 10px 12px 14px 12px;
    border-radius: 12px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  body {
    align-items: flex-start;
    padding-top: 5px;
  }
  #game-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  #mobile-controls {
    flex-direction: column;
  }
}