/* =========================================================
 * SyntheSweep 共通UI演出・SVGアイコンスタイル (shared/common.css)
 * 本編 (index.html) ＆ 1問1答ミニゲーム (quiz/) 共通利用
 * ========================================================= */

/* --- カスタム SVG アイコン共通レイアウト --- */
.ss-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* 盤面セル内アイコンラッパーの厳密センタリング */
.mine-cell .icon-flag,
.mine-cell .icon-mine,
.mine-cell .icon-explosion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 0;
  pointer-events: none;
}

/* 盤面セル内 SVG サイズ（セル幅に追従・equal_regions / signed_delta 併用時も中央に収まる） */
.mine-cell .ss-icon {
  width: calc(var(--cell-size, 48px) * 0.56);
  height: calc(var(--cell-size, 48px) * 0.56);
  max-width: 72%;
  max-height: 72%;
}

/* 旗アイコン：暗背景・等数エリア色上でも視認性が高いコントラスト */
.mine-cell .icon-flag {
  color: #f8fafc;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

/* 地雷アイコン */
.mine-cell .icon-mine {
  color: #fecaca;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* 踏破した爆発地雷アイコン */
.mine-cell.mine-exploded {
  background: radial-gradient(circle at center, #b91c1c 0%, #7f1d1d 75%) !important;
  border-color: #fb923c !important;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.65), inset 0 0 8px rgba(254, 240, 138, 0.35);
}

.mine-cell .icon-explosion {
  filter: drop-shadow(0 0 4px rgba(251, 146, 60, 0.75));
}

/* トップバー等のアイコンボタン内 SVG は 19px 固定（PC幅での過大表示を防止） */
.btn-icon .ss-icon {
  width: 19px;
  height: 19px;
}

#soundToggleBtn {
  color: #38bdf8;
}

#soundToggleBtn.is-muted {
  color: #94a3b8;
  opacity: 0.78;
}

/* --- 手触りアニメーション --- */

/* 1. 安全マス新規開示時の軽いポップ */
@keyframes cellRevealPop {
  0% {
    transform: scale(0.86);
    opacity: 0.72;
  }
  60% {
    transform: scale(1.045);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.mine-cell.cell-reveal-pop {
  animation: cellRevealPop 0.17s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 2. 旗立て時のバウンス */
@keyframes flagBounce {
  0% {
    transform: scale(0.62) translateY(3px);
    opacity: 0.7;
  }
  58% {
    transform: scale(1.18) translateY(-2px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.mine-cell .icon-flag.flag-bounce {
  animation: flagBounce 0.21s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 3. クリア／正解時の軽いフラッシュ */
@keyframes boardClearFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.75);
    border-color: #34d399;
  }
  55% {
    box-shadow: 0 0 26px 4px rgba(16, 185, 129, 0.55);
    border-color: #6ee7b7;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.board-grid.board-clear-flash {
  animation: boardClearFlash 0.55s ease-out;
}

@keyframes cellCorrectFlash {
  0% {
    filter: brightness(1.45);
    transform: scale(1.06);
  }
  100% {
    filter: brightness(1);
    transform: scale(1);
  }
}

.mine-cell.cell-correct-flash {
  animation: cellCorrectFlash 0.32s ease-out;
}

/* モーション低減設定への配慮 */
@media (prefers-reduced-motion: reduce) {
  .mine-cell.cell-reveal-pop,
  .mine-cell .icon-flag.flag-bounce,
  .board-grid.board-clear-flash,
  .mine-cell.cell-correct-flash {
    animation: none !important;
  }
}
