/* style.css - VATЯIS Vaporwave Style */

/* Fonte retrô pixelada */
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

/* ===============================
   ESTILO GERAL DO BODY
   =============================== */
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(
    circle at center,
    #ff00ff,
    #111
  ); /* Fundo com efeito néon degradê */
  overflow: hidden;
  font-family: "Press Start 2P", monospace;
  color: #fff;
  position: relative;
}

/* ===============================
   CANVAS DO JOGO
   =============================== */
#gameCanvas {
  display: block;
  margin: 0 auto;
  background: radial-gradient(
    circle at center,
    rgba(255, 0, 255, 0.1),
    rgba(0, 0, 0, 1)
  ); /* fundo translúcido com centro rosa */
  box-shadow: 0 0 30px #f0f; /* brilho néon rosa */
  border: 1px solid #0ff; /* borda azul neon */
  image-rendering: pixelated; /* mantém a estética pixelada */
  outline: none;
  transition: box-shadow 0.3s ease-in-out; /* transição suave */
}

/* Efeito de borda pulsante quando o foco é dado ao canvas */
#gameCanvas:focus {
  box-shadow: 0 0 20px #0ff, 0 0 40px #f0f, 0 0 60px #ff0;
}

/* ===============================
   HUD (score, logo, level, etc.)
   =============================== */
#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  pointer-events: none; /* evita clique acidental */
  font-family: "Press Start 2P", monospace; /* fonte pixelizada */
  color: #fff;
}

/* Logo com animação glitchada e efeito neon */
#logo {
  font-size: 30px;
  color: #ff66cc;
  text-shadow: 0 0 8px #ff00ff, 0 0 20px #ff00ff, 0 0 30px #ff66cc,
    0 0 40px #ff66cc;
  margin-bottom: 20px;
  letter-spacing: 2px;
  animation: neonGlow 1.5s infinite alternate, glitch 2s infinite; /* animação neon + glitch */
}

/* Estilo dos elementos HUD de pontuação, nível e linhas */
#score,
#level,
#lines {
  font-size: 18px;
  margin: 15px 0;
  color: #00ffff;
  text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #ff00ff;
  animation: neonGlow 1s infinite alternate, glitch 2s infinite;
}

/* Animação de brilho neon */
@keyframes neonGlow {
  0% {
    text-shadow: 0 0 8px #ff00ff, 0 0 20px #ff00ff, 0 0 40px #ff66cc;
  }
  100% {
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 0 80px #ff00ff;
  }
}

/* Animação de glitch */
@keyframes glitch {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  20% {
    transform: translateX(-5px);
    opacity: 0.8;
  }
  40% {
    transform: translateX(5px);
    opacity: 0.6;
  }
  60% {
    transform: translateX(-3px);
    opacity: 0.4;
  }
  80% {
    transform: translateX(3px);
    opacity: 0.2;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Transição suave para o HUD */
#hud div {
  transition: all 0.3s ease;
}

/* Efeito de background de fundo para a HUD */
#hud {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.8), 0 0 20px rgba(255, 0, 255, 0.6),
    0 0 30px rgba(255, 102, 204, 0.8);
}

/* Efeito de borda neon */
#hud {
  border: 2px solid #ff66cc;
  animation: borderGlow 1.5s infinite alternate;
}

@keyframes borderGlow {
  0% {
    border-color: #ff66cc;
  }
  100% {
    border-color: #00ffff;
  }
}

/* ===============================
   FUNDO COM EFEITO DE ESTRELAS
   =============================== */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("images/stars-pixelated.png");
  background-size: cover;
  background-repeat: repeat;
  opacity: 0.2;
  z-index: -1;
  animation: moveStars 60s linear infinite;
}

/* Animação sutil das estrelas */
@keyframes moveStars {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 1000px;
  }
}

/* ===============================
   EFEITO GLITCH NO CANVAS
   =============================== */
@keyframes glitch {
  0% {
    transform: skew(0deg);
  }
  20% {
    transform: skew(-5deg);
  }
  40% {
    transform: skew(5deg);
  }
  60% {
    transform: skew(-5deg);
  }
  80% {
    transform: skew(5deg);
  }
  100% {
    transform: skew(0deg);
  }
}

/* Ativa o efeito glitch quando um evento específico ocorre, como a mudança de nível ou a finalização do jogo */
#gameCanvas.glitch {
  animation: glitch 0.2s infinite; /* pequeno efeito de distorção */
}

/* ===============================
   TRANSIÇÃO DE PALETA: MODO NEON (dia/noite)
   =============================== */
@keyframes paletteTransition {
  0% {
    background: radial-gradient(circle at center, #ff00ff, #111);
  }
  50% {
    background: radial-gradient(circle at center, #ff66cc, #222);
  }
  100% {
    background: radial-gradient(circle at center, #ff00ff, #111);
  }
}

/* Aplica a transição de paleta em todo o fundo com uma animação suave */
body.neonMode {
  animation: paletteTransition 10s infinite alternate;
}

/* ===============================
   RESPONSIVIDADE (mínima)
   =============================== */
@media (max-width: 500px) {
  body {
    font-size: 10px;
  }

  #hud {
    top: 10px;
    left: 10px;
    transform: scale(0.85);
  }

  #logo {
    font-size: 16px;
  }

  #score,
  #level,
  #lines {
    font-size: 10px;
  }
}

#footer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10%;
  bottom: 10px;
  left: 10px;
  font-size: 12px;
  color: #fff;
  text-shadow: 0 0 5px #fff;
}

#footer a {
  color: #fff;
  text-decoration: none;
}

/* ===============================
   HUD DA PRÓXIMA PEÇA
   =============================== */
#nextPieceHud {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  pointer-events: none;
  font-family: "Press Start 2P", monospace;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.8), 0 0 20px rgba(255, 0, 255, 0.6),
    0 0 30px rgba(255, 102, 204, 0.8);
  border: 2px solid #ff66cc;
  animation: borderGlow 1.5s infinite alternate;
  text-align: center;
}

#nextPieceTitle {
  font-size: 16px;
  color: #00ffff;
  text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #ff00ff;
  animation: neonGlow 1s infinite alternate;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

#nextPieceCanvas {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #0ff;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  image-rendering: pixelated;
}

/* Responsividade para o HUD da próxima peça */
@media (max-width: 500px) {
  #nextPieceHud {
    top: 10px;
    right: 10px;
    transform: scale(0.85);
    padding: 15px;
  }

  #nextPieceTitle {
    font-size: 12px;
  }
}

/* Ajuste para telas muito pequenas */
@media (max-width: 400px) {
  #nextPieceHud {
    display: none; /* Esconde em telas muito pequenas */
  }
}
