/* styles.css */

/* Reset default browser styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body and HTML Styles */
body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Press Start 2P', cursive;
  background-color: #000;
  cursor: crosshair;
}

/* Arcade Background */
#arcade-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://images.unsplash.com/photo-1511882150382-421056c89033?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1171&q=80');
  background-size: cover;
  background-position: center;
  opacity: 0.5;
  animation: backgroundPulse 5s infinite alternate;
  filter: blur(2px);
}

@keyframes backgroundPulse {
  0% { opacity: 0.3; }
  100% { opacity: 0.7; }
}

/* Game Screen */
#game-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vmin;
  height: 60vmin;
  background-color: rgba(0, 0, 0, 0.8);
  border: 5px solid #fff;
  box-shadow: 0 0 20px #0ff, 0 0 40px #f0f, 0 0 60px #ff0;
  overflow: hidden;
  z-index: 10;
}

#game-title {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 4vmin;
  color: #fff;
  text-shadow: 2px 2px #ff00ff, -2px -2px #00ffff;
  white-space: nowrap;
}

/* Preloader Styles */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#preloader video {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: cover;
}

/* Trippy Visual Effects */
.game-character, .boss-character {
  position: absolute;
  font-size: 8vmin;
  animation: flyUpAndFall var(--animation-duration) forwards, trippyEffect 2s infinite;
}

@keyframes trippyEffect {
  0% {
    filter: hue-rotate(0deg);
    transform: scale(1) rotate(0deg);
  }
  50% {
    filter: hue-rotate(180deg);
    transform: scale(1.2) rotate(180deg);
  }
  100% {
    filter: hue-rotate(360deg);
    transform: scale(1) rotate(360deg);
  }
}

@keyframes flyUpAndFall {
  0% {
    bottom: 0%;
    animation-timing-function: ease-out;
  }
  50% {
    bottom: 70%;
    animation-timing-function: ease-in;
  }
  100% {
    bottom: 0%;
  }
}

/* Boss Character */
.boss-character {
  font-size: 8vmin;
  animation: bossEntrance 5s forwards, trippyEffect 2s infinite;
  position: absolute;
  top: -20%;
}

@keyframes bossEntrance {
  0% { top: -20%; }
  100% { top: 20%; }
}

/* Fade-out animation for when a character is shot */
.fade-out {
  animation: fadeOut 0.5s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.5);
  }
}

/* Damage overlay */
#damage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 20;
}

/* Extra Life Character */
.extra-life-character {
  position: absolute;
  font-size: 6vmin;
  top: 20%;
  animation: rainbowColors 2s linear infinite;
}

/* Rainbow color shifting */
@keyframes rainbowColors {
  0% { color: red; }
  16% { color: orange; }
  33% { color: yellow; }
  50% { color: green; }
  66% { color: blue; }
  83% { color: indigo; }
  100% { color: violet; }
}

/* Scrolling text container */
#message-container {
  position: absolute;
  top: 25%;
  width: 100%;
  text-align: center;
  font-size: 3vmin;
  animation: rrainbowColors 0.2s linear infinite;
  pointer-events: none;
  z-index: 30;
}
@keyframes rrainbowColors {
  0% { color: #FF00FF; }
  16% { color: cyan; }
  33% { color: pink; }
  50% { color: lime; }
  66% { color: yellow; }
  83% { color: pink; }
  100% { color: violet; }
}

/* Scrolling text animation */
.scroll-text {
  display: inline-block;
  white-space: nowrap;
  animation: scrollLeft 5s linear forwards;
}

@keyframes scrollLeft {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(-100%);
  }
}

/* Name Input Container */
#name-input-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  padding: 2vmin;
  border: 2px solid #fff;
  display: none;
  z-index: 25;
  text-align: center;
}

#name-input-container input {
  padding: 1vmin;
  font-size: 2vmin;
  width: 80%;
  border: none;
  border-radius: 4px;
  margin-bottom: 1vmin;
}

#name-input-container button {
  padding: 1vmin 2vmin;
  font-size: 2vmin;
  background-color: #00ff00;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#name-input-container button:hover {
  background-color: #00cc00;
}

/* Leaderboard Container */
#leaderboard-container {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 2vmin;
  border: 2px solid #fff;
  display: none;
  z-index: 25;
  text-align: center;
}

#leaderboard-container h2 {
  margin-bottom: 1vmin;
  color: #fff;
}

#leaderboard-container ol {
  list-style: decimal inside;
  padding: 0;
  margin: 0;
  color: #fff;
  font-size: 2vmin;
}

#leaderboard-container ol li {
  margin: 0.5vmin 0;
}

#leaderboard-container button {
  margin-top: 1vmin;
  margin-right: 1vmin;
  padding: 1vmin 2vmin;
  font-size: 2vmin;
  background-color: #ffffff;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#leaderboard-container button:hover {
  background-color: #dddddd;
}

/* Start Button */
#start-button {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  padding: 2vmin 4vmin;
  font-size: 3vmin;
  background-color: #ff00ff;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  font-family: 'Press Start 2P', cursive;
  z-index: 15;
}

#start-button:hover {
  background-color: #00ffff;
  box-shadow: 0 0 20px #0ff;
}

/* Score Display */
#score {
  position: absolute;
  top: 2%;
  right: 2%;
  font-size: 2vmin;
  color: #fff;
  z-index: 15;
  text-shadow: 1px 1px #000;
}

/* Lives Display */
#lives {
  position: absolute;
  top: 2%;
  left: 2%;
  font-size: 2vmin;
  color: #fff;
  z-index: 15;
  text-shadow: 1px 1px #000;
}

/* Level Display */
#level {
  position: absolute;
  top: 6%;
  right: 2%;
  font-size: 2vmin;
  color: #fff;
  z-index: 15;
  text-shadow: 1px 1px #000;
}

/* High Scores Display */
#high-scores {
  position: absolute;
  bottom: 2%;
  left: 2%;
  font-size: 2vmin;
  color: #fff;
  z-index: 15;
  text-shadow: 1px 1px #000;
}

#leaderboard {
  list-style: none;
  padding: 0;
  margin: 0;
}

#leaderboard li {
  margin: 0.5vmin 0;
}

/* Hidden Class */
.hidden {
  display: none;
}

/* Killing Spree Container */
#killing-spree-container {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4vmin;
  color: #fff;
  text-align: center;
  z-index: 30;
  opacity: 0;
  transition: opacity 0.3s;
}

.killing-spree-active {
  opacity: 1;
  animation: rainbowText 1s linear infinite, pulseSize 0.5s ease-in-out infinite alternate;
}

@keyframes rainbowText {
  0% { color: red; }
  16% { color: orange; }
  33% { color: yellow; }
  50% { color: green; }
  66% { color: blue; }
  83% { color: indigo; }
  100% { color: violet; }
}

@keyframes pulseSize {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* Screen Shake Effect */
@keyframes screenShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 5px); }
  40% { transform: translate(5px, -5px); }
  60% { transform: translate(-5px, 5px); }
  80% { transform: translate(5px, -5px); }
  100% { transform: translate(0, 0); }
}

.screen-shake {
  animation: screenShake 0.3s;
}

/* Explosion Effect */
.explosion {
  position: absolute;
  width: 100vmin;
  height: 100vmin;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,255,0,1) 0%, rgba(255,0,0,0) 70%);
  animation: explosionAnimation 1s forwards;
  pointer-events: none;
  z-index: 50;
}

@keyframes explosionAnimation {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Adjusted for Hidden Game Screen */
#game-screen.hidden {
  display: none;
}
