:root {
    --z-slot-iframe: 0;       /* 机台 iframe */
    --z-cocos: 10;            /* cocos 网页 */
	--z-web-iframe: 20;	  	  /* 显示iframe网页(rsg/amoe) */
    --z-game-tips: 30;        /* 游戏上方提示(强制横屏、提示全屏等) */
	--z-loading: 40;
    --z-aihelp: 100000;       /* aihelp 网页 */
    --z-aihelp-close: 100001; /* aihelp 关闭按钮 */
}

/* 隐藏zendesk三个点 */
#launcher,
#webWidget,
iframe[title*='messaging' i] {
  visibility: hidden !important;
  pointer-events: none !important;
}

body[data-zendesk-window-open] #launcher,
body[data-zendesk-window-open] #webWidget,
body[data-zendesk-window-open] iframe[title*='messaging' i] {
  visibility: visible !important;
  pointer-events: auto !important;
}

/* 打开客服时固定 body，防止 iOS 橡皮筋拖动底层画面 */
body[data-zendesk-window-open] {
    position: fixed;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
}
/* stylelint-enable selector-id-pattern */

#GameDiv {
    position: relative;
}

#Cocos3dGameContainer {
    position: relative;
    z-index: var(--z-cocos);
    /* 修复 Safari(尤其 M1 芯片 WebKit) 上 iframe 合成层错误盖住 cocos canvas 的问题:
       强制 cocos 独占独立合成层并建立独立层叠上下文, 稳定其始终位于最上层。 */
    isolation: isolate;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.web-iframe {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    width: 100vw;
    height: 100%;
    height: 100dvh; /* 适配 iOS Safari 伪全屏展开后的大视口高度 */
    border: 0;
    margin: 0;
    pointer-events: auto;
    z-index: var(--z-web-iframe);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    display: none;
}

#content {
    position: relative;
    z-index: var(--z-cocos);
}

body.slot-mode #content,
body.slot-mode #Cocos3dGameContainer {
    pointer-events: none;
}

body.slot-mode.cocos-interactive #content,
body.slot-mode.cocos-interactive #Cocos3dGameContainer {
    pointer-events: auto;
}

.AIHelpSupportBox {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	z-index: var(--z-aihelp)
}

.AIHelpSupportClose {
	position: fixed;
	right: 20px;
	top: 20px;
	width: 30px;
	height: 30px;
	color: #fff;
	background: url(../images/aihelp_btn_close.png) no-repeat center center;
	border-radius: 0.25rem;
	cursor: pointer;
	z-index: var(--z-aihelp-close)
}

.change-orientation-landscape {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	background: linear-gradient(0deg, #280565, #AD0B7F);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: var(--z-game-tips);
}

.content-class {
	flex-shrink: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
	padding-bottom: env(safe-area-inset-bottom)
}

/*
 * 显示 iOS PWA 安装引导时，收回“上滑进入伪全屏”所需的额外滚动空间。
 * 100svh 对应 Safari 工具栏展开时的小视口高度；固定根节点高度后再回到页面
 * 顶部，可以避免用户上滑进入伪全屏后根滚动区域仍停留在大视口高度。
 */
html.safari-pwa-guiding,
html.safari-pwa-guiding body {
	height: 100svh !important;
	min-height: 100svh !important;
	max-height: 100svh !important;
	overflow: hidden !important;
}

#id-touch-screen {

	position: absolute;
	top: 0rem;
	width: 100vw;

	/* 只比视口高一点点：制造"极小滚动余量"，让快滑/慢滑都只能在顶部小范围滚动，
	   保证 Safari 一滑就收起工具栏进入全屏，又不会"滚过头"变成整页滚动。 */
	height: calc(100vh + 60px);
	text-align: center;
	font-size: 3rem;
	color: white;
	background: rgba(0,0,0,0.5);
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	flex-shrink: 0;
	z-index: var(--z-game-tips);
}

@keyframes finger-swipe-up {
	0%,100% {
		transform: translateY(2rem);
		opacity: 0.4
	}

	50% {
		transform: translateY(-2rem);
		opacity: 1
	}
}

.touch-screen-finger {
	height: 24rem;
	width: 24rem;
	margin-top: 5rem;
	animation: finger-swipe-up 1.5s ease-in-out infinite;
}

.touch-screen-text {
	font-size: 4.5rem;
	font-weight: 600;
}

.touch-screen-button {
	background: transparent;
	color: white;
	border: none;
	font-size: 3rem
}

.fixed-position {
	position: fixed
}

div,img {
	flex-shrink: 0
}

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

/* iOS 竖屏下适配 Zendesk 聊天窗口，避开顶部状态栏和电池 */
@media (orientation: portrait) and (max-width: 768px) {
    .zd-chat-window,
    iframe#webWidget,
    iframe.zEWidget-webWidget,
    iframe.zEWidget-frame,
    iframe[data-product="web_widget"] {
        top: max(env(safe-area-inset-top, 48px), 48px) !important;
        height: calc(100% - max(env(safe-area-inset-top, 48px), 48px)) !important;
        height: calc(100dvh - max(env(safe-area-inset-top, 48px), 48px)) !important;
        overscroll-behavior: contain !important;
    }
}
