:root {
  --neon-cyan: #00f0ff;
  --neon-pink: #ff0077;
  --neon-purple: #9d00ff;
  --neon-yellow: #ffe600;
  --neon-green: #00ff66;
  --neon-orange: #ff6600;
  --bg-dark: #030408;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: #020306;
  color: #eaf0ff;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 600px;
  max-height: 840px;
  background: #020308;
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.25), inset 0 0 40px rgba(0, 240, 255, 0.05);
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.35);
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #03040c;
  cursor: crosshair;
  touch-action: none;
}

/* UI Overlays */
.ui-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
  pointer-events: auto;
}

.ui-screen.hidden {
  display: none !important;
}

/* HUD Overlay */
#hud {
  pointer-events: none;
  padding: 16px 18px;
  justify-content: space-between;
  z-index: 10;
}

#hud button, #hud .icon-btn, #hud .bomb-btn {
  pointer-events: auto;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.hud-stat-group {
  width: 135px;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  color: #7d90b8;
  margin-bottom: 2px;
  letter-spacing: 1px;
}

.bar-container {
  height: 8px;
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.15s ease-out;
}

.health-fill {
  background: linear-gradient(90deg, #ff1a4a, #ff6b3d);
  box-shadow: 0 0 10px rgba(255, 40, 80, 0.8);
}

.shield-fill {
  background: linear-gradient(90deg, #00b0ff, #00f0ff);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
}

.hud-score-group {
  text-align: center;
  flex-grow: 1;
}

.score-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.7);
}

.combo-tag {
  display: inline-block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.8);
  animation: pulse 0.7s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.75; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.05); }
}

.hud-system-group {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(15, 22, 45, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--neon-cyan);
}

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

/* Boss HUD */
.boss-hud {
  position: absolute;
  top: 72px;
  left: 20px;
  right: 20px;
  text-align: center;
}

.boss-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
}

.boss-warning-tag {
  color: #ff2a55;
  letter-spacing: 1px;
  animation: blink 0.5s infinite alternate;
}

@keyframes blink {
  from { opacity: 1; }
  to { opacity: 0.25; }
}

.boss-name {
  color: #ffb703;
  letter-spacing: 1px;
}

.boss-bar-container {
  height: 10px;
  background: rgba(20, 10, 15, 0.9);
  border-color: rgba(255, 50, 80, 0.6);
  border-radius: 5px;
}

.boss-fill {
  background: linear-gradient(90deg, #ff0055, #ff6600, #ffdd00);
  box-shadow: 0 0 12px rgba(255, 50, 80, 0.9);
}

/* Wave Banner */
.wave-banner {
  position: absolute;
  top: 38%;
  left: 0;
  right: 0;
  text-align: center;
  transform: translateY(-50%);
  pointer-events: none;
  animation: bannerFade 2.6s forwards ease-out;
  z-index: 15;
}

.wave-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 25px rgba(0, 240, 255, 0.9);
}

.wave-subtitle {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--neon-yellow);
  margin-top: 6px;
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(255, 230, 0, 0.8);
}

@keyframes bannerFade {
  0% { opacity: 0; transform: translateY(-50%) scale(0.85); }
  15% { opacity: 1; transform: translateY(-50%) scale(1.04); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-50%) scale(1.15); }
}

/* Bottom HUD */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.hud-weapon-status {
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 8px;
  padding: 6px 12px;
  backdrop-filter: blur(4px);
}

.weapon-badge {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--neon-cyan);
}

.sub-badge {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--neon-yellow);
  margin-top: 2px;
}

.bomb-btn {
  background: linear-gradient(135deg, rgba(255, 0, 119, 0.9), rgba(157, 0, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  padding: 9px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: 0 0 16px rgba(255, 0, 119, 0.45);
  transition: transform 0.1s ease, filter 0.1s ease;
}

.bomb-btn:active {
  transform: scale(0.94);
  filter: brightness(1.2);
}

.bomb-count {
  background: #fff;
  color: #9d00ff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
}

/* Start Screen */
#start-screen {
  background: radial-gradient(circle at 50% 20%, rgba(24, 30, 68, 0.96) 0%, rgba(5, 7, 16, 0.99) 75%);
  padding: 20px 18px;
  justify-content: space-between;
  align-items: center;
  overflow-y: auto;
}

.title-container {
  text-align: center;
  margin-top: 4px;
}

.spark-line {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--neon-cyan);
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.game-logo {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.85);
}

.logo-accent {
  color: var(--neon-pink);
  text-shadow: 0 0 20px rgba(255, 0, 119, 0.85);
}

.subtitle {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: #8da2c7;
  margin-top: 4px;
}

.ship-selection-section {
  width: 100%;
  max-width: 480px;
  margin: 6px 0;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  text-align: center;
  margin-bottom: 8px;
}

.ship-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ship-card {
  display: flex;
  align-items: center;
  background: rgba(16, 22, 45, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ship-card:hover {
  border-color: rgba(0, 240, 255, 0.7);
  background: rgba(22, 34, 70, 0.9);
}

.ship-card.selected {
  background: rgba(20, 38, 80, 0.98);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.5);
}

.ship-preview-box {
  width: 76px;
  height: 64px;
  background: rgba(6, 10, 25, 0.85);
  border-radius: 6px;
  margin-right: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ship-preview-box canvas {
  width: 76px;
  height: 64px;
}

.ship-info {
  flex-grow: 1;
}

.ship-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.ship-desc {
  font-size: 11px;
  color: #9eb2d6;
  margin: 2px 0 3px;
  line-height: 1.2;
}

.ship-stats {
  display: flex;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--neon-yellow);
}

.high-score-board {
  display: flex;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 11px;
  color: #cbd8f3;
  margin: 4px 0;
}

.controls-guide {
  text-align: center;
  font-size: 11px;
  color: #8da2c7;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.key {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-display);
  font-size: 9px;
  color: #fff;
}

.btn-primary {
  width: 100%;
  max-width: 320px;
  padding: 13px 24px;
  background: linear-gradient(135deg, #00f0ff, #0088ff);
  color: #030a1c;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.5px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.55);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

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

.btn-secondary {
  width: 100%;
  max-width: 320px;
  padding: 11px 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #cbd8f3;
  font-family: var(--font-display);
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
}

.modal {
  background: rgba(3, 5, 14, 0.88);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}

.modal-card {
  background: rgba(14, 20, 42, 0.96);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 14px;
  padding: 24px 22px;
  text-align: center;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.25);
}

.modal-card h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 4px;
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.7);
}

.modal-card p {
  color: #8da2c7;
  font-size: 13px;
  margin-bottom: 14px;
}

.volume-control-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.slider-row input[type=\"range\"] {
  flex-grow: 1;
  accent-color: var(--neon-cyan);
  cursor: pointer;
  touch-action: auto;
}

.slider-row span {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--neon-cyan);
  min-width: 36px;
  text-align: right;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.gameover-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  color: #ff1a4a;
  letter-spacing: 2px;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(255, 26, 74, 0.8);
}

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

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 8px;
}

.stat-title {
  display: block;
  font-size: 10px;
  color: #8da2c7;
  letter-spacing: 1px;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.high-record-badge {
  background: rgba(255, 230, 0, 0.15);
  border: 1px solid var(--neon-yellow);
  color: var(--neon-yellow);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
}
