/* 全屏尺寸 */
body,
#WEBGLcontainer,
canvas {
	width: 100vw;
	height: 100vh;
}

body {
	margin: 0;
	color: #fff;
	font-family: "Roboto", sans-serif;
	font-size: 16px;
	overscroll-behavior: none;
	position: fixed;
	overflow-y: hidden;
}

#WEBGLcontainer,
canvas {
	pointer-events: auto; /* 确保可以接收触摸事件 */
	z-index: 1; /* 确保在 overlay 下方，但可以接收事件 */
}

#WEBGLcontainer {
	position: fixed;
	top: 0;
	left: 0;
	overflow: hidden;
}

canvas {
	display: block;
	overscroll-behavior: none;
	overflow-y: hidden;
	position: relative;
}

a,
button,
input,
select {
	pointer-events: auto;
}

#joystick-wrapper {
	border: 1px solid rgba(255, 255, 255, 0.5);
	width: 125px;
	height: 125px;
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%);
	text-align: center;
	border-radius: 100%;
	justify-content: center;
	align-items: center;
	opacity: 1;
	display: none;
	/* 确保摇杆可以接收触摸事件 */
	pointer-events: auto !important;
	touch-action: none !important;
	z-index: 9999 !important;
}

/* 触摸设备且资源加载完成后显示摇杆 */
@media (hover: none) and (pointer: coarse) {
	#joystick-wrapper.loaded {
		display: flex;
	}
}

.preload-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: black;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 1000;
	opacity: 0.9;
	pointer-events: auto; /* 加载时允许交互 */
}

.preload-overlay.fade-out {
	pointer-events: none !important; /* 淡出时禁用交互，让 canvas 接收事件 */
}

/* 统一 box-sizing */
.trinity-rings-spinner,
.trinity-rings-spinner *,
.loading-text-div,
.loading-resource-name {
	box-sizing: border-box;
}

.trinity-rings-spinner {
	height: 500px;
	width: 500px;
	padding: 3px;
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
	overflow: hidden;
}
.trinity-rings-spinner .circle {
	position: absolute;
	display: block;
	border-radius: 50%;
	border: 10px solid #fffc00;
}

.trinity-rings-spinner .circle:nth-child(1) {
	height: 350px;
	width: 350px;
	animation: trinity-rings-spinner-circle1-animation 1.5s infinite linear;
	border-width: 10px;
	opacity: 0.9;
}
.trinity-rings-spinner .circle:nth-child(2) {
	height: calc(350px * 0.65);
	width: calc(350px * 0.65);
	animation: trinity-rings-spinner-circle2-animation 1.5s infinite linear;
	border-width: 8px;
	opacity: 0.7;
}
.trinity-rings-spinner .circle:nth-child(3) {
	height: calc(350px * 0.45);
	width: calc(350px * 0.45);
	animation: trinity-rings-spinner-circle3-animation 1.5s infinite linear;
	border-width: 6px;
	opacity: 0.5;
}

@keyframes trinity-rings-spinner-circle1-animation {
	0% {
		transform: rotateZ(20deg) rotateY(0deg);
	}
	100% {
		transform: rotateZ(100deg) rotateY(360deg);
	}
}
@keyframes trinity-rings-spinner-circle2-animation {
	0% {
		transform: rotateZ(100deg) rotateX(0deg);
	}
	100% {
		transform: rotateZ(0deg) rotateX(360deg);
	}
}
@keyframes trinity-rings-spinner-circle3-animation {
	0% {
		transform: rotateZ(100deg) rotateX(-360deg);
	}
	100% {
		transform: rotateZ(-360deg) rotateX(360deg);
	}
}

/* 加载文本通用样式 */
.loading-text-div,
.loading-resource-name {
	position: absolute;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
		Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
	color: #fffc00;
	left: 50%;
	transform: translateX(-50%);
	text-align: center;
}

.loading-text-div {
	font-size: 26px;
	bottom: calc(50% - 100px);
}

.loading-resource-name {
	font-size: 18px;
	opacity: 0.8;
	bottom: calc(50% - 220px);
	white-space: nowrap;
}

.fade-out {
	animation: fade-out-animation 0.75s 1 forwards;
}

@keyframes fade-out-animation {
	from {
		opacity: 0.9;
	}
	to {
		opacity: 0;
		display: none;
		visibility: "hidden";
		cursor: default;
	}
}
