:root {
	--surface: rgba(255, 255, 255, 0.85);
	--border: rgba(15, 23, 42, 0.15);
	--ink: #0b132b;
	--accent: #ff6cd9;
	--gradient: radial-gradient(circle at 20% 20%, #4d2cda, transparent 60%),
		radial-gradient(circle at 80% 0%, #ff8e4d, transparent 50%),
		radial-gradient(circle at 10% 80%, #00c6ff, transparent 55%),
		radial-gradient(circle at 90% 90%, #f72585, transparent 65%),
		linear-gradient(135deg, #050714, #111237);
}

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

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

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
	background-image: var(--gradient);
	color: var(--ink);
	overflow-x: hidden;
	overflow-y: auto;
}

.app-shell {
	position: relative;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	padding: 0;
}

.toolbar {
	position: absolute;
	top: clamp(0.5rem, 1.5vw, 0.9rem);
	left: clamp(0.5rem, 1.5vw, 0.9rem);
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.45rem 0.55rem;
	background: rgba(255, 255, 255, 0.64);
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 999px;
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
	backdrop-filter: blur(14px);
	z-index: 2;
	max-width: calc(100vw - 1rem);
}

.toolbar-actions {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	flex-wrap: wrap;
}

h1 {
	font-size: clamp(0.72rem, 1.7vw, 0.9rem);
	line-height: 1.1;
	margin: 0;
	color: #071224;
	font-weight: 600;
}

button {
	font: inherit;
	font-weight: 600;
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0.5rem 0.85rem;
	font-size: 0.78rem;
	line-height: 1;
	box-shadow: 0 6px 16px rgba(247, 37, 133, 0.26);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#goBack {
	background: linear-gradient(180deg, #ff6b6b 0%, #e03131 100%);
	color: #fff;
	border: 2px solid rgba(255, 255, 255, 0.4);
	box-shadow: 0 8px 18px rgba(224, 49, 49, 0.32);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	text-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
}

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

#goBack:active {
	transform: translateY(1px);
}

button:hover,
button:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(247, 37, 133, 0.34);
	outline: none;
}

button:active {
	transform: translateY(1px);
}

button:disabled {
	opacity: 0.6;
	cursor: progress;
	transform: none;
}

.play-area {
	position: absolute;
	inset: 0;
	overflow: hidden;
	touch-action: none;
	user-select: none;
}

.balloon-wrap {
	position: absolute;
	cursor: pointer;
	touch-action: none;
	animation: rise-up var(--rise-duration, 10s) linear forwards;
}

@keyframes rise-up {
	0% {
		transform: translateY(0);
	}
	100% {
		transform: translateY(-120vh);
	}
}

.balloon {
	width: var(--size, 100px);
	height: calc(var(--size, 100px) * 1.2);
	border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
	background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85), var(--color, #ff4d9d));
	box-shadow: inset -6px -10px 16px rgba(0, 0, 0, 0.15), 0 6px 16px rgba(0, 0, 0, 0.2);
	position: relative;
}

.balloon::after {
	content: '';
	position: absolute;
	bottom: -12px;
	left: 50%;
	transform: translateX(-50%);
	width: 2px;
	height: 60px;
	background: rgba(255, 255, 255, 0.7);
}

.balloon.pop {
	animation: balloon-pop 250ms ease-out forwards;
}

@keyframes balloon-pop {
	0% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.25);
		opacity: 0.8;
	}
	100% {
		transform: scale(0);
		opacity: 0;
	}
}

.particle {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
	animation: particle-fly 600ms ease-out forwards;
}

@keyframes particle-fly {
	0% {
		transform: translate(0, 0) scale(1);
		opacity: 1;
	}
	100% {
		transform: translate(var(--dx), var(--dy)) scale(0);
		opacity: 0;
	}
}

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

.confetti-piece {
	position: absolute;
	top: -10vh;
	width: 14px;
	height: 22px;
	border-radius: 999px;
	opacity: 0.95;
	animation: confetti-fall var(--duration, 1800ms) linear forwards;
	transform: translate3d(0, 0, 0) rotate(0deg);
}

@keyframes confetti-fall {
	0% {
		opacity: 0;
		transform: translate3d(0, -10vh, 0) rotate(0deg) scale(0.7);
	}
	10% {
		opacity: 1;
	}
	100% {
		opacity: 0;
		transform: translate3d(var(--drift, 0px), 115vh, 0) rotate(var(--spin, 720deg)) scale(1);
	}
}

@media (max-width: 900px) {
	body {
		min-height: 100vh;
	}

	.app-shell {
		display: flex;
		flex-direction: column;
		gap: 1rem;
		min-height: 100vh;
		padding: 0;
	}

	.play-area {
		position: static;
		flex: 1;
		width: 100%;
	}

	.toolbar {
		position: fixed;
		top: 0.85rem;
		left: 0.85rem;
		right: auto;
		width: auto;
		max-width: calc(100vw - 1.5rem);
		flex-wrap: nowrap;
		gap: 0.4rem;
		padding: 0.45rem 0.65rem;
	}

	.toolbar-actions {
		width: auto;
		flex-wrap: nowrap;
		gap: 0.35rem;
	}

	button {
		flex: 0 0 auto;
		min-width: auto;
	}
}

@media (max-width: 560px) {
	h1 {
		font-size: 1.05rem;
	}

	button {
		flex: 1 1 auto;
		min-width: auto;
		padding: 0.45rem 0.65rem;
		font-size: 0.72rem;
	}

	.toolbar {
		border-radius: 1rem;
		gap: 0.4rem;
		flex-wrap: wrap;
	}

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