* {
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	min-height: 100%;
	overflow: hidden;
}

body {
	margin: 0;
	font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
	color: #f8fbff;
	background:
		radial-gradient(circle at 18% 16%, rgba(255, 221, 93, 0.28), transparent 18rem),
		linear-gradient(135deg, #101820 0%, #244058 42%, #78b8c6 100%);
	touch-action: none;
}

button {
	font: inherit;
}

.game-stage {
	position: relative;
	width: 100vw;
	height: 100vh;
	min-height: 520px;
	overflow: hidden;
	isolation: isolate;
	background:
		radial-gradient(circle at 78% 18%, rgba(255, 217, 81, 0.42), transparent 9rem),
		linear-gradient(180deg, rgba(83, 185, 220, 0.76), rgba(245, 250, 252, 0.96) 43%, #f9fcff 100%),
		repeating-linear-gradient(120deg, transparent 0 58px, rgba(84, 171, 194, 0.18) 58px 61px, transparent 61px 118px);
}

.game-stage::before,
.game-stage::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 2;
}

.game-stage::before {
	background:
		linear-gradient(180deg, rgba(9, 18, 25, 0.18), transparent 24%, transparent 72%, rgba(11, 18, 25, 0.1)),
		repeating-linear-gradient(112deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 92px),
		repeating-linear-gradient(90deg, transparent 0 30px, rgba(72, 131, 153, 0.08) 30px 32px, transparent 32px 64px);
	mix-blend-mode: multiply;
}

.game-stage::after {
	background-image:
		radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.5px),
		radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px);
	background-position: 0 0, 46px 62px;
	background-size: 96px 96px, 132px 132px;
	opacity: 0.62;
	animation: snow-drift 13s linear infinite;
}

#skifree-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	vertical-align: top;
	z-index: 1;
	background: transparent;
	cursor: crosshair;
	image-rendering: pixelated;
}

.skyline {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	opacity: 0.85;
}

.peak {
	position: absolute;
	bottom: 48%;
	width: 42vw;
	aspect-ratio: 1;
	background:
		linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0 20%, transparent 20%),
		linear-gradient(45deg, #3a7892 0 50%, #80c5d4 50% 100%);
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
	filter: drop-shadow(0 18px 0 rgba(36, 92, 116, 0.16)) drop-shadow(0 28px 28px rgba(16, 32, 40, 0.2));
}

.peak-a {
	left: -7vw;
	transform: scale(1.08);
}

.peak-b {
	left: 28vw;
	bottom: 51%;
	transform: scale(1.22);
}

.peak-c {
	right: -9vw;
	transform: scale(0.98);
}

.brand-panel,
.status-strip,
.start-overlay,
.welcome-screen,
.game-actions,
.touch-pad {
	position: absolute;
	z-index: 3;
}

.welcome-screen {
	inset: 0;
	z-index: 8;
	display: grid;
	place-items: center;
	overflow: hidden;
	background: #05080d;
	transition: opacity 220ms ease, visibility 220ms ease;
}

.welcome-screen.is-hidden {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.welcome-video {
	position: absolute;
	inset: -3%;
	width: 106%;
	height: 106%;
	object-fit: cover;
	filter: blur(2.5px) saturate(1.22) contrast(1.12) brightness(0.72);
	transform: scale(1.02);
}

.welcome-screen::before,
.welcome-screen::after,
.welcome-pixel-layer {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.welcome-screen::before {
	z-index: 1;
	background:
		radial-gradient(circle at 50% 43%, transparent 0 32%, rgba(0, 0, 0, 0.28) 60%, rgba(0, 0, 0, 0.78) 100%),
		linear-gradient(180deg, rgba(0, 0, 0, 0.36), transparent 38%, rgba(0, 0, 0, 0.58));
}

.welcome-screen::after {
	z-index: 2;
	background:
		linear-gradient(rgba(255, 255, 255, 0.055) 50%, rgba(0, 0, 0, 0.12) 50%),
		repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 7px);
	background-size: 100% 4px, 8px 100%;
	mix-blend-mode: overlay;
	opacity: 0.7;
}

.welcome-pixel-layer {
	z-index: 2;
	backdrop-filter: blur(1px);
	background:
		repeating-linear-gradient(0deg, transparent 0 9px, rgba(255, 255, 255, 0.08) 9px 10px),
		repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.12) 9px 10px);
	opacity: 0.55;
}

.welcome-copy {
	position: absolute;
	top: clamp(40px, 9vh, 92px);
	left: 50%;
	z-index: 3;
	transform: translateX(-50%);
	width: min(760px, calc(100vw - 28px));
	text-align: center;
}

.welcome-copy h1 {
	margin: 0;
	color: #fff3bf;
	font-size: clamp(48px, 10vw, 116px);
	line-height: 0.95;
	letter-spacing: 0;
	text-shadow:
		0 5px 0 #8b2d4d,
		0 9px 0 #2a1832,
		0 18px 38px rgba(0, 0, 0, 0.55);
}

.enter-game-button {
	position: absolute;
	left: 50%;
	bottom: clamp(42px, 12vh, 108px);
	z-index: 3;
	width: min(320px, calc(100vw - 48px));
	height: 68px;
	border: 4px solid #351b34;
	border-radius: 8px;
	color: #331800;
	background:
		linear-gradient(180deg, #fff08b 0%, #ffbd32 48%, #e77716 100%);
	box-shadow:
		inset 0 4px 0 rgba(255, 255, 255, 0.5),
		inset 0 -6px 0 rgba(111, 39, 20, 0.3),
		0 8px 0 #1e1020,
		0 18px 32px rgba(0, 0, 0, 0.42);
	font-size: clamp(24px, 4.5vw, 38px);
	font-weight: 900;
	letter-spacing: 0;
	cursor: pointer;
	transform: translateX(-50%);
	transition: transform 150ms ease, filter 150ms ease;
}

.enter-game-button:hover {
	filter: brightness(1.07);
	transform: translateX(-50%) translateY(-2px);
}

.enter-game-button:active {
	transform: translateX(-50%) translateY(4px);
	box-shadow:
		inset 0 4px 0 rgba(255, 255, 255, 0.35),
		inset 0 -4px 0 rgba(111, 39, 20, 0.25),
		0 4px 0 #1e1020,
		0 10px 22px rgba(0, 0, 0, 0.36);
}

.brand-panel {
	top: max(18px, env(safe-area-inset-top));
	left: clamp(16px, 4vw, 44px);
	max-width: min(390px, calc(100vw - 32px));
	text-shadow: 0 2px 12px rgba(5, 15, 22, 0.32);
	pointer-events: none;
}

.badge {
	display: inline-flex;
	align-items: center;
	min-height: 24px;
	padding: 4px 10px;
	border: 1px solid rgba(255, 255, 255, 0.48);
	border-radius: 999px;
	color: #10212a;
	background: rgba(255, 255, 255, 0.68);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0;
}

.brand-panel h1 {
	margin: 10px 0 6px;
	font-size: clamp(36px, 5.8vw, 72px);
	line-height: 0.96;
	letter-spacing: 0;
	color: #ffffff;
}

.brand-panel p {
	margin: 0;
	max-width: 26em;
	font-size: clamp(14px, 1.7vw, 18px);
	line-height: 1.7;
	color: rgba(255, 255, 255, 0.88);
}

.status-strip {
	top: max(20px, env(safe-area-inset-top));
	right: clamp(16px, 3vw, 36px);
	display: grid;
	grid-template-columns: repeat(3, minmax(96px, 1fr));
	gap: 8px;
	width: min(430px, calc(100vw - 32px));
}

.status-strip div,
.game-actions,
.touch-pad,
.start-overlay {
	border: 1px solid rgba(255, 255, 255, 0.42);
	background: rgba(18, 39, 54, 0.64);
	box-shadow: 0 18px 48px rgba(14, 26, 34, 0.18);
	backdrop-filter: blur(14px);
}

.status-strip div {
	min-height: 62px;
	padding: 10px 12px;
	border-radius: 8px;
}

.status-strip span {
	display: block;
	color: rgba(255, 255, 255, 0.64);
	font-size: 12px;
}

.status-strip strong {
	display: block;
	margin-top: 4px;
	color: #ffffff;
	font-size: 14px;
	line-height: 1.25;
}

.start-overlay {
	top: 50%;
	left: 50%;
	width: min(720px, calc(100vw - 32px));
	min-height: 420px;
	padding: 30px 28px 28px;
	border-radius: 8px;
	text-align: center;
	transform: translate(-50%, -48%);
	transition: opacity 220ms ease, visibility 220ms ease, transform 220ms ease;
}

.start-overlay.is-hidden {
	visibility: hidden;
	opacity: 0;
	transform: translate(-50%, -45%) scale(0.96);
	pointer-events: none;
}

.hero-skier {
	width: 92px;
	height: 92px;
	margin: 0 auto 18px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.5);
	background:
		url("../sprite-characters.png") 21px 22px / 273px 583px no-repeat,
		linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(229, 245, 250, 0.82));
	box-shadow: inset 0 -12px 28px rgba(52, 101, 116, 0.2), 0 14px 28px rgba(0, 0, 0, 0.16);
	image-rendering: pixelated;
}

.start-overlay h2 {
	margin: 12px 0 8px;
	font-size: 34px;
	line-height: 1.1;
	letter-spacing: 0;
}

.start-overlay p {
	margin: 0 auto 24px;
	max-width: 25em;
	color: rgba(255, 255, 255, 0.78);
	line-height: 1.7;
}

.setup-step.is-hidden {
	display: none;
}

.character-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	margin: 18px 0;
}

.character-card {
	position: relative;
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	gap: 10px;
	min-height: 300px;
	padding: 10px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.1);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
	cursor: pointer;
	overflow: hidden;
}

.character-card::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 3px solid transparent;
	border-radius: 8px;
	pointer-events: none;
}

.character-card.is-selected::after {
	border-color: #f8d85e;
}

.character-card img {
	width: 100%;
	height: 260px;
	object-fit: cover;
	object-position: center 28%;
	border-radius: 6px;
	image-rendering: auto;
}

.character-card span {
	position: relative;
	z-index: 1;
	display: block;
	min-height: 34px;
	padding: 7px 10px;
	border-radius: 7px;
	color: #10212a;
	background: #f8d85e;
	font-size: 18px;
	font-weight: 900;
}

.skill-panel {
	display: grid;
	gap: 12px;
	margin: 20px 0;
}

.skill-row {
	display: grid;
	grid-template-columns: minmax(96px, 1fr) auto;
	align-items: center;
	gap: 14px;
	padding: 14px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.08);
	text-align: left;
}

.skill-row strong,
.skill-row span {
	display: block;
}

.skill-row strong {
	color: #ffffff;
	font-size: 18px;
}

.skill-row span {
	margin-top: 4px;
	color: rgba(255, 255, 255, 0.66);
	font-size: 13px;
}

.segmented {
	display: grid;
	grid-template-columns: repeat(3, 52px);
	gap: 6px;
}

.segmented button,
.secondary-action {
	border: 1px solid rgba(255, 255, 255, 0.36);
	border-radius: 7px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.12);
	cursor: pointer;
}

.segmented button {
	width: 52px;
	height: 40px;
	font-weight: 800;
}

.segmented button.is-selected {
	color: #10212a;
	background: #f8d85e;
	border-color: #f8d85e;
}

.setup-actions {
	display: grid;
	grid-template-columns: 112px 1fr;
	gap: 10px;
}

.secondary-action {
	height: 52px;
	font-weight: 800;
}

.wallet-status {
	min-height: 22px;
	margin: 12px 0 0;
	color: rgba(255, 255, 255, 0.78);
	font-size: 13px;
	line-height: 1.45;
}

.primary-action,
.game-actions button,
.touch-pad button {
	border: 0;
	color: #10212a;
	background: #f8d85e;
	box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16), 0 12px 24px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transition: transform 150ms ease, filter 150ms ease;
}

.primary-action {
	width: 100%;
	height: 52px;
	border-radius: 8px;
	font-weight: 800;
}

.primary-action:disabled {
	cursor: wait;
	filter: grayscale(0.25) brightness(0.86);
	transform: none;
}

.game-actions {
	right: clamp(16px, 3vw, 36px);
	bottom: max(20px, env(safe-area-inset-bottom));
	display: grid;
	grid-template-columns: repeat(3, 72px);
	gap: 8px;
	padding: 8px;
	border-radius: 8px;
}

.game-actions button,
.touch-pad button {
	width: 72px;
	height: 44px;
	border-radius: 7px;
	font-weight: 800;
}

.touch-pad {
	left: clamp(16px, 3vw, 36px);
	bottom: max(20px, env(safe-area-inset-bottom));
	display: none;
	grid-template-columns: repeat(4, 48px);
	gap: 8px;
	padding: 8px;
	border-radius: 8px;
}

.touch-pad button {
	width: 48px;
	height: 48px;
	font-size: 28px;
	line-height: 1;
}

.primary-action:hover,
.game-actions button:hover,
.touch-pad button:hover {
	filter: brightness(1.04);
	transform: translateY(-1px);
}

.primary-action:active,
.game-actions button:active,
.touch-pad button:active {
	transform: translateY(1px);
}

@keyframes snow-drift {
	from {
		background-position: 0 0, 46px 62px;
	}
	to {
		background-position: 110px 210px, 180px 282px;
	}
}

@media (max-width: 900px) {
	.game-stage {
		min-height: 100vh;
	}

	.brand-panel {
		top: max(14px, env(safe-area-inset-top));
		left: 16px;
		max-width: 280px;
	}

	.brand-panel h1 {
		font-size: 40px;
	}

	.brand-panel p,
	.status-strip {
		display: none;
	}

	.start-overlay {
		top: 47%;
		min-height: 330px;
		padding: 24px 20px;
	}

	.character-grid {
		gap: 10px;
	}

	.character-card {
		min-height: 230px;
	}

	.character-card img {
		height: 190px;
	}

	.touch-pad {
		display: grid;
	}

	.game-actions {
		grid-template-columns: repeat(3, 58px);
	}

	.game-actions button {
		width: 58px;
	}
}

@media (max-width: 520px) {
	.brand-panel h1 {
		font-size: 32px;
	}

	.brand-panel .badge {
		display: none;
	}

	.start-overlay h2 {
		font-size: 28px;
	}

	.welcome-copy {
		top: max(34px, env(safe-area-inset-top));
	}

	.enter-game-button {
		bottom: max(34px, env(safe-area-inset-bottom));
		height: 58px;
	}

	.start-overlay {
		width: calc(100vw - 20px);
		max-height: calc(100vh - 112px);
		overflow-y: auto;
	}

	.character-card {
		min-height: 178px;
		padding: 7px;
	}

	.character-card img {
		height: 140px;
	}

	.character-card span {
		min-height: 30px;
		padding: 5px 8px;
		font-size: 16px;
	}

	.skill-row {
		grid-template-columns: 1fr;
		gap: 10px;
		text-align: center;
	}

	.segmented {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.segmented button {
		width: 100%;
	}

	.game-actions {
		right: 10px;
		bottom: max(12px, env(safe-area-inset-bottom));
		grid-template-columns: repeat(3, 48px);
	}

	.game-actions button {
		width: 48px;
		font-size: 13px;
	}

	.touch-pad {
		left: 10px;
		bottom: max(12px, env(safe-area-inset-bottom));
		grid-template-columns: repeat(4, 42px);
	}

	.touch-pad button {
		width: 42px;
		height: 44px;
	}
}
