#coordinate-warp
{
	position: absolute;
	top: 14px;
	left: 14px;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
	z-index: 2;
	padding: 8px;
	border: 1px solid rgba(255, 255, 255, 0.65);
	border-radius: 4px;
	background: rgba(20, 36, 42, 0.82);
	color: #fff;
	font: 12px/1.2 sans-serif;
}

#mode-controls
{
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	display: flex;
	gap: 8px;
}

#airplane-mode
{
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.88);
	color: #fff;
	font: 600 13px/1 sans-serif;
	cursor: pointer;
}

#airplane-mode:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#airplane-mode:disabled
{
	opacity: 0.55;
	cursor: wait;
}

#walk-mode
{
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.88);
	color: #fff;
	font: 600 13px/1 sans-serif;
	cursor: pointer;
}

#walk-mode:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#walk-mode:disabled
{
	opacity: 0.55;
	cursor: wait;
}

#drive-mode
{
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.88);
	color: #fff;
	font: 600 13px/1 sans-serif;
	cursor: pointer;
}

#drive-mode:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#drive-mode:disabled
{
	opacity: 0.55;
	cursor: wait;
}

#mouse-lock
{
	position: absolute;
	top: 102px;
	right: 14px;
	z-index: 2;
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.88);
	color: #fff;
	font: 600 13px/1 sans-serif;
	cursor: pointer;
}

#mouse-lock:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#mouse-lock:disabled
{
	opacity: 0.55;
	cursor: wait;
}

#debug-stats
{
	position: absolute;
	top: 146px;
	right: 14px;
	z-index: 2;
	padding: 5px 7px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.82);
	color: #fff;
	font: 11px/1.2 monospace;
	font-variant-numeric: tabular-nums;
}

#debug-stats[hidden]
{
	display: none;
}

#view-state-controls
{
	position: absolute;
	top: 58px;
	right: 14px;
	display: flex;
	align-items: center;
	gap: 6px;
	z-index: 2;
}

#view-state-controls button
{
	min-height: 36px;
	padding: 7px 10px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.88);
	color: #fff;
	font: 600 13px/1 sans-serif;
	cursor: pointer;
}

#view-state-controls button:disabled
{
	opacity: 0.55;
	cursor: wait;
}

#view-state-controls button:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#view-state-status
{
	color: #fff;
	font: 11px/1.2 sans-serif;
}

#coordinate-warp .coordinate-warp-row
{
	display: flex;
	align-items: center;
	gap: 7px;
}

#coordinate-warp .coordinate-warp-row label
{
	display: flex;
	align-items: center;
	gap: 4px;
}

#coordinate-warp .coordinate-warp-location
{
	display: flex;
	align-items: center;
	gap: 7px;
}

#coordinate-warp input,
#coordinate-warp select
{
	width: 88px;
	min-width: 0;
	padding: 5px;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.95);
	color: #17282d;
	font: inherit;
}

#coordinate-warp select
{
	flex: 1;
	width: auto;
}

#coordinate-warp button
{
	min-height: 28px;
	padding: 4px 9px;
	border: 0;
	border-radius: 3px;
	background: #f1c75b;
	color: #17282d;
	font: inherit;
	cursor: pointer;
}

#coordinate-warp button:disabled
{
	opacity: 0.55;
	cursor: wait;
}

#coordinate-warp output
{
	color: #ffe09a;
}

#coordinate-warp input:focus-visible,
#coordinate-warp select:focus-visible,
#coordinate-warp button:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#touch-feedback
{
	position: fixed;
	inset: 0;
	z-index: 3;
	pointer-events: none;
}

.touch-arrow
{
	position: absolute;
	height: 3px;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
	transform-origin: left center;
}

.touch-arrow::after
{
	position: absolute;
	right: 0;
	top: 50%;
	width: 12px;
	height: 12px;
	border-top: 3px solid #fff;
	border-right: 3px solid #fff;
	content: "";
	transform: translateY(-50%) rotate(45deg);
}

.touch-arrow-move { background: #f1c75b; }
.touch-arrow-move::after { border-color: #f1c75b; }

.touch-ripple
{
	position: absolute;
	width: 40px;
	height: 40px;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
	animation: touch-ripple 450ms ease-out forwards;
}

@keyframes touch-ripple
{
	from { opacity: 0.9; transform: translate(-50%, -50%) scale(0.35); }
	to { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}

#viewer .touch-joystick
{
	display: none;
	position: absolute;
	bottom: 20px;
	z-index: 2;
	width: 112px;
	height: 112px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 50%;
	background: rgba(20, 36, 42, 0.32);
	box-shadow: inset 0 0 0 1px rgba(15, 31, 37, 0.18), 0 2px 8px rgba(15, 31, 37, 0.2);
	touch-action: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

#viewer .touch-joystick::after
{
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	border: 1px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	background: rgba(238, 246, 244, 0.76);
	box-shadow: 0 1px 5px rgba(15, 31, 37, 0.28);
	content: "";
	transform: translate(calc(-50% + var(--stick-x, 0px)), calc(-50% + var(--stick-y, 0px)));
}

#viewer .touch-joystick:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 3px;
}

#viewer .touch-joystick.is-disabled
{
	visibility: hidden;
	pointer-events: none;
}

#viewer .touch-joystick-move
{
	left: 20px;
}

#viewer .touch-steering-control,
#viewer .touch-drive-actions
{
	display: none;
	position: absolute;
	bottom: 20px;
	z-index: 2;
	touch-action: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

#viewer .touch-steering-control
{
	left: 20px;
	width: min(260px, calc(100vw - 112px));
	height: 72px;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 36px;
	background: rgba(20, 36, 42, 0.32);
	box-shadow: inset 0 0 0 1px rgba(15, 31, 37, 0.18), 0 2px 8px rgba(15, 31, 37, 0.2);
}

.touch-steering-label
{
	position: absolute;
	top: 7px;
	left: 14px;
	color: rgba(255, 255, 255, 0.86);
	font: 600 9px/1 sans-serif;
	user-select: none;
}

.touch-steering-track
{
	position: absolute;
	left: 14px;
	right: 14px;
	top: 43px;
	height: 2px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.5);
}

.touch-steering-track::before
{
	position: absolute;
	left: 50%;
	top: -4px;
	width: 2px;
	height: 10px;
	background: rgba(255, 255, 255, 0.55);
	content: "";
}

.touch-steering-thumb
{
	position: absolute;
	left: 50%;
	top: 50%;
	width: 38px;
	height: 38px;
	border: 1px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	background: rgba(238, 246, 244, 0.82);
	box-shadow: 0 1px 5px rgba(15, 31, 37, 0.28);
	transform: translate(calc(-50% + var(--steering-x, 0px)), -50%);
	pointer-events: none;
}

#viewer .touch-drive-actions
{
	right: 16px;
	display: none;
	flex-direction: column;
	gap: 8px;
}

.touch-drive-button
{
	width: 62px;
	height: 62px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 50%;
	background: rgba(20, 36, 42, 0.38);
	box-shadow: inset 0 0 0 1px rgba(15, 31, 37, 0.18), 0 2px 8px rgba(15, 31, 37, 0.2);
	color: #fff;
	font: 700 9px/1 sans-serif;
	touch-action: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.touch-drive-button[aria-pressed="true"]
{
	background: rgba(58, 112, 121, 0.82);
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.32), 0 1px 4px rgba(15, 31, 37, 0.22);
}

.touch-drive-button:focus-visible,
#viewer .touch-steering-control:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 3px;
}

#viewer .touch-steering-control.is-disabled,
#viewer .touch-drive-actions.is-disabled
{
	visibility: hidden;
	pointer-events: none;
}

#postprocess-toggle,
#physics-debug-toggle
{
	position: absolute;
	top: 190px;
	right: 14px;
	z-index: 2;
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	background: rgba(20, 36, 42, 0.88);
	color: #fff;
	font: 600 13px/1 sans-serif;
	cursor: pointer;
}

#physics-debug-toggle
{
	top: 234px;
}

#postprocess-toggle:focus-visible,
#physics-debug-toggle:focus-visible
{
	outline: 2px solid #f1c75b;
	outline-offset: 2px;
}

#postprocess-toggle:disabled
{
	opacity: 0.55;
	cursor: wait;
}

@media (hover: none) and (pointer: coarse), (max-width: 700px)
{
	#viewer .touch-joystick
	{
		display: block;
	}

	#viewer .touch-steering-control,
	#viewer .touch-drive-actions
	{
		display: flex;
	}
}

@media (max-width: 640px)
{
	#mode-controls { top: 100px; }
	#view-state-controls { top: 144px; }
	#mouse-lock { top: 188px; }
	#debug-stats { top: 232px; }
	#postprocess-toggle { top: 276px; }
	#physics-debug-toggle { top: 320px; }
}

@media (max-width: 480px)
{
	#viewer .touch-joystick
	{
		bottom: 16px;
		width: 96px;
		height: 96px;
	}

	#viewer .touch-joystick-move
	{
		left: 16px;
	}

	#viewer .touch-steering-control
	{
		left: 16px;
		bottom: 16px;
		height: 68px;
	}

	#viewer .touch-drive-actions
	{
		right: 12px;
		bottom: 12px;
		gap: 6px;
	}

	.touch-drive-button
	{
		width: 56px;
		height: 56px;
		font-size: 8px;
	}
}
