html {
  box-sizing: border-box;
  height: 100%;
}

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

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  margin: 0;
  background: rgb(99, 117, 143) top center no-repeat;
  font-family: sans-serif;
}

.play-area, .game-over {
  width: 1008px; /* (110 + 16) * 8 */
  height: 756px; /* (110 + 16) * 7 */
}

.play-area.done {
  display: none;
}

.card {
  position: relative;
  float: left;
  width: 110px;
  height: 110px;
  margin: 8px;
  cursor:pointer;
}

.hidden {
  visibility: hidden;
  opacity: 0;
  transform: scale(0.2);
  transition: visibility 0.5s, opacity 0.5s, transform 0.5s;
}

.side-front, .side-back {
  position: absolute;
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  background: white;
}

.side-front {
  font-size: 32px;
  line-height: 110px;
  text-align: center;
  user-select: none;
  transform: rotateY(0deg);
  transition: transform 0.125s linear 0.125s;
}

.flipped .side-front {
  transform: rotateY(90deg);
  transition-delay: 0s;
}

.side-back {
  padding: 2px;
  transform: rotateY(-90deg);
  transition: transform 0.125s linear 0s;
}

.flipped .side-back {
  transform: rotateY(0deg);
  transition-delay: 0.125s;
}

.card-image {
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.credits {
  margin: 8px;
  color: white;
  font-size: 14px;
}

.credits a {
  color: #8bcff7;
}

.game-over {
  display: none;
  flex-direction: column;
  justify-content: center;
  color: white;
  text-align: center;
  transition: transform 0.4s, opacity 0.4s;
}

.game-over.done {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.game-over.done.start {
  opacity: 0;
  transform: translateY(40px);
}

.over-text {
  margin-bottom: 24px;
  font-size: 96px;
  font-weight: bold;
  line-height: 80px;
}

.again-text {
  font-size: 18px;
}
