html {
  background: url(https://www.marouze.com/GAMES/2048/2048_bg_1920x1080-min.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

@font-face {
  font-family: 'SynnovaRegular';
  src: url('https://www.marouze.com/GAMES/2048/2synnova-regular-webfont.woff2') format('woff2');
}

body, html {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: 'SynnovaRegular', sans-serif; /* Utilisez la police personnalisée pour le corps du document */
}

#game-container {
  display: grid;
  grid-template-columns: repeat(4, 120px);
  grid-template-rows: repeat(4, 120px);
  gap: 10px;
  margin: 0 auto;
  background-color: #8e92b1; /* Marron clair */
  width: 514px; /* Largeur de 510px */
  border: 20px solid #8e92b1; /* Bordure de couleur Marron clair */
  border-radius: 10px; /* Bords arrondis */
}

.tile {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  font-family: 'SynnovaRegular', sans-serif;
}

.value-2 {
  background-color: #FFEB3B; /* Jaune */
}

.value-4 {
  background-color: #FFD54F; /* Jaune clair */
}

.value-8 {
  background-color: #FFC107; /* Jaune orangé */
}

.value-16 {
  background-color: #FFA000; /* Orangé */
}

.value-32 {
  background-color: #FF8F00; /* Orangé foncé */
}

.value-64 {
  background-color: #FF6F00; /* Orangé profond */
}

.value-128 {
  background-color: #FF5722; /* Rouge orangé */
}

.value-256 {
  background-color: #F44336; /* Rouge */
}

.value-512 {
  background-color: #D32F2F; /* Rouge foncé */
}

.value-1024 {
  background-color: #B71C1C; /* Rouge profond */
}

.value-2048 {
  background-color: #8B0000; /* Rouge intense */
}

.tile:empty {
  background-color: #c7c9d8; /* Gris pour les cases vides */
}


header {
  text-align: center;
  margin-bottom: 20px;
}

h1 {
  font-size: 36px;
  color: #fff;
  margin: 0;
  font-family: 'SynnovaRegular', sans-serif;
}


@media (max-width: 780px) {
  #game-container {
    width: 320px;
    grid-template-columns: repeat(4, 1fr); /* Utilisez une fraction égale pour les colonnes */
    grid-template-rows: repeat(4, 1fr); /* Utilisez une fraction égale pour les lignes sur mobile */
    gap: 10px; /* Ajustez la valeur en fonction de l'espace que vous souhaitez entre les lignes sur mobile */
  }

 .tile {
    width: calc((100vw - 100px) / 4); /* Ajustement pour mobile avec 4 colonnes et prise en compte des marges de 10px */
    height: calc((100vw - 100px) / 4); /* Ajustement pour mobile avec 4 colonnes et prise en compte des marges de 10px */
  }
}

@keyframes mergeAnimation {
  0% {
    transform: scale(1);
    background-color: inherit;
  }
  50% {
    transform: scale(1.2);
    background-color: #ffcc00; /* Highlight color during the animation (yellow here) */
  }
  100% {
    transform: scale(1);
    background-color: inherit;
  }
}

.tile-merge {
  animation: mergeAnimation 0.5s ease-in-out;
}

/* Add this style to restore the background color after the animation */
.tile-merge.restore-bg {
  animation: none;
  background-color: #ffcc00 !important;
  transition: background-color 0.5s ease-in-out;
}


#score-display {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  color: #fff;
  font-family: 'SynnovaRegular', sans-serif;
  margin: 0;
  background-color: #333;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: color 0.3s ease-in-out;
}

#game-over-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px;
  border: 2px solid #333;
  text-align: center;
  z-index: 2; /* Assure que le popup est au-dessus du reste du contenu */
}

#game-over-popup h2 {
  margin-bottom: 20px;
}

#game-over-popup button {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
}

.max-tile-container {
  width: 60px; /* Ajustez la taille de la tuile selon vos préférences */
  height: 60px; /* Ajustez la taille de la tuile selon vos préférences */
  margin: 10px auto; /* Ajustez la marge selon vos préférences */
}

.max-tile {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  font-family: 'SynnovaRegular', sans-serif;
}


.tile-appear {
  animation: appearAnimation 0.3s ease-in;
}

@keyframes appearAnimation {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}