: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;
}

.pad-area {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: clamp(1rem, 3vw, 2rem);
	padding: clamp(4rem, 10vh, 6rem) clamp(1rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem);
	align-items: stretch;
	justify-items: stretch;
	touch-action: none;
	user-select: none;
}

.sound-pad {
	position: relative;
	border-radius: 2rem;
	cursor: pointer;
	touch-action: none;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 2px 4px rgba(255, 255, 255, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
}

.sound-pad::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.35), transparent 60%);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.sound-pad:active,
.sound-pad.active {
	transform: scale(0.96);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sound-pad.active::before {
	opacity: 1;
}

.ripple {
	position: absolute;
	border-radius: 50%;
	transform: scale(0);
	animation: ripple-out 600ms ease-out forwards;
	pointer-events: none;
	background: rgba(255, 255, 255, 0.45);
}

@keyframes ripple-out {
	0% {
		transform: scale(0);
		opacity: 1;
	}
	100% {
		transform: scale(2.5);
		opacity: 0;
	}
}

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

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

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

	.pad-area {
		position: static;
		flex: 1;
		width: 100%;
		padding-top: 5rem;
	}

	.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;
	}

	.pad-area {
		grid-template-columns: repeat(2, 1fr);
	}
}
