* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-container {
  width: 100%;
  height: 100%;
  background: url("assets/background.webp") no-repeat center center;
  background-size: cover;
  position: relative;
  overflow: hidden;
}

#score {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#lives {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 32px;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

#naty {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: min(20vh, 150px);
  transition: left 0.1s ease-out, transform 0.2s ease-out;
  max-height: 25%;
  width: auto;
}

#controls {
  position: fixed;
  bottom: 20px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  display: none;
}

#btnLeft,
#btnRight {
  background: none;
  border: none;
  cursor: pointer;
  width: 80px;
  height: 80px;
}

#btnLeft img,
#btnRight img {
  width: 100%;
  height: 100%;
}

#btnStart {
  position: fixed;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  background: none;
  border: none;
  cursor: pointer;
  width: 100px;
  height: 50px;
  box-shadow: 0 0 10px rgba(183, 253, 71, 0.5);
  animation: pulseStart 1.5s ease-in-out infinite;
}

#btnStart img {
  width: 100%;
  height: 100%;
}

.collect-effect {
  position: absolute;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
  text-align: center;
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.collect-effect .points {
  color: #4caf50;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.collect-effect .stars {
  font-size: 20px;
  animation: sparkle 1s linear infinite;
}

.miss-effect {
  position: absolute;
  color: #f44336;
  font-size: 24px;
  font-weight: bold;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px) scale(1.5);
    opacity: 0;
  }
}

.product {
  position: absolute;
  width: 50px;
  height: 70px;
  pointer-events: none;
  transition: transform 0.1s linear;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

#win-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

#win-screen h1 {
  color: #ffeb3b;
  text-align: center;
  font-size: 30px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-weight: bold;
}

#btnClickHere {
  color: #fff;
  font-weight: bold;
  padding: 15px 30px;
  font-size: 24px;
  background: #ffeb3b;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 0 10px rgba(183, 253, 71, 0.5);
}

#btnClickHere:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(183, 253, 71, 0.5);
}

#btnRestart {
  background: none;
  border: none;
  cursor: pointer;
  width: 100px;
  height: 50px;
}

#btnRestart img {
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.power-up {
  position: absolute;
  width: 40px;
  height: 40px;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float 1s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.7));
  z-index: 100;
}

.power-up-effect {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
  animation: powerUpShow 2s ease-out forwards;
  text-align: center;
  z-index: 1000;
}

.combo-effect {
  position: fixed;
  top: 40%;
  left: 50%;
  text-align: center;
  transform: translate(-50%, -50%);
  font-size: 30px;
  font-weight: bold;
  color: #ff4081;
  text-shadow: 0 0 15px rgba(255, 64, 129, 0.7);
  animation: comboShow 1s ease-out forwards;
  z-index: 1000;
}

@keyframes float {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-10px);
  }
}

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

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

.magnet-active {
  filter: drop-shadow(0 0 20px #4caf50);
}

.shield-active {
  filter: drop-shadow(0 0 20px #2196f3);
}

.double-active {
  filter: drop-shadow(0 0 20px #ff4081);
}

/* Estilos do Baú de Conquistas */
.collection-button {
  position: fixed;
  top: 20px;
  left: 20px;
  background: none;
  border: none;
  cursor: pointer;
  width: clamp(40px, 8vw, 60px);
  height: clamp(40px, 8vw, 60px);
  transition: transform 0.2s;
  z-index: 100;
}

.collection-button:hover {
  transform: scale(1.1);
}

.collection-button img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

#collection-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.collection-content {
  position: relative;
  width: min(95%, 800px);
  height: min(100vh, 400px);
  background: url("assets/bgcolecao.webp") no-repeat center center;
  background-size: contain;
  padding: clamp(80px, 4vw, 40px);
  border-radius: 20px;
  padding-top: 120px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#btnCloseCollection {
  position: absolute;
  top: clamp(10px, 2vw, 20px);
  right: clamp(10px, 2vw, 20px);
  background: none;
  border: none;
  cursor: pointer;
  width: clamp(30px, 6vw, 40px);
  height: clamp(30px, 6vw, 40px);
  transition: transform 0.2s;
}

#btnCloseCollection:hover {
  transform: scale(1.1);
}

#btnCloseCollection img {
  width: 100%;
  height: 100%;
}

.collection-content h2 {
  color: #fff;
  font-size: clamp(24px, 5vw, 32px);
  text-align: center;
  margin-bottom: clamp(15px, 3vw, 30px);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
  margin-top: auto;
  align-items: start;
  justify-items: center;
  width: 100%;
  height: 100%;
}

.collection-item {
  border-radius: 10px;
  padding: clamp(2px, 1vw, 5px);
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.collection-item:hover {
  transform: scale(1.05);
}

.collection-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin-bottom: 5px;
}

.collection-item .item-name {
  color: #fff;
  font-size: clamp(10px, 2vw, 12px);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  text-align: center;
  word-break: break-word;
}

#reward-message {
  padding: 15px;
  max-width: 400px;
  border-radius: 10px;
  text-align: center;
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(183, 253, 71, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(183, 253, 71, 0.8);
  }
}

/* Estilização da scrollbar do grid de coleção */
.collection-grid::-webkit-scrollbar {
  width: 8px;
}

.collection-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.collection-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.collection-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 480px) {
  .collection-content {
    padding-left: 30px;
    padding-right: 30px;
  }

  .collection-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 10px;
    width: 100%;
  }

  .collection-item {
    max-width: 100%;
  }

  #naty {
    height: min(100vh, 200px);
    bottom: 30px; /* Espaço para os botões de controle */
  }
}

@media (min-width: 481px) {
  .collection-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 769px) {
  .collection-grid {
    grid-width: 30%;
  }
}

/* Ajuste para telas muito baixas */
@media (max-height: 600px) {
  #naty {
    height: min(12vh, 100px);
    bottom: 70px;
  }
}

@keyframes pulseStart {
  0% {
    transform: translate(-50%, 50%) scale(1);
    filter: brightness(1);
  }
  50% {
    transform: translate(-50%, 50%) scale(1.1);
    filter: brightness(1.2);
  }
  100% {
    transform: translate(-50%, 50%) scale(1);
    filter: brightness(1);
  }
}

/* Estilos para o sistema de níveis */
.level-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 30px;
  border-radius: 15px;
  font-size: 24px;
  color: #333;
  font-weight: bold;
  text-align: center;
  animation: fadeInOut 2s ease-in-out;
  z-index: 1000;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.level-up-effect {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 215, 0, 0.9);
  padding: 20px;
  border-radius: 20px;
  text-align: center;
  animation: levelUp 3s ease-in-out;
  z-index: 1000;
}

.level-up-effect .stars {
  font-size: 40px;
  margin-bottom: 10px;
  animation: spin 3s linear infinite;
}

.level-up-effect div {
  font-size: 30px;
  color: #333;
  font-weight: bold;
  margin: 5px 0;
}

.level-up-effect .subtitle {
  font-size: 20px;
  color: #666;
}

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

@keyframes levelUp {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  10% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.flip-left {
  transform: translateX(-50%) scaleX(-1) !important;
}

.flip-right {
  transform: translateX(-50%) scaleX(1) !important;
}
