@import url("https://fonts.googleapis.com/css?family=Comfortaa");

/* ==========================================
   BASE STYLES
   ========================================== */
html,
body {
  margin: 0;
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: relative;
  font-family: "Comfortaa", cursive;
}

#container {
  background-color: #1a2a44;
  width: 100%;
  height: 100%;
  position: relative;
}

#container #game {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

/* ==========================================
   SCORE DISPLAY
   ========================================== */
#container #score {
  position: absolute;
  top: 20px;
  width: 100%;
  text-align: center;
  font-size: 10vh;
  font-weight: bold;
  transition: transform 0.5s ease, text-shadow 0.3s ease;
  color: #fff;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(255, 255, 255, 0.2);
  transform: translatey(-200px) scale(1);
  z-index: 10;
}

#container.playing #score,
#container.resetting #score {
  transform: translatey(0px) scale(1);
}

#container.ended #score {
  transform: translatey(4vh) scale(1.5);
  text-shadow:
    0 2px 20px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(255, 215, 0, 0.5);
}

/* ==========================================
   HIGH SCORE DISPLAY
   ========================================== */
#high-score {
  position: absolute;
  top: 25vh;
  width: 100%;
  text-align: center;
  font-size: 2.5vh;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 10;
}

#container.playing #high-score,
#container.ended #high-score {
  opacity: 1;
}

/* ==========================================
   COMBO DISPLAY
   ========================================== */
#combo-display {
  position: absolute;
  top: 20vh;
  width: 100%;
  text-align: center;
  font-size: 3vh;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
  z-index: 10;
}

#combo-display.combo-active {
  font-size: 4vh;
  font-weight: bold;
  color: #FFD700;
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.8),
    0 0 20px rgba(255, 215, 0, 0.5),
    0 0 30px rgba(255, 215, 0, 0.3);
  animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ==========================================
   INSTRUCTIONS
   ========================================== */
#container #instructions {
  position: absolute;
  width: 100%;
  top: 30vh;
  left: 0;
  text-align: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 2vh;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#container #instructions.hide {
  opacity: 0 !important;
  transform: translateY(-20px);
}

#container.playing #instructions {
  opacity: 1;
}

#container.ended #instructions {
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
}

/* ==========================================
   GAME OVER SCREEN
   ========================================== */
#container .game-over {
  position: absolute;
  top: 10vh;
  left: 0;
  width: 100%;
  height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

#container .game-over * {
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#container .game-over h2 {
  margin: 0;
  padding: 0;
  font-size: 50px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

#container .game-over p {
  font-size: 16px;
}

#container .game-over {
  visibility: hidden;
}

#container.ended .game-over {
  visibility: visible;
}

#container.ended .game-over * {
  opacity: 1;
  transform: translatey(0);
}

#container.ended .game-over p {
  transition-delay: 0.3s;
  opacity: 0.8;
}

/* ==========================================
   STATS CONTAINER
   ========================================== */
#stats-container {
  position: absolute;
  bottom: 20%;
  left: 0;
  width: 100%;
  text-align: center;
  display: none;
  z-index: 25;
}

#stats-container .stat-item {
  font-size: 2.5vh;
  color: rgba(255, 255, 255, 0.9);
  margin: 8px 0;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#stats-container .new-high-score {
  font-size: 4vh;
  font-weight: bold;
  color: #FFD700;
  margin-bottom: 15px;
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.8),
    0 0 20px rgba(255, 215, 0, 0.5);
  animation: glow 1s ease infinite;
}

@keyframes glow {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(255, 215, 0, 0.8),
      0 0 20px rgba(255, 215, 0, 0.5);
  }
  50% {
    text-shadow:
      0 0 20px rgba(255, 215, 0, 1),
      0 0 40px rgba(255, 215, 0, 0.8),
      0 0 60px rgba(255, 215, 0, 0.5);
  }
}

#container.ended #stats-container {
  display: block;
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: 0.5s;
  opacity: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   GAME READY SCREEN
   ========================================== */
#container .game-ready {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  z-index: 15;
}

#container .game-ready #start-button {
  transition: all 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  border: 3px solid #fff;
  border-radius: 50px;
  padding: 15px 40px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  backdrop-filter: blur(5px);
  color: #fff;
  font-size: 30px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow:
    0 5px 20px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(255, 255, 255, 0.1);
}

#container .game-ready #start-button:hover {
  transform: translatey(0) scale(1.05);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(255, 255, 255, 0.2);
}

#container.ready .game-ready #start-button {
  opacity: 1;
  transform: translatey(0);
}

/* ==========================================
   FLOATING TEXT (PERFECT, COMBO)
   ========================================== */
.floating-text {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 6vh;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 3px;
  pointer-events: none;
  z-index: 100;
  animation: floatUp 1s ease forwards;
  text-shadow:
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px currentColor,
    0 2px 10px rgba(0, 0, 0, 0.5);
}

.floating-text.fade-out {
  animation: fadeOut 0.5s ease forwards;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1.2);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(-30px) scale(1);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-60px) scale(0.8);
  }
}

/* ==========================================
   FLASH OVERLAY
   ========================================== */
.flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 50;
  animation: flash 0.2s ease forwards;
}

@keyframes flash {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
  }
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
  position: absolute;
  bottom: 10px;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  z-index: 5;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */
@media (max-width: 600px) {
  #container #score {
    font-size: 15vh;
  }

  .floating-text {
    font-size: 5vh;
  }

  #container .game-ready #start-button {
    font-size: 24px;
    padding: 12px 30px;
  }

  #container .game-over h2 {
    font-size: 40px;
  }
}

/* ==========================================
   SCREEN SHAKE ANIMATION
   ========================================== */
.screen-shake {
  animation: shake 0.1s ease;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* ==========================================
   BONUS GLOW EFFECT
   ========================================== */
.bonus-glow {
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.8),
    0 0 40px rgba(255, 215, 0, 0.5),
    0 0 60px rgba(255, 215, 0, 0.3);
}

/* ==========================================
   PERFECT STREAK INDICATOR
   ========================================== */
.streak-indicator {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
}

.streak-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.streak-dot.active {
  background: #FFD700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* ==========================================
   LOADING ANIMATION
   ========================================== */
.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ==========================================
   POWER-UP BUTTONS
   ========================================== */
#powerup-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#container.playing #powerup-container {
  opacity: 1;
}

.powerup-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.05) 100%);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.powerup-btn:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.powerup-btn:active {
  transform: scale(0.95);
}

.powerup-btn.powerup-used {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.4) 0%, rgba(0, 255, 255, 0.1) 100%);
  border-color: #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* Disabled state for bonus button */
.powerup-btn.powerup-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(100%);
  transform: scale(0.95);
}

.powerup-btn.powerup-disabled:hover {
  transform: scale(0.95);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

/* Available/Ready state for bonus button */
.powerup-btn.powerup-available {
  background: linear-gradient(135deg, rgba(0, 255, 0, 0.4) 0%, rgba(0, 255, 0, 0.1) 100%);
  border-color: #00ff00;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
  animation: bonusPulse 1.5s ease infinite;
}

@keyframes bonusPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.8), 0 0 40px rgba(0, 255, 0, 0.4);
  }
}

/* Charges counter badge */
.powerup-charges {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: white;
  font-size: 12px;
  font-weight: bold;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.powerup-btn.powerup-available .powerup-charges {
  background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
  animation: chargePulse 1s ease infinite;
}

@keyframes chargePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.powerup-icon {
  font-size: 24px;
  margin-bottom: 2px;
}

.powerup-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: bold;
}

/* ==========================================
   DAILY CHALLENGE
   ========================================== */
#daily-challenge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.2) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 10px 15px;
  z-index: 50;
  min-width: 120px;
  backdrop-filter: blur(5px);
}

.daily-title {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-align: center;
}

.daily-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.daily-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff88, #00ffcc);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.daily-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
}

.daily-complete {
  font-size: 12px;
  color: #00ff88;
  text-align: center;
  margin-top: 5px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* ==========================================
   EXTRA LIVES DISPLAY
   ========================================== */
#lives-display {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, rgba(255,0,0,0.3) 0%, rgba(255,0,0,0.1) 100%);
  border: 1px solid rgba(255, 100, 100, 0.4);
  border-radius: 10px;
  padding: 8px 15px;
  font-size: 16px;
  color: #fff;
  z-index: 50;
  backdrop-filter: blur(5px);
}

/* ==========================================
   MILESTONE CELEBRATION
   ========================================== */
.milestone-text {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8vh;
  font-weight: bold;
  color: #00FF00;
  text-shadow:
    0 0 20px rgba(0, 255, 0, 0.8),
    0 0 40px rgba(0, 255, 0, 0.5),
    0 0 60px rgba(0, 255, 0, 0.3);
  animation: milestonePopup 1.5s ease forwards;
  z-index: 100;
}

@keyframes milestonePopup {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.5);
  }
  30% {
    opacity: 1;
    transform: translateX(-50%) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1) translateY(-50px);
  }
}

/* ==========================================
   RESPONSIVE FOR POWER-UPS
   ========================================== */
@media (max-width: 400px) {
  #powerup-container {
    gap: 8px;
  }

  .powerup-btn {
    width: 55px;
    height: 55px;
  }

  .powerup-icon {
    font-size: 18px;
  }

  .powerup-label {
    font-size: 7px;
  }

  #daily-challenge {
    padding: 8px 10px;
    min-width: 100px;
  }

  .daily-title {
    font-size: 8px;
  }

  .daily-text {
    font-size: 9px;
  }
}
