@import url('https://fonts.googleapis.com/css2?family=Fredoka&display=swap');

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

body {
  font-family: 'Fredoka', sans-serif;
  background-image: url("https://cdn.shopify.com/s/files/1/0615/8522/7975/files/Pet_Pwr_Petsecor.png?v=1752680902");
  background-color: #fce8c9;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 75%;
  background-attachment: fixed;
  color: #8a4d96;
  text-align: center;
  position: relative;
  z-index: 0;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255,255,255,0.8);
  z-index: -1;
}

#sidebar {
  padding: 10px;
}

#logo {
  margin-top: 0;
  margin-bottom: -38px;
}

#logo img {
  width: 90px;
  height: auto;
  margin-bottom: 0;
}

.header {
  margin-top: 40px;
}

.header h1 {
  text-align: center;
  font-size: 2.2em;
  font-weight: bold;
  color: #6d3685;
  margin-top: 40px;
}

.header h2 {
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  color: #6d3685;
  margin-top: 10px;
}

.controls {
  margin: 2rem auto;
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 1rem;
  color: #6d3685;
  margin-top: 20px;
  font-weight: bold;
}

.refresh {
  cursor: pointer;
  font-size: 1.2rem;
  color: #6d3685;
  transition: color 0.3s;
}
.refresh:hover {
  color: #a45ac5;
}

.game-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.deck {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 1;
  list-style: none; /* ✅ aggiungi qui */
  padding: 0;
  margin: 0;
}


.card {
  aspect-ratio: 1 / 1;
  width: 100%;
  perspective: 800px;
}
.front {
  background-color: #d1a7f3;
  background-image: url('https://files.catbox.moe/s3r0ao.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 90%; /* regola la grandezza */
}


.card-container {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
  border-radius: 12px;
}

.card-container.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.front {
  background-color: #d1a7f3;
}

.back {
  background-color: #fff;
  transform: rotateY(180deg);
}

.card-face.back img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.cant-click-this {
  pointer-events: none;
}

.wrong {
  animation: wrong 0.25s ease-in-out;
}

@keyframes wrong {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-15deg); }
  50% { transform: rotate(0); }
  75% { transform: rotate(15deg); }
}

.correct {
  animation: correct 0.3s ease-in-out;
}

@keyframes correct {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.popup {
  background: white;
  color: #8a4d96;
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  position: relative;
  font-family: 'Fredoka', sans-serif;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.popup .code {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 1rem;
  display: block;
}

.popup-text {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

#shopBtn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #d1a7f3;
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: bold;
  text-transform: uppercase;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  cursor: pointer;
  font-size: 1.2rem;
  color: #999;
}

/* 📱 Media Query per mobile */
@media (max-width: 600px) {
  .deck {
    max-width: 90vw;
    gap: 6px;
  }

  .controls {
    flex-direction: column;
    gap: 1rem;
  }

  .popup {
    width: 90%;
    padding: 1.5rem;
  }

  .popup-text {
    font-size: 0.9rem;
  }
}
