/* 全体の背景画像設定 */
body {

  background-image: url('pazlu_game_back.png');
  background-size: contain;
  /* ← 画面に収まるように縮小 */
  background-repeat: no-repeat;
  /* ← 繰り返さない */
  background-position: center top;
  background-color: #e6e6fa;

  margin: 0;
}

#game-container {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 5px;
}

/* グリッドの配置調整 */
#grid {
  display: grid;
  grid-template-columns: repeat(8, 50px);
  grid-template-rows: repeat(8, 50px);
  gap: 2px;
  margin: 30px auto;
  width: fit-content;
  background-color: rgba(178, 235, 184, 0.5);
  /* グリッド部分に少し暗めの背景（お好み） */
  padding: 10px;
  border-radius: 8px;
}

/* 各セルの見た目 */
.cell {
  width: 50px;
  height: 50px;
  border: 1px solid #444;
  background-color: #cbddd2;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 画像のサイズ */
.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

#score-board {
  color: white;
  font-size: 20px;
  margin-bottom: 10px;
  margin-top: 5px;
  text-align: center;
}

#timer {
  color: white;
  font-size: 20px;
  text-align: center;
  margin-top: 40px;
  margin-bottom: 20px;
}

/* ゲームオーバー用ポップアップ */
#gameover-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  /* 背景を暗くする */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#gameover-popup .popup-content {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  font-size: 20px;
}

#gameover-popup.hidden {
  display: none;
}

#gameover-popup button {
  margin-top: 20px;
  font-size: 18px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background-color: #4CAF50;
  color: white;
  cursor: pointer;
}

#start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  /* 半透明白背景 */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

#start-button {
  font-size: 24px;
  padding: 16px 32px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

#bg {
  width: 100%;
  max-width: 420px;
  /* 8マス×50px＋余白くらい */
  height: auto;
  display: block;
  margin: 0 auto;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
}

#grid {
  display: grid;
  grid-template-columns: repeat(8, 50px);
  gap: 2px;
  margin-top: 20px;
  z-index: 1;
}

.gameover-icon {
  width: 80px;
  /* 好きなサイズに調整してOK */
  height: auto;
  display: block;
  margin: 0 auto 15px;
  border-radius: 50%;
  /* 丸くしたければ */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  /* 影つけてもかわいい */
}

.gameover-icon {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto 10px;
}

@keyframes explode {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    filter: brightness(1);
  }

  20% {
    transform: scale(1.4) rotate(10deg);
    filter: brightness(2.5);
  }

  40% {
    transform: scale(1.1) rotate(-20deg);
    filter: brightness(3);
  }

  70% {
    transform: scale(1.6) rotate(45deg);
    filter: brightness(1.2);
    opacity: 0.8;
  }

  100% {
    transform: scale(0) rotate(180deg);
    opacity: 0;
    filter: brightness(0);
  }
}

.exploding {

  animation: explode 0.45s ease-out;
  z-index: 10;
  pointer-events: none;
  will-change: transform, opacity, filter;
}