@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Inter:wght@400;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  cursor: crosshair;
  user-select: none;
}

canvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

#hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
  display: none;
}
#hud.visible { display: block; }

#creator-tag {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #ff6a33;
  text-shadow: 0 0 10px rgba(255, 106, 51, 0.4);
  letter-spacing: 3px;
  background: rgba(20, 20, 20, 0.7);
  padding: 6px 16px;
  border: 1px solid rgba(255, 106, 51, 0.3);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#hud-top-left { position: absolute; top: 16px; left: 16px; }

#health-bar-bg {
  width: 200px; height: 20px;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid rgba(255, 120, 50, 0.25);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
#health-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff6a33, #ff8c42);
  border-radius: 2px;
  transition: width 0.15s ease, background 0.3s;
}
#health-bar-fill.medium { background: linear-gradient(90deg, #e8a020, #cc7700); }
#health-bar-fill.low    { background: linear-gradient(90deg, #ff3333, #aa1111); }

#health-text {
  position: absolute;
  top: 50%; left: 8px;
  transform: translateY(-50%);
  font-size: 11px; font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  letter-spacing: 0.5px;
}

#time-display {
  margin-top: 6px;
  font-size: 12px; color: #666;
  font-weight: 600;
  letter-spacing: 1px;
}

#hud-top-center {
  position: absolute;
  top: 16px;
  left: 50%; transform: translateX(-50%);
}
#reload-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px; font-weight: 700;
  color: #ff6a33;
  text-shadow: 0 0 12px rgba(255,106,51,0.5);
  animation: pulse-glow 0.4s ease-in-out infinite alternate;
  display: none;
}
#reload-text.visible { display: block; }

#hud-top-right {
  position: absolute;
  top: 16px; right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
#fullscreen-btn {
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(255, 106, 51, 0.3);
  color: #ccc;
  font-size: 16px;
  width: 32px; height: 32px;
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
}
#fullscreen-btn:hover {
  background: rgba(255, 106, 51, 0.15);
  border-color: rgba(255, 106, 51, 0.5);
  color: #ff6a33;
}
#ammo-display {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px; font-weight: 700;
  color: #eee;
  letter-spacing: 1px;
}
#ammo-display.empty { color: #ff3333; }

#score-display {
  margin-top: 4px;
  font-size: 12px; color: #777;
  font-weight: 600;
  letter-spacing: 0.5px;
}

#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: rgba(255, 106, 51, 0.8);
  text-shadow: 0 0 8px rgba(255, 106, 51, 0.4);
  pointer-events: none;
  font-weight: 300;
}

#fps-counter {
  position: absolute;
  bottom: 8px; right: 10px;
  font-size: 10px; color: #444;
  font-weight: 600;
  letter-spacing: 1px;
}

#damage-flash {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,50,30,0.3) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}
#damage-flash.active { opacity: 1; }

/* ── Touch Controls (Mobile) ── */
#touch-controls {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 15;
  pointer-events: none;
}
body.mobile-mode #touch-controls { display: block; }

#touch-joystick {
  position: absolute;
  bottom: 30px; left: 30px;
  width: 130px; height: 130px;
  background: rgba(255, 34, 34, 0.12);
  border: 2px solid rgba(255, 34, 34, 0.35);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
}

#joystick-knob {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 50px; height: 50px;
  background: radial-gradient(circle, rgba(255, 80, 80, 0.8), rgba(200, 30, 30, 0.6));
  border: 2px solid rgba(255, 100, 100, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(255, 34, 34, 0.3);
  transition: transform 0.05s;
}

#touch-right {
  position: absolute;
  bottom: 30px; right: 30px;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 14px;
  pointer-events: auto;
}

.touch-reload-pos {
  position: absolute;
  bottom: 170px; left: 35px;
  pointer-events: auto;
}

.touch-btn {
  border: none;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.touch-shoot {
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(255, 50, 50, 0.9), rgba(180, 20, 20, 0.8));
  border: 2px solid rgba(255, 80, 80, 0.6);
  box-shadow: 0 0 25px rgba(255, 34, 34, 0.4);
  font-size: 30px;
}
.touch-shoot:active {
  background: radial-gradient(circle, rgba(255, 100, 100, 1), rgba(220, 40, 40, 0.9));
  box-shadow: 0 0 35px rgba(255, 50, 50, 0.6);
  transform: scale(0.92);
}

.touch-small {
  width: 50px; height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 106, 51, 0.4);
  color: #ff6a33;
  font-size: 18px;
}
.touch-small:active {
  background: rgba(255, 106, 51, 0.3);
  transform: scale(0.9);
}

.touch-pause {
  position: absolute;
  top: 16px; right: 60px;
  width: 40px; height: 40px;
  background: rgba(30, 30, 30, 0.7);
  border: 1px solid rgba(255, 106, 51, 0.3);
  color: #ccc;
  font-size: 16px;
  pointer-events: auto;
}
.touch-pause:active {
  background: rgba(255, 106, 51, 0.3);
}

#touch-camera-zone {
  position: absolute;
  top: 0; right: 0;
  width: 55%;
  height: calc(100% - 180px);
  pointer-events: auto;
  touch-action: none;
}

/* Device selection buttons */
.device-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.device-btn {
  font-size: 15px !important;
  letter-spacing: 2px !important;
  padding: 16px !important;
}

/* ── Username / Danger Landing ── */
#username-screen {
  background: radial-gradient(ellipse at center, rgba(40, 0, 0, 0.98) 0%, rgba(5, 0, 0, 0.99) 100%);
}

.danger-box {
  position: relative;
  background: rgba(15, 0, 0, 0.9);
  border: 2px solid #ff2222;
  border-radius: 4px;
  padding: 40px 48px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 60px rgba(255, 0, 0, 0.15), inset 0 0 40px rgba(255, 0, 0, 0.05);
  animation: boxPulse 2s ease-in-out infinite;
}

@keyframes boxPulse {
  0%, 100% { box-shadow: 0 0 60px rgba(255, 0, 0, 0.15), inset 0 0 40px rgba(255, 0, 0, 0.05); border-color: #ff2222; }
  50% { box-shadow: 0 0 80px rgba(255, 0, 0, 0.3), inset 0 0 60px rgba(255, 0, 0, 0.08); border-color: #ff4444; }
}

.danger-stripe {
  width: 100%;
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    #ff2222 0px, #ff2222 8px,
    #1a1a1a 8px, #1a1a1a 16px
  );
  border-radius: 2px;
}

.danger-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: #ff2222;
  letter-spacing: 5px;
  margin: 20px 0 6px;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.6), 0 0 60px rgba(255, 0, 0, 0.2);
  animation: dangerFlicker 3s ease-in-out infinite;
}

@keyframes dangerFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
  25%, 75% { opacity: 0.95; text-shadow: 0 0 30px rgba(255, 0, 0, 0.8); }
}

.danger-subtitle {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: #ff4444;
  letter-spacing: 4px;
  margin-bottom: 28px;
  opacity: 0.7;
}

.danger-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #ff3333;
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
}

.danger-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(30, 0, 0, 0.8);
  border: 1px solid #ff2222;
  border-radius: 4px;
  color: #ff6666;
  font-size: 16px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  transition: all 0.3s;
  caret-color: #ff4444;
}
.danger-input::placeholder {
  color: #551111;
  letter-spacing: 2px;
  font-weight: 500;
}
.danger-input:focus {
  border-color: #ff4444;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.25);
  background: rgba(40, 0, 0, 0.9);
}

.danger-btn {
  margin-top: 18px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #cc0000, #880000);
  border: 1px solid #ff2222;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
  pointer-events: auto;
}
.danger-btn:hover {
  background: linear-gradient(135deg, #ff0000, #aa0000);
  box-shadow: 0 0 25px rgba(255, 0, 0, 0.4);
  transform: scale(1.02);
}
.danger-btn:active {
  transform: scale(0.98);
}

.danger-warning {
  margin-top: 16px;
  margin-bottom: 16px;
  font-size: 10px;
  color: #ff2222;
  letter-spacing: 2px;
  font-weight: 600;
  opacity: 0.5;
  animation: warnPulse 1.5s ease-in-out infinite;
}

@keyframes warnPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}



.overlay-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(5, 5, 5, 0.92);
  z-index: 20;
  gap: 8px;
}
.overlay-screen.active { display: flex; }

.title-glow {
  font-family: 'Orbitron', sans-serif;
  font-size: 52px; font-weight: 900;
  color: #ff6a33;
  text-shadow: 0 0 40px rgba(255,106,51,0.4), 0 0 80px rgba(255,106,51,0.15);
  letter-spacing: 8px;
  text-transform: uppercase;
}
.title-glow.red {
  color: #ff3333;
  text-shadow: 0 0 40px rgba(255,50,50,0.4), 0 0 80px rgba(255,50,50,0.15);
}

.subtitle {
  font-size: 14px; color: #555;
  margin-top: 0;
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: 600;
}

.prompt {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 28px;
  font-weight: 600;
}

.controls-hint {
  font-size: 12px; color: #3a3a3a;
  margin-top: 16px;
  letter-spacing: 0.5px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
  width: 200px;
}
.menu-btn {
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(255, 106, 51, 0.3);
  color: #eee;
  padding: 14px 0;
  font-size: 14px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;
}
.menu-btn:hover {
  background: rgba(255, 106, 51, 0.2);
  border-color: #ff6a33;
  color: #ff6a33;
  box-shadow: 0 0 15px rgba(255, 106, 51, 0.2);
}

#gameover-stats {
  margin-top: 10px;
  text-align: center;
  font-size: 18px; color: #999;
  line-height: 1.9;
  font-weight: 600;
}
#gameover-stats span {
  color: #ff6a33;
}

.overlay-screen::after {
  content: '';
  position: absolute;
  bottom: 40px;
  width: 120px; height: 1px;
  background: linear-gradient(90deg, transparent, #ff6a33, transparent);
  opacity: 0.3;
}

.pulse {
  animation: pulse-text 1.8s ease-in-out infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes pulse-glow {
  0% { opacity: 0.5; }
  100% { opacity: 1; text-shadow: 0 0 16px rgba(255,106,51,0.6); }
}
