* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #1e1e24;
  color: #f3f4f6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  user-select: none;
}

.game-container {
  display: flex;
  gap: 24px;
  background-color: #2b2b36;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.board-wrapper {
  position: relative;
  background-color: #16161c;
  padding: 6px;
  border-radius: 8px;
  border: 2px solid #3d3d4e;
}

/* 6列 × 12行 */
.board {
  display: grid;
  grid-template-columns: repeat(6, 40px);
  grid-template-rows: repeat(12, 40px);
  gap: 2px;
  background-color: #16161c;
}

.cell {
  width: 40px;
  height: 40px;
  background-color: #202029;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 最上段 (y=0) はゲームオーバー境界線として薄い警告色・点線下部 */
.cell.danger-zone {
  background-color: #2b1f24;
  border-bottom: 1px dashed rgba(239, 68, 68, 0.5);
}

/* ストーンの共通スタイル */
.stone {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease;
}

.stone.color-red {
  background: radial-gradient(circle at 35% 35%, #ff7676, #dc2626);
  border: 1px solid #b91c1c;
}

.stone.color-blue {
  background: radial-gradient(circle at 35% 35%, #60a5fa, #2563eb);
  border: 1px solid #1d4ed8;
}

.stone.color-green {
  background: radial-gradient(circle at 35% 35%, #4ade80, #16a34a);
  border: 1px solid #15803d;
}

.stone.color-yellow {
  background: radial-gradient(circle at 35% 35%, #fde047, #ca8a04);
  border: 1px solid #a16207;
}

/* 消去アニメーション */
.stone.clearing {
  animation: pop-vanish 0.25s forwards ease-in-out;
}

@keyframes pop-vanish {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    filter: brightness(1.6);
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* サイドバー */
.sidebar {
  width: 170px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background-color: #20202a;
  border: 1px solid #353545;
  border-radius: 8px;
  padding: 12px;
}

.panel h3 {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: 0.05em;
}

/* NEXTプレビュー (横2×縦2枠) */
.next-preview {
  display: grid;
  grid-template-columns: repeat(1, 40px);
  grid-template-rows: repeat(2, 40px);
  gap: 4px;
  justify-content: center;
  margin: 4px auto;
}

.next-preview .cell {
  background-color: #191922;
}

/* 情報パネル */
.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-item .label {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 600;
}

.info-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

/* 操作説明 */
.controls-guide ul {
  list-style: none;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.controls-guide li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #d1d5db;
}

kbd {
  background-color: #374151;
  border: 1px solid #4b5563;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.75rem;
  font-family: inherit;
  color: #f9fafb;
}

/* アクションボタン */
.action-btn, #retry-btn {
  background-color: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.action-btn:hover, #retry-btn:hover {
  background-color: #1d4ed8;
}

.action-btn:active, #retry-btn:active {
  transform: scale(0.98);
}

/* ゲームオーバー オーバーレイ */
.overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 15, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.game-over-modal {
  background-color: #272733;
  padding: 24px 20px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #4a4a60;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.game-over-modal h2 {
  color: #ef4444;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.game-over-modal p {
  color: #e5e7eb;
  font-size: 1rem;
  margin-bottom: 16px;
  font-weight: 600;
}
