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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}

body {
  background: linear-gradient(-45deg, #111, #222, #000, #333);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@keyframes gradientBG {
  0% {background-position:0% 50%}
  50% {background-position:100% 50%}
  100% {background-position:0% 50%}
}

header {
  padding: 1rem 2rem;
  text-align: center;
}

.header-container img {
  width: 60px;
  height: 60px;
  margin-right: 10px;
  border: 1px solid #fff;
  border-radius: 10px;
  transition: transform 0.3s ease;
}

.header-container img:hover {
  transform: scale(1.1) rotate(5deg);
}

header span {
  font-size: 1.5rem;
  font-weight: bold;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.game-container {
  max-width: 900px;
  width: 100%;
  text-align: center;
}

.game-container h2 {
  margin-bottom: 0.5rem;
}

.instructions {
  margin-bottom: 1.5rem;
  color: #ccc;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.card {
  width: 100%;
  padding-top: 100%;
  position: relative;
  perspective: 1000px;
}

.card-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
  border-radius: 15px;
  box-shadow: 5px 5px 15px rgba(0,0,0,0.7), -5px -5px 15px rgba(255,255,255,0.05);
}

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

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  backface-visibility: hidden;
}

.card-front {
  background: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  color: #fff;
}

.card-back {
  background: #3498db;
  transform: rotateY(180deg);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  color: #fff;
}

.card-inner.matched {
  animation: matchGlow 0.5s ease-in-out infinite alternate;
}

@keyframes matchGlow {
  0% { box-shadow: 0 0 10px #fff, 0 0 20px #3498db; }
  100% { box-shadow: 0 0 20px #fff, 0 0 40px #3498db; }
}

.reset-btn {
  margin-top: 1.5rem;
  padding: 0.5rem 1.5rem;
  background: #111;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  background: #fff;
  color: #000;
  transform: translateY(-2px);
}

footer {
  background: rgba(0,0,0,0.7);
  padding: 1rem 2rem;
  text-align: center;
  backdrop-filter: blur(8px);
}
