:root {
	--bg: #0f0d1a;
	--bg-2: #1a1630;
	--ink: #f4f1ff;
	--muted: #b9b2d6;
	--accent: #ffb3d9;
	--accent-2: #7ee7ff;
	--border: rgba(255, 255, 255, 0.14);
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	min-height: 100%;
	overflow: hidden;
	background:
		radial-gradient(1000px 600px at 15% -10%, #37256b 0%, transparent 60%),
		radial-gradient(900px 500px at 110% 110%, #10425c 0%, transparent 55%),
		linear-gradient(160deg, var(--bg), var(--bg-2));
	color: var(--ink);
	font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
	line-height: 1.6;
}

.shake-root {
	position: relative;
	min-height: 100vh;
	min-height: 100dvh;
}

/* Screen shake driven by JS-set custom properties during the explosion. */
.shake-root.shaking {
	animation: shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
	10%,
	90% {
		transform: translate(-4px, 2px) rotate(-0.4deg);
	}
	30%,
	70% {
		transform: translate(8px, -6px) rotate(0.8deg);
	}
	50% {
		transform: translate(-10px, 4px) rotate(-1deg);
	}
	100% {
		transform: none;
	}
}

.page {
	position: relative;
	z-index: 2;
	max-width: 46rem;
	margin: 0 auto;
	padding: clamp(3.5rem, 10vh, 7rem) 1.25rem 4rem;
	display: grid;
	gap: 2.5rem;
	pointer-events: none;
}

.card {
	pointer-events: auto;
	padding: 0;
	transition:
		transform 900ms cubic-bezier(0.2, 0.8, 0.2, 1),
		opacity 900ms ease;
}

/* Debris pieces are thrown by CSS custom properties set at explosion time. */
.card.debris {
	transform: translate(var(--dx, 0px), var(--dy, 0px)) rotate(var(--dr, 0deg))
		scale(var(--ds, 1));
	opacity: 0;
}

h1,
h2 {
	margin: 0 0 0.5rem;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

h1 {
	font-size: clamp(2rem, 6vw, 3rem);
	color: var(--accent);
}

h2 {
	font-size: clamp(1.25rem, 3.5vw, 1.6rem);
}

p {
	margin: 0 0 0.75rem;
	color: var(--muted);
}

p:last-child {
	margin-bottom: 0;
}

a {
	color: var(--accent-2);
	text-underline-offset: 3px;
}

a:hover {
	color: var(--accent);
}

.hint {
	color: var(--accent);
	font-weight: 600;
}

.cat-layer,
.particles {
	position: fixed;
	inset: 0;
	z-index: 3;
	pointer-events: none;
}

.particles {
	z-index: 4;
}

.cat {
	position: absolute;
	top: 0;
	left: 0;
	width: 84px;
	height: 84px;
	will-change: transform;
	filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

/* Wobble lives on an inner wrapper so the movement transform is never clobbered. */
.cat-inner {
	width: 100%;
	height: 100%;
	transform-origin: 50% 50%;
}

.cat.spawning .cat-inner {
	animation: pop-in 900ms ease-out both;
}

@keyframes pop-in {
	from {
		opacity: 0;
		transform: scale(0.2);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.hud,
.banner {
	position: fixed;
	z-index: 6;
	pointer-events: none;
}

.hud {
	top: 1rem;
	right: 1rem;
	display: flex;
	gap: 0.75rem;
	padding: 0.5rem 0.9rem;
	font-variant-numeric: tabular-nums;
	font-size: 0.95rem;
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--border);
	border-radius: 999px;
}

.hud-item strong {
	color: var(--accent);
}

.banner {
	left: 50%;
	bottom: 2rem;
	transform: translateX(-50%);
	padding: 0.5rem 1.1rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.5);
	border: 1px solid var(--border);
	font-weight: 600;
	opacity: 0;
	transition: opacity 200ms ease;
	text-align: center;
}

.banner.visible {
	opacity: 1;
}

.overlay {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	padding: 1.25rem;
	background: rgba(6, 4, 16, 0.72);
	backdrop-filter: blur(4px);
}

.overlay[hidden] {
	display: none;
}

.overlay-box {
	max-width: 26rem;
	text-align: center;
	padding: 2rem;
	border-radius: 20px;
	border: 1px solid var(--border);
	background: linear-gradient(160deg, #241c46, #12213a);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.score-line {
	color: var(--ink);
}

.score-line strong {
	color: var(--accent);
	font-variant-numeric: tabular-nums;
}

button {
	margin-top: 0.5rem;
	padding: 0.7rem 1.4rem;
	font: inherit;
	font-weight: 700;
	color: #241033;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

button:hover {
	filter: brightness(1.08);
}

button:focus-visible {
	outline: 3px solid var(--accent-2);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.shake-root.shaking {
		animation: none;
	}

	.card {
		transition: opacity 400ms ease;
	}

	.card.debris {
		transform: none;
	}

	.cat.spawning .cat-inner {
		animation: none;
	}
}
