* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background: linear-gradient(-45deg, #ffe6f0, #fce6b0, #cfe7f5, #e0f7ff);
  background-size: 400% 400%;
  animation: gradientBG 30s ease infinite;
  color: #333;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.3s, box-shadow 0.3s;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e94a87;
  animation: fadeIn 1s ease;
}

header .logo {
  height: 50px;
}

header button {
  background: linear-gradient(135deg, #fec057, #e94a87);
  color: #fff;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
}

header button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(233, 74, 135, 0.5);
}

footer {
  text-align: center;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.9rem;
  color: #ea4a88;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  text-align: center;
  overflow: hidden;
}

main h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #e94a87;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.themes-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}

.theme {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s, border 0.3s, background 0.3s, box-shadow 0.3s;
  border: 2px solid rgba(0, 0, 0, 0.1);
}

.theme:hover {
  transform: translateY(-6px) scale(1.1);
  border-color: #e94a87;
  background: rgba(233, 74, 135, 0.15);
  box-shadow: 0 6px 20px rgba(233, 74, 135, 0.3);
}

.theme img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.theme p {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

#stats {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: #fec057;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  perspective: 1000px;
  width: 100%;
  flex: 1;
  justify-items: center;
  align-items: center;
}

.card {
  width: 100%;
  padding-top: 100%;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.card::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #cfe7f5, #e94a87);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  backface-visibility: hidden;
  top: 0;
  left: 0;
}

.card img {
  position: absolute;
  width: 80%;
  height: 80%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotateY(180deg);
  backface-visibility: hidden;
  border-radius: 12px;
  object-fit: contain;
}

.card.flipped {
  transform: rotateY(180deg);
}

.card.matched {
  animation: bounce 0.6s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: scale(1) rotateY(180deg);
  }
  50% {
    transform: scale(1.1) rotateY(180deg);
  }
}

@keyframes pulseBtn {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@media (max-width: 768px) {
  .game-board {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
  }
  .card {
    width: 90%;
    padding-top: 90%;
  }
  header h1 {
    font-size: 1.3rem;
  }
  header button {
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
  }
}

@media (min-width: 768px) {
  .themes-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 900px;
  }

  .game-board {
    grid-template-columns: repeat(4, 1fr);
    max-width: 600px;
    margin: auto;
  }

  header h1 {
    font-size: 2rem;
  }
}

@media (min-width: 1200px) {
  .themes-container {
    grid-template-columns: repeat(6, 1fr);
    max-width: 1200px;
  }

  .game-board {
    grid-template-columns: repeat(4, 1fr);
    max-width: 800px;
  }
}

@media (min-width: 1024px) {
  .game-board {
    height: calc(100vh - 180px);
    display: grid;
    align-content: center;
    justify-content: center;
  }

  .game-board .card {
    width: calc((80vh - 200px) / 4);
    padding-top: calc((80vh - 200px) / 4);
    max-width: 150px;
  }
}
