* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1px;
}

.container {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 600px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1px;
  flex-wrap: wrap;
  gap: 10px;
}

h1 {
  color: #776e65;
  font-size: 3em;
  font-weight: bold;
}

.score-container {
  display: flex;
  gap: 10px;
}

.score-box {
  background: #bbada0;
  color: white;
  padding: 15px 25px;
  border-radius: 10px;
  text-align: center;
}

.score-box .label {
  font-size: 0.8em;
  text-transform: uppercase;
  font-weight: bold;
}

.score-box .value {
  font-size: 1.5em;
  font-weight: bold;
  margin-top: 5px;
}

.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.controls label {
  color: #776e65;
  font-weight: bold;
}

.controls input {
  padding: 8px;
  border: 2px solid #bbada0;
  border-radius: 5px;
  width: 60px;
  font-size: 1em;
}

button {
  background: #8f7a66;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  background: #9f8a76;
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

.game-board {
  background: #bbada0;
  border-radius: 10px;
  padding: 15px;
  position: relative;
  margin: 0 auto;
}

.grid-container {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.tile {
  background: #cdc1b4;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2em;
  font-weight: bold;
  color: #776e65;
  transition: all 0.15s ease-in-out;
}

.tile[data-value="2"] {
  background: #eee4da;
  color: #776e65;
}
.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;
  font-size: 1.8em;
}
.tile[data-value="256"] {
  background: #edcc61;
  color: #f9f6f2;
  font-size: 1.8em;
}
.tile[data-value="512"] {
  background: #edc850;
  color: #f9f6f2;
  font-size: 1.8em;
}
.tile[data-value="1024"] {
  background: #edc53f;
  color: #f9f6f2;
  font-size: 1.5em;
}
.tile[data-value="2048"] {
  background: #edc22e;
  color: #f9f6f2;
  font-size: 1.5em;
}

.game-over {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(238, 228, 218, 0.9);
  border-radius: 10px;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 20px;
}

.game-over.show {
  display: flex;
}

.game-over h2 {
  color: #776e65;
  font-size: 2.5em;
}

.instructions {
  margin-top: 20px;
  color: #776e65;
  text-align: center;
}

.instructions p {
  margin: 5px 0;
}

@media (max-width: 600px) {
  h1 {
    font-size: 2em;
  }
  .tile {
    font-size: 1.5em;
  }
}
