@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap");

body {
  font-family: "Orbitron", sans-serif;
  background-color: #000;
  color: #0f0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

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

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

#background-canvas {
  z-index: 1;
}

#game-canvas {
  z-index: 3;
  cursor: crosshair;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud {
  display: flex;
  justify-content: space-between;
  font-size: 24px;
  text-shadow: 0 0 5px #0f0;
  padding: 20px;
}

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
  text-shadow: 0 0 5px #0f0;
  background: rgba(0, 20, 0, 0.9);
  border-top: 2px solid #0f0;
  padding: 15px 20px;
  box-sizing: border-box;
  z-index: 5;
}

.shop-button {
  border: 1px solid #0f0;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
  color: #0f0;
  font-family: inherit;
  font-size: 16px;
  border-radius: 6px;
  text-shadow: 0 0 5px #0f0;
}

.shop-button:hover {
  background: #0f0;
  color: #000;
  text-shadow: none;
}

.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  border: 1px solid #0f0;
  background: transparent;
  color: #0f0;
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.close-button:hover {
  background: #f00;
  color: #fff;
  border-color: #f00;
}

.continue-button {
  border: 1px solid #0f0;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
  color: #0f0;
  font-family: inherit;
  font-size: 16px;
  border-radius: 6px;
  margin-top: 20px;
}

.continue-button:hover {
  background: #0f0;
  color: #000;
}

#shop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 4;
  display: none;
  pointer-events: all;
}

#shop-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 20, 0, 0.95);
  border: 2px solid #0f0;
  padding: 30px;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  color: #0f0;
  box-shadow: 0 0 30px #0f0;
  pointer-events: all;
  width: 80vw;
  #max-width: 1200px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 10px;
}

#gun-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-height: 65vh;
  overflow-y: auto;
  padding: 20px;
  margin: 0 auto;
  box-sizing: border-box;
}

.gun-option {
  border: 2px solid #0f0;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(0, 255, 0, 0.1);
  color: #0f0;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 280px;
  justify-content: space-between;
  border-radius: 8px;
  flex: 0 0 auto;
  min-width: 280px;
  max-width: 320px;
  width: calc(25% - 20px);
  box-sizing: border-box;
}

.weapon-stats {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.8;
  line-height: 1.4;
}

.weapon-stats div {
  margin: 2px 0;
}

.gun-option img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: brightness(0) saturate(100%) invert(50%) sepia(100%) saturate(2000%)
    hue-rotate(120deg);
}

.gun-option.equipped img {
  filter: brightness(0) saturate(100%) invert(0%);
}

.gun-option.disabled img {
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%)
    hue-rotate(0deg);
}

.gun-option:hover {
  background: rgba(0, 255, 0, 0.2);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
  transform: scale(1.02);
}

.gun-option.disabled {
  color: #555;
  border-color: #555;
  cursor: not-allowed;
}

.gun-option.equipped {
  background: #0f0;
  color: #000;
  box-shadow: 0 0 10px #0f0;
}

#message-box {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  text-shadow: 0 0 10px #f00;
  color: #f00;
  z-index: 6;
  text-align: center;
}

/* Main Menu Styles */
#main-menu,
#guns-screen,
#high-scores-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #000011 0%, #001122 50%, #000033 100%);
  opacity: 0.95;
}

.menu-content {
  position: relative;
  text-align: center;
  max-width: 600px;
  padding: 40px;
  z-index: 11;
}

/* Override for guns screen to allow wider layout */
#guns-screen .menu-content {
  max-width: 95vw;
  width: 100%;
  padding: 20px;
}

.game-title h1 {
  font-size: 4rem;
  margin: 0;
  text-shadow: 0 0 20px #0f0, 0 0 40px #0f0;
  animation: glow 2s ease-in-out infinite alternate;
}

.game-title .subtitle {
  font-size: 1.5rem;
  margin: 10px 0 40px 0;
  opacity: 0.8;
  color: #aaf;
}

@keyframes glow {
  from {
    text-shadow: 0 0 20px #0f0, 0 0 40px #0f0;
  }
  to {
    text-shadow: 0 0 30px #0f0, 0 0 60px #0f0, 0 0 80px #0f0;
  }
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 40px 0;
}

.menu-btn {
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  font-weight: bold;
  padding: 15px 30px;
  border: 2px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  pointer-events: all;
}

.menu-btn.primary {
  color: #0f0;
  border-color: #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.menu-btn.primary:hover {
  background: #0f0;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  transform: scale(1.05);
}

.menu-btn.secondary {
  color: #aaf;
  border-color: #aaf;
  box-shadow: 0 0 10px rgba(170, 170, 255, 0.3);
}

.menu-btn.secondary:hover {
  background: #aaf;
  color: #000;
  box-shadow: 0 0 20px rgba(170, 170, 255, 0.8);
  transform: scale(1.05);
}

.menu-btn.danger {
  color: #f44;
  border-color: #f44;
  font-size: 1rem;
  padding: 10px 20px;
}

.menu-btn.danger:hover {
  background: #f44;
  color: #fff;
  transform: scale(1.05);
}

.menu-footer {
  margin-top: 60px;
  opacity: 0.6;
  font-size: 0.9rem;
}

/* Screen Headers */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  width: 100%;
}

.screen-header h2 {
  font-size: 2.5rem;
  margin: 0;
  text-shadow: 0 0 10px #aaf;
  flex: 1;
  text-align: center;
}

.back-btn {
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  color: #aaf;
  background: transparent;
  border: 2px solid #aaf;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
}

.back-btn:hover {
  background: #aaf;
  color: #000;
  transform: scale(1.05);
}

/* Guns Grid - Flowing Row Layout */
.guns-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: 20px;
  #width: 80%;
  max-height: 65vh;
  overflow-y: auto;
  padding: 20px;
  margin: 0 auto;
  box-sizing: border-box;
}

.gun-card {
  background: rgba(0, 255, 0, 0.1);
  border: 2px solid #0f0;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  flex: 0 0 auto;
  min-width: 280px;
  max-width: 320px;
  width: calc(25% - 20px);
  box-sizing: border-box;
  height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.gun-card:hover {
  background: rgba(0, 255, 0, 0.2);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
  transform: scale(1.02);
}

.gun-card.locked {
  opacity: 0.5;
  border-color: #555;
  background: rgba(85, 85, 85, 0.1);
}

.gun-card h3 {
  margin: 0 0 10px 0;
  font-size: 1.3rem;
  color: #0f0;
}

.gun-card .gun-type {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 15px;
}

.gun-card .gun-stats {
  font-size: 0.8rem;
  line-height: 1.6;
}

.gun-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 10px 0;
  filter: brightness(0) saturate(100%) invert(50%) sepia(100%) saturate(2000%)
    hue-rotate(120deg);
}

.gun-card.locked img {
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%);
}

/* High Scores */
.scores-list {
  background: rgba(0, 255, 0, 0.1);
  border: 2px solid #0f0;
  padding: 30px;
  margin: 20px 0;
  max-height: 50vh;
  overflow-y: auto;
}

.score-entry {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
  font-size: 1.2rem;
}

.score-entry:last-child {
  border-bottom: none;
}

.score-entry.highlight {
  background: rgba(0, 255, 0, 0.2);
  color: #fff;
  font-weight: bold;
}

.scores-footer {
  margin-top: 30px;
}

.no-scores {
  opacity: 0.7;
  font-style: italic;
  padding: 40px;
}

/* Pause Overlay */
#pause-overlay, #audio-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Reload Indicator */
#reload-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  pointer-events: none;
  animation: reloadPulse 0.5s ease-out;
}

.reload-content {
  text-align: center;
  background: rgba(255, 140, 0, 0.95);
  border: 3px solid #ff8c00;
  padding: 30px 50px;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(255, 140, 0, 0.7);
}

.reload-content h2 {
  font-size: 2.5rem;
  margin: 0 0 20px 0;
  text-shadow: 0 0 15px #ff8c00;
  color: #fff;
  font-weight: bold;
}

.reload-progress {
  width: 300px;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #ff8c00;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

#reload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff4500, #ff8c00, #ffff00);
  width: 0%;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.8);
}

@keyframes reloadPulse {
  0% { 
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% { 
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.pause-content {
  text-align: center;
  background: rgba(0, 20, 40, 0.95);
  border: 2px solid #0f0;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.pause-content h2 {
  font-size: 3rem;
  margin: 0 0 30px 0;
  text-shadow: 0 0 15px #0f0;
  color: #0f0;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.audio-controls {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.volume-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.volume-control label {
  min-width: 120px;
  text-align: left;
  font-size: 1rem;
  color: #0f0;
}

.volume-control input[type="range"] {
  flex: 1;
  height: 6px;
  background: #333;
  border: 1px solid #0f0;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: #0f0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #0f0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.volume-control span {
  min-width: 50px;
  text-align: right;
  font-size: 0.9rem;
  color: #0f0;
  text-shadow: 0 0 3px #0f0;
}

/* Responsive breakpoints for guns grid */
@media (max-width: 480px) {
  .guns-grid,
  #gun-options {
    width: 100%;
    gap: 15px;
    padding: 15px;
  }

  .gun-card,
  .gun-option {
    width: 100%;
    min-width: 260px;
    max-width: none;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .guns-grid,
  #gun-options {
    width: 100%;
    gap: 18px;
  }

  .gun-card,
  .gun-option {
    width: calc(50% - 18px);
    min-width: 280px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .guns-grid,
  #gun-options {
    width: 100%;
    gap: 20px;
  }

  .gun-card,
  .gun-option {
    width: calc(33.333% - 20px);
    min-width: 280px;
    max-width: 300px;
  }
}

@media (min-width: 1025px) and (max-width: 1400px) {
  .guns-grid,
  #gun-options {
    width: 100%;
    gap: 22px;
  }

  .gun-card,
  .gun-option {
    width: calc(25% - 22px);
    min-width: 280px;
    max-width: 320px;
  }
}

@media (min-width: 1401px) {
  .guns-grid,
  #gun-options {
    width: 100%;
    gap: 25px;
  }

  .gun-card,
  .gun-option {
    width: calc(20% - 25px);
    min-width: 280px;
    max-width: 350px;
  }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .menu-content {
    padding: 20px;
    max-width: 90vw;
  }

  #shop-modal {
    width: 95vw;
  }

  .game-title h1 {
    font-size: 3rem;
  }

  .menu-btn {
    font-size: 1.2rem;
    padding: 12px 25px;
  }

  .screen-header {
    flex-direction: column;
    gap: 15px;
  }

  .screen-header h2 {
    font-size: 2rem;
  }
}

/* Enhanced High Score Styles */
.score-entry {
  display: flex;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
  font-size: 1.1rem;
}

.score-entry.offline-score {
  opacity: 0.7;
  font-style: italic;
}

.score-rank {
  font-weight: bold;
  font-size: 1.3rem;
  width: 60px;
  flex-shrink: 0;
  color: #ff0;
  text-shadow: 0 0 5px #ff0;
}

.score-details {
  flex: 1;
  margin-left: 15px;
}

.score-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.score-name {
  font-weight: bold;
  color: #0ff;
  text-shadow: 0 0 3px #0ff;
}

.score-points {
  font-weight: bold;
  color: #0f0;
  text-shadow: 0 0 3px #0f0;
}

.score-sub {
  font-size: 0.9rem;
  opacity: 0.8;
  color: #ccc;
}

.scores-header {
  border-bottom: 2px solid rgba(0, 255, 0, 0.5);
  margin-bottom: 10px;
}

.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #ff0;
  animation: pulse 2s infinite;
}

/* Highscore submission modal styles */
#highscore-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.highscore-details {
  background: rgba(0, 255, 0, 0.1);
  border: 2px solid #0f0;
  padding: 20px;
  margin: 20px 0;
  border-radius: 10px;
}

.highscore-form {
  margin: 20px 0;
}

.highscore-form label {
  display: block;
  margin-bottom: 10px;
  color: #0ff;
  font-weight: bold;
}

.highscore-form input {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #0f0;
  color: #0f0;
  padding: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  border-radius: 5px;
  width: 100%;
  max-width: 300px;
}

.highscore-form input:focus {
  outline: none;
  border-color: #0ff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#submission-status {
  min-height: 20px;
  font-weight: bold;
}
