main {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-image: url('../img/bg.jpg');
  background-size: cover;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 50px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.8);
  font-size: 1.2em;
  width: 100%;
  max-width: 800px;
  padding: 30px;
  margin: 0 0 30px;
  border-radius: 5px;
  flex-wrap: wrap;
  gap: 10px;
}

.difficulty-display {
  font-size: 0.8em;
  color: #666;
  padding: 5px 10px;
  background-color: rgba(238, 102, 92, 0.2);
  border-radius: 5px;
}

.buttons_section {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 110px;
}

.button_song {
  padding: 10px;
  background-color: #000; 
  border-radius: 35px;
  cursor: pointer;
}

.button_song:hover {
  transform: scale(1.1);
}

.fa-volume-xmark {
  color: #fff;
}

.fa-volume-high {
  color: #fff;
}

/* Grid padrão para nível Iniciante (10 pares = 20 cartas) */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Grid para nível Médio (15 pares = 30 cartas) */
.grid.medium {
  grid-template-columns: repeat(5, 1fr);
  max-width: 750px;
}

/* Grid para nível Difícil (20 pares = 40 cartas) */
.grid.hard {
  grid-template-columns: repeat(5, 1fr);
  max-width: 900px;
}

.card {
  aspect-ratio: 3/4;
  width: 100%;
  border-radius: 5px;
  position: relative;
  transition: all 400ms ease;
  transform-style: preserve-3d;
  background-color: #ccc;
  cursor: pointer;
}

.face {
  width: 100%;
  height: 100%;
  position: absolute;
  background-size: cover;
  background-position: center;
  border: 2px solid #39813a;
  border-radius: 5px;
  transition: all 400ms ease;
}

.front {
  transform: rotateY(180deg);
}

.back {
  background-image: url('../img/back.png');
  backface-visibility: hidden;
}

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

.disabled-card {
  filter: saturate(0);
  opacity: 0.5;
}

/* Responsividade para telas maiores */
@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 700px;
  }

  .grid.medium {
    grid-template-columns: repeat(6, 1fr);
    max-width: 850px;
  }

  .grid.hard {
    grid-template-columns: repeat(8, 1fr);
    max-width: 1000px;
  }

  header {
    max-width: 1000px;
  }
}

/* Ajustes para telas menores */
@media (max-width: 768px) {
  header {
    font-size: 0.9em;
    padding: 20px;
  }

  .difficulty-display {
    font-size: 0.7em;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

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

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