* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

body {
  width: 100%;
  font-family: sans-serif;
}

.wrap {
  width: 100%;
  overflow: auto;
  font-size: 16px;
  text-align: center;
}
.wrap header {
  width: 100%;
  margin-bottom: 40px;
}
.wrap header h1 {
  margin: 20px 0;
  font-weight: 400;
}
.wrap header h1 span {
  font-size: 0.85em;
}
.wrap header nav {
  width: 90%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.wrap header nav a {
  display: inline-block;
  width: 32%;
  max-width: 100px;
  padding: 8px;
  text-decoration: none;
  color: #222;
  background-color: #fffffe;
  border: 1px solid #1265ea;
  font-size: 24px;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.wrap header nav a:hover, .wrap header nav a:focus {
  color: #fffffe;
  background-color: #1265ea;
}
.wrap header nav a:active {
  color: #fffffe;
  background-color: #1565c0;
}
.wrap header nav a.now {
  color: #fffffe;
  background-color: #0d47a1;
  pointer-events: none;
}
.wrap .container {
  width: 98%;
  max-width: 500px;
  margin: 0 auto 40px;
  padding: 40px 0;
  background-color: #fff;
  border-radius: 5px;
  border: 1px solid #ddd;
}
.wrap .container button {
  display: block;
  width: 80%;
  max-width: 300px;
  margin: 0 auto 30px;
  padding: 12px 24px;
  font-size: 20px;
  border-radius: 5px;
  background-color: #ff4d4d;
  border: 1px solid #ff4d4d;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}
.wrap .container button:hover, .wrap .container button:focus {
  background-color: #ff3333;
  border-color: #ff3333;
  color: #fff;
}
.wrap .container #timer {
  margin-bottom: 30px;
  font-size: 1.4em;
}
.wrap .container .board {
  display: grid;
  grid-template-columns: repeat(4, 80px);
  gap: 10px;
  justify-content: center;
}
.wrap .container .board .card {
  width: 80px;
  height: 100px;
  background: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.wrap .container .board .card.open, .wrap .container .board .card.matched {
  background: #fff;
  cursor: default;
}
.wrap .container .message {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
}
.wrap .container .message.show {
  display: flex;
}
.wrap .container .message .box {
  background: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  text-align: center;
  animation: pop 0.6s ease-out;
}
.wrap .container .message p {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 20px;
}
.wrap .container .message #restartBtn {
  margin-bottom: 0;
}
.wrap .ad {
  margin-bottom: 40px;
}
.wrap footer {
  margin-bottom: 20px;
  color: #333;
  font-size: 0.9em;
  padding: 0 10px;
}
.wrap footer ul {
  list-style-type: none;
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
.wrap footer ul li {
  margin: 6px 12px;
}
.wrap footer ul li a {
  display: inline-block;
  color: #333;
  text-decoration: none;
  padding: 4px 8px;
}
.wrap footer ul li a:hover {
  color: #666;
  background-color: #eef;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  70% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
@media (max-width: 576px) {
  .wrap footer ul {
    display: block;
  }
  .wrap footer ul li {
    margin-bottom: 16px;
  }
}