:root {
  --primary-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --emp-violet: #a855f7;
  --gold: #fbbf24;
  --bg-space: #050814;
  --panel-bg: rgba(10, 18, 36, 0.88);
  --panel-border: rgba(16, 185, 129, 0.45);
  --font-main: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-space);
  color: #f8fafc;
  font-family: var(--font-main);
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #0d1b2a 0%, #030712 100%);
}

#gameCanvas {
  display: block;
  background-color: transparent;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.18);
  touch-action: none;
}

#hud-overlay {
  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;
}

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

.hud-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
}

.hud-val {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 10px var(--primary-emerald);
  font-family: 'Courier New', Courier, monospace;
}

.highscore-text {
  font-size: 16px;
  color: var(--gold);
}

.hud-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 165px;
}

.bar-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #10b981);
  transition: width 0.15s ease-out;
}

.shield-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 0.15s ease-out;
}

.emp-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7e22ce, #c084fc);
  transition: width 0.1s ease-out;
}

#combo-container {
  position: absolute;
  top: 78px;
  right: 20px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  transform: scale(0.9);
}

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

.combo-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
}

.combo-text {
  font-size: 11px;
  letter-spacing: 2px;
  color: #fde68a;
}

#touch-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 24px;
  pointer-events: none;
  z-index: 20;
}

.touch-btn-zone {
  display: flex;
  gap: 14px;
  pointer-events: auto;
}

.touch-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  border: 2px solid var(--primary-emerald);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  outline: none;
}

.touch-btn.shield {
  border-color: #38bdf8;
  color: #38bdf8;
}

.touch-btn.emp {
  border-color: #c084fc;
  color: #c084fc;
}

.touch-btn.shoot {
  border-color: var(--primary-emerald);
  color: var(--primary-emerald);
  width: 70px;
  height: 70px;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 7, 18, 0.86);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
}

.modal-overlay.hidden {
  display: none;
  pointer-events: none;
}

.card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 30px 36px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.25);
}

.game-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #10b981 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.gameover-title {
  background: linear-gradient(135deg, #ef4444 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-subtitle {
  font-size: 13px;
  letter-spacing: 2px;
  color: #94a3b8;
  margin-bottom: 22px;
}

.instructions {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 22px;
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  color: #cbd5e1;
}

.instructions ul {
  list-style: none;
}

.instructions li {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-badge {
  display: inline-block;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: bold;
  color: #34d399;
  font-family: monospace;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: #030712;
  font-weight: 800;
  font-size: 16px;
  padding: 14px 32px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.45);
}

.audio-toggle-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 6px;
}
