/* Reset CSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body Styling */
body {
  font-family: 'Oswald', sans-serif;
  background: linear-gradient(180deg, #2f6d9b, #afcffe);
  color: #333;
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Centering Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
header {
  padding: 20px 0;
}

.logo-container {
  text-align: center;
}

.logo {
  font-size: 36px;
  color: #fff;
  text-decoration: none;
}

/* Desktop Navigation */
.desktop-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.desktop-nav a {
  font-size: 16px;
  color: #fff;
  text-decoration: none;
}

.desktop-nav a:hover {
  text-decoration: underline;
}

/* Hamburger Menu for Mobile */
.hamburger-menu {
  display: none;
  position: relative;
}

.hamburger-icon {
  font-size: 30px;
  cursor: pointer;
  position: absolute;
  top: 15px;
  left: 15px;
  color: #fff;
}

.hamburger-links {
  display: none;
  flex-direction: column;
  background-color: #003366;
  padding: 10px;
  position: absolute;
  top: 50px;
  left: 0;
  width: 200px;
  z-index: 99
}

.hamburger-links.active {
  display: flex;
}

.hamburger-links a {
  color: #fff;
  padding: 10px;
  text-decoration: none;
}

.hamburger-links a:hover {
  background-color: #2f6d9b;
}

/* Game Area Box */
.game-area {
  position: relative;
  background-color: #fff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 95%;
  margin: 20px auto;
}

/* Game Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.scores {
  display: flex;
  gap: 10px;
}

.score-box {
  background-color: #c0c0c0;
  color: #776e65;
  border: 2px solid white;
  border-radius: 3px;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
}

.score-label {
  font-size: 13px;
  text-transform: uppercase;
}

#score, #best-score {
  font-size: 20px;
}

#new-game {
  background-color: #c0c0c0;
  color: #776e65;
  border: 2px solid white;
  padding: 10px 15px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 3px;
  cursor: pointer;
}

/* Game Container */
.game-container {
  background-color: #bbada0;
  border-radius: 6px;
  padding: 15px;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 15px;
  background-color: #bbada0;
}

.grid-cell {
  width: 100px;
  height: 100px;
  background-color: rgba(238, 228, 218, 0.35);
  border-radius: 3px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 35px;
  font-weight: bold;
}

/* Tile Colors */
.tile-2 { background: linear-gradient(135deg, #a1e7ff, #64b5f6); color: #776e65; }
.tile-4 { background: linear-gradient(135deg, #81d4fa, #42a5f5); color: #776e65; }
.tile-8 { background: linear-gradient(135deg, #4caf50, #2196f3); color: #f9f6f2; }
.tile-16 { background: linear-gradient(135deg, #43a047, #1e88e5); color: #f9f6f2; }
.tile-32 { background: linear-gradient(135deg, #388e3c, #1976d2); color: #f9f6f2; }
.tile-64 { background: linear-gradient(135deg, #2e7d32, #1565c0); color: #f9f6f2; }
.tile-128 { background: linear-gradient(135deg, #1b5e20, #0d47a1); color: #f9f6f2; }
.tile-256 { background: linear-gradient(135deg, #33691e, #0277bd); color: #f9f6f2; }
.tile-512 { background: linear-gradient(135deg, #1a237e, #006064); color: #f9f6f2; }
.tile-1024 { background: linear-gradient(135deg, #311b92, #00838f); color: #f9f6f2; }
.tile-2048 { background: linear-gradient(135deg, #4a148c, #006064); color: #f9f6f2; }

/* How to Play Section */
.how-to-play {
  background: linear-gradient(135deg, #d4fc79, #96e6a1);
  color: #333;
  padding: 40px;
  border-radius: 10px;
  max-width: 744px;
  width: 97%;
  margin: 20px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.how-to-play h2 {
  margin-bottom: 20px;
  color: #333;
}

.how-to-play p {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 15px;
}

/* Footer */
footer {
  background: black;
  color: white;
  padding: 40px 0 0 0;
  width: 100%;
  margin-top: auto;
}

.footer-content-container {
  max-width: 900px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.footer-column {
  display: flex;
  flex-direction: column;
}

.footer-logo {
  font-size: 24px;
  color: white;
  text-decoration: none;
}

.footer-column h4 {
  margin-bottom: 10px;
}

.footer-column a {
  color: white;
  text-decoration: none;
  margin-bottom: 8px;
}

.footer-column a:hover {
  text-decoration: underline;
}

/* Copyright Text */
.copyright {
  text-align: center;
  padding: 20px 0;
  font-size: 14px;
  color: #fff;
  background: black;
  margin-top: 20px;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
  
  .hamburger-menu {
    display: block;
  }
  
  .game-area {
    padding: 10px;
  }

  .grid-container {
    gap: 10px;
  }

  .grid-cell {
    width: auto;
    height: auto;
    aspect-ratio: 1 / 1;
    font-size: 24px;
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .game-area {
    padding: 5px;
  }

  .grid-container {
    gap: 5px;
  }

  .grid-cell {
    font-size: 20px;
  }
}

/* Prevent unwanted touch actions on the grid container */
.grid-container {
  touch-action: none;
}