@font-face {
	font-family: "Pixelcraft";
	src: url("../../src/assets/fonts/Pixelcraft/Pixelcraft%20-%20Personal%20Use.ttf") format("truetype");
	font-display: swap;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	font-family: "Pixelcraft", "Microsoft YaHei", monospace;
	color: #f8efff;
	background: #0f1626;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background: url("./bg-cd.png") center / cover no-repeat;
	filter: brightness(0.54) saturate(1.04);
	z-index: -2;
}

body::after {
	content: "";
	position: fixed;
	inset: 0;
	background: rgba(179, 212, 255, 0.14);
	z-index: -1;
}

.driver-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 0.45rem;
	width: 100%;
}

.driver-header {
	text-align: center;
	margin-bottom: 0.45rem;
	text-shadow: 2px 2px 0 rgba(38, 55, 96, 0.95);
}

.driver-header h1 {
	margin: 0.2rem 0 0.45rem;
	font-size: clamp(1.4rem, 2.9vw, 2.1rem);
	letter-spacing: 0.07em;
}

.driver-header p {
	margin: 0;
	font-size: 0.92rem;
	color: #e4f3ff;
}

.back-link {
	display: inline-block;
	padding: 0.35rem 0.72rem;
	margin-bottom: 0.45rem;
	border: 2px solid rgba(199, 232, 255, 0.9);
	background: rgba(255, 255, 255, 0.11);
	box-shadow: 3px 3px 0 rgba(43, 68, 117, 0.5);
	color: #f1f8ff;
	text-decoration: none;
}

.driver-wrap {
	position: relative;
	width: min(1240px, calc(100vw - 0.45rem));
	margin: 0 auto;
	border: 3px solid rgba(199, 232, 255, 0.85);
	background: rgba(15, 27, 47, 0.35);
	box-shadow: 0 0 0 4px rgba(52, 81, 140, 0.35), 0 10px 0 rgba(33, 55, 95, 0.5);
}

#driverCanvas {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	max-height: calc(100vh - 5.6rem);
	image-rendering: pixelated;
}

.hud {
	position: absolute;
	top: 0.8rem;
	left: 0.8rem;
	display: grid;
	gap: 0.34rem;
	padding: 0.5rem 0.6rem;
	font-size: 0.95rem;
	border: 2px solid rgba(199, 232, 255, 0.72);
	background: rgba(9, 18, 36, 0.4);
	text-shadow: 2px 2px 0 rgba(38, 55, 96, 0.95);
	pointer-events: none;
}

.menu-btn {
	position: absolute;
	top: 0.8rem;
	right: 0.8rem;
	z-index: 4;
	padding: 0.42rem 0.8rem;
	border: 2px solid rgba(199, 232, 255, 0.9);
	background: rgba(14, 29, 53, 0.68);
	color: #f0f7ff;
	font-family: inherit;
	font-size: 0.86rem;
	box-shadow: 3px 3px 0 rgba(33, 55, 95, 0.65);
}

.game-menu {
	position: absolute;
	inset: 0;
	z-index: 6;
	display: grid;
	place-items: center;
	background: rgba(8, 14, 24, 0.58);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	padding: 1rem;
}

.game-menu.hidden {
	display: none;
}

.menu-panel {
	width: min(420px, calc(100% - 1rem));
	border: 2px solid rgba(199, 232, 255, 0.9);
	background: rgba(12, 23, 42, 0.9);
	box-shadow: 6px 6px 0 rgba(33, 55, 95, 0.65);
	padding: 0.8rem;
	text-shadow: 2px 2px 0 rgba(38, 55, 96, 0.95);
}

.menu-panel h2,
.menu-panel h3 {
	margin: 0;
	font-size: 1rem;
}

.menu-actions {
	display: flex;
	gap: 0.6rem;
	margin-top: 0.65rem;
	margin-bottom: 0.9rem;
}

.menu-actions button,
.bind-btn {
	border: 2px solid rgba(199, 232, 255, 0.9);
	background: rgba(14, 29, 53, 0.68);
	color: #f0f7ff;
	font-family: inherit;
	font-size: 0.82rem;
	padding: 0.36rem 0.58rem;
	box-shadow: 3px 3px 0 rgba(33, 55, 95, 0.65);
}

.bind-btn.waiting {
	border-color: #ffe17c;
	background: rgba(72, 63, 28, 0.72);
}

.keybind-panel {
	display: grid;
	gap: 0.5rem;
}

.keybind-list {
	display: grid;
	gap: 0.45rem;
}

.keybind-row {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 0.5rem;
}

.stamina-row {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.stamina-ring {
	position: relative;
	width: 44px;
	height: 44px;
	display: inline-grid;
	place-items: center;
}

.stamina-ring svg {
	width: 44px;
	height: 44px;
	transform: rotate(-90deg);
}

.ring-bg,
.ring-value {
	fill: none;
	stroke-width: 5;
}

.ring-bg {
	stroke: rgba(175, 210, 240, 0.24);
}

.ring-value {
	stroke: #7dff9b;
	stroke-linecap: round;
	transition: stroke-dashoffset 0.16s linear, stroke 0.16s linear;
}

#staminaText {
	position: absolute;
	font-size: 0.58rem;
	text-shadow: 1px 1px 0 rgba(38, 55, 96, 0.95);
}

.touch-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0.75rem;
	display: none;
	justify-content: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	padding: 0 0.5rem;
}

.touch-controls button {
	min-width: 74px;
	padding: 0 0.6rem;
	height: 56px;
	border: 2px solid rgba(199, 232, 255, 0.9);
	background: rgba(14, 29, 53, 0.62);
	color: #f0f7ff;
	font-family: inherit;
	font-size: 0.9rem;
	box-shadow: 3px 3px 0 rgba(33, 55, 95, 0.65);
}

#hookBtn {
	background: rgba(22, 44, 73, 0.72);
}

@media (max-width: 900px) {
	.touch-controls {
		display: flex;
	}
}
