/* =====================================================================
   style.css — 2048（数字合わせパズル）ツール固有の微調整のみ。
   共通スタイルは /_shared/shirugear.css に任せる。
   色は CSS 変数 var(--sg-…, フォールバック) を優先。
   ===================================================================== */

/* ツールバー（スコア + ボタン） */
.sg-game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sg-scores {
  display: flex;
  gap: 18px;
}
.sg-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.sg-stat__label {
  font-size: 0.72rem;
  color: var(--sg-muted, #777);
}
.sg-stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sg-game-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 盤面 */
.sg-board-wrap {
  display: flex;
  justify-content: center;
}
.sg-board-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  padding: 8px;
  border-radius: 12px;
  background: var(--sg-border, #bbada0);
  outline: none;
  touch-action: none; /* スワイプでページがスクロールしないように */
}
.sg-board-2048:focus-visible {
  box-shadow: 0 0 0 3px var(--sg-accent, #3b5bdb);
}

.sg-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--sg-bg-alt, rgba(238, 228, 218, 0.35));
  color: var(--sg-fg, #776e65);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.1rem, 7vw, 2.1rem);
  user-select: none;
  min-width: 0;
  min-height: 0;
  transition: transform 0.08s ease;
}
.sg-cell--filled {
  animation: sg-pop 0.12s ease;
}
.sg-cell--small {
  font-size: clamp(0.85rem, 5vw, 1.5rem);
}
@keyframes sg-pop {
  0% { transform: scale(0.85); }
  100% { transform: scale(1); }
}

/* タイル色（数字ごと）。定番配色に寄せつつ、テーマ変数で上書き可能に。 */
.sg-cell[data-v="2"]    { background: #eee4da; color: #776e65; }
.sg-cell[data-v="4"]    { background: #ede0c8; color: #776e65; }
.sg-cell[data-v="8"]    { background: #f2b179; color: #fff; }
.sg-cell[data-v="16"]   { background: #f59563; color: #fff; }
.sg-cell[data-v="32"]   { background: #f67c5f; color: #fff; }
.sg-cell[data-v="64"]   { background: #f65e3b; color: #fff; }
.sg-cell[data-v="128"]  { background: #edcf72; color: #fff; }
.sg-cell[data-v="256"]  { background: #edcc61; color: #fff; }
.sg-cell[data-v="512"]  { background: #edc850; color: #fff; }
.sg-cell[data-v="1024"] { background: #edc53f; color: #fff; }
.sg-cell[data-v="2048"] { background: #edc22e; color: #fff; }
/* 2048 超え */
.sg-cell[data-v="4096"],
.sg-cell[data-v="8192"],
.sg-cell[data-v="16384"],
.sg-cell[data-v="32768"],
.sg-cell[data-v="65536"] {
  background: var(--sg-accent, #3c3a32);
  color: #fff;
}

/* 勝利 / ゲームオーバー オーバーレイ */
.sg-game-overlay {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  background: var(--sg-card-bg, #fff);
  border: 2px solid var(--sg-accent, #3b5bdb);
}
.sg-game-overlay__text {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--sg-accent, #3b5bdb);
}
.sg-game-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
