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

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

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at center, #090d16 0%, #020617 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* TOP HUD */
#hud-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.status-badge {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #10b981;
  color: #10b981;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.status-badge.alert {
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
  animation: pulseAlert 0.4s infinite alternate;
}

@keyframes pulseAlert {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.hud-right {
  display: flex;
  gap: 12px;
}

.stat-badge {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.badge-tag {
  font-size: 8px;
  font-weight: 800;
  color: #94a3b8;
}

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

/* OVERLAYS */
.overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.94) 0%, rgba(2, 6, 23, 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;
}

.card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(16, 185, 129, 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(16, 185, 129, 0.2);
  position: relative;
  overflow: hidden;
}

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

.stealth-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #d1fae5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border-radius: 30px;
  margin-bottom: 12px;
}

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

.subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #10b981;
  margin-bottom: 12px;
}

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

.controls-guide {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(16, 185, 129, 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: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  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-start {
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 14px 28px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.4);
  transition: all 0.2s ease;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(5, 150, 105, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 24px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}

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

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

.stat-card {
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(16, 185, 129, 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: #10b981;
  letter-spacing: 0.8px;
}

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

.stat-val.highlight {
  color: #10b981;
  font-size: 24px;
}

/* TOUCH CONTROLS */
#touch-controls {
  position: absolute;
  bottom: 24px;
  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 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
}

.touch-mid {
  display: flex;
  gap: 20px;
}

.touch-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
}

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

.takedown-btn {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  width: 60px;
  height: 60px;
  font-size: 12px;
  font-weight: 900;
}

.hack-btn {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
  width: 60px;
  height: 60px;
  font-size: 12px;
  font-weight: 900;
}

.sprint-btn {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  width: 60px;
  height: 60px;
  font-size: 12px;
  font-weight: 900;
}

/* 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; }
}
