/* ==========================================
   2048 Game Module — 游戏的完整样式
   ========================================== */

/* ===== 游戏外层容器 ===== */
.game-2048-wrapper {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px 28px 20px;
  box-shadow:
    0 0 40px rgba(255, 0, 255, 0.08),
    0 0 80px rgba(100, 0, 255, 0.05),
    inset 0 0 40px rgba(255, 255, 255, 0.02);
  user-select: none;
}

/* ===== 顶部信息栏 (分数 + 新游戏按钮) ===== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.game-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #ff00ff;
  text-shadow: 0 0 10px #ff00ff, 0 0 20px rgba(255, 0, 255, 0.5);
  letter-spacing: 3px;
}

.game-scores {
  display: flex;
  gap: 12px;
}

.score-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 16px;
  text-align: center;
  min-width: 70px;
}

.score-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.score-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ===== 游戏棋盘 ===== */
.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px;
  width: 340px;
  height: 340px;
}

/* ===== 单个格子 ===== */
.game-cell {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.6rem;
  color: #fff;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
}

/* 空格子 (值为 0) */
.game-cell[data-value="0"] {
  background: rgba(255, 255, 255, 0.03);
}

/* ---- 各级别数字块的颜色与辉光 ---- */
/* 2 — 浅灰 */
.game-cell[data-value="2"] {
  background: #2a2a3a;
  color: #ccc;
}

/* 4 — 米白 */
.game-cell[data-value="4"] {
  background: #3a3a4a;
  color: #ddd;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.08);
}

/* 8 — 橙色 */
.game-cell[data-value="8"] {
  background: #5a3a1a;
  color: #ffaa44;
  box-shadow: 0 0 10px rgba(255, 170, 68, 0.3);
}

/* 16 — 亮橙 */
.game-cell[data-value="16"] {
  background: #6a4020;
  color: #ff8844;
  box-shadow: 0 0 12px rgba(255, 136, 68, 0.35);
}

/* 32 — 红色 */
.game-cell[data-value="32"] {
  background: #6a2020;
  color: #ff5555;
  box-shadow: 0 0 14px rgba(255, 85, 85, 0.4);
}

/* 64 — 品红 */
.game-cell[data-value="64"] {
  background: #5a2050;
  color: #ff44cc;
  box-shadow: 0 0 16px rgba(255, 68, 204, 0.4);
}

/* 128 — 紫色 */
.game-cell[data-value="128"] {
  background: #3a2060;
  color: #cc66ff;
  box-shadow: 0 0 18px rgba(204, 102, 255, 0.45);
}

/* 256 — 蓝色 */
.game-cell[data-value="256"] {
  background: #1a3060;
  color: #6699ff;
  box-shadow: 0 0 20px rgba(102, 153, 255, 0.5);
}

/* 512 — 青色 */
.game-cell[data-value="512"] {
  background: #1a5050;
  color: #44dddd;
  box-shadow: 0 0 22px rgba(68, 221, 221, 0.5);
}

/* 1024 — 绿色 */
.game-cell[data-value="1024"] {
  background: #1a5020;
  color: #55dd55;
  font-size: 1.3rem;
  box-shadow: 0 0 26px rgba(85, 221, 85, 0.55);
}

/* 2048 — 金色 (胜利!) */
.game-cell[data-value="2048"] {
  background: #554400;
  color: #ffdd00;
  font-size: 1.2rem;
  box-shadow: 0 0 30px rgba(255, 221, 0, 0.6);
  animation: winGlow 1s ease-in-out infinite alternate;
}

/* 4096+ — 彩虹色 */
.game-cell[data-value="4096"] {
  background: #222;
  color: #ff4488;
  font-size: 1.1rem;
  box-shadow: 0 0 35px rgba(255, 68, 136, 0.6);
}
.game-cell[data-value="8192"] {
  background: #222;
  color: #44ffff;
  font-size: 1rem;
  box-shadow: 0 0 40px rgba(68, 255, 255, 0.6);
}

@keyframes winGlow {
  0%   { box-shadow: 0 0 30px rgba(255, 221, 0, 0.6); }
  100% { box-shadow: 0 0 50px rgba(255, 221, 0, 0.9), 0 0 80px rgba(255, 200, 0, 0.4); }
}

/* 新生成/合并格子的弹跳动画 */
.game-cell.just-merged {
  animation: cellPop 0.2s ease-out;
}

@keyframes cellPop {
  0%   { transform: scale(0.8); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ===== 新游戏按钮 ===== */
.btn-new-game {
  background: rgba(255, 0, 255, 0.15);
  border: 1px solid rgba(255, 0, 255, 0.3);
  color: #ff88ff;
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 8px;
  letter-spacing: 2px;
  transition: background 0.2s, box-shadow 0.2s;
  cursor: none;
}

.btn-new-game:hover {
  background: rgba(255, 0, 255, 0.25);
  box-shadow: 0 0 16px rgba(255, 0, 255, 0.3);
}

/* ===== 游戏结束覆盖层 ===== */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 2;
  backdrop-filter: blur(3px);
}

.game-over-text {
  font-size: 2rem;
  font-weight: bold;
  color: #ff4488;
  text-shadow: 0 0 20px rgba(255, 68, 136, 0.6);
  letter-spacing: 4px;
}