:root {
	--bg: #9be7ff;
	--ground: #6cc24a;
	--hud: #ffffffcc;
	--p1: #ff355d;
	--p2: #6a5acd;
	--hp: #00c853;
	--hp-bg: #e0e0e0;
	--shadow: #00000020;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	background: linear-gradient(#b3ecff, var(--bg));
	color: #222;
	user-select: none;
}

#app {
	max-width: 1100px;
	margin: 0 auto;
	padding: 12px;
}

.hud {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 12px;
	background: var(--hud);
	border-radius: 12px;
	padding: 8px 12px;
	box-shadow: 0 4px 12px var(--shadow);
}

.group {
	display: grid;
	gap: 6px;
}

.left .label {
	color: var(--p1);
	font-weight: 800;
}

.right .label {
	color: var(--p2);
	font-weight: 800;
	text-align: right;
}

.center {
	text-align: center;
}

.message {
	font-weight: 800;
	font-size: 18px;
}

.tips {
	display: flex;
	gap: 12px;
	justify-content: center;
	opacity: .8;
	font-size: 12px;
}

.healthbar {
	width: 100%;
	height: 14px;
	background: var(--hp-bg);
	border-radius: 99px;
	overflow: hidden;
}

.health {
	height: 100%;
	background: var(--hp);
	width: 100%;
	transition: width .15s ease-out;
}

.left .health {
	background: linear-gradient(90deg, #00e676, var(--hp));
}

.right .health {
	background: linear-gradient(90deg, #00b0ff, #00c853);
}

.score {
	font-size: 14px;
	opacity: .9;
}

.stage-wrap {
	margin: 14px 0;
}

#game {
	width: 100%;
	height: auto;
	display: block;
	background: #87ceeb;
	border-radius: 16px;
	box-shadow: 0 8px 24px var(--shadow);
}

.controls {
	display: flex;
	gap: 10px;
	justify-content: center;
}

.controls button {
	padding: 10px 14px;
	border-radius: 10px;
	border: 2px solid #2222;
	background: #fff;
	cursor: pointer;
	font-weight: 700;
}

.controls button:hover {
	filter: brightness(0.96);
}

.controls button:active {
	transform: translateY(1px);
}

@media (max-width: 600px) {
	.tips {
		flex-direction: column;
	}
}

/* 触屏按键（iPad） */
.touch-controls {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 12px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	padding: 0 12px;
	pointer-events: none;
	/* 容器不挡事件，内部按钮可点 */
}

.tc-left,
.tc-right {
	display: grid;
	gap: 6px;
	justify-items: center;
	pointer-events: auto;
}

.touch-controls .title {
	font-weight: 800;
	background: var(--hud);
	padding: 2px 8px;
	border-radius: 8px;
}

.row {
	display: flex;
	gap: 10px;
}

.tc-btn {
	min-width: 64px;
	min-height: 64px;
	border-radius: 14px;
	border: 2px solid #2222;
	background: #ffffffee;
	font-size: 24px;
	font-weight: 900;
	box-shadow: 0 4px 12px var(--shadow);
}

.tc-btn.attack {
	background: #ffe9a8;
}

.tc-btn:active {
	transform: scale(0.98);
}

/* 默认在触屏环境显示；在桌面可隐藏 */
@media (hover: hover) and (pointer: fine) {
	.touch-controls {
		display: none;
	}
}