:root {
	--bg: #fdf5ec;
	--sun: #ffd074;
	--leaf: #8cc084;
	--sky: #9ed7ff;
	--ink: #2c2620;
	--card: #fffaf5;
	--shadow: rgba(137, 105, 68, 0.18);
	--accent: #ff8b6a;
	--accent-dark: #ff7a52;
	--focus: rgba(66, 153, 225, 0.65);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	height: 100%;
}

body {
	margin: 0;
	font-family: 'Nunito', 'Segoe UI', sans-serif;
	color: var(--ink);
	background-image: radial-gradient(circle at 12% 20%, rgba(255, 208, 116, 0.85), transparent 45%),
		radial-gradient(circle at 82% 10%, rgba(158, 215, 255, 0.7), transparent 42%),
		radial-gradient(circle at 70% 80%, rgba(140, 192, 132, 0.4), transparent 35%),
		linear-gradient(135deg, #fdf5ec 0%, #fbe3cb 40%, #fefbf4 100%);
	min-height: 100vh;
	min-height: 100dvh;
	background-repeat: no-repeat;
	background-size: cover;
	line-height: 1.5;
}

body * {
	font-family: inherit;
}

.app-shell {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	padding: clamp(0.85rem, 4vw, 2rem);
}

.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: clamp(0.85rem, 2vw, 1.2rem) clamp(1rem, 2.5vw, 1.35rem);
	background: rgba(255, 255, 255, 0.85);
	border-radius: 1.6rem;
	box-shadow: 0 20px 45px rgba(147, 98, 42, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.4);
	backdrop-filter: blur(10px);
}

.brand {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.eyebrow {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.22em;
	color: rgba(44, 38, 32, 0.6);
	margin: 0;
}

h1 {
	margin: 0;
	font-family: 'Baloo 2', cursive;
	font-weight: 600;
	font-size: clamp(1.5rem, 4vw, 2.35rem);
	color: var(--ink);
}

.toolbar-actions {
	display: flex;
	gap: 0.65rem;
	flex-wrap: wrap;
}

#goBack {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.6rem 1.1rem;
	border-radius: 999px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	background: linear-gradient(180deg, #ff6b6b 0%, #e03131 100%);
	color: #fff;
	font-weight: 700;
	font-size: 0.95rem;
	text-decoration: none;
	box-shadow: 0 12px 24px rgba(224, 49, 49, 0.32);
	text-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
	transition: transform 200ms ease, box-shadow 200ms ease;
	cursor: pointer;
}

#goBack:hover,
#goBack:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 16px 30px rgba(224, 49, 49, 0.38);
	outline: 3px solid rgba(255, 107, 107, 0.3);
	outline-offset: 2px;
}

#goBack:active {
	transform: translateY(0);
}

button {
	border: none;
	background: var(--accent);
	color: #fff7f1;
	border-radius: 999px;
	padding: 0.6rem 1.1rem;
	font-weight: 600;
	font-size: 0.95rem;
	box-shadow: 0 12px 24px rgba(255, 139, 106, 0.3);
	transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
	cursor: pointer;
}

button:hover,
button:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 16px 30px rgba(255, 139, 106, 0.35);
	outline: none;
}

button:focus-visible {
	box-shadow: 0 0 0 3px var(--focus), 0 16px 30px rgba(255, 139, 106, 0.35);
}

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

button[aria-pressed='true'] {
	background: var(--accent-dark);
}

.instruction-panel {
	margin-top: 1rem;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 1.4rem;
	padding: 1rem 1.35rem;
	box-shadow: 0 15px 35px rgba(140, 110, 76, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.7);
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--ink);
}

.board {
	margin-top: 1.25rem;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.card-grid {
	width: min(900px, 100%);
	display: grid;
	gap: clamp(1rem, 3vw, 1.75rem);
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.object-card {
	position: relative;
	background: var(--card);
	border-radius: 1.8rem;
	padding: 1.35rem;
	box-shadow: 0 25px 40px var(--shadow);
	border: 2px solid rgba(255, 255, 255, 0.7);
	min-height: 200px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	transition: transform 250ms ease, box-shadow 250ms ease, border-color 200ms ease;
	cursor: pointer;
}

.object-card:focus-visible {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--focus), 0 25px 40px var(--shadow);
}

.object-card[data-state='revealed'] {
	transform: translateY(-6px) scale(1.02);
	box-shadow: 0 30px 50px rgba(138, 107, 78, 0.28);
}

.object-card[data-correct='true'] {
	border-color: var(--leaf);
	background: linear-gradient(160deg, #fffef9, rgba(140, 192, 132, 0.15));
}

.object-card[data-correct='false'][data-state='revealed'] {
	border-color: #f8b4b0;
}

.object-card.shake {
	animation: card-shake 400ms ease;
}

.object-emoji {
	font-size: clamp(3rem, 9vw, 4.5rem);
	line-height: 1;
	margin-bottom: 0.6rem;
}

.object-label {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--ink);
}

.object-hint {
	margin-top: 0.2rem;
	font-size: 0.95rem;
	color: rgba(44, 38, 32, 0.65);
}

#confettiLayer {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 3;
}

.confetti-piece {
	position: absolute;
	width: 12px;
	height: 20px;
	border-radius: 999px;
	opacity: 0.9;
	animation: confetti-fall var(--duration, 1800ms) linear forwards;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

@keyframes confetti-fall {
	0% {
		opacity: 0;
		transform: translate3d(var(--x, 0), -10vh, 0) rotate(0deg) scale(0.8);
	}
	10% {
		opacity: 1;
	}
	100% {
		opacity: 0;
		transform: translate3d(var(--x, 0), 110vh, 0) rotate(var(--spin, 540deg)) scale(1);
	}
}

@keyframes card-shake {
	0%,
	100% {
		transform: translateX(0);
	}
	20% {
		transform: translateX(-8px);
	}
	40% {
		transform: translateX(8px);
	}
	60% {
		transform: translateX(-5px);
	}
	80% {
		transform: translateX(5px);
	}
}

@media (max-width: 720px) {
	.app-shell {
		padding: 0.95rem;
	}

	.toolbar {
		flex-direction: column;
		align-items: flex-start;
	}

	.toolbar-actions {
		width: 100%;
		justify-content: space-between;
	}

	button {
		flex: 1 1 30%;
		text-align: center;
	}

	#goBack {
		flex: 1 1 30%;
		text-align: center;
	}

	.instruction-panel {
		font-size: 1rem;
		padding: 0.9rem 1.1rem;
	}

	.object-card {
		min-height: 160px;
		padding: 1rem;
	}

	.object-emoji {
		font-size: 3rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}
