* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #02040a;
  color: #fff;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* Post-FX Simulation Vignettes */
#vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(circle, transparent 55%, rgba(0, 0, 0, 0.88) 100%);
}

#damage-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(circle, transparent 35%, rgba(255, 0, 60, 0.65) 100%);
  opacity: 0;
  transition: opacity 0.1s ease;
}

#god-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(circle, rgba(0, 255, 200, 0.35) 0%, rgba(255, 230, 0, 0.5) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Dynamic Floating Damage Numbers Container */
#damage-text-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 18;
  overflow: hidden;
}

.dmg-popup {
  position: absolute;
  font-weight: 950;
  font-size: 18px;
  color: #00ffff;
  text-shadow: 0 0 8px #00ffff, 0 0 2px #000;
  pointer-events: none;
  transform: translate(-50%, -100%);
  animation: popup-float 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.dmg-popup.crit {
  font-size: 26px;
  color: #ffee00;
  text-shadow: 0 0 14px #ffee00, 0 0 3px #ff0055;
  letter-spacing: 1px;
}

.dmg-popup.heal {
  font-size: 20px;
  color: #39ff14;
  text-shadow: 0 0 10px #39ff14;
}

@keyframes popup-float {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.7); }
  20% { transform: translate(-50%, -20px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -55px) scale(0.9); }
}

/* Custom Sci-Fi Aim Crosshair */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 15;
}
#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: rgba(0, 255, 234, 0.9);
  box-shadow: 0 0 10px #00ffea;
}
#crosshair::before {
  top: 15px;
  left: 0;
  width: 32px;
  height: 2px;
}
#crosshair::after {
  top: 0;
  left: 15px;
  width: 2px;
  height: 32px;
}
#crosshair .dot {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 4px;
  height: 4px;
  background: #ff0055;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff0055;
}

/* Top Buttons Bar */
#top-buttons {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 120;
  display: flex;
  gap: 10px;
}

#top-buttons button {
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid rgba(0, 255, 234, 0.4);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
#top-buttons button:hover {
  border-color: #00f0ff;
  box-shadow: 0 0 14px #00f0ff;
  transform: scale(1.08);
}

/* HUD System */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 24px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.player-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
}

.stat-bar-container {
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid rgba(0, 255, 234, 0.4);
  border-radius: 8px;
  padding: 5px 9px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.stat-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.hp-label { color: #ff3366; }
.shield-label { color: #0088ff; }
.god-label { color: #00ffcc; }
.stamina-label { color: #ffb703; }

.bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.hp-fill {
  background: linear-gradient(90deg, #ff0055, #ff5533);
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.8);
}

.shield-fill {
  background: linear-gradient(90deg, #0066ff, #00ffff);
  box-shadow: 0 0 12px rgba(0, 136, 255, 0.8);
}

.god-fill {
  width: 0%;
  background: linear-gradient(90deg, #00f0ff, #ffee00);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.9);
}

.stamina-fill {
  background: linear-gradient(90deg, #ffb703, #fb8500);
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.8);
}

.hud-center-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wave-badge {
  background: rgba(15, 22, 40, 0.9);
  border: 1px solid #00f0ff;
  border-radius: 24px;
  padding: 6px 22px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #00f0ff;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.5);
  text-transform: uppercase;
}

#boss-hud {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 380px;
  max-width: 85vw;
  background: rgba(22, 6, 14, 0.9);
  border: 2px solid #ff0055;
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: 0 0 30px rgba(255, 0, 85, 0.6);
  backdrop-filter: blur(10px);
  animation: pulse-border 1.5s infinite alternate;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 15px rgba(255, 0, 85, 0.4); }
  100% { box-shadow: 0 0 32px rgba(255, 0, 85, 0.85); }
}

.boss-name {
  color: #ff3366;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 4px;
  text-shadow: 0 0 12px #ff0055;
}

.boss-bar-bg {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 50, 100, 0.5);
}

.boss-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #990022, #ff0055, #ff7700);
  box-shadow: 0 0 18px #ff0055;
  transition: width 0.2s ease;
}

.hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.radar-box {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 234, 0.6);
  background: rgba(5, 12, 24, 0.85);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(8px);
}

#radar-canvas {
  width: 100%;
  height: 100%;
}

.score-display {
  font-size: 22px;
  font-weight: 950;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
}

.score-num {
  color: #00ffcc;
  margin-left: 6px;
}

.combo-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-container.active {
  opacity: 1;
  transform: scale(1);
}

.combo-count {
  font-size: 36px;
  font-weight: 950;
  font-style: italic;
  color: #ffee00;
  text-shadow: 0 0 18px #ffee00;
  line-height: 1;
}

.combo-rank {
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ff0055;
  text-shadow: 0 0 16px #ff0055;
}

/* Skills Cooldown Dock */
.hud-middle {
  position: absolute;
  bottom: 95px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
}

.skills-dock {
  display: flex;
  gap: 12px;
}

.skill-slot {
  width: 52px;
  height: 52px;
  background: rgba(12, 18, 34, 0.88);
  border: 1px solid rgba(0, 255, 234, 0.4);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.skill-icon {
  font-size: 22px;
}

.skill-key {
  font-size: 9px;
  font-weight: 900;
  color: #00f0ff;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.skill-cd-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 9px;
  height: 0%;
  transition: height 0.1s linear;
}

/* Bottom HUD Row: Weapons Dock */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.weapons-dock {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.weapon-slot {
  width: 65px;
  height: 65px;
  background: rgba(14, 20, 36, 0.88);
  border: 1px solid rgba(0, 255, 234, 0.35);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.weapon-slot:hover {
  border-color: #00f0ff;
  transform: translateY(-3px);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.weapon-slot.active {
  border: 2px solid #00f0ff;
  background: rgba(0, 240, 255, 0.22);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.75);
  transform: translateY(-5px);
}

.weapon-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 10px;
  font-weight: 900;
  color: #88a0c0;
}

.weapon-icon {
  font-size: 24px;
}

.weapon-name {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
  color: #ccd6f6;
}

.weapon-ammo {
  position: absolute;
  bottom: 2px;
  right: 5px;
  font-size: 10px;
  font-weight: 900;
  color: #ffb703;
}

#banner-announce {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  font-size: 40px;
  font-weight: 950;
  letter-spacing: 5px;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 25px #00f0ff, 0 0 50px #ff0055;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#banner-announce.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.ui-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(2, 4, 10, 0.92);
  backdrop-filter: blur(14px);
  padding: 20px;
  transition: opacity 0.3s ease;
}

.menu-card {
  max-width: 600px;
  width: 92%;
  background: rgba(14, 22, 42, 0.95);
  border: 2px solid rgba(0, 255, 234, 0.6);
  border-radius: 16px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: 0 0 45px rgba(0, 240, 255, 0.35), inset 0 0 20px rgba(0, 240, 255, 0.08);
}

.game-title {
  font-size: 44px;
  font-weight: 950;
  letter-spacing: 5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #00f0ff 50%, #ff0055 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 24px rgba(0, 240, 255, 0.6);
  margin-bottom: 6px;
  line-height: 1.1;
}

.game-subtitle {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #ffb703;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.controls-guide {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 26px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  font-size: 12px;
  text-align: left;
}

.control-item span:first-child {
  font-weight: 900;
  color: #00f0ff;
  display: inline-block;
  min-width: 85px;
}
.control-item span:last-child {
  color: #cbd5e1;
}

.btn-primary {
  padding: 16px 46px;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #00f0ff, #0088ff);
  color: #030a1a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.7);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 0 38px rgba(0, 240, 255, 0.95);
}

.btn-primary:active {
  transform: scale(0.97);
}

.settings-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0;
  font-size: 15px;
  font-weight: 700;
  color: #00f0ff;
}

.settings-group input[type="range"] {
  accent-color: #00f0ff;
  width: 140px;
}

#perk-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(2, 4, 10, 0.92);
  backdrop-filter: blur(14px);
}

.perk-cards-grid {
  display: flex;
  gap: 20px;
  margin-top: 26px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 850px;
}

.perk-card {
  width: 220px;
  background: rgba(16, 24, 46, 0.95);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.perk-card:hover {
  border-color: #ffee00;
  transform: translateY(-8px) scale(1.04);
  box-shadow: 0 0 35px rgba(255, 238, 0, 0.5);
}

.perk-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.perk-title {
  font-size: 16px;
  font-weight: 850;
  color: #00f0ff;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.perk-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

#mobile-controls {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.touch-stick-zone {
  position: absolute;
  bottom: 25px;
  left: 25px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(0, 240, 255, 0.5);
  border-radius: 50%;
  pointer-events: auto;
}

.touch-stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: radial-gradient(circle, #00f0ff 0%, rgba(0, 240, 255, 0.5) 100%);
  border-radius: 50%;
  box-shadow: 0 0 18px #00f0ff;
  pointer-events: none;
}

.touch-action-buttons {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(18, 26, 48, 0.9);
  border: 2px solid rgba(0, 240, 255, 0.6);
  color: #fff;
  font-weight: 900;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
  backdrop-filter: blur(8px);
}

.touch-btn:active {
  background: rgba(0, 240, 255, 0.45);
  transform: scale(0.92);
}

.btn-attack { border-color: #ff0055; box-shadow: 0 0 18px rgba(255, 0, 85, 0.6); }
.btn-dash { border-color: #ffb703; }
.btn-vortex { border-color: #b700ff; }
.btn-god { border-color: #ffee00; box-shadow: 0 0 24px rgba(255, 238, 0, 0.8); }

@media (max-width: 800px) {
  #mobile-controls { display: block; }
  .controls-guide { grid-template-columns: 1fr; }
  .weapons-dock { transform: scale(0.8); transform-origin: bottom left; }
  .hud-middle { bottom: 85px; }
  .radar-box { width: 75px; height: 75px; }
}
