:root {
  --colour-primary: #231f20;
  --colour-secondary: #faf8f0;
  --font-main: "Barrio", system-ui;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: #d98f3a;
  margin: 0 auto;
}
h1 {
  margin: 16px;
  font-family: var(--font-main);
  font-size: 48px;
  color: #231f20;
  text-shadow: 2px -1px rgba(250, 248, 240, 1);
}
.timer {
  color: var(--colour-primary);
  font-size: 22px;
  font-family: "Courier New", Courier, monospace;
  margin: 8px;
}
.wrapper {
  padding: 25px;
  margin: 0 auto;
  border-radius: 10px;
  border: 2px dashed #231f20;
  background: var(--colour-secondary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.cards,
.card,
.view {
  display: flex;
  align-items: center;
  justify-content: center;
}
.cards {
  height: 400px;
  width: 400px;
  padding: 0;
  flex-wrap: wrap;
  justify-content: space-between;
}
.cards .card {
  cursor: pointer;
  list-style: none;
  user-select: none;
  position: relative;
  perspective: 1000px;
  transform-style: preserve-3d;
  height: calc(25% - 10px);
  width: calc(25% - 10px);
}
.card.shake {
  animation: shake 0.35s ease-in-out;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-13px);
  }
  40% {
    transform: translateX(13px);
  }
  60% {
    transform: translateX(-8px);
  }
  80% {
    transform: translateX(8px);
  }
}

.card .view {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 7px;
  background: var(--colour-secondary);
  pointer-events: none;
  backface-visibility: hidden;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid #231f20;
  transition: transform 0.25s linear;
}
.card .front-view img {
  width: 50px;
}
.card .back-view img {
  max-width: 70px;
  border-radius: 3px;
}
.card .back-view {
  transform: rotateY(-180deg);
}
.card.flip .back-view {
  transform: rotateY(0);
}
.card.flip .front-view {
  transform: rotateY(180deg);
}
footer {
  color: var(--colour-primary);
  font-size: 18px;
  font-family: var(--font-main);
  padding: 20px;
}
a {
  color: var(--colour-primary);
  text-decoration: none;
}
a:hover {
  color: var(--colour-secondary);
}

@media (max-width: 700px) {
  h1 {
    font-size: 40px;
  }
  .cards {
    height: 350px;
    width: 350px;
  }
  .card .front-view img {
    width: 35px;
  }
  .card .back-view img {
    max-width: 55px;
  }
}

@media (max-width: 530px) {
  h1 {
    font-size: 30px;
  }
  .cards {
    height: 250px;
    width: 250px;
  }
  .card .front-view img {
    width: 30px;
  }
  .card .back-view img {
    max-width: 45px;
  }
  footer {
    font-size: 16px;
  }
}
