/* ===== 顶牛棋 · 手机框布局 ===== */
* { -webkit-tap-highlight-color: transparent; }

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: hidden;
}

body {
	background: radial-gradient(circle at 50% 0%, #2c4a6b 0%, #16283a 55%, #0d1723 100%);
	font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

#stage {
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 16px 12px;
	box-sizing: border-box;
}

/* 手机外框：高度约为一屏，宽度按 9:16 */
#phone {
	position: relative;
	height: min(84vh, 700px);
	aspect-ratio: 9 / 16;
	max-width: calc(100vw - 24px);
	max-height: calc(100vh - 90px);
	border-radius: 30px;
	background: #0b1220;
	padding: 9px;
	box-sizing: border-box;
	box-shadow:
		0 0 0 2px #3d4b5e,
		0 18px 40px rgba(0, 0, 0, .55),
		inset 0 0 0 1px rgba(255, 255, 255, .06);
}

/* 屏幕区域：所有内容都裁切在这里面 */
#screen {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: 22px;
	overflow: hidden;
	background: #f3e9d6;
}

#container {
	position: absolute;
	inset: 0;
}

#canvas {
	display: block;
	width: 100%;
	height: 100%;
	background-size: 100% 100%;
	background-repeat: no-repeat;
}

/* ===== 弹层（说明 / 胜负 / 错误提示）===== */
.pop_layer {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 1002;
	background-color: rgba(0, 0, 0, .45);
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 16px;
	box-sizing: border-box;
}

.pop_show { display: flex; }

.pop_img {
	margin: 0 auto;
	max-width: 88%;
	max-height: 76%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 10px;
}

.pop_tip {
	color: #ffe9b0;
	font-size: 13px;
	letter-spacing: 1px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}

/* ===== 框外返回链接 ===== */
.back_link {
	flex: none;
	color: #cfe0f2;
	font-size: 14px;
	text-decoration: none;
	padding: 7px 18px;
	border: 1px solid rgba(207, 224, 242, .35);
	border-radius: 999px;
	background: rgba(255, 255, 255, .06);
	transition: background .2s, color .2s;
}

.back_link:hover {
	background: rgba(255, 255, 255, .16);
	color: #fff;
}

/* 横屏时压缩框高，保证完整可见 */
@media (orientation: landscape) and (max-height: 520px) {
	#phone { height: min(92vh, 460px); }
	.back_link { font-size: 12px; padding: 5px 14px; }
}
