* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: #071b30;
  color: #eef;
}
#game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #071b30;
}
#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 1rem;
  align-items: center;
}
#hud > div {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 160px;
}
#beamButton {
  position: absolute;
  right: 16px;
  bottom: 24px;
  width: calc(100px + 2vw);
  max-width: 140px;
  padding: 14px 16px;
  border: none;
  border-radius: 999px;
  background: #52c0ff;
  color: #042b42;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  transition: transform 0.2s ease, filter 0.2s ease;
}
#beamButton:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
#beamButton.active {
  background: #e9ff59;
  color: #122100;
}
#mobileControls {
  display: none;
  position: absolute;
  bottom: 14vh;
  left: 12px;
  z-index: 6;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  pointer-events: none;
}
#mobileControls .mobileButton {
  pointer-events: auto;
}
body:not(.mobile-device) #mobileControls {
  display: none !important;
}
@media (hover: hover) and (pointer: fine), (min-width: 901px) {
  #mobileControls {
    display: none !important;
  }
}
.mobile-dpad {
  display: grid;
  gap: 10px;
  justify-items: center;
}
.mobile-dpad-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.mobileButton {
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 12px 24px rgba(0,0,0,0.16);
  backdrop-filter: blur(10px);
}
.mobileButton.active,
.mobileButton:active,
.mobileButton.keyboard-active {
  background: rgba(255, 255, 255, 0.32);
  color: #042b42;
  transform: translateY(1px);
  filter: brightness(1.02);
}
.mobileBeam {
  min-width: 116px;
  padding: 0 16px;
  height: 54px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
body.mobile-device #mobileControls {
  display: flex;
  pointer-events: auto;
}
body.mobile-device #beamButton {
  display: none;
}
#pauseButton {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: rgba(82, 192, 255, 0.95);
  color: #042b42;
  font-weight: 700;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  transition: transform 0.2s ease, filter 0.2s ease;
}
#pauseButton:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
#menuOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 12, 25, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10;
}
#menuOverlay.menu-hidden {
  display: none;
}
#menuContent {
  width: min(92vw, 440px);
  padding: 34px 28px;
  border-radius: 24px;
  background: rgba(10, 23, 40, 0.88);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 28px 80px rgba(0,0,0,0.32);
  text-align: center;
}
#menuTitle {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin-bottom: 14px;
  color: #f3fbff;
  letter-spacing: 0.02em;
}
#menuSubtitle {
  font-size: 1rem;
  line-height: 1.6;
  color: #c7dbee;
  margin-bottom: 24px;
}
#menuExtra {
  margin-bottom: 20px;
  text-align: left;
}
.menuControlRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.menuShareText {
  color: #b8d8ff;
  word-break: break-word;
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.menuShareRow {
  margin-bottom: 12px;
}
.menuControlLabel {
  flex: 1 1 auto;
  color: #eef;
  font-size: 0.98rem;
}
#volumeSlider {
  width: 100%;
}
#volumeValue {
  min-width: 44px;
  text-align: right;
  color: #b8d8ff;
}
#menuButtons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.menuButton {
  min-width: 140px;
  padding: 14px 18px;
  border: none;
  border-radius: 999px;
  background: #52c0ff;
  color: #042b42;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, filter 0.2s ease;
}
.menuButton:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.menuButton.secondary {
  background: #1f76b8;
  color: #eef;
}
@media (max-width: 600px) {
  #hud {
    font-size: 0.95rem;
    gap: 8px;
  }
  #hud > div {
    min-width: auto;
    flex: 1 1 100%;
  }
}
