@charset "UTF-8";

:root {
	--cell: 40px;
	--board-cols: 16;
	--board-rows: 14;
	--board-pad: 10px;
	--board-border: 6px;
	--ink: #222;
	--muted: #666;
	--panel: #fff;
	--board-bg: #464646;
	--board-edge: #a2a5ac;
}

* {
	-webkit-tap-highlight-color: transparent;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html, body {
	min-height: 100%;
}

body {
	margin: 0;
	padding: 0;
	color: var(--ink);
	background: #f2f3f5;
	font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
	overflow-x: hidden;
}

.back-home {
	display: inline-block;
	margin-bottom: 12px;
	color: #31BDEC !important;
	font-size: 14px;
	text-decoration: none;
}

.container {
	margin: 10px auto 20px;
	width: 960px;
	max-width: 100%;
	background: var(--panel);
	padding: 20px;
}

.container a, .container a:hover, .container a:active {
	color: #31BDEC !important;
}

.box {
	box-sizing: content-box;
	width: calc(var(--cell) * var(--board-cols));
	height: calc(var(--cell) * var(--board-rows));
	margin: 0 auto;
	position: relative;
	background: var(--board-bg);
	border-radius: 0;
	box-shadow: inset 0 0 10px 10px #464646;
	background-repeat: repeat;
	border: var(--board-border) solid var(--board-edge);
	padding: var(--board-pad);
	overflow: hidden;
	touch-action: none;
	user-select: none;
}

.box .box-item {
	box-sizing: border-box;
	text-align: center;
	width: var(--cell);
	height: var(--cell);
	float: left;
	position: relative;
	display: block;
}

.box .box-item div {
	width: var(--cell);
	height: var(--cell);
	line-height: var(--cell);
	font-size: calc(var(--cell) * 0.55);
}

/* 透明+走廊 */
.box .box-item div[data-role="0"] {
	background: transparent;
}

/* 墙壁 */
.box .box-item div[data-role="1"] {
	cursor: no-drop;
	border: 0 solid #53575a;
	border-radius: 2px;
	box-shadow: 0 4px 4px 0 #303030;
	background: url(../images/wall.jpg) no-repeat center;
	background-size: cover;
}

/* 箱子原来的位置、人物踩原点 */
.box .box-item div[data-role="2"],
.box .box-item div[data-role="5"].people2origin {
	color: #1bff00;
	border: 2px dashed #8c8e00;
	width: calc(var(--cell) - 6px);
	height: calc(var(--cell) - 6px);
	line-height: calc(var(--cell) - 6px);
	margin: 3px;
	border-radius: 8px;
	font-size: calc(var(--cell) * 0.35);
	text-shadow: 0 0 5px #b3ffaa;
	box-shadow: inset 0 0 5px 1px #303030;
}

.box .box-item div[data-role="2"]:before {
	content: "●";
	font-size: calc(var(--cell) * 0.28);
}

/* 箱子位置 */
.box .box-item div[data-role="3"] {
	box-shadow: 0 4px 4px 0 #303030;
	background: url(../images/box.jpg) no-repeat center;
	background-size: cover;
}

/* 人的位置：公用根目录 people.png，两个游戏共用一份 */
.box .box-item div[data-role="5"] {
	background: url(../../people.png) no-repeat center;
	background-size: auto 100%;
}

.lv-btn {
	width: 80px;
	height: 40px;
	background: #9fa4a8;
	box-shadow: 0 3px 3px 0 #86888d;
	margin: 0;
	display: inline-block;
	transition: background .2s;
	color: #fff;
	border: 1px solid #9a9ea2;
	cursor: pointer;
	font-size: 15px;
	font-weight: bold;
	letter-spacing: 1px;
	border-radius: 4px;
}

.lv-btn:hover,
.lv-btn:active {
	background: #7f858b;
}

.kk_step span, .kk_time span {
	color: orange;
}

.opt-desc {
	margin-top: 20px;
	border-top: 1px solid #eee;
	padding-top: 12px;
}

.opt-desc summary {
	cursor: pointer;
	font-size: 15px;
	font-weight: 600;
	color: #444;
	padding: 8px 0;
	list-style: none;
}

.opt-desc summary::-webkit-details-marker {
	display: none;
}

.opt-desc p {
	text-indent: 2em;
	margin: 0 0 8px;
	color: #999;
	font-size: 14px;
	line-height: 1.6;
}

.content {
	width: calc(var(--cell) * var(--board-cols) + var(--board-pad) * 2 + var(--board-border) * 2);
	max-width: 100%;
	margin: 0 auto;
}

.controll {
	margin: 14px auto 0;
	text-align: center;
}

.controll .stats {
	display: flex;
	justify-content: center;
	gap: 24px;
	margin-bottom: 12px;
	font-size: 16px;
}

.controll .btns {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
}

.kk_level {
	font-size: 1.4rem;
	font-weight: bold;
	margin-bottom: 12px;
	text-align: center;
}

/* 方向键 - 桌面默认也显示，小屏更醒目 */
.dpad {
	width: 168px;
	height: 168px;
	margin: 18px auto 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: repeat(3, 1fr);
	gap: 6px;
}

.dpad-btn {
	border: none;
	border-radius: 10px;
	background: #9fa4a8;
	color: #fff;
	font-size: 22px;
	font-weight: bold;
	cursor: pointer;
	box-shadow: 0 3px 0 #7a7f84;
	user-select: none;
	touch-action: manipulation;
}

.dpad-btn:active {
	transform: translateY(2px);
	box-shadow: 0 1px 0 #7a7f84;
	background: #7f858b;
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }

.tip-mobile {
	display: none;
	text-align: center;
	color: #999;
	font-size: 12px;
	margin-top: 10px;
}

blockquote, body, button, dd, div, dl, dt, form, h1, h2, h3, h4, h5, h6,
input, li, ol, p, pre, td, textarea, th, ul {
	margin: 0;
	padding: 0;
}

.layui-col-space1 > * {
	padding: .5px;
}

.layui-col-xs1, .layui-col-xs10, .layui-col-xs11, .layui-col-xs12,
.layui-col-xs2, .layui-col-xs3, .layui-col-xs4, .layui-col-xs5,
.layui-col-xs6, .layui-col-xs7, .layui-col-xs8, .layui-col-xs9 {
	float: left;
	position: relative;
	display: block;
}

.layui-elem-field {
	border-color: #e6e6e6;
	padding: 0;
	border-style: solid;
	margin: 12px 0;
}

.layui-field-title {
	margin: 10px 0 14px;
	border-width: 1px 0 0;
}

.layui-elem-field legend {
	margin-left: 12px;
	padding: 0 8px;
	font-size: 16px;
	font-weight: 400;
}

/* ========== 手机端适配 ========== */
@media screen and (max-width: 720px) {
	:root {
		--cell: min(40px, calc((100vw - 48px) / 16));
		--board-pad: 6px;
		--board-border: 4px;
	}

	body {
		background: #fff;
	}

	.container {
		width: 100%;
		margin: 0;
		padding:
			max(12px, env(safe-area-inset-top))
			max(12px, env(safe-area-inset-right))
			max(16px, env(safe-area-inset-bottom))
			max(12px, env(safe-area-inset-left));
	}

	.back-home {
		margin-bottom: 8px;
		font-size: 13px;
	}

	.kk_level {
		font-size: 1.15rem;
		margin-bottom: 8px;
	}

	.content {
		width: 100%;
	}

	.box {
		max-width: 100%;
	}

	.controll {
		margin-top: 12px;
	}

	.controll .stats {
		gap: 16px;
		font-size: 14px;
		margin-bottom: 10px;
	}

	.controll .btns {
		gap: 6px;
	}

	.lv-btn {
		width: auto;
		min-width: 72px;
		flex: 1 1 40%;
		height: 42px;
		font-size: 14px;
		letter-spacing: 0;
	}

	.dpad {
		width: min(200px, 56vw);
		height: min(200px, 56vw);
		margin-top: 16px;
	}

	.dpad-btn {
		font-size: 24px;
		border-radius: 12px;
	}

	.tip-mobile {
		display: block;
	}

	.opt-desc p {
		padding: 0 4px;
		font-size: 13px;
		text-indent: 0;
	}

	.box .box-item div[data-role="1"],
	.box .box-item div[data-role="3"] {
		box-shadow: 0 2px 2px 0 #303030;
	}

	.box .box-item div[data-role="2"],
	.box .box-item div[data-role="5"].people2origin {
		width: calc(var(--cell) - 4px);
		height: calc(var(--cell) - 4px);
		line-height: calc(var(--cell) - 4px);
		margin: 2px;
		border-width: 1px;
		border-radius: 4px;
	}
}

/* 横屏：压缩说明区，方向键靠右可选 */
@media screen and (max-width: 900px) and (orientation: landscape) {
	:root {
		--cell: min(32px, calc((100vh - 120px) / 14), calc((100vw - 220px) / 16));
	}

	.container {
		padding: 8px 12px;
	}

	.content {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-start;
		justify-content: center;
		gap: 12px;
	}

	.kk_level {
		width: 100%;
		margin-bottom: 4px;
		font-size: 1rem;
	}

	.controll {
		width: 100%;
		order: 3;
		margin-top: 4px;
	}

	.dpad {
		width: 120px;
		height: 120px;
		margin: 0;
		order: 2;
	}

	.tip-mobile {
		display: none;
	}

	.lv-btn {
		height: 36px;
		min-width: 64px;
		font-size: 13px;
	}

	.opt-desc {
		display: none;
	}
}
