.row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.cell {
  background: var(--bg-sec);
  border-radius: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: clamp(1rem, 2.5vw, 2rem);
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  aspect-ratio: 1 / 1;
}

/* Tile colors */
.tile2 {
  background: #eee4da;
  color: #776e65;
}
.tile4 {
  background: #ede0c8;
  color: #776e65;
}
.tile8 {
  background: #f2b179;
  color: #f9f6f2;
}
.tile16 {
  background: #f59563;
  color: #f9f6f2;
}
.tile32 {
  background: #f67c5f;
  color: #f9f6f2;
}
.tile64 {
  background: #f65e3b;
  color: #f9f6f2;
}
.tile128 {
  background: #edcf72;
  color: #f9f6f2;
  font-size: clamp(1rem, 2vw, 1.2rem);
}
.tile256 {
  background: #edcc61;
  color: #f9f6f2;
  font-size: clamp(1rem, 2vw, 1.2rem);
}
.tile512 {
  background: #edc850;
  color: #f9f6f2;
  font-size: clamp(1rem, 2vw, 1.2rem);
}
.tile1024 {
  background: #edc53f;
  color: #f9f6f2;
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}
.tile2048 {
  background: #edc22e;
  color: #f9f6f2;
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}

.gameOver {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6); /* dim background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.gameOverContent {
  background: var(--bg-sec);
  padding: 2rem 3rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  max-width: 90%;
}

.gameOverContent h2 {
  color: #edc22e;
  font-weight: bold;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1rem;
}

.gameOverContent p {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  margin-bottom: 1.5rem;
  color: var(--txt);
}

.gameOverContent button {
  background: #edc22e;
  color: #fff;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  transition: background 0.2s;
}
.gameOverContent button:hover {
  background: var(--bg-ter);
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .gameContainer {
    width: calc(100% - 60px);
    margin-left: 60px;
  }

  .board {
    width: 95vw;
    padding: 0.8rem;
    gap: 0.4rem;
  }
  .row {
    gap: 0.4rem;
  }
  .cell {
    font-size: clamp(0.9rem, 4vw, 1.5rem);
  }
}

@media (max-width: 640px) {
  .gameContainer {
    width: calc(100% - 50px);
    margin-left: 50px;
  }

  .game2048 {
    padding-top: 60px;
  }
  nav h1 {
    font-size: 1.8rem;
  }
  nav button {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .scoreContainer {
    flex-direction: column;
    gap: 0.5rem;
  }
}
