@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

* {
  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: #020208;
  font-family: 'Orbitron', monospace, sans-serif;
  color: #00ffff;
}

/* Canvas background */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* CRT Scanline Overlay */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  z-index: 10;
  opacity: 0.6;
}

.vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.9);
  z-index: 11;
}

/* HUD Overlay */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 30px;
}

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

.hud-panel {
  background: rgba(4, 16, 32, 0.65);
  border: 1px solid #00ffff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4), inset 0 0 10px rgba(0, 255, 255, 0.2);
  padding: 12px 20px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

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

.hud-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: #ff0077;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 8px #ff0077;
}

.hud-value {
  font-size: 28px;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 12px #00ffff;
}

.hud-multiplier {
  font-size: 16px;
  color: #ffe600;
  text-shadow: 0 0 10px #ffe600;
  margin-left: 8px;
}

/* Shield Bar */
.hud-shield-box {
  width: 280px;
}

.shield-bar-outer {
  width: 100%;
  height: 16px;
  background: rgba(0, 20, 40, 0.8);
  border: 1px solid #00ffff;
  border-radius: 2px;
  margin-top: 6px;
  padding: 2px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.shield-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #0088ff, #00ffff);
  box-shadow: 0 0 12px #00ffff;
  transition: width 0.2s ease-out, background 0.3s ease;
}

.shield-bar-inner.low {
  background: linear-gradient(90deg, #ff0044, #ff0077);
  box-shadow: 0 0 12px #ff0044;
}

/* Level Cleared Announcement Banner */
.level-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 28;
  opacity: 1;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.level-banner.hidden {
  opacity: 0;
  transform: translate(-50%, -60%) scale(0.8);
}

#level-banner-title {
  font-size: 54px;
  font-weight: 900;
  color: #ffe600;
  text-shadow: 0 0 30px #ffe600, 0 0 60px #ff0077;
  letter-spacing: 6px;
  text-transform: uppercase;
}

#level-banner-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  color: #00ffff;
  letter-spacing: 4px;
  text-shadow: 0 0 15px #00ffff;
  margin-top: 8px;
}

/* Boss Health Bar Overlay */
.boss-hud {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  max-width: 90%;
  background: rgba(4, 16, 32, 0.85);
  border: 2px solid #ff0077;
  box-shadow: 0 0 20px rgba(255, 0, 119, 0.6);
  padding: 10px 20px;
  border-radius: 6px;
  text-align: center;
  z-index: 22;
  transition: opacity 0.4s ease;
}

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

.boss-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #ff0077;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 0 0 10px #ff0077;
}

.boss-bar-outer {
  width: 100%;
  height: 16px;
  background: rgba(40, 0, 10, 0.9);
  border: 1px solid #ff0077;
  border-radius: 3px;
  padding: 2px;
}

.boss-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff0044, #ffe600);
  box-shadow: 0 0 15px #ff0044;
  transition: width 0.15s linear;
}

/* Crosshair Reticle */
#crosshair {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  pointer-events: none;
  z-index: 15;
}

#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: #00ffff;
  box-shadow: 0 0 8px #00ffff;
}

#crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

#crosshair::after {
  left: 50%;
  top: 0;
  height: 100%;
  width: 2px;
  transform: translateX(-50%);
}

.crosshair-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  border: 2px solid #ff0077;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px #ff0077;
}

/* Menus & Modals */
.menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 2, 12, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 30;
  opacity: 1;
  transition: opacity 0.4s ease;
}

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

.menu-card {
  background: rgba(6, 20, 40, 0.85);
  border: 2px solid #00ffff;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.5), inset 0 0 20px rgba(0, 255, 255, 0.2);
  padding: 28px 34px;
  border-radius: 8px;
  text-align: center;
  max-width: 540px;
  width: 92%;
  max-height: 94vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.menu-card-wide {
  max-width: 820px;
}

.menu-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

.leaderboard-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  background: rgba(0, 255, 255, 0.05);
  border: 1px dashed rgba(0, 255, 255, 0.4);
  padding: 14px 16px;
  border-radius: 4px;
  font-family: 'Share Tech Mono', monospace;
}

.leaderboard-box-gameover {
  max-width: 520px;
}

.leaderboard-header {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #ffe600;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.6);
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 230, 0, 0.3);
  text-align: center;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  font-size: 13px;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 6px;
  border-radius: 2px;
  color: #e0ffff;
}

.leaderboard-row.top-rank {
  color: #ffe600;
  text-shadow: 0 0 6px rgba(255, 230, 0, 0.5);
  font-weight: bold;
}

.leaderboard-row.highlight-new {
  background: rgba(255, 0, 119, 0.25);
  border: 1px solid #ff0077;
  color: #fff;
}

.leaderboard-rank {
  width: 32px;
  text-align: left;
  color: #ff0077;
  font-weight: bold;
}

.leaderboard-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 10px;
}

.leaderboard-score {
  text-align: right;
  color: #00ffff;
  font-weight: bold;
}

.highscore-entry-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  background: rgba(255, 0, 119, 0.12);
  border: 1px solid #ff0077;
  box-shadow: 0 0 15px rgba(255, 0, 119, 0.35);
  padding: 12px 16px;
  border-radius: 6px;
}

.highscore-entry-box.hidden {
  display: none;
}

.highscore-entry-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #ffe600;
  letter-spacing: 2px;
  text-shadow: 0 0 8px #ffe600;
}

.highscore-entry-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#highscore-name-input {
  flex: 1;
  background: rgba(2, 6, 16, 0.9);
  border: 1px solid #00ffff;
  color: #00ffff;
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 4px;
  outline: none;
  letter-spacing: 1.5px;
  box-shadow: inset 0 0 8px rgba(0, 255, 255, 0.25);
  user-select: text;
  -webkit-user-select: text;
}

#highscore-name-input:focus {
  border-color: #ffe600;
  box-shadow: 0 0 12px rgba(255, 230, 0, 0.5), inset 0 0 8px rgba(255, 230, 0, 0.25);
}

.btn-save-score {
  padding: 10px 20px;
  font-size: 14px;
}

.title-glow {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #00ffff;
  text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
  line-height: 1.2;
  text-transform: uppercase;
}

.subtitle-glow {
  font-size: 16px;
  color: #ff0077;
  text-shadow: 0 0 10px #ff0077;
  letter-spacing: 3px;
  font-family: 'Share Tech Mono', monospace;
}

.splash-credits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  padding-top: 14px;
  width: 100%;
  border-top: 1px solid rgba(0, 255, 255, 0.25);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: #a8f8ff;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  background: rgba(0, 255, 255, 0.05);
  border: 1px dashed rgba(0, 255, 255, 0.4);
  padding: 16px;
  border-radius: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #e0ffff;
}

.controls-row {
  display: flex;
  justify-content: space-between;
}

.key-badge {
  background: #ff0077;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: bold;
  box-shadow: 0 0 6px #ff0077;
}

/* Neon Buttons */
.btn-tron {
  background: transparent;
  border: 2px solid #00ffff;
  color: #00ffff;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4), inset 0 0 10px rgba(0, 255, 255, 0.1);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-tron:hover {
  background: #00ffff;
  color: #020208;
  box-shadow: 0 0 30px #00ffff, inset 0 0 15px #00ffff;
}

.btn-tron:active {
  transform: scale(0.96);
}

.btn-secondary {
  border-color: #ff0077;
  color: #ff0077;
  box-shadow: 0 0 15px rgba(255, 0, 119, 0.4);
}

.btn-secondary:hover {
  background: #ff0077;
  color: #fff;
  box-shadow: 0 0 30px #ff0077;
}

/* Audio Toggle Button */
#audio-toggle {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 25;
  padding: 8px 16px;
  font-size: 12px;
}

/* Mobile Controls */
#mobile-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  display: none;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 25;
  pointer-events: none;
}

.mobile-btn {
  pointer-events: auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.15);
  border: 2px solid #00ffff;
  color: #00ffff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

.mobile-btn:active {
  background: rgba(0, 255, 255, 0.5);
}

/* Loading Bar Rules */
.loading-bar-outer {
  width: 100%;
  height: 22px;
  background: rgba(0, 20, 40, 0.9);
  border: 2px solid #ffe600;
  border-radius: 4px;
  padding: 3px;
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.4);
}

.loading-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff0077, #ffe600, #00ffff);
  box-shadow: 0 0 15px #00ffff;
  transition: width 0.12s linear;
}

@media (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }
  .menu-split-grid {
    grid-template-columns: 1fr;
  }
  .hud-panel {
    padding: 8px 12px;
  }
  .hud-value {
    font-size: 20px;
  }
  .hud-shield-box {
    width: 180px;
  }
  .title-glow {
    font-size: 28px;
  }
  #level-banner-title {
    font-size: 32px;
  }
}
