* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #080a10;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  top: env(safe-area-inset-top, 12px);
  left: 0;
  right: 0;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.hud-box {
  background: rgba(14, 18, 32, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
  border-radius: 10px;
  padding: 6px 14px;
  text-align: center;
  min-width: 90px;
  backdrop-filter: blur(8px);
}

.wave-box {
  border-color: rgba(255, 0, 128, 0.5);
  box-shadow: 0 0 12px rgba(255, 0, 128, 0.25);
}

.hud-label {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #8fa0c2;
  font-weight: 700;
}

.hud-val {
  font-size: 20px;
  font-weight: 900;
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
}

.wave-box .hud-val {
  color: #ff007f;
  text-shadow: 0 0 8px rgba(255, 0, 128, 0.7);
}

.status-bars {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.bar-container {
  position: relative;
  height: 18px;
  background: rgba(18, 22, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.bar-fill {
  height: 100%;
  transition: width 0.15s ease-out;
}

.hp-fill {
  background: linear-gradient(90deg, #ff0055, #00ff88);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 1px 3px #000;
}

.icon-btn {
  pointer-events: auto;
  position: absolute;
  right: 20px;
  top: env(safe-area-inset-top, 14px);
  background: rgba(14, 18, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  backdrop-filter: blur(6px);
}

/* Touch Controls */
#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  pointer-events: none;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  padding: 0 28px calc(env(safe-area-inset-bottom, 15px) + 15px) 28px;
  align-items: flex-end;
}

#joystick-zone {
  width: 140px;
  height: 140px;
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

#joystick-base {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.12) 0%, rgba(0, 240, 255, 0.03) 70%);
  border: 2px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

#joystick-stick {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, #00f0ff 0%, #0088cc 100%);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.8);
  position: absolute;
  pointer-events: none;
  transition: transform 0.05s ease-out;
}

#shoot-zone {
  pointer-events: auto;
}

#shoot-btn {
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff007f 0%, #a00050 100%);
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 25px rgba(255, 0, 128, 0.7);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s, box-shadow 0.08s;
}

#shoot-btn span {
  font-size: 11px;
  letter-spacing: 1px;
  opacity: 0.9;
}

#shoot-btn:active {
  transform: scale(0.92);
  box-shadow: 0 0 40px rgba(255, 0, 128, 1);
  background: radial-gradient(circle, #ff3399 0%, #cc0066 100%);
}

/* Modals & Screens */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 8, 16, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  overflow-y: auto;
}

.card {
  background: #111422;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.neon-border {
  border: 2px solid #00f0ff;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.25), inset 0 0 20px rgba(0, 240, 255, 0.08);
}

.game-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 4px;
}

.neon-highlight {
  color: #ff007f;
  text-shadow: 0 0 18px rgba(255, 0, 128, 0.8);
}

.subtitle {
  color: #8fa0c2;
  font-size: 14px;
  margin-bottom: 22px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Face Customizer */
.face-customizer {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 22px;
}

.custom-card {
  flex: 1;
  background: #161a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.custom-card h3 {
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 12px;
  color: #a8b8db;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 12px;
  border: 3px solid #00f0ff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090c17;
}

.custom-card:nth-child(2) .avatar-preview {
  border-color: #ff007f;
  box-shadow: 0 0 14px rgba(255, 0, 128, 0.4);
}

.avatar-circle {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.default-face {
  font-size: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-file-btn {
  display: inline-block;
  background: linear-gradient(135deg, #1f2747, #131932);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.custom-file-btn:hover {
  background: #2b3560;
  border-color: #00f0ff;
}

.custom-file-btn input[type="file"] {
  display: none;
}

.presets-row {
  display: flex;
  gap: 6px;
}

.preset-btn {
  background: #0e1224;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 16px;
  padding: 4px 6px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.preset-btn:hover, .preset-btn.active {
  border-color: #00f0ff;
  transform: scale(1.15);
}

.controls-hint {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: #8fa0c2;
  margin-bottom: 22px;
  line-height: 1.6;
}

.controls-hint strong {
  color: #fff;
}

/* Glowing Buttons */
.glow-btn {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  text-transform: uppercase;
  transition: transform 0.12s, box-shadow 0.12s;
}

.start-glow {
  background: linear-gradient(90deg, #00f0ff, #0077ff);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.6);
}

.start-glow:hover {
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.9);
  transform: scale(1.02);
}

.gameover-title {
  color: #ff0055;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 3px;
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(255, 0, 85, 0.8);
}

.score-summary {
  font-size: 18px;
  margin-bottom: 26px;
  line-height: 2;
}

.gold {
  color: #ffd700;
  font-weight: 900;
}

.restart-glow {
  background: linear-gradient(90deg, #ff007f, #ff5500);
  box-shadow: 0 0 25px rgba(255, 0, 128, 0.6);
}

.restart-glow:hover {
  box-shadow: 0 0 35px rgba(255, 0, 128, 0.9);
  transform: scale(1.02);
}

/* Floating Damage Texts */
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-35px) scale(1.2); }
}
