* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: system-ui, sans-serif;
  background: #faf8ef;
  color: #776e65;
  text-align: center;
}

:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.hud {
  width: 100%;
  padding: 0.75rem;
  background: #edc22e;
  color: #f9f6f2;
}

.hud h1 {
  margin: 0;
  font-size: 1.25rem;
}

.hud__score {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 72px));
  grid-template-rows: repeat(4, minmax(56px, 72px));
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #bbada0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #cdc1b4;
  color: #776e65;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile.t-2 { background: #eee4da; }
.tile.t-4 { background: #ede0c8; }
.tile.t-8 { background: #f2b179; color: #f9f6f2; }
.tile.t-16 { background: #f59563; color: #f9f6f2; }
.tile.t-32 { background: #f67c5f; color: #f9f6f2; }
.tile.t-64 { background: #f65e3b; color: #f9f6f2; }
.tile.t-128 { background: #edcf72; color: #f9f6f2; font-size: 1.1rem; }
.tile.t-256 { background: #edcc61; color: #f9f6f2; font-size: 1.1rem; }
.tile.t-512 { background: #edc850; color: #f9f6f2; font-size: 1.1rem; }
.tile.t-1024 { background: #edc53f; color: #f9f6f2; font-size: 1rem; }
.tile.t-2048 { background: #edc22e; color: #f9f6f2; font-size: 1rem; }
.tile.t-super { background: #3c3a32; color: #f9f6f2; font-size: 0.95rem; }

.status {
  min-height: 1.5rem;
  margin: 0;
  font-weight: 600;
}

.button {
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 8px;
  background: #8f7a66;
  color: #f9f6f2;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.button:hover {
  background: #7f6a58;
}

.hint {
  margin: 0;
  color: #a29382;
  font-size: 0.875rem;
}
