/* Vibrant & Cyber-Styled 2048 UI */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px;
}

.game-wrapper {
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

h1 {
  font-size: 2.6rem;
  font-weight: bold;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.instructions {
  font-size: 1rem;
  color: #bdc3c7;
  margin-bottom: 20px;
}

.game-container {
  background: #1e272e;
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto 20px auto;
  box-shadow: inset 0 0 12px #222;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  height: 100%;
  width: 100%;
}

.tile {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.6rem;
  color: #fff;
  user-select: none;
  aspect-ratio: 1 / 1;
  transition: transform 0.2s ease, background-color 0.3s ease;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Bright Neon-Like Tile Colors */
.tile-2    { background-color: #00cec9; }
.tile-4    { background-color: #0984e3; }
.tile-8    { background-color: #6c5ce7; }
.tile-16   { background-color: #a29bfe; }
.tile-32   { background-color: #ffeaa7; color: #2d3436; }
.tile-64   { background-color: #fab1a0; color: #2d3436; }
.tile-128  { background-color: #ff7675; font-size: 1.4rem; }
.tile-256  { background-color: #fd79a8; font-size: 1.4rem; }
.tile-512  { background-color: #e17055; font-size: 1.4rem; }
.tile-1024 { background-color: #ff9f43; font-size: 1.3rem; color: #2d3436; }
.tile-2048 { background-color: #fbc531; font-size: 1.2rem; color: #2d3436; }

.info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.1rem;
  color: #f1f2f6;
  margin-top: 10px;
}

#restart-btn {
  background: #00cec9;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  color: #2d3436;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

#restart-btn:hover {
  background: #00b894;
  color: white;
  box-shadow: 0 0 10px #00b894;
}

/* Overlay for Game Over or Install Prompt */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: #2d3436;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

.overlay-content button {
  margin-top: 15px;
  padding: 10px 20px;
  background: #fbc531;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

.overlay-content button:hover {
  background: #e1b12c;
  color: #222;
}

/* Responsive UI */
@media (max-width: 450px) {
  .game-wrapper {
    padding: 10px;
  }
  h1 {
    font-size: 2rem;
  }
  .instructions {
    font-size: 0.9rem;
  }
  #restart-btn {
    padding: 8px 14px;
    font-size: 1rem;
  }
}
