@import url("https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&display=swap");

:root {
   --gameBodyColor: #d9d9d9;
   --elementBgColor: #ad9d8e;
   --titleColor: #8e8073;
   --elementFontColor: #EEE4DA;
   --borderRadius: 15px;
   --fontsizeTwoDigit: 35px;
   --fontsizeThreeDigit: 30px;
   --fontsizeFourDigit: 25px;
}
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  font-family: "League Spartan", sans-serif;
}
html, body {
   overscroll-behavior: none;
   overscroll-behavior-y: none;
}
body {
   background-color: #faf8f0;
}
.game-body {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 530px;
  background-color: var(--gameBodyColor);
  border-radius: var(--borderRadius);
  padding: 13px;
}
.game-body .game-header {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  place-items: center;
  gap: 10px;
  margin: 5px auto 13px auto;
}
.game-body .game-header > div {
  width: 175px;
  height: 50px;
  background-color: var(--elementBgColor);
  border-radius: var(--borderRadius);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--elementFontColor);
  font-weight: 600;
  font-size: 20px;
}
.game-body .game-header div.title {
  font-size: 60px;
  font-weight: 800;
  color: var(--titleColor);
  background-color: transparent;
  padding-top: 10px;
}
.game-body .game-header div#new-game {
  background-color: var(--titleColor);
  color: var(--elementFontColor);
  cursor: pointer;
}
.game-body .game-header div.score-container {
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
}
.game-body .game-grid {
  width: 374px;
  height: 374px;
  background-color: var(--elementBgColor);
  border-radius: var(--borderRadius);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  padding: 10px;
  position: relative;
}
.game-body .game-grid .grid-items {
  width: 81px;
  height: 81px;
  border-radius: calc(var(--borderRadius) - 3px);
  background-color: rgba(238, 228, 218, 0.4);
}
.game-body .game-grid .tile-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}
.game-body .game-grid .tile-layer .tile {
  position: absolute;
  top: 0;
  left: 0;
  width: 81px;
  height: 81px;
  line-height: 85px;
  text-align: center;
  font-size: 38px;
  font-weight: 700;
  color: #f9f6f2;
  border-radius: calc(var(--borderRadius) - 3px);
  box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.7);
  transition: all 0.2s ease-in-out;
  -webkit-transition: all 0.2s ease-in-out;
  -moz-transition: all 0.2s ease-in-out;
}
.game-body .game-grid .tile-layer .tile.new-tile {
  animation: tile-fade-in 0.2s ease-in-out;
}
.game-body .game-grid .tile-layer .tile.merged {
  animation: tile-bounce 0.2s ease-in-out;
}
.game-body .game-grid .tile-layer [data-tile-value="2"] {
  background-color: #eee4da;
  color: #776e65;
}
.game-body .game-grid .tile-layer [data-tile-value="4"] {
  background-color: #ede0c8;
  color: #776e65;
}
.game-body .game-grid .tile-layer [data-tile-value="8"] {
  background-color: #f2b179;
  color: #f9f6f2;
}
.game-body .game-grid .tile-layer [data-tile-value="16"] {
  background-color: #f59563;
  font-size: var(--fontsizeTwoDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="32"] {
  background-color: #f67c5f;
  font-size: var(--fontsizeTwoDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="64"] {
  background-color: #f65e3b;
  font-size: var(--fontsizeTwoDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="128"] {
  background-color: #edcf72;
  font-size: var(--fontsizeThreeDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="256"] {
  background-color: #edcc61;
  font-size: var(--fontsizeThreeDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="512"] {
  background-color: #edc850;
  font-size: var(--fontsizeThreeDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="1024"] {
  background-color: #edc53f;
  font-size: var(--fontsizeFourDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="2048"] {
  background-color: #edc22e;
  font-size: var(--fontsizeFourDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="4096"] {
  background-color: #3c3a32;
  font-size: var(--fontsizeFourDigit);
}
.game-body .game-grid .tile-layer [data-tile-value="8192"] {
  background-color: #1a1a1a;
  font-size: var(--fontsizeFourDigit);
}

@keyframes tile-fade-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes tile-bounce {
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

/* small device */

@media (max-width: 360px) {
   .game-body {
      transform: translate(-50%, -50%) scale(0.8);
   }
}

@media (max-width: 480px) {
   .game-body {
      transform: translate(-50%, -50%) scale(0.9);
      background-color: transparent;
   }
   .game-body .game-header div.title {
      background-color: var(--elementBgColor);
      color: var(--elementFontColor);
      font-size: 40px;
   }
}

/* folding device */
@media (min-width: 700px) and (max-height: 512px) {
   .game-body {
      transform: translate(-50%, -50%) scale(0.9);
   }
}

/* tablets */
@media (min-width: 768px) and (max-width: 1024px) {
  /* for both portrait and landscape */
  .game-body {
      transform: translate(-50%, -50%) scale(1.5);
   }
}

@media (min-width: 768px) and (orientation: landscape) {
  /* for landscape */
  .game-body {
      transform: translate(-50%, -50%) scale(1.3);
   }
}

/* laptop */
@media (min-width: 1024px) {
   .game-body {
      transform: translate(-50%, -50%) scale(1);
   }
}

/*# sourceMappingURL=style.css.map */
