body {
  font-family: sans-serif;
  text-align: center;
}

h2 {
  margin-top: 60px;
}

/* --- 盤面 --- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.cell {
  width: 110px;
  height: 165px;
  background-color: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #ccc;
}

/* --- 手札 --- */
.hand {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

/* --- カード --- */
.card {
  width: 110px;
  height: 165px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  font-weight: bold;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.card img {
  width: 100%;
  height: auto;
  object-fit: contain;
}


.card .name {
  margin-top: 4px;
  font-size: 14px;
}

.card .stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 16px;
  /* ← 数字を大きく */
  padding: 0 5px;
  font-weight: bold;
}

.card.selected {
  border-color: red;
}

/* --- ステータス位置 --- */
.stat {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  font-weight: bold;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
}

.stat-top {
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.stat-right {
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.stat-bottom {
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.stat-left {
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
}

/* --- 背景色（勝利側） --- */
.card.cpu-card {
  background: linear-gradient(to bottom right, #a0e0ff, #70c0ff);
}

.card.player-card {
  background: linear-gradient(to bottom right, #ffb0d0, #ff80b0);
}

/* --- ひっくり返す演出（必要なら） --- */
.card.flipped {
  transform: rotateY(180deg);
  transition: transform 0.5s;
}

#cpu-hand {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.cpu-hand-card {
  width: 110px;
  height: 165px;
  background-image: url("images/card-game-ura.jpg");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 5px;
}

#cpu-hand {
  display: flex;
  gap: 10px;
  /* カードの間隔調整 */
  justify-content: center;
  margin-bottom: 20px;
}

.back-card {
  width: 100px;
  height: 140px;
}

#result-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 30px 60px;
  border-radius: 15px;
  font-size: 40px;
  font-weight: bold;
  z-index: 9999;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  animation: popIn 0.4s ease-out;
  text-shadow: 2px 2px 5px #000;
}


.hidden {
  display: none;
}

#next-game-button {
  position: fixed;
  top: 70%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 30px;
  font-size: 18px;
  font-weight: bold;
  background-color: #09a013;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  z-index: 9999;
  animation: fadeIn 0.5s ease-out;
}

#next-game-button.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@media screen and (max-width: 480px) {
  .board {
    grid-template-columns: repeat(3, 90px);
  }

  .cell,
  .card,
  .cpu-hand-card {
    width: 90px;
    height: 135px;
  }

  .card img {
    max-height: 70px;
  }

  .stat {
    font-size: 10px;
    padding: 1px 3px;
  }

  #cpu-hand {
    gap: 6px;
  }
}