html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: hidden;
	background: #06060c;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #eaf0ff;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

canvas#game {
	display: block;
	width: 100%;
	height: 100%;
}

.hidden { display: none !important; }

/* ---- Speed-blur vignette (darkens edges as speed increases) ---- */
#speed-vignette {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 3;
	opacity: 0;
	background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(6, 6, 12, 0.75) 100%);
	transition: opacity 0.15s linear;
}

/* ---- HUD bar ---- */
#hud-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 14px 18px;
	pointer-events: none;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
	z-index: 5;
}

#speed, #distance {
	background: rgba(18, 18, 42, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	padding: 8px 18px;
	font-weight: 800;
	font-size: 1.1rem;
	white-space: nowrap;
}
#speed { color: #00e5ff; }
#distance { color: #ff2d78; }
.unit { font-size: 0.7rem; font-weight: 600; color: #92a0c9; }

#speed-track {
	flex: 1;
	max-width: 160px;
	height: 8px;
	background: rgba(18, 18, 42, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 6px;
	overflow: hidden;
}
#speed-fill {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #00e5ff, #ff2d78);
	transition: width 0.08s linear;
}

#sound-toggle {
	pointer-events: auto;
	cursor: pointer;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(18, 18, 42, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 17px;
	flex-shrink: 0;
}
#sound-toggle.muted { color: #92a0c9; }

/* ---- Overlays (shared pattern with the other sample games) ---- */
.overlay {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	text-align: center;
	background: radial-gradient(circle at 50% 40%, rgba(18, 18, 42, 0.85), rgba(6, 6, 12, 0.95));
	padding: 24px;
	z-index: 10;
}

.overlay h1 {
	margin: 0 0 4px;
	font-size: 2.2rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	background: linear-gradient(90deg, #00e5ff, #7cf8ff 40%, #ff2d78);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.overlay p {
	margin: 0;
	color: #c7c8d1;
	max-width: 380px;
	font-size: 0.95rem;
}

.overlay .hint { font-size: 0.85rem; color: #9a9ba7; }

.score-line { font-size: 1.1rem; color: #fff; font-weight: 700; }
.score-line.best { font-size: 0.9rem; color: #9a9ba7; font-weight: 500; }

.btn {
	margin-top: 10px;
	background: linear-gradient(90deg, #00e5ff, #7cf8ff);
	color: #06060c;
	border: none;
	border-radius: 999px;
	padding: 14px 36px;
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	cursor: pointer;
	box-shadow: 0 0 24px rgba(0, 229, 255, 0.35);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 32px rgba(0, 229, 255, 0.5); }
.btn:active { transform: translateY(0) scale(0.98); }

/* ---- Touch controls (shown automatically on touch devices) ---- */
#touch-controls {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 6;
	display: none;
}
.touch-btn {
	position: absolute;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 999px;
	background: rgba(18, 18, 42, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #00e5ff;
	font-size: 26px;
}
.touch-btn:active { background: rgba(0, 229, 255, 0.25); }
#btn-left { left: 20px; bottom: 90px; }
#btn-right { left: 96px; bottom: 90px; }
#btn-brake { right: 20px; bottom: 90px; color: #ff2d78; }
#btn-gas { right: 96px; bottom: 90px; width: 80px; height: 80px; }

@media (hover: none) and (pointer: coarse) {
	#touch-controls { display: block; }
}
