:root {
	--ink: #f8fbff;
	--panel: rgba(15, 23, 42, 0.82);
	--line: rgba(255, 255, 255, 0.16);
	--gold: #ffd54f;
	--orange: #ff7a18;
	--pink: #ff4fa3;
	--blue: #63d5ff;
	--shadow: 0 22px 60px rgba(4, 10, 24, 0.32);
}

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

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

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: Nunito, system-ui, sans-serif;
	color: var(--ink);
	background:
		radial-gradient(circle at 14% 12%, rgba(255, 213, 79, 0.34), transparent 24%),
		radial-gradient(circle at 88% 16%, rgba(99, 213, 255, 0.25), transparent 24%),
		linear-gradient(180deg, #63c8ff 0%, #8fe3ff 45%, #fdf1c9 100%);
	overflow-x: hidden;
	touch-action: manipulation;
}

button, a { font: inherit; }

.app-shell {
	min-height: 100vh;
	padding: clamp(0.55rem, 1.4vw, 1rem);
}

.topbar,
.canvas-panel,
.controls-card {
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
	backdrop-filter: blur(14px);
}

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: 0.8rem 1rem;
	border-radius: 1.5rem;
	background: rgba(9, 18, 36, 0.74);
}

.eyebrow,
.subtitle,
.hud-chip span,
.touch-zone,
.controls-card p {
	margin: 0;
}

.eyebrow {
	color: var(--gold);
	font-size: 0.76rem;
	font-weight: 900;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	margin-bottom: 0.18rem;
}

h1,
h2 {
	margin: 0;
	font-family: Fredoka, system-ui, sans-serif;
}

h1 {
	font-size: clamp(1.8rem, 4vw, 3rem);
	line-height: 0.95;
	text-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
}

.subtitle {
	margin-top: 0.35rem;
	color: rgba(248, 251, 255, 0.86);
	font-size: 0.98rem;
}

.version-pill {
	display: inline-flex;
	gap: 0.25rem;
	margin-top: 0.45rem;
	padding: 0.22rem 0.55rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.24);
	color: rgba(248, 251, 255, 0.92);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.04em;
}

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

#goBack,
button {
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	padding: 0.68rem 1rem;
	background: linear-gradient(135deg, #ff7a18, #ff4fa3);
	color: var(--ink);
	font-weight: 900;
	text-decoration: none;
	cursor: pointer;
}

#goBack:hover,
#goBack:focus-visible,
button:hover,
button:focus-visible {
	outline: none;
	transform: translateY(-1px);
	border-color: rgba(255, 255, 255, 0.56);
}

.game-shell {
	max-width: 1180px;
	margin: 0.55rem auto 0;
	display: grid;
	gap: 0.6rem;
}

.hud-chip {
	border-radius: 1rem;
	padding: 0.55rem 0.7rem;
	background: rgba(255, 255, 255, 0.58);
	border: 1px solid rgba(18, 32, 58, 0.12);
	min-width: 0;
	color: #12203a;
	backdrop-filter: blur(8px);
}

.overlay-chip {
	position: absolute;
	top: 0.95rem;
	z-index: 3;
	min-width: 7rem;
	pointer-events: none;
}

.stars-chip { right: 0.95rem; text-align: right; }
.boost-chip { left: 0.95rem; min-width: 8.5rem; }

.boost-bar {
	margin-top: 0.3rem;
	height: 0.55rem;
	border-radius: 999px;
	background: rgba(18, 32, 58, 0.18);
	overflow: hidden;
	border: 1px solid rgba(18, 32, 58, 0.12);
}

#boostFill {
	height: 100%;
	width: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, #ff7a18, #ff4fa3);
	transition: width 0.08s linear, opacity 0.2s ease;
}

.boost-chip.is-empty #boostFill { opacity: 0.32; }

.hud-chip span {
	display: block;
	font-size: 0.7rem;
	font-weight: 900;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #4b5563;
}

.hud-chip strong {
	display: block;
	margin-top: 0.14rem;
	font-size: clamp(1rem, 2vw, 1.35rem);
	line-height: 1.1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.canvas-panel {
	position: relative;
	border-radius: 1.8rem;
	padding: 0.4rem;
	background: rgba(255, 255, 255, 0.18);
	overflow: hidden;
	touch-action: none;
	user-select: none;
}

#gameCanvas {
	display: block;
	width: 100%;
	height: min(76vh, calc(100dvh - 145px));
	min-height: 360px;
	border-radius: 1.45rem;
	background: linear-gradient(180deg, #89ddff 0%, #c8f0ff 66%, #f4d293 100%);
	touch-action: none;
}

.touch-zone {
	position: absolute;
	bottom: 0.8rem;
	width: calc(50% - 1rem);
	height: 23%;
	display: grid;
	place-items: center;
	padding: 0.9rem;
	border-radius: 1.25rem;
	background: linear-gradient(180deg, transparent, rgba(255, 122, 24, 0.18));
	border: 1px solid rgba(255, 255, 255, 0.22);
	color: rgba(18, 32, 58, 0.72);
	font-weight: 900;
	font-size: clamp(0.72rem, 2vw, 0.9rem);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	appearance: none;
	-webkit-appearance: none;
	pointer-events: auto;
	cursor: pointer;
	user-select: none;
}

.touch-zone:active,
.touch-zone.is-active {
	transform: scale(0.98);
	background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255, 122, 24, 0.3));
	border-color: rgba(255, 255, 255, 0.48);
}

.touch-left {
	left: 0.8rem;
	background: linear-gradient(180deg, transparent, rgba(255, 122, 24, 0.2));
}

.touch-left:active,
.touch-left.is-active {
	background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255, 122, 24, 0.34));
}

.touch-right {
	right: 0.8rem;
	background: linear-gradient(180deg, transparent, rgba(255, 79, 163, 0.22));
}

.touch-right:active,
.touch-right.is-active {
	background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255, 79, 163, 0.4));
}

.touch-right.is-empty {
	opacity: 0.55;
	filter: grayscale(0.4);
}

.controls-card {
	padding: 0.95rem 1rem;
	border-radius: 1.35rem;
	background: rgba(9, 18, 36, 0.78);
}

.controls-card h2 {
	font-size: 1rem;
	margin-bottom: 0.5rem;
}

.controls-card p + p { margin-top: 0.55rem; }

.controls-card p {
	color: rgba(248, 251, 255, 0.84);
	line-height: 1.45;
}

.controls-card strong {
	color: #fff7c8;
}

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

@media (max-width: 760px) {
	.topbar {
		flex-direction: column;
		align-items: stretch;
	}

	.toolbar-actions { justify-content: stretch; }
	.toolbar-actions > * { flex: 1 1 9rem; text-align: center; }
	#gameCanvas { height: clamp(330px, calc(100dvh - 260px), 560px); }
	.touch-zone { width: calc(50% - 1rem); }
}

@media (max-width: 520px) {
	.app-shell { padding: 0.45rem; }
	.topbar { padding: 0.75rem; border-radius: 1.2rem; }
	.hud-chip { padding: 0.48rem 0.62rem; }
	.canvas-panel { border-radius: 1.15rem; padding: 0.3rem; }
	#gameCanvas { min-height: 0; height: clamp(300px, calc(100dvh - 312px), 470px); border-radius: 1rem; }
	.touch-zone { bottom: 0.45rem; border-radius: 1rem; }
	.controls-card { padding: 0.85rem; border-radius: 1.1rem; }
}
