/* ========== 2048 ========== */

.game-page { max-width: 520px; }

.score-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.score-box {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}

.score-label { font-size: .78rem; color: var(--text-dim); }

.score-value { font-size: 1.3rem; font-weight: 700; color: var(--accent); }

.score-value.bump { animation: bump .25s ease; }

@keyframes bump {
  50% { transform: scale(1.3); }
}

.board {
  position: relative;
  width: min(92vw, 460px);
  aspect-ratio: 1;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  touch-action: none;
  user-select: none;
}

.grid-bg {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--gap, 12px);
  padding: var(--gap, 12px);
}

.grid-cell {
  background: rgba(255, 255, 255, .045);
  border-radius: 10px;
}

.tile-container { position: absolute; inset: 0; }

.tile {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 800;
  background: #eee4da;
  color: #776e65;
  transform: var(--pos);
  transition: transform .15s ease-in-out;
  will-change: transform;
}

.tile.v2    { background: #eee4da; }
.tile.v4    { background: #ede0c8; }
.tile.v8    { background: #f2b179; color: #f9f6f2; }
.tile.v16   { background: #f59563; color: #f9f6f2; }
.tile.v32   { background: #f67c5f; color: #f9f6f2; }
.tile.v64   { background: #f65e3b; color: #f9f6f2; }
.tile.v128  { background: #edcf72; color: #f9f6f2; box-shadow: 0 0 12px rgba(243, 215, 116, .35); }
.tile.v256  { background: #edcc61; color: #f9f6f2; box-shadow: 0 0 14px rgba(243, 215, 116, .4); }
.tile.v512  { background: #edc850; color: #f9f6f2; box-shadow: 0 0 16px rgba(243, 215, 116, .45); }
.tile.v1024 { background: #edc53f; color: #f9f6f2; box-shadow: 0 0 18px rgba(243, 215, 116, .5); }
.tile.v2048 { background: #edc22e; color: #f9f6f2; box-shadow: 0 0 22px rgba(243, 194, 46, .6); }
.tile.vsuper { background: #3c3a32; color: #f9f6f2; }

.tile.appear { animation: appear .18s ease .05s backwards; }

@keyframes appear {
  from { transform: var(--pos) scale(0); }
  to   { transform: var(--pos) scale(1); }
}

.tile.pop { animation: pop .22s ease; }

@keyframes pop {
  50% { transform: var(--pos) scale(1.18); }
}

.tile.absorbed { animation: absorb .15s ease forwards; }

@keyframes absorb {
  to { opacity: 0; }
}

/* ---------- 结算遮罩 ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(22, 19, 15, .82);
  border-radius: var(--radius);
  backdrop-filter: blur(2px);
}

.overlay.hidden, .hidden { display: none; }

.overlay-msg { font-size: 1.8rem; font-weight: 800; }

.overlay-actions { display: flex; gap: 12px; }
