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

body {
	background: #faf8ef;
	font-family: Arial, sans-serif;
	display: flex;
	justify-content: center;
	padding: 40px 16px;
}

.container {
	width: 100%;
	max-width: 480px;
}

.header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

h1 {
	font-size: 64px;
	font-weight: bold;
	color: #776e65;
}

.scores {
	display: flex;
	gap: 8px;
}

.score-box {
	background: #bbada0;
	border-radius: 6px;
	padding: 8px 16px;
	text-align: center;
	min-width: 80px;
}

.score-label {
	display: block;
	font-size: 11px;
	color: #eee4da;
	font-weight: bold;
}
.score-value {
	display: block;
	font-size: 22px;
	font-weight: bold;
	color: white;
}

.toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

.toolbar p {
	font-size: 14px;
	color: #776e65;
}

#btn-restart {
	background: #8f7a66;
	color: white;
	border: none;
	border-radius: 6px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
}

#btn-restart:hover {
	background: #776e65;
}

.grid {
	background: #bbada0;
	border-radius: 8px;
	padding: 12px;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}

.cell {
	background: #cdc1b4;
	border-radius: 6px;
	aspect-ratio: 1;
}

.tile {
	width: 100%;
	height: 100%;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	font-weight: bold;
}

/* Couleurs des tuiles */
.tile-2 {
	background: #eee4da;
	color: #776e65;
}
.tile-4 {
	background: #ede0c8;
	color: #776e65;
}
.tile-8 {
	background: #f2b179;
	color: white;
}
.tile-16 {
	background: #f59563;
	color: white;
}
.tile-32 {
	background: #f67c5f;
	color: white;
}
.tile-64 {
	background: #f65e3b;
	color: white;
}
.tile-128 {
	background: #edcf72;
	color: white;
	font-size: 26px;
}
.tile-256 {
	background: #edcc61;
	color: white;
	font-size: 26px;
}
.tile-512 {
	background: #edc850;
	color: white;
	font-size: 26px;
}
.tile-1024 {
	background: #edc53f;
	color: white;
	font-size: 22px;
}
.tile-2048 {
	background: #edc22e;
	color: white;
	font-size: 22px;
}

.overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.message {
	background: #f9f6f2;
	border-radius: 12px;
	padding: 40px;
	text-align: center;
	max-width: 300px;
	width: 90%;
}

.message p {
	font-size: 28px;
	font-weight: bold;
	color: #776e65;
	margin-bottom: 8px;
}

.message span {
	display: block;
	font-size: 14px;
	color: #bbada0;
	margin-bottom: 24px;
}

.message button {
	background: #8f7a66;
	color: white;
	border: none;
	border-radius: 6px;
	padding: 10px 24px;
	font-size: 16px;
	font-weight: bold;
	cursor: pointer;
}

.message button:hover {
	background: #776e65;
}

@keyframes pop {
	0% {
		transform: scale(0);
	}
	60% {
		transform: scale(1.1);
	}
	100% {
		transform: scale(1);
	}
}

@keyframes slide-in {
	0% {
		opacity: 0;
		transform: scale(0.9) translateY(4px);
	}
	100% {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.tile {
	animation: slide-in 0.08s ease-out;
	transition: background 0.1s ease;
}

.tile-new {
	animation: pop 0.15s ease-out;
}
