body {
  margin: 0;
  font-family: sans-serif;
  background-color: #f0f0f0;
  text-align: center;
}

h1 {
  font-size: 1.8em;
  margin-top: 40px;
}

p {
  font-size: 1.2em;
  margin: 20px;
}

#title-screen,
#gameover-screen,
#congrats-screen {
  padding: 40px;
  background-color: #ffffff;
}

#score-area {
  display: flex;
  justify-content: space-around;
  font-size: 1.2em;
  margin: 10px;
  flex-wrap: wrap;
}

#game-area {
  display: grid;
  justify-content: center;
  grid-gap: 4px;
  margin: 0 auto;
  padding: 10px;
  max-width: calc(64px * 7 + 4px * 6); /* 最大7列分の幅＋隙間 */
}

canvas {
  width: 64px;
  height: 64px;
  cursor: pointer;
  background-color: transparent;
  image-rendering: pixelated;
  transition: opacity 0.5s ease;
}

/* フェードアニメーション */
.fade-out {
  animation: fadeOut 0.5s forwards;
}

.fade-in {
  animation: fadeIn 0.5s forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* スマホ対応 */
@media (max-width: 600px) {
  canvas {
    width: 48px;
    height: 48px;
  }

  #game-area {
    max-width: calc(48px * 7 + 4px * 6);
  }

  h1 {
    font-size: 1.5em;
  }

  p {
    font-size: 1em;
  }

  #score-area {
    font-size: 1em;
    flex-direction: column;
    align-items: center;
  }
}