/* ============================================
   違う色さがし - 固有スタイル
   ============================================ */

/* スコアエリア */
.score-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.score-box {
  background: #BBADA0;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  text-align: center;
  min-width: 70px;
  flex: 1;
}

.score-label {
  display: block;
  font-size: 0.7rem;
  color: #EEE4DA;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ゲームボード */
.board-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* カラーパネルのグリッド */
.color-grid {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #BBADA0;
  border-radius: 12px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* カラーパネル（背景色はJSで設定） */
.color-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  cursor: pointer;
  /* 色そのものを見分けるゲームなので、背景色は遷移させない */
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
}

/* ホバー（デスクトップ）。色の見え方を変えないよう拡大とリングのみ */
@media (hover: hover) {
  .color-cell:hover {
    transform: scale(1.06);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
    z-index: 2;
  }
}

/* 正解パネル */
.color-cell.correct {
  z-index: 5;
  box-shadow: 0 0 0 4px #56ab2f, 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: correct-pop 0.26s ease;
}

@keyframes correct-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1.12); }
}

/* 不正解パネル（色は変えずリング＋シェイク） */
.color-cell.wrong {
  z-index: 4;
  box-shadow: 0 0 0 4px #E74C3C;
  animation: shake 0.4s ease;
}

/* ヒント表示中の正解パネル（色はそのまま、光るリングで点滅） */
.color-cell.hint {
  z-index: 6;
  animation: hint-pulse 0.9s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% {
    box-shadow: 0 0 0 3px #fff, 0 0 0 7px #1ABC9C;
    transform: scale(1.06);
  }
  50% {
    box-shadow: 0 0 0 4px #fff, 0 0 0 12px #1ABC9C;
    transform: scale(1.14);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ペナルティ通知 */
.penalty-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(231, 76, 60, 0.95);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
}

.penalty-notice.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ヒント通知（ペナルティと重ならないよう少し上に表示） */
.hint-notice {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(26, 188, 156, 0.96);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
}

.hint-notice.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ライフのハート表示 */
.score-value.lives {
  letter-spacing: 0.05em;
}

/* 正解時の「どう違ったか」カード（盤面の下に表示してマスを隠さない） */
.diff-reveal {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(255, 255, 255, 0.97);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  padding: 0.6rem 0.9rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 20;
  width: max-content;
  max-width: 96%;
}

.diff-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.diff-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #56ab2f;
  margin-bottom: 0.45rem;
}

.diff-swatches {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.diff-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.diff-chip {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.diff-code {
  font-size: 0.62rem;
  color: #776E65;
  font-variant-numeric: tabular-nums;
}

.diff-cap {
  font-size: 0.62rem;
  font-weight: 700;
  color: #999;
}

.diff-arrow {
  color: #776E65;
  font-weight: 700;
  font-size: 1.1rem;
}

.diff-delta {
  font-size: 0.82rem;
  font-weight: 700;
  color: #333;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ゲームオーバーレイ */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(238, 228, 218, 0.92);
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: overlay-appear 0.5s ease;
}

.game-overlay.active {
  display: flex;
}

@keyframes overlay-appear {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.overlay-content {
  text-align: center;
  padding: 2rem 1.5rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  width: 90%;
}

.overlay-content h2 {
  font-size: 1.75rem;
  color: #E67E22;
  margin-bottom: 0.75rem;
}

/* ゲームオーバーは赤系の見出し */
.overlay-content.over h2 {
  color: #E74C3C;
}

.result-text {
  font-size: 1.05rem;
  color: #776E65;
  margin-bottom: 0.5rem;
  line-height: 1.8;
}

.best-text {
  font-size: 0.85rem;
  color: #E67E22;
  font-weight: 600;
  margin-bottom: 1rem;
  min-height: 1.2em;
}

.overlay-content .btn-primary {
  margin-top: 0.5rem;
}

/* レスポンシブ */
@media (max-width: 500px) {
  .color-grid {
    gap: 3px;
    padding: 8px;
  }

  .color-cell {
    border-radius: 4px;
  }
}

@media (max-width: 400px) {
  .color-grid {
    gap: 2px;
    padding: 6px;
  }

  .color-cell {
    border-radius: 3px;
  }

  .score-box {
    padding: 0.4rem 0.5rem;
    min-width: 55px;
  }

  .score-value {
    font-size: 1rem;
  }
}
