.game-section {
  max-width: 500px;
  margin: 0 auto;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.game-score-wrap {
  background: var(--control-bg);
  border: 1px solid var(--control-outline);
  border-radius: 10px;
  padding: 6px 14px;
  text-align: center;
}

.score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.score-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.grid-container {
  position: relative;
  background: var(--control-bg);
  border: 1px solid var(--control-outline);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  aspect-ratio: 1 / 1;
  touch-action: none;
}

.cell {
  background: var(--bg-dark);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
}

.tile {
  position: absolute;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  transition: left 0.15s ease-in-out, top 0.15s ease-in-out;
  will-change: left, top;
  z-index: 2;
  background: #eee4da;
  color: #776e65;
}

.tile-new {
  animation: tileAppear 0.2s ease-out;
}

@keyframes tileAppear {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.tile-merged {
  animation: tileMerge 0.2s ease-out;
}

@keyframes tileMerge {
  0%   { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.tile[data-value="4"]   { background: #ede0c8; color: #776e65; }
.tile[data-value="8"]   { background: #f2b179; color: #f9f6f2; }
.tile[data-value="16"]  { background: #f59563; color: #f9f6f2; }
.tile[data-value="32"]  { background: #f67c5f; color: #f9f6f2; }
.tile[data-value="64"]  { background: #f65e3b; color: #f9f6f2; }
.tile[data-value="128"] { background: #edcf72; color: #f9f6f2; }
.tile[data-value="256"] { background: #edcc61; color: #f9f6f2; }
.tile[data-value="512"] { background: #edc850; color: #f9f6f2; }
.tile[data-value="1024"]{ background: #edc53f; color: #f9f6f2; }
.tile[data-value="2048"]{ background: #edc22e; color: #f9f6f2; }
.game-message {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
  z-index: 10;
}

.game-message.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-message p {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 500px) {
  .grid-container {
    padding: 6px;
    gap: 6px;
  }
  .tile {
    font-size: 20px;
  }
  .game-header .h1 {
    font-size: 16px;
  }
  .score-value {
    font-size: 18px;
  }
}