:root {
  --bg: #fffbe9;
  --cell: #eaeaea;
  --text: #222;
}

body.dark {
  --bg: #181818;
  --cell: #2a2a2a;
  --text: #f3f3f3;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* or center if you want everything fully centered */
  transition: background 0.3s, color 0.3s;
  text-align: center;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}


h1 {
  margin-top: 10px;
}

.game-container {
  width: fit-content;
  margin: 20px auto;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(5, 60px);
  grid-template-rows: repeat(6, 60px);
  gap: 4px;
  margin: 20px auto;
  cursor: pointer;
}

.cell {
  width: 60px;
  height: 60px;
  background-color: var(--cell);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  transition: transform 0.2s ease;
}

.cell.merge-anim {
  animation: mergeBounce 0.4s;
}

@keyframes mergeBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.fruit-1 { background: #ff9999; }
.fruit-2 { background: #ffd966; }
.fruit-3 { background: #b6fcb6; }
.fruit-4 { background: #a0d8ef; }
.fruit-5 { background: #dabfff; }

.info {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 16px;
  margin-bottom: 10px;
}

.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  font-size: 20px;
}

body.dark .overlay {
  background: rgba(0, 0, 0, 0.9);
}

.overlay.hidden,
.game-container.hidden {
  display: none;
}

button {
  padding: 8px 18px;
  background-color: #007bff;
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  margin-top: 10px;
}
