:root {
	--background: #03070a;
	--ink: #e6f4f1;
	--dim: #6f948f;
	--accent: #ffc24a;
	--line: rgba(255, 194, 74, 0.22);
	--line-hover: rgba(255, 194, 74, 0.55);
	--blue: rgba(91, 157, 255, 0.6);
	--mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: #000;
	color: var(--ink);
	font-family: var(--mono);
	-webkit-font-smoothing: antialiased;
	touch-action: none;
	user-select: none;
}

#stage {
	position: fixed;
	inset: 0;
}

#stage canvas {
	display: block;
	width: 100%;
	height: 100%;
	touch-action: none;
	cursor: grab;
}

#stage canvas:active {
	cursor: grabbing;
}

.ui-hidden .hud,
.ui-hidden #panel {
	display: none !important;
}

button {
	font-family: var(--mono);
	cursor: pointer;
}

#fps {
	position: fixed;
	left: 20px;
	top: 20px;
	width: 118px;
	height: 30px;
	padding: 0 8px;
	text-align: left;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1px;
	color: #6b450f;
	background: rgba(255, 247, 230, 0.62);
	border: 1px solid rgba(217, 153, 51, 0.55);
	border-radius: 3px;
	opacity: 0.8;
	white-space: pre;
	z-index: 20;
}

#fps:hover {
	color: #331c00;
	background: rgba(255, 250, 237, 0.85);
	border-color: var(--accent);
}

#fps:active {
	background: var(--accent);
	border-color: rgba(191, 128, 25, 1);
}

#toggle {
	position: fixed;
	right: 20px;
	top: 20px;
	width: 41.6px;
	height: 41.6px;
	padding: 0;
	display: grid;
	place-items: center;
	background: rgba(3, 8, 10, 0.72);
	border: 1px solid var(--line);
	border-radius: 2px;
	z-index: 20;
}

#toggle:hover,
.close:hover {
	background: rgba(6, 25, 24, 0.85);
	border-color: var(--blue);
}

#toggle svg {
	width: 18.4px;
	height: 18.4px;
}

#panel {
	position: fixed;
	right: 0;
	top: 0;
	height: 100%;
	width: min(352px, 88vw);
	z-index: 30;
	transform: translateX(101%);
	transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
	visibility: hidden;
	background: linear-gradient(to bottom, rgba(3, 8, 11, 0.94), rgba(4, 10, 13, 0.9));
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-left: 1px solid rgba(23, 41, 65, 1);
}

#panel.open {
	transform: translateX(0);
	visibility: visible;
}

#panel.closing {
	visibility: visible;
}

#panel .scroll {
	position: absolute;
	left: 13px;
	right: 12px;
	top: 73.6px;
	bottom: 0;
	padding: 0 12px;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: none;
}

#panel .scroll::-webkit-scrollbar {
	display: none;
}

.header {
	position: relative;
	height: 35.4px;
	margin-bottom: 20.8px;
	border-bottom: 1px solid var(--line);
}

.header .title {
	position: absolute;
	left: 0;
	top: 5px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 2px;
	color: var(--ink);
}

.close {
	position: absolute;
	right: 0;
	top: 0;
	width: 54.7px;
	height: 23.2px;
	font-size: 8px;
	letter-spacing: 2px;
	color: var(--accent);
	background: rgba(3, 8, 10, 0.72);
	border: 1px solid var(--line);
	border-radius: 2px;
	padding: 0;
}

.heading {
	height: 10px;
	line-height: 10px;
	margin-bottom: 12.8px;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 2px;
	color: var(--accent);
}

.pills {
	display: flex;
	gap: 6px;
	height: 24.4px;
}

.pills + .pills {
	margin-top: 10.4px;
}

.pills.last {
	margin-bottom: 24px;
}

.pill {
	flex: 1 1 0;
	min-width: 0;
	overflow: hidden;
	font-size: 8px;
	letter-spacing: 1px;
	color: var(--dim);
	background: rgba(4, 11, 14, 0.55);
	border: 1px solid var(--line);
	border-radius: 2px;
	padding: 6px 4px;
}

.pill:hover {
	color: var(--ink);
	border-color: var(--line-hover);
}

.pill.active {
	color: var(--ink);
	font-weight: 700;
	background: rgb(14, 24, 43);
	border-color: var(--accent);
	box-shadow: 0 0 8px rgba(91, 157, 255, 0.13);
}

.group {
	margin-bottom: 24px;
}

.row {
	position: relative;
	height: 20.3px;
	margin-bottom: 14.4px;
}

.group .row:last-child {
	margin-bottom: 0;
}

.row .caption,
.row .value {
	position: absolute;
	top: 0;
	height: 10px;
	line-height: 10px;
	font-size: 9px;
	letter-spacing: 1px;
}

.row .caption {
	left: 0;
	color: var(--dim);
}

.row .value {
	right: 0;
	color: var(--ink);
	font-weight: 700;
}

.row input[type="range"] {
	position: absolute;
	left: 2px;
	right: 0;
	top: 13.3px;
	width: calc(100% - 2px);
	height: 12px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.row input[type="range"]::-webkit-slider-runnable-track {
	height: 2px;
	background: rgba(91, 157, 255, 0.2);
	border-radius: 1px;
}

.row input[type="range"]::-moz-range-track {
	height: 2px;
	background: rgba(91, 157, 255, 0.2);
	border-radius: 1px;
}

.row input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 10px;
	height: 10px;
	margin-top: -4px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 0 3px rgba(255, 194, 74, 0.12), 0 0 0 7px rgba(255, 194, 74, 0.05), 0 0 0 10px rgba(255, 194, 74, 0.02);
}

.row input[type="range"]::-moz-range-thumb {
	width: 10px;
	height: 10px;
	border: 0;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 0 3px rgba(255, 194, 74, 0.12), 0 0 0 7px rgba(255, 194, 74, 0.05), 0 0 0 10px rgba(255, 194, 74, 0.02);
}

.drift {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 18px;
	margin-top: 12px;
	padding-left: 4px;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 1px;
	color: var(--ink);
	background: none;
	border: 0;
}

.drift .box {
	width: 12px;
	height: 12px;
	border-radius: 2px;
	border: 1px solid var(--line);
}

.drift.checked .box {
	background: var(--accent);
	border-color: var(--accent);
}

.panel-tail {
	height: 24px;
}

#veil {
	position: fixed;
	inset: 0;
	z-index: 50;
	background: var(--background);
	transition: opacity 0.9s ease-in-out;
}

#veil .track {
	position: absolute;
	left: 50%;
	top: 50%;
	width: min(208px, 40vw);
	height: 1px;
	transform: translate(-50%, -50%);
	background: var(--line);
	overflow: hidden;
}

#veil .sweep {
	position: absolute;
	top: 0;
	left: 0;
	width: 40%;
	height: 1px;
	background: var(--accent);
	animation: sweep 1.5s infinite;
	animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
}

@keyframes sweep {
	from {
		transform: translateX(-100%);
	}
	to {
		transform: translateX(250%);
	}
}

#veil.done {
	opacity: 0;
	pointer-events: none;
}

#veil .message {
	position: absolute;
	left: 50%;
	top: calc(50% + 28px);
	transform: translateX(-50%);
	width: min(420px, calc(100vw - 32px));
	text-align: center;
	font-size: 11px;
	line-height: 1.7;
	letter-spacing: 1px;
	color: var(--dim);
}

#stats {
	position: fixed;
	left: 8px;
	bottom: 8px;
	z-index: 25;
	padding: 6px 8px;
	font-size: 11px;
	line-height: 1.35;
	white-space: pre;
	color: #a8fff0;
	background: rgba(3, 7, 9, 0.82);
	border: 1px solid rgba(91, 157, 255, 0.28);
	pointer-events: none;
	display: none;
}

#stats.visible {
	display: block;
}

@media (max-width: 600px) {
	#fps {
		left: 16px;
		top: 16px;
	}

	#toggle {
		right: 16px;
		top: 16px;
		width: 48px;
		height: 48px;
	}

	#panel {
		left: 50%;
		right: auto;
		top: auto;
		bottom: 0;
		width: min(480px, 100vw);
		height: min(288px, 34vh);
		border-left: 0;
		border-top: 1px solid rgba(23, 41, 65, 1);
		border-radius: 10px 10px 0 0;
		transform: translate(-50%, 101%);
	}

	#panel.open {
		transform: translate(-50%, 0);
	}

	#panel .scroll {
		left: 5px;
		right: 6px;
		top: 0;
	}

	.header {
		position: sticky;
		top: 0;
		height: 56.2px;
		margin: 0 0 20.8px;
		background: #03080b;
		z-index: 2;
	}

	.header .title {
		top: 20px;
		font-size: 11px;
		letter-spacing: 1px;
	}

	.close {
		top: 5.6px;
		width: 60px;
		height: 44px;
		font-size: 11px;
		letter-spacing: 1px;
	}

	.heading {
		height: 15px;
		line-height: 15px;
		font-size: 12px;
		letter-spacing: 3px;
	}

	.row {
		height: 63px;
		margin-bottom: 12px;
	}

	.row .caption,
	.row .value {
		height: 15px;
		line-height: 15px;
		font-size: 12px;
	}

	.row input[type="range"] {
		left: 0;
		width: 100%;
		top: 19px;
		height: 44px;
	}

	.row input[type="range"]::-webkit-slider-thumb {
		width: 24px;
		height: 24px;
		margin-top: -11px;
	}

	.row input[type="range"]::-moz-range-thumb {
		width: 24px;
		height: 24px;
	}

	.drift {
		height: 44px;
		gap: 12px;
		padding-left: 0;
		font-size: 12px;
	}

	.drift .box {
		width: 24px;
		height: 24px;
	}
}

button:focus {
	outline: none;
}

button:focus-visible {
	outline: 1px solid rgba(91, 157, 255, 0.45);
	outline-offset: 0;
}
