html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0f14;
  color: #f0f3f8;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#game {
  display: block;
  max-width: 100vw;
  max-height: 100dvh;
  image-rendering: optimizeQuality;
  background: #000;
}

#mobile-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.top-actions {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: auto;
}

.top-actions button,
.fire-button {
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 8px;
  background: rgba(9, 16, 28, 0.72);
  color: #f8fafc;
  font: 700 14px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-width: 64px;
  min-height: 42px;
  padding: 0 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  backdrop-filter: blur(8px);
}

.joystick {
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 132px;
  height: 132px;
  pointer-events: auto;
}

.joystick-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255,255,255,0.52);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,201,240,0.16), rgba(15,23,42,0.48));
  box-shadow: inset 0 0 20px rgba(255,255,255,0.14), 0 8px 28px rgba(0,0,0,0.35);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(230, 241, 255, 0.86);
  border: 2px solid rgba(15,23,42,0.7);
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 14px rgba(0,0,0,0.38);
}

.fire-button {
  position: absolute;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(42px, env(safe-area-inset-bottom));
  width: 96px;
  height: 96px;
  border-radius: 50%;
  font-size: 18px;
  pointer-events: auto;
  background: rgba(190, 24, 93, 0.72);
}

@media (max-width: 520px) {
  .joystick {
    width: 116px;
    height: 116px;
  }

  .fire-button {
    width: 82px;
    height: 82px;
  }

  .top-actions button {
    min-width: 56px;
    min-height: 38px;
    padding: 0 9px;
  }
}
