:root {
  --rosewater: #f4dbd6;
  --flamingo: #f0c6c6;
  --pink: #f5bde6;
  --mauve: #c6a0f6;
  --red: #ed8796;
  --maroon: #ee99a0;
  --peach: #f5a97f;
  --yellow: #eed49f;
  --green: #a6da95;
  --teal: #8bd5ca;
  --sky: #91d7e3;
  --sapphire: #7dc4e4;
  --blue: #8aadf4;
  --lavender: #b7bdf8;
  --text: #cad3f5;
  --subtext-1: #b8c0e0;
  --subtext-0: #a5adcb;
  --overlay-2: #939ab7;
  --overlay-1: #8087a2;
  --overlay-0: #6e738d;
  --surface-2: #5b6078;
  --surface-1: #494d64;
  --surface-0: #363a4f;
  --base: #24273a;
  --mantle: #1e2030;
  --crust: #181926;
}
* {
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  background-color: var(--crust);
  color: var(--text);
  visibility: hidden;
  opacity: 0;
  -webkit-transition: opacity 0.3s linear;
  -o-transition: opacity 0.3s linear;
  transition: opacity 0.3s linear;
}
.container {
  position: relative;
  padding-left: 15px;
  padding-right: 15px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  @media (min-width: 768px) {
    width: 750px;
  }
  @media (min-width: 992px) {
    width: 970px;
  }
}
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background-color: var(--base);
}
::-webkit-scrollbar-thumb {
  background-color: var(--text);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--subtext-0);
}
a {
  text-decoration: none;
}

.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: rgba(36, 39, 58, 0.9);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  .difficulty {
    margin-bottom: 40px;
    h2 {
      text-align: center;
      margin-bottom: 20px;
    }
    > div {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-pack: center;
          -ms-flex-pack: center;
              justify-content: center;
      -webkit-box-align: center;
          -ms-flex-align: center;
              align-items: center;
      position: relative;
      gap: 25px;
      a {
        color: var(--crust);
        width: 90px;
        height: 35px;
        border-radius: 8px;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: center;
            -ms-flex-pack: center;
                justify-content: center;
        -webkit-box-align: center;
            -ms-flex-align: center;
                align-items: center;
        font-size: 16px;
        opacity: 0.6;
        cursor: pointer;
      }
      .easy {
        background-color: var(--green);
      }
      .medium {
        background-color: var(--yellow);
      }
      .hard {
        background-color: var(--red);
      }
      .selected {
        -webkit-transition: opacity 0.5s;
        -o-transition: opacity 0.5s;
        transition: opacity 0.5s;
        opacity: 1;
      }
    }
  }
  .player-name {
    margin-bottom: 40px;
    font-size: 20px;
    input {
      outline: none;
      border: 2px solid var(--mauve);
      border-radius: 8px;
      width: 320px;
      height: 40px;
      padding: 10px;
      font-size: 20px;
      color: var(--text);
      background-color: rgba(54, 58, 79, 0.7);
      text-align: center;
      &::-webkit-input-placeholder {
        color: var(--surface-2);
      }
      &::-moz-placeholder {
        color: var(--surface-2);
      }
      &:-ms-input-placeholder {
        color: var(--surface-2);
      }
      &::-ms-input-placeholder {
        color: var(--surface-2);
      }
      &::placeholder {
        color: var(--surface-2);
      }
    }
  }
  .start-btn {
    background-color: var(--mauve);
    color: var(--crust);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
  }
}

.top-info {
  padding: 15px;
  margin: 15px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: 15px;
  font-size: 18px;
  border: 2px solid var(--mauve);
  :has(.name) {
    white-space: nowrap;
    overflow: hidden;
    -o-text-overflow: ellipsis;
       text-overflow: ellipsis;
  }
  .name {
    color: var(--flamingo);
  }
  .wrong-tries {
    color: var(--red);
  }
}

/*ERROR: Autoprefixer CSS online error*/
.cards-box {
  padding-left: 15px;
  padding-right: 15px;
  justify-content: center;
  display: grid;
  gap: 15px;
  transition: opacity 0.3s linear;
  &.level-1 {
    grid-template-columns: repeat(4, 1fr);
    @media (max-width: 768px) {
      grid-template-columns: repeat(3, 1fr);
    }
  }
  &.level-2 {
    grid-template-columns: repeat(5, 1fr);
    @media (max-width: 768px) {
      grid-template-columns: repeat(4, 1fr);
    }
  }
  &.level-3 {
    grid-template-columns: repeat(6, 1fr);
    @media (max-width: 768px) {
      grid-template-columns: repeat(5, 1fr);
    }
  }
  [class*="card-"] {
    position: relative;
    background-color: var(--surface-0);
    aspect-ratio: 1;
    border: 3px solid var(--mauve);
    font-size: 7vw;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    transition: transform 0.7s;
    &.is-flipped {
      transform: rotateY(180deg);
      pointer-events: none;
    }
    &.is-matched {
      pointer-events: none;
      transform: rotateY(180deg);
    }
    &.is-unflipping {
      transform: rotateY(180deg);
    }
    .back,
    .front {
      position: absolute;
      backface-visibility: hidden;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .back {
      width: 100%;
      height: 100%;
      cursor: pointer;
    }
    .front {
      width: 80%;
      transform: rotateY(180deg);
      img {
        max-width: 100%;
      }
    }
  }
}

.result-message {
  visibility: hidden;
  opacity: 0;
  -webkit-transition: opacity 0.5s;
  -o-transition: opacity 0.5s;
  transition: opacity 0.5s;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
      -ms-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  background-color: var(--base);
  width: 400px;
  height: 200px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  border-radius: 15px;
  -webkit-box-shadow: 0 2px 10px var(--surface-0);
          box-shadow: 0 2px 10px var(--surface-0);
  @media (max-width: 768px) {
    width: 300px;
  }
  .close-btn {
    position: absolute;
    right: 15px;
    top: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--red);
    color: var(--base);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    cursor: pointer;
  }
  .box {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    p {
      font-size: 22px;
      span {
        color: var(--mauve);
      }
    }
    .buttons {
      margin-top: 30px;
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-pack: center;
          -ms-flex-pack: center;
              justify-content: center;
      -webkit-box-align: center;
          -ms-flex-align: center;
              align-items: center;
      gap: 20px;
      .high-scores-btn {
        cursor: pointer;
        background-color: var(--mauve);
        color: var(--base);
        padding: 8px 16px;
        border-radius: 8px;
      }
      .play-again-btn {
        cursor: pointer;
        background-color: var(--lavender);
        color: var(--base);
        padding: 8px 16px;
        border-radius: 8px;
      }
    }
  }
}

.high-scores {
  margin-top: 40px;
  > div {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    h2 {
      margin-bottom: 20px;
      color: var(--crust);
      width: 120px;
      padding: 8px 0;
      text-align: center;
      position: relative;
    }
    &.easy h2 {
      background-color: var(--green);
    }
    &.medium h2 {
      background-color: var(--yellow);
    }
    &.hard h2 {
      background-color: var(--red);
    }
    .scores {
      margin-bottom: 40px;
      text-align: center;
      border: 2px solid var(--text);
      border-collapse: collapse;
      max-width: 100%;
      th,
      td {
        padding: 15px;
        border: 2px solid var(--text);
      }
      .rank {
        color: var(--lavender);
      }
      .name {
        color: var(--mauve);
        @media (min-width: 768px) {
          min-width: 200px;
        }
      }
      .score {
        color: var(--rosewater);
        @media (min-width: 768px) {
          min-width: 200px;
        }
      }
    }
  }
}
