/* 手绘卡通风格样式 */
:root {
	--bg: #fffaf3;
	--ink: #2b2b2b;
	--accent: #ff9f1a;
	--accent-2: #6cc644;
	--muted: #c9c3b8;
	--grid: #ece4d9;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: ui-rounded, "SF Pro Rounded", "SF Pro", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.page {
	max-width: 840px;
	margin: 0 auto;
	padding: 16px;
}

.title {
	margin: 8px 0 4px;
	font-weight: 800;
	letter-spacing: 1px;
	text-shadow: 0 2px 0 #fff7, 2px 2px 0 #0001;
}

.hud {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.stats {
	display: flex;
	gap: 16px;
	font-weight: 700;
}

.stats span {
	display: inline-block;
	min-width: 2ch;
	text-align: right;
}

.stage {
	position: relative;
	display: grid;
	place-items: center;
	margin-top: 8px;
}

#game {
	width: 100%;
	height: auto;
	max-width: 640px;
	aspect-ratio: 1 / 1;
	background: repeating-conic-gradient(from 45deg, #0000 0 90deg, #0001 90deg 180deg);
	border: 4px solid var(--ink);
	border-radius: 16px;
	box-shadow: 0 10px 0 #0001, 0 6px 20px #0002 inset, 0 0 0 6px #fff4 inset;
}

.overlay {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
}

.overlay.hidden {
	display: none;
}

.panel {
	background: #fffefb;
	border: 3px solid var(--ink);
	border-radius: 14px;
	padding: 18px 20px;
	width: min(92%, 420px);
	box-shadow: 8px 8px 0 #0002;
	text-align: center;
}

.panel h2 {
	margin: 0 0 8px;
}

.btn {
	border: 3px solid var(--ink);
	background: #fff;
	border-radius: 12px;
	padding: 8px 14px;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 4px 4px 0 #0002;
	transition: transform .05s ease;
}

.btn:active {
	transform: translate(1px, 1px);
	box-shadow: 2px 2px 0 #0002;
}

.btn.primary {
	background: var(--accent);
	color: #fff;
}

.toolbar {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: center;
	padding: 12px 0;
}

.toggle {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}

.controls {
	position: absolute;
	right: -60px;
	top: 50%;
	translate: 0 -50%;
	display: grid;
	gap: 6px;
}

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

.dir {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 3px solid var(--ink);
	background: #fff;
	font-size: 16px;
	cursor: pointer;
	box-shadow: 3px 3px 0 #0002;
}

@media (max-width: 920px) {
	.controls {
		position: static;
		translate: 0 0;
		margin-top: 12px;
		grid-template-columns: 1fr;
		justify-items: center;
	}
}

/* 画布绘制风格（手绘线条效果）由 JS 完成，这里只提供基础视觉氛围。*/