@font-face {
  font-family: Orbitron;
  src: url(fonts/Orbitron.woff2);
  font-display: swap;
}

:root {
  --color-accent: #33ebee;
  --color-accent-glow: rgba(51, 235, 238, 0.5);
  --glass-border-strong: rgba(255, 255, 255, 0.5);
  --overlay-dark: rgba(0, 0, 0, 0.9);
  --main-fonts: #d9e0e6;
}

* {
  font-family: "Orbitron", monospace;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: clamp(16px, 2.5vw, 20px);
}

.toggle_display {
  visibility: hidden;
}

#title,
#level_title,
#target_color,
#main_game_button,
.game-message,
#button_text {
  font-weight: 900;
  opacity: 0.85;
  color: var(--main-fonts);
  letter-spacing: 1px;
}

body {
  background: radial-gradient(
      circle at 15% 15%,
      rgba(255, 0, 150, 0.1) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 85% 85%,
      rgba(0, 255, 255, 0.1) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 0, 0.05) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #0a0a0a 0%,
      #1a0a1a 25%,
      #0a1a1a 50%,
      #1a1a0a 75%,
      #0a0a0a 100%
    );
  background-size: 300% 300%, 300%, 200% 200%, 400% 400%;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 5rem;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
      2px 2px at 20% 30%,
      rgba(255, 255, 255, 0.9),
      transparent
    ),
    radial-gradient(3px 3px at 60% 15%, rgba(255, 255, 255, 0.95), transparent),
    radial-gradient(2px 2px at 80% 85%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(3px 3px at 10% 60%, rgba(200, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 70% 25%, rgba(255, 255, 255, 0.8), transparent);
  background-size: 200px 200px, 300px 300px, 150px 150px, 220px 220px,
    260px 260px;
  animation: sparkle 40s linear infinite;
  pointer-events: none;
  z-index: -1;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.5));
}

@keyframes sparkle {
  0% {
    opacity: 0.75;
    transform: scale(1);
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0.75;
    transform: scale(1.2);
  }
}

main {
  max-width: 800px;
  padding: 0 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
}

#title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  max-width: 550px;
  width: 100%;
}

#level_title {
  font-size: clamp(2.25rem, 5vw, 2.5rem);
}
#lives {
  padding-top: 0.4em;
  padding-left: 1em;
}
#lives img {
  width: 2.5em;
  margin-left: 0.5em;
  filter: drop-shadow(0 0 0 #d49191) drop-shadow(0 -2px 6px #ff0000);
}

#target_color {
  display: block;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  width: fit-content;
  margin: 0.3em auto;
  text-shadow: none;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3))
    drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
  color: rgb(255, 255, 255);
}

#main_game_button {
  width: clamp(340px, 90vw, 65%);
  height: clamp(300px, 20vw, 400px);
  border-radius: 20px;
  border: none;
  cursor: cell;
  padding: 1rem;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
  transition: transform 0.25s ease;
  margin-top: 0.6em;
}

#main_game_button:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1), inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

#button_text {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

/* Volume Slider Container */
#volume_slider_container {
  position: absolute;
  top: 116%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 10;
  opacity: 0.8;
  padding: 0.2rem 0.6rem;
  filter: drop-shadow(0 0 1px rgba(100, 100, 100, 0.3))
    drop-shadow(0 0 1px rgba(100, 100, 100, 0.5));
}
#volume_slider {
  width: 380px;
  background: transparent;
  outline: none;
  cursor: pointer;
}

#volume_display {
  display: block;
  filter: drop-shadow(0 0 3px var(--color-accent-glow));
  transition: all linear 0.25s;
}
#volume_display:hover {
  cursor: pointer;
}
#volume_slider::-webkit-slider-thumb {
  transform: scale(1.4);
  transition: all 0.25s ease;
}
#volume_slider::-webkit-slider-thumb:hover {
  transform: scale(1.6);
}

/* Game Message */
.game-message {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(3rem, 4vw, 5rem);
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  background: var(--overlay-dark);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
  border: 3px solid var(--glass-border-strong);
  z-index: 1000;
  animation: messageAppear 0.5s ease-out;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Game button color classes */
.game-color-0 {
  background-color: rgb(255, 0, 0) !important;
}
.game-color-1 {
  background-color: rgb(0, 0, 255) !important;
}
.game-color-2 {
  background-color: rgb(224, 101, 1) !important;
}
.game-color-3 {
  background-color: rgb(0, 128, 0) !important;
}
.game-color-4 {
  background-color: rgb(248, 245, 34) !important;
}
.game-color-5 {
  background-color: rgb(128, 0, 128) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  #volume_slider_container {
    display: none !important;
  }
  .game-message {
    width: 84%;
    margin-top: 1rem;
  }
}

#restart {
  position: absolute;
  top: 104%;
  left: 50%;
  transform: translateX(-50%);
  letter-spacing: 1px;
  font-weight: bold;
  padding: 0.5rem 0.75rem;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  border-radius: 8px;
  border: none;
  background-color: #616161ff;
  color: #ffffff;
  cursor: pointer;
  filter: drop-shadow(0 0 2px rgb(255, 255, 255));
  transition: transform 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  #main_game_button:hover {
    transform: scale(1.01);
  }
  #restart:hover {
    transform: translateX(-50%) scale(1.05);
  }
}
@media (max-width: 500px) {
  #main_game_button {
    width: 84vw;
    height: clamp(300px, 40vw, 400px);
  }
  #level_title {
    font-size: clamp(2rem, 6vw, 2rem);
    padding-top: 0.2em;
  }
  #lives img {
    width: 2rem;
    padding-top: 0.3em;
    margin-left: 0.4em;
  }
}
@media (max-width: 400px) {
  #main_game_button {
    height: clamp(250px, 40vw, 400px);
  }
  #level_title {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }
  #lives img {
    width: 1.66rem;
    padding-top: 0.1em;
    margin-left: 0.2em;
  }
}

/* Instructions Overlay */
#instructions_overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-out;
  letter-spacing: 1px;
}

#instructions_overlay.hidden {
  display: none;
}

#instructions_modal {
  background: var(--overlay-dark);
  border: 3px solid var(--glass-border-strong);
  border-radius: 20px;
  padding: 2rem 2rem;
  max-width: 500px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.4s ease-out;
}

#instructions_modal h2 {
  font-size: clamp(1rem, 5vw, 2.2rem);
  color: var(--color-accent);
  margin-bottom: 1rem;
  font-weight: 900;
}

#instructions_modal ul {
  list-style: none;
  padding: 0;
  margin-bottom: 1.2rem;
  text-align: left;
}

#instructions_modal li {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  color: var(--main-fonts);
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
}

#instructions_modal li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

#close_instructions {
  background-color: var(--color-accent);
  color: #000;
  border: none;
  padding: 0.8rem 2.5rem;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 900;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  filter: drop-shadow(0 0 10px var(--color-accent-glow));
}

#close_instructions:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 15px var(--color-accent-glow));
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
