html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

:root {
  font-family: sans-serif;
}

.container {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 50px;
}

.success-img,
.fail-img {
  display: none;
  height: 500px;
  margin-bottom: 40px;
}

.timer-wrapper {
  position: absolute;
  opacity: 0;
  left: 100px;
  width: 100px;
  height: 100px;
  margin-right: 20px;
}

.timer path {
  fill: none;
  stroke-linecap: round;
  stroke-width: 5;
  stroke: #fff;
  transition: stroke-dasharray .5s ease;
}

.timer circle {
  fill: red;
}

.timer text {
  font-size: 30px;
  font-weight: 700;
  fill: #fff;
}

.new-game-btn {
  width: 300px;
  height: 80px;
  cursor: pointer;
  color: red;
  font-weight: 600;
  font-size: 34px;
  border: 2px solid red;
  outline: 2px solid red;
  background-color: transparent;
  animation: outline-flicker 1s ease infinite;
  transition: color .1s ease, background-color .1s ease;
}

.new-game-btn:hover {
  color: white;
  background-color: red;
  animation: none;
}

.new-game-btn:active {
  background-color: rgb(172, 0, 0);
}

@keyframes outline-flicker {
  from {
    outline-offset: 0;
  }

  to {
    outline-offset: 20px;
    outline-color: transparent;
  }
}

.row {
  display: none;
  flex-wrap: wrap;
  width: 600px;
  height: 650px;
  margin: -10px;
}

.card-wrapper {
  width: 25%;
  height: 25%;
  padding: 10px;
  opacity: 0;
  transition: opacity .2s ease;
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 5%;
  cursor: pointer;
}

.front, .back {
  position: absolute;
  width: 100%;
  height: 100%;
  color: rgb(91, 7, 136);
  overflow: hidden;
  backface-visibility: hidden;
  border-radius: inherit;
  transition: transform .7s ease;
  border: 2px solid rgb(91, 7, 136);
}

.front {
  padding: 30px;
  text-align: center;
  font-size: 70px;
  transform: perspective(900px) rotateY(180deg);
  background-size: calc(100% - 5px) calc(100% - 5px);
  background-repeat: no-repeat;
  background-position: center;
}

.front::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  outline: 2px solid rgb(91, 7, 136);
}

.back {
  position: relative;
  transform: perspective(900px) rotateY(0deg) scale(1);
}

.back::before {
  content: '';
  position: absolute;
  inset: 3px;
  background-image: url(../img/ricebowl.jpg);
  background-size: cover;
  opacity: .4;
  border-radius: inherit;
}

.back::after {
  content: '';
  position: absolute;
  inset: 3px;
  outline: 2px solid rgb(91, 7, 136);
  border-radius: inherit;
}

.card-wrapper:nth-child(-n+4):nth-child(odd) .back::before,
.card-wrapper:nth-child(n+5):nth-child(-n+8):nth-child(even) .back::before,
.card-wrapper:nth-child(n+9):nth-child(-n+12):nth-child(odd) .back::before,
.card-wrapper:nth-child(n+13):nth-child(-n+16):nth-child(even) .back::before {
  background-image: url(../img/nekowife.png);
  opacity: .7;
}

@keyframes card_scale {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1)
  }
}

.card.is-flipped {
  animation: card_scale .7s alternate ease;
}

.card.is-flipped>.front {
  transform: perspective(900px) rotateY(0deg);
}

.card.is-flipped>.back {
  transform: perspective(900px) rotateY(-180deg);
}
