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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #080a10;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #ffffff;
  touch-action: none;
}

#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #080a10;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d111a;
  cursor: crosshair;
}

/* ==========================================
   HUD OVERLAY & UI PANELS
   ========================================== */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  z-index: 10;
}

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

.status-panel {
  background: rgba(13, 17, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.progress-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s ease-out;
  border-radius: 6px;
}

#hpFill {
  background: linear-gradient(90deg, #ef4444, #f87171);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

#specialFill {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

.special-ready-glow #specialFill {
  background: linear-gradient(90deg, #eab308, #f59e0b);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.9);
  animation: pulseGlow 1s infinite alternate;
}

@keyframes pulseGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.4); }
}

.info-badge-container {
  display: flex;
  gap: 12px;
}

.info-badge {
  background: rgba(13, 17, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  min-width: 90px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.info-value {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
  font-family: monospace;
}

.info-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin-top: 2px;
}

/* Pause Button Top Right */
.icon-btn {
  pointer-events: auto;
  background: rgba(13, 17, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 18px;
  transition: transform 0.1s, background 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.2);
}

/* Wave Announcement Banner */
#waveBanner {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 20;
}

#waveBanner.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.wave-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(59, 130, 246, 0.5);
}

.wave-subtitle {
  font-size: 14px;
  color: #94a3b8;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ==========================================
   TOUCH CONTROLS (MOBILE VIRTUAL JOYSTICKS)
   ========================================== */
#touchControls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  display: none; /* Auto-enabled on touch */
}

.joystick-zone {
  position: absolute;
  bottom: 20px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
}

#leftJoystickZone {
  left: 20px;
}

#rightJoystickZone {
  right: 20px;
}

.joystick-base {
  position: absolute;
  width: 140px;
  height: 140px;
  top: 10px;
  left: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
}

.joystick-knob {
  position: absolute;
  width: 54px;
  height: 54px;
  top: 53px;
  left: 53px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translate(0px, 0px);
}

#specialBtn {
  position: absolute;
  bottom: 180px;
  right: 40px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #64748b;
  font-weight: 800;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.2s;
}

#specialBtn.ready {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
  animation: buttonPulse 1.2s infinite alternate;
}

@keyframes buttonPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ==========================================
   MODAL OVERLAYS & MENUS
   ========================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 10, 16, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.menu-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 36px 40px;
  width: 90%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  animation: modalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.menu-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.menu-subtitle {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 28px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Stats Grid inside modals */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.25);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box {
  text-align: center;
}

.stat-val {
  font-size: 22px;
  font-weight: 800;
  color: #38bdf8;
  font-family: monospace;
}

.stat-lbl {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Toggle rows in settings */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-label {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch.on {
  background: #2563eb;
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch.on .toggle-knob {
  transform: translateX(22px);
}
