@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

:root {
	color-scheme: light;
	--clr-primary: #e8432a;
	--clr-secondary: #f5a623;
	--clr-accent: #3498db;
	--clr-white: #fff8f0;
	--clr-dark: #1a1a2e;
	font-family: 'Press Start 2P', monospace;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	overflow: hidden;
	height: 100%;
	width: 100%;
}

#game-container {
	position: relative;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	background: #000;
}

#gameCanvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: block;
	image-rendering: auto;
	filter: contrast(1.05) saturate(1.12);
}

#scanlines {
	position: absolute;
	inset: 0;
	z-index: 45;
	pointer-events: none;
	background: none;
}

#scanlines::after {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at center, transparent 75%, rgba(0, 0, 0, 0.06) 100%);
}

.screen {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	transition: opacity 0.5s ease, visibility 0.5s;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	background: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.8) 100%);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.screen.active {
	opacity: 1;
	visibility: visible;
	pointer-events: all;
}

.title-content {
	text-align: center;
	animation: fadeSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1);
	background: linear-gradient(135deg, rgba(15, 15, 45, 0.85) 0%, rgba(25, 25, 60, 0.75) 100%);
	border: 2px solid rgba(255, 255, 255, 0.12);
	padding: 2.5rem 3rem;
	border-radius: 32px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
	backdrop-filter: blur(24px) saturate(180%);
	-webkit-backdrop-filter: blur(24px) saturate(180%);
	max-width: 90vw;
	position: relative;
	overflow: hidden;
}

.title-content::before {
	content: '';
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	background: conic-gradient(from 0deg, transparent, rgba(255, 100, 50, 0.03), transparent, rgba(100, 150, 255, 0.03), transparent);
	animation: rotateBg 12s linear infinite;
	pointer-events: none;
}

.retro-badge {
	font-family: 'Orbitron', sans-serif;
	font-size: clamp(0.5rem, 1.4vw, 0.75rem);
	font-weight: 700;
	color: transparent;
	background: linear-gradient(90deg, #f5a623, #ff6b35, #f5a623);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	letter-spacing: 5px;
	margin-bottom: 0.8rem;
	animation: shimmer 3s ease infinite;
	position: relative;
}

.game-title {
	font-family: 'Orbitron', sans-serif;
	font-size: clamp(1.8rem, 6vw, 4rem);
	font-weight: 900;
	color: transparent;
	background: linear-gradient(180deg, #ffffff 0%, #ffccaa 40%, #ff6633 100%);
	-webkit-background-clip: text;
	background-clip: text;
	margin-bottom: 0.15em;
	line-height: 1.2;
	filter: drop-shadow(0 4px 8px rgba(255, 80, 30, 0.4)) drop-shadow(0 0 30px rgba(255, 100, 50, 0.15));
	letter-spacing: -1px;
	position: relative;
}

.game-subtitle {
	font-family: 'Orbitron', sans-serif;
	font-size: clamp(0.5rem, 1.8vw, 0.85rem);
	font-weight: 400;
	color: rgba(255, 220, 180, 0.7);
	text-shadow: 0 0 20px rgba(255, 150, 80, 0.2);
	margin-bottom: 1.2rem;
	letter-spacing: 5px;
}

.controls-hint {
	font-family: 'Orbitron', sans-serif;
	font-size: clamp(0.35rem, 1vw, 0.5rem);
	color: rgba(255, 255, 255, 0.35);
	margin-bottom: 1.8rem;
	letter-spacing: 3px;
	animation: pulse 2.5s ease infinite;
}

.menu-buttons {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.7rem;
}

.menu-btn {
	font-family: 'Orbitron', sans-serif;
	font-weight: 700;
	font-size: clamp(0.6rem, 1.6vw, 0.85rem);
	padding: 1em 2.5em;
	border: 2px solid rgba(255, 100, 80, 0.4);
	border-radius: 16px;
	background: linear-gradient(135deg, rgba(255, 70, 50, 0.95) 0%, rgba(232, 67, 42, 0.95) 50%, rgba(200, 40, 20, 0.95) 100%);
	color: var(--clr-white);
	cursor: pointer;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
	box-shadow: 0 6px 20px rgba(232, 67, 42, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
	transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	letter-spacing: 1.5px;
	position: relative;
	overflow: hidden;
}

.menu-btn::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
	transition: left 0.5s;
}

.menu-btn:hover::before {
	left: 100%;
}

.menu-btn:hover {
	transform: translateY(-4px) scale(1.02);
	box-shadow: 0 10px 35px rgba(232, 67, 42, 0.55), 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
	background: linear-gradient(135deg, rgba(255, 100, 70, 1) 0%, rgba(255, 85, 51, 0.98) 50%, rgba(232, 67, 42, 0.98) 100%);
	border-color: rgba(255, 150, 100, 0.6);
}

.menu-btn:active {
	transform: translateY(1px);
	box-shadow: 0 2px 8px rgba(232, 67, 42, 0.3);
}

.menu-btn--secondary {
	background: linear-gradient(135deg, rgba(60, 170, 240, 0.9) 0%, rgba(52, 152, 219, 0.92) 50%, rgba(41, 128, 185, 0.92) 100%);
	font-size: clamp(0.5rem, 1.2vw, 0.65rem);
	box-shadow: 0 5px 18px rgba(52, 152, 219, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -2px 0 rgba(0, 0, 0, 0.1);
	border-color: rgba(80, 180, 240, 0.4);
}

.menu-btn--secondary:hover {
	background: linear-gradient(135deg, rgba(90, 190, 255, 0.95) 0%, rgba(74, 168, 232, 0.95) 50%, rgba(52, 152, 219, 0.95) 100%);
	box-shadow: 0 9px 30px rgba(52, 152, 219, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
	border-color: rgba(120, 200, 255, 0.5);
}

.controls-info {
	margin-top: 1.2rem;
	background: linear-gradient(135deg, rgba(10, 10, 30, 0.7) 0%, rgba(20, 20, 45, 0.6) 100%);
	border: 1.5px solid rgba(255, 255, 255, 0.12);
	padding: 1.2rem 1.6rem;
	border-radius: 18px;
	backdrop-filter: blur(16px) saturate(150%);
	-webkit-backdrop-filter: blur(16px) saturate(150%);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.controls-info p {
	color: rgba(255, 255, 255, 0.75);
	font-family: 'Orbitron', sans-serif;
	font-size: 0.45rem;
	margin: 0.4em 0;
	line-height: 2;
}

.controls-info kbd {
	display: inline-block;
	background: linear-gradient(135deg, rgba(255, 180, 50, 0.95), rgba(245, 166, 35, 0.9));
	color: #fff;
	padding: 0.3em 0.6em;
	font-family: 'Orbitron', sans-serif;
	font-size: 0.4rem;
	font-weight: 700;
	min-width: 1.8em;
	text-align: center;
	margin-right: 0.4em;
	border: 1.5px solid rgba(255, 200, 80, 0.4);
	border-radius: 6px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.hidden {
	display: none !important;
}

/* Mobile Controls */
.mobile-controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 60;
	pointer-events: none;
	padding: 0.8rem;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	padding-bottom: max(0.8rem, env(safe-area-inset-bottom));
}

.mobile-controls__left,
.mobile-controls__right {
	pointer-events: all;
	display: flex;
	gap: 10px;
	align-items: flex-end;
}

.mobile-controls__center {
	pointer-events: all;
	position: absolute;
	bottom: calc(100% + 12px);
	left: 50%;
	transform: translateX(-50%);
}

.mobile-btn--tilt {
	width: clamp(50px, 14vw, 70px);
	height: clamp(50px, 14vw, 70px);
	border-radius: 50%;
	font-size: clamp(1rem, 3.5vw, 1.4rem);
	background: rgba(80, 80, 120, 0.5);
	border-color: rgba(150, 150, 220, 0.4);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1;
	transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.mobile-btn--tilt.tilt-active {
	background: rgba(34, 170, 220, 0.55);
	border-color: rgba(34, 200, 255, 0.7);
	box-shadow: 0 0 15px rgba(34, 200, 255, 0.3), inset 0 0 8px rgba(34, 200, 255, 0.15);
}

.mobile-btn--tilt .mobile-btn__label {
	font-size: clamp(0.3rem, 1vw, 0.4rem);
	margin-top: 2px;
	opacity: 0.7;
	letter-spacing: 1px;
}

.tilt-indicator {
	position: absolute;
	bottom: calc(max(0.8rem, env(safe-area-inset-bottom)) + clamp(70px, 20vw, 100px) + 80px);
	left: 50%;
	transform: translateX(-50%);
	pointer-events: none;
	z-index: 61;
	display: flex;
	align-items: center;
	gap: 6px;
	background: linear-gradient(135deg, rgba(10, 10, 30, 0.7) 0%, rgba(15, 15, 35, 0.65) 100%);
	padding: 6px 14px;
	border-radius: 24px;
	border: 2px solid rgba(34, 200, 255, 0.35);
	backdrop-filter: blur(10px) saturate(140%);
	-webkit-backdrop-filter: blur(10px) saturate(140%);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tilt-indicator__bar {
	width: 90px;
	height: 8px;
	background: linear-gradient(135deg, rgba(20, 20, 40, 0.8) 0%, rgba(10, 10, 25, 0.9) 100%);
	border-radius: 6px;
	position: relative;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.15);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.tilt-indicator__dot {
	position: absolute;
	top: -1px;
	left: 50%;
	width: 10px;
	height: 10px;
	background: linear-gradient(135deg, #66eeff, #44ddff);
	border-radius: 50%;
	transform: translateX(-50%);
	transition: left 0.08s ease-out;
	box-shadow: 0 0 10px rgba(68, 221, 255, 0.7), 0 0 20px rgba(68, 221, 255, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.5);
	border: 1px solid rgba(255, 255, 255, 0.3);
}

.tilt-indicator__label {
	font-family: 'Orbitron', sans-serif;
	font-size: 0.35rem;
	color: rgba(255, 255, 255, 0.5);
	letter-spacing: 1px;
}

.mobile-btn {
	font-family: 'Press Start 2P', monospace;
	border: 3px solid rgba(255, 255, 255, 0.45);
	background: linear-gradient(135deg, rgba(20, 20, 40, 0.75) 0%, rgba(10, 10, 25, 0.8) 100%);
	backdrop-filter: blur(10px) saturate(140%);
	-webkit-backdrop-filter: blur(10px) saturate(140%);
	color: rgba(255, 255, 255, 0.9);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
	transition: all 0.08s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.mobile-btn:active,
.mobile-btn--active {
	background: linear-gradient(135deg, rgba(80, 80, 120, 0.8) 0%, rgba(60, 60, 100, 0.85) 100%);
	border-color: rgba(255, 255, 255, 0.7);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.4);
	transform: scale(0.96);
}

.mobile-btn--steer {
	width: clamp(60px, 16vw, 85px);
	height: clamp(70px, 20vw, 100px);
	border-radius: 14px;
	font-size: clamp(1rem, 4vw, 1.6rem);
}

.mobile-btn--accel {
	width: clamp(60px, 16vw, 85px);
	height: clamp(70px, 20vw, 100px);
	border-radius: 14px;
	font-size: clamp(0.8rem, 3vw, 1.2rem);
	background: linear-gradient(135deg, rgba(40, 200, 40, 0.7) 0%, rgba(34, 170, 34, 0.75) 100%);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-color: rgba(60, 240, 60, 0.6);
	box-shadow: 0 4px 16px rgba(34, 170, 34, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.mobile-btn--accel:active,
.mobile-btn--accel.mobile-btn--active {
	background: linear-gradient(135deg, rgba(50, 240, 50, 0.85) 0%, rgba(40, 200, 40, 0.9) 100%);
	border-color: #44FF44;
	box-shadow: 0 2px 8px rgba(34, 220, 34, 0.4), inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 15px rgba(34, 220, 34, 0.3);
}

.mobile-btn--brake {
	width: clamp(60px, 16vw, 85px);
	height: clamp(70px, 20vw, 100px);
	border-radius: 14px;
	font-size: clamp(0.8rem, 3vw, 1.2rem);
	background: linear-gradient(135deg, rgba(220, 50, 50, 0.7) 0%, rgba(200, 40, 40, 0.75) 100%);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-color: rgba(240, 70, 70, 0.6);
	box-shadow: 0 4px 16px rgba(200, 40, 40, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.mobile-btn--brake:active,
.mobile-btn--brake.mobile-btn--active {
	background: linear-gradient(135deg, rgba(255, 70, 70, 0.85) 0%, rgba(220, 50, 50, 0.9) 100%);
	border-color: #FF4444;
	box-shadow: 0 2px 8px rgba(220, 50, 50, 0.4), inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 15px rgba(220, 50, 50, 0.3);
}

.mobile-btn__label {
	display: block;
	font-size: clamp(0.3rem, 1.2vw, 0.45rem);
	margin-top: 4px;
	opacity: 0.6;
}

.hud {
	position: absolute;
	inset: 0;
	z-index: 50;
	pointer-events: none;
	padding: 0.6rem;
}

.hud__top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	position: relative;
}

.hud__reset-btn {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	margin-top: 2.2rem;
	font-family: 'Orbitron', sans-serif;
	font-weight: 700;
	font-size: clamp(0.4rem, 1.1vw, 0.55rem);
	padding: 0.5em 1.3em;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 12px;
	background: linear-gradient(135deg, rgba(15, 15, 35, 0.8) 0%, rgba(20, 20, 45, 0.75) 100%);
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	color: rgba(255, 255, 255, 0.9);
	cursor: pointer;
	pointer-events: all;
	transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	z-index: 55;
	letter-spacing: 1.2px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.hud__reset-btn:hover {
	background: linear-gradient(135deg, rgba(60, 170, 240, 0.85) 0%, rgba(52, 152, 219, 0.8) 100%);
	border-color: rgba(80, 180, 255, 0.5);
	color: #fff;
	transform: translateX(-50%) translateY(-2px) scale(1.03);
	box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hud__reset-btn:active {
	transform: translateX(-50%) translateY(1px);
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

.hud__position {
	background: linear-gradient(135deg, rgba(10, 10, 25, 0.8) 0%, rgba(20, 20, 40, 0.75) 100%);
	backdrop-filter: blur(12px) saturate(150%);
	-webkit-backdrop-filter: blur(12px) saturate(150%);
	border: 2.5px solid var(--clr-secondary);
	padding: 0.4rem 0.8rem;
	font-size: 1.4rem;
	color: var(--clr-secondary);
	text-shadow: 0 3px 10px rgba(0, 0, 0, 0.7), 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 15px rgba(245, 166, 35, 0.3);
	line-height: 1;
	border-radius: 12px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(245, 166, 35, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.hud__position-suffix {
	font-size: 0.6rem;
	vertical-align: super;
}

.hud__position-label {
	font-size: 0.6rem;
	color: rgba(255, 255, 255, 0.5);
}

.hud__timer {
	background: linear-gradient(135deg, rgba(10, 10, 25, 0.75) 0%, rgba(20, 20, 40, 0.7) 100%);
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	border: 2px solid rgba(255, 255, 255, 0.2);
	padding: 0.4rem 0.8rem;
	color: var(--clr-white);
	font-size: 0.7rem;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.4);
	border-radius: 10px;
	box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.hud__lap {
	background: linear-gradient(135deg, rgba(10, 10, 25, 0.75) 0%, rgba(20, 20, 40, 0.7) 100%);
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	border: 2.5px solid var(--clr-primary);
	padding: 0.4rem 0.8rem;
	color: var(--clr-white);
	font-size: 0.9rem;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(232, 67, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.hud__lap-label {
	font-size: 0.45rem;
	color: rgba(255, 255, 255, 0.4);
	margin-right: 0.2em;
}

.hud__lap-total {
	color: rgba(255, 255, 255, 0.35);
	font-size: 0.6rem;
}

.hud__boost-indicator {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -70px);
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(0.8rem, 2.5vw, 1.1rem);
	color: transparent;
	background: linear-gradient(90deg, #ff8800, #ffcc00, #ff8800);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	filter: drop-shadow(0 2px 8px rgba(255, 136, 0, 0.6));
	animation: shimmer 0.8s ease infinite;
}

.hud__lap-popup {
	position: absolute;
	top: 35%;
	left: 50%;
	transform: translateX(-50%);
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(1rem, 3.5vw, 1.6rem);
	color: transparent;
	background: linear-gradient(180deg, #ffffff, #88ccff);
	-webkit-background-clip: text;
	background-clip: text;
	filter: drop-shadow(0 3px 10px rgba(100, 180, 255, 0.4));
	animation: countPop 0.6s ease-out;
	letter-spacing: 2px;
}

.hud__turbo-popup {
	position: absolute;
	top: 42%;
	left: 50%;
	transform: translateX(-50%);
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(0.9rem, 3vw, 1.3rem);
	color: transparent;
	background: linear-gradient(90deg, #00ff88, #44ffcc, #00ff88);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	filter: drop-shadow(0 2px 12px rgba(0, 255, 136, 0.5));
	animation: countPop 0.6s ease-out, shimmer 1s ease infinite;
}

.hud__wrong-way {
	position: absolute;
	top: 25%;
	left: 50%;
	transform: translateX(-50%);
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(0.8rem, 2.5vw, 1.1rem);
	color: #ff2222;
	text-shadow: 0 0 20px rgba(255, 34, 34, 0.5);
	animation: blink 0.5s step-start infinite;
	background: rgba(100, 0, 0, 0.3);
	padding: 0.4em 1em;
	border-radius: 8px;
	border: 1px solid rgba(255, 50, 50, 0.3);
}

.hud__bottom {
	position: absolute;
	bottom: 0.6rem;
	left: 0.6rem;
	right: 0.6rem;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	pointer-events: none;
}

@media (max-width: 768px), (pointer: coarse) {
	.hud__bottom {
		bottom: calc(max(0.8rem, env(safe-area-inset-bottom)) + clamp(70px, 20vw, 100px) + 20px);
	}

	.hud__minimap {
		transform: scale(0.7);
		transform-origin: bottom right;
	}

	.hud__left-panel {
		transform: scale(0.85);
		transform-origin: bottom left;
	}
}

.hud__left-panel {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.hud__speed {
	background: linear-gradient(135deg, rgba(10, 10, 25, 0.8) 0%, rgba(20, 20, 40, 0.75) 100%);
	backdrop-filter: blur(12px) saturate(150%);
	-webkit-backdrop-filter: blur(12px) saturate(150%);
	border: 2.5px solid rgba(255, 255, 255, 0.25);
	padding: 0.4rem 0.8rem;
	font-size: 1.1rem;
	color: var(--clr-white);
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.hud__speed-unit {
	font-family: 'Orbitron', sans-serif;
	font-size: 0.35rem;
	color: rgba(255, 255, 255, 0.35);
	margin-left: 0.2em;
}

.hud__speed-bar {
	width: 140px;
	height: 12px;
	background: linear-gradient(135deg, rgba(10, 10, 25, 0.7) 0%, rgba(5, 5, 15, 0.8) 100%);
	border: 2px solid rgba(255, 255, 255, 0.2);
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hud__speed-bar-fill {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #22cc44, #66dd22, #88ee00, #aaff11, #ccff00);
	box-shadow: 0 0 10px rgba(136, 238, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
	transition: width 0.1s;
	border-radius: 6px;
}

.hud__speed-bar-boost {
	position: absolute;
	right: 0;
	top: 0;
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #ff6600, #ffcc00);
	animation: boostFlash 0.15s step-start infinite alternate;
	transition: width 0.1s;
	border-radius: 4px;
}

.hud__drift-meter {
	display: flex;
	align-items: center;
	gap: 0.3rem;
}

.hud__drift-label {
	font-family: 'Orbitron', sans-serif;
	font-size: 0.3rem;
	color: rgba(255, 255, 255, 0.35);
	letter-spacing: 1px;
}

.hud__drift-bar {
	width: 100px;
	height: 8px;
	background: rgba(0, 0, 0, 0.5);
	border: 1px solid rgba(255, 255, 255, 0.12);
	position: relative;
	overflow: hidden;
	border-radius: 4px;
}

.hud__drift-bar-fill {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #3399ff, #cc44ff, #ff2266);
	transition: width 0.15s;
	border-radius: 3px;
}

.hud__coins {
	background: linear-gradient(135deg, rgba(20, 15, 10, 0.75) 0%, rgba(30, 20, 10, 0.7) 100%);
	backdrop-filter: blur(10px) saturate(140%);
	-webkit-backdrop-filter: blur(10px) saturate(140%);
	border: 2px solid rgba(255, 215, 0, 0.5);
	padding: 0.25rem 0.55rem;
	font-size: 0.55rem;
	color: #FFD700;
	display: flex;
	align-items: center;
	gap: 0.35rem;
	border-radius: 10px;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(255, 215, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 8px rgba(255, 215, 0, 0.3);
}

.hud__coin-icon {
	color: #FF8844;
	font-size: 0.6rem;
	filter: drop-shadow(0 1px 3px rgba(255, 100, 30, 0.4));
}

.hud__minimap {
	background: linear-gradient(135deg, rgba(10, 10, 25, 0.6) 0%, rgba(15, 15, 30, 0.5) 100%);
	border: 2.5px solid rgba(255, 255, 255, 0.2);
	padding: 5px;
	border-radius: 16px;
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

#minimapCanvas {
	display: block;
	image-rendering: auto;
}

.countdown {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(3rem, 10vw, 6rem);
	color: transparent;
	background: linear-gradient(180deg, #ffffff, #ffcc88);
	-webkit-background-clip: text;
	background-clip: text;
	filter: drop-shadow(0 4px 15px rgba(255, 100, 50, 0.5)) drop-shadow(0 0 40px rgba(255, 80, 30, 0.3));
	animation: countPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.finish-content {
	text-align: center;
	animation: fadeSlideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
	background: linear-gradient(135deg, rgba(15, 15, 45, 0.9) 0%, rgba(25, 25, 60, 0.85) 100%);
	border: 2.5px solid rgba(255, 255, 255, 0.15);
	padding: 2.5rem 3.5rem;
	max-width: 90vw;
	border-radius: 32px;
	backdrop-filter: blur(28px) saturate(180%);
	-webkit-backdrop-filter: blur(28px) saturate(180%);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
	position: relative;
	overflow: hidden;
}

.finish-flag {
	font-size: 3rem;
	margin-bottom: 0.5rem;
	animation: pulse 1.5s ease infinite;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.finish-title {
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(1.2rem, 4vw, 2.2rem);
	color: transparent;
	background: linear-gradient(180deg, #ffffff 0%, #ffcc88 100%);
	-webkit-background-clip: text;
	background-clip: text;
	filter: drop-shadow(0 3px 6px rgba(255, 100, 50, 0.4));
	margin-bottom: 0.5em;
}

.finish-position {
	font-family: 'Orbitron', sans-serif;
	font-weight: 900;
	font-size: clamp(2rem, 8vw, 4rem);
	color: transparent;
	background: linear-gradient(180deg, #FFD700 0%, #FF8800 50%, #FF4400 100%);
	-webkit-background-clip: text;
	background-clip: text;
	filter: drop-shadow(0 4px 10px rgba(255, 136, 0, 0.4));
	margin-bottom: 0.2em;
}

.finish-time {
	font-family: 'Orbitron', sans-serif;
	font-size: clamp(0.5rem, 1.4vw, 0.75rem);
	color: rgba(255, 255, 255, 0.8);
	margin-bottom: 0.8rem;
	letter-spacing: 2px;
}

.finish-stats {
	font-family: 'Orbitron', sans-serif;
	font-size: 0.42rem;
	color: rgba(255, 255, 255, 0.65);
	margin-bottom: 1.4rem;
	line-height: 2.6;
	background: linear-gradient(135deg, rgba(10, 10, 30, 0.5) 0%, rgba(15, 15, 35, 0.4) 100%);
	padding: 1rem 1.4rem;
	border-radius: 16px;
	border: 1.5px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.finish-buttons {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
}

@keyframes bounceIn {
	0% {
		transform: scale(0.3);
		opacity: 0;
	}

	100% {
		transform: scale(1);
		opacity: 1;
	}
}

@keyframes fadeSlideIn {
	0% {
		transform: translateY(30px) scale(0.95);
		opacity: 0;
	}

	100% {
		transform: translateY(0) scale(1);
		opacity: 1;
	}
}

@keyframes countPop {
	0% {
		transform: translate(-50%, -50%) scale(2.5);
		opacity: 0;
	}

	60% {
		transform: translate(-50%, -50%) scale(0.95);
		opacity: 1;
	}

	100% {
		transform: translate(-50%, -50%) scale(1);
		opacity: 1;
	}
}

@keyframes blink {
	50% {
		opacity: 0;
	}
}

@keyframes pulse {
	0%, 100% {
		opacity: 0.35;
	}

	50% {
		opacity: 0.7;
	}
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

@keyframes rotateBg {
	0% {
		transform: rotate(0deg);
	}

	100% {
		transform: rotate(360deg);
	}
}

@keyframes boostFlash {
	0% {
		color: #ff8800;
	}

	100% {
		color: #ffee00;
	}
}