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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06090e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Space Grotesk", sans-serif;
  color: #e6edf3;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #090d14;
  cursor: crosshair;
}

/* FLASHBANG WHITEOUT OVERLAY */
.flash-whiteout {
  position: absolute;
  inset: 0;
  background: #ffffff;
  pointer-events: none;
  z-index: 35;
  opacity: 0;
  transition: opacity 0.05s ease;
}

.flash-whiteout.active {
  opacity: 1;
}

/* 2026 TACTICAL HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
  gap: 12px;
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-card {
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 16px rgba(56, 189, 248, 0.1);
  min-width: 150px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.hud-tag {
  font-size: 10px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.mag-status {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.mag-status.low {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  animation: pulseLow 0.5s infinite alternate;
}

@keyframes pulseLow {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.ammo-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.ammo-counter {
  font-size: 26px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

.ammo-max {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.ammo-pips-track {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  height: 8px;
}

.ammo-pip {
  flex: 1;
  background: #38bdf8;
  border-radius: 1px;
}

.ammo-pip.empty {
  background: rgba(255, 255, 255, 0.1);
}

.threat-pill {
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 20px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mission-pill {
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 20px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mission-num {
  font-size: 9px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 1.2px;
}

.mission-obj {
  font-size: 13px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.bomb-pill {
  background: rgba(239, 68, 68, 0.25);
  backdrop-filter: blur(12px);
  border: 1px solid #ef4444;
  border-radius: 20px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: pulseBomb 0.5s infinite alternate;
}

@keyframes pulseBomb {
  from { box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
  to { box-shadow: 0 0 16px rgba(239, 68, 68, 0.8); }
}

.bomb-label {
  font-size: 9px;
  font-weight: 800;
  color: #fca5a5;
  letter-spacing: 1px;
}

.bomb-val {
  font-size: 16px;
  font-weight: 900;
  color: #ff4d4d;
  font-family: monospace;
}

/* WARLORD VIKTOR BOSS HUD */
.boss-hud {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 520px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 16px rgba(239, 68, 68, 0.25);
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.boss-hud.hidden {
  display: none !important;
}

.boss-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.boss-tag {
  font-size: 9px;
  font-weight: 800;
  color: #ef4444;
  letter-spacing: 1.2px;
}

.boss-name {
  font-size: 13px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
}

.boss-phase {
  font-size: 10px;
  font-weight: 800;
  color: #fca5a5;
}

.boss-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  overflow: hidden;
}

.boss-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #dc2626, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  border-radius: 4px;
  transition: width 0.1s ease;
}

/* ACTION CONTEXT PROMPT */
.action-prompt {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid #38bdf8;
  border-radius: 12px;
  padding: 8px 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7), 0 0 14px rgba(56, 189, 248, 0.3);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  animation: promptFloat 1.2s infinite ease-in-out alternate;
}

.action-prompt.hidden {
  display: none !important;
}

@keyframes promptFloat {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(-4px); }
}

.prompt-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-key {
  background: #38bdf8;
  color: #06090e;
  font-weight: 900;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
}

.prompt-text {
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.8px;
}

.prompt-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.prompt-progress-fill {
  width: 0%;
  height: 100%;
  background: #38bdf8;
  transition: width 0.05s linear;
}

/* ARMORY UPGRADE TERMINAL */
.upgrade-card {
  max-width: 640px !important;
  width: 95% !important;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.upgrade-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  padding: 16px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
}

.upgrade-item:hover, .upgrade-item:focus-visible {
  border-color: #38bdf8;
  background: rgba(2, 132, 199, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
  outline: none;
}

.upgrade-item:active {
  transform: scale(0.97);
}

.upgrade-tag {
  font-size: 9px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.upgrade-name {
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
}

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

.pill-label {
  font-size: 9px;
  font-weight: 800;
  color: #f87171;
  letter-spacing: 1px;
}

.pill-val {
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

/* Armor Card */
.armor-card {
  min-width: 160px;
}

.armor-val {
  font-size: 11px;
  font-weight: 900;
  color: #38bdf8;
  font-family: monospace;
}

.armor-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 0 8px;
}

.armor-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
  border-radius: 3px;
  transition: width 0.1s ease;
}

.tactical-gear-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.gear-item {
  display: flex;
  flex-direction: column;
}

.gear-tag {
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
}

.gear-val {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  font-family: monospace;
}

/* OVERLAYS */
.overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(13, 17, 23, 0.94) 0%, rgba(3, 7, 18, 0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.menu-card {
  background: rgba(18, 24, 38, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 92%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.2);
  position: relative;
  overflow: hidden;
}

.menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #0284c7, transparent);
}

.tactical-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border-radius: 30px;
  margin-bottom: 12px;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.menu-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 4px;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
}

.menu-tagline {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #38bdf8;
  margin-bottom: 12px;
}

.menu-subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.controls-guide {
  background: rgba(10, 14, 22, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-around;
  gap: 16px;
  text-align: left;
}

.guide-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-item {
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  font-family: monospace;
}

.btn {
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 14px 28px;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #075985 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(2, 132, 199, 0.6);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  margin-top: 10px;
}

.pause-actions, .gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 24px;
}

.stat-box {
  background: rgba(10, 14, 22, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.8px;
}

.stat-val {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
  margin-top: 4px;
}

.stat-val.highlight {
  color: #38bdf8;
  font-size: 24px;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

/* 2026 TOUCH CONTROLS */
.touch-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}

@media (pointer: coarse), (max-width: 820px) {
  .touch-controls {
    display: flex;
  }
}

.touch-stick {
  width: 100px;
  height: 100px;
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 50%;
  position: relative;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.touch-knob {
  width: 44px;
  height: 44px;
  background: #0284c7;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

.touch-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-action-btn {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #ffffff;
  border-radius: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  width: 58px;
  height: 58px;
  transition: transform 0.08s ease;
}

.touch-action-btn:active {
  transform: scale(0.92);
}

.fire-btn {
  background: rgba(239, 68, 68, 0.35);
  border-color: rgba(239, 68, 68, 0.7);
  width: 66px;
  height: 66px;
  font-size: 13px;
}

.flash-btn {
  background: rgba(234, 179, 8, 0.25);
  border-color: rgba(234, 179, 8, 0.6);
  font-size: 11px;
}

.breach-btn {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
  font-size: 10px;
}

.reload-btn {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  font-size: 10px;
}

/* Pause decorative HUD motion with the round, without freezing overlay transitions. */
body:has(#pause-overlay:not(.hidden)) *,
body:has(#pause-overlay:not(.hidden)) *::before,
body:has(#pause-overlay:not(.hidden)) *::after {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
