:root {
	--sky-top: #0b1f4d;
	--sky-bottom: #65c8ff;
	--panel: rgba(245, 251, 255, 0.9);
	--panel-line: rgba(21, 61, 117, 0.18);
	--ink: #16314f;
	--muted: #58779c;
	--accent: #4f8cff;
	--accent-strong: #2a6ce5;
	--warm: #ff9c46;
	--snow-shadow: #bedfff;
	--danger: #ff7a8a;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
	color: var(--ink);
	background:
		radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.28), transparent 20%),
		radial-gradient(circle at 82% 14%, rgba(206, 239, 255, 0.35), transparent 22%),
		linear-gradient(180deg, var(--sky-top) 0%, #2d5fb5 38%, var(--sky-bottom) 100%);
}

button,
a {
	font: inherit;
}

.app-shell {
	position: relative;
	min-height: 100vh;
	min-height: 100dvh;
	padding: clamp(1rem, 3vw, 2rem);
	overflow: hidden;
}

.toolbar,
.status-card,
.scene-card,
.puzzle-card,
.bottom-actions {
	position: relative;
	border: 1px solid var(--panel-line);
	background: var(--panel);
	box-shadow: 0 24px 60px rgba(9, 30, 68, 0.22);
	backdrop-filter: blur(16px);
}

.toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	border-radius: 1.5rem;
	padding: 1rem 1.2rem;
	margin-bottom: 1rem;
}

.toolbar-actions,
.score-row,
.bottom-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	align-items: center;
}

.score-panel {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.55rem;
	min-width: min(320px, 44vw);
}

h1,
h2,
h3,
p {
	margin: 0;
}

h1,
h2,
h3 {
	font-family: 'Fredoka', 'Segoe UI', sans-serif;
}

h1 {
	font-size: clamp(1.9rem, 5vw, 3rem);
	line-height: 1;
}

h2 {
	font-size: clamp(1.05rem, 2.5vw, 1.45rem);
	line-height: 1.35;
}

h3 {
	font-size: clamp(1.4rem, 4vw, 2rem);
	margin-top: 0.2rem;
}

.eyebrow,
.label {
	margin: 0;
	color: var(--accent-strong);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.status-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	border-radius: 1.3rem;
	padding: 1rem 1.15rem;
	margin-bottom: 1rem;
}

.score-row span {
	white-space: nowrap;
	border-radius: 999px;
	padding: 0.55rem 0.85rem;
	background: rgba(79, 140, 255, 0.14);
	font-weight: 700;
}

.chance-meter {
	display: grid;
	grid-template-columns: repeat(6, minmax(18px, 1fr));
	gap: 0.35rem;
	width: 100%;
	max-width: 320px;
	padding: 0.38rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.54);
	box-shadow: inset 0 -4px 0 rgba(190, 223, 255, 0.42);
}

.chance-step {
	height: 0.86rem;
	border-radius: 999px;
	background: rgba(255, 122, 138, 0.28);
	box-shadow: inset 0 0 0 1px rgba(214, 75, 105, 0.18);
	transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.chance-step.safe {
	background: linear-gradient(180deg, #9ff3c4 0%, #4fd491 100%);
	box-shadow: inset 0 -2px 0 rgba(34, 132, 89, 0.22);
}

.chance-step.spend-next {
	background: linear-gradient(180deg, #ffe08a 0%, #ffad4d 100%);
	box-shadow: inset 0 -2px 0 rgba(204, 112, 30, 0.24);
}

.chance-step.spent {
	opacity: 0.65;
}

.game-layout {
	display: grid;
	grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
	gap: 1rem;
}

.scene-card,
.puzzle-card {
	border-radius: 1.5rem;
	padding: clamp(1rem, 3vw, 1.4rem);
}

.snow-scene {
	position: relative;
	min-height: 420px;
	border-radius: 1.4rem;
	overflow: hidden;
	background:
		radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.9), rgba(255,255,255,0) 22%),
		linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 32%),
		linear-gradient(180deg, #214690 0%, #6fcbff 70%, #b8ecff 100%);
	box-shadow: inset 0 -22px 36px rgba(255, 255, 255, 0.3);
}

.sky-glow {
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 50% 16%, rgba(255, 255, 255, 0.7), transparent 18%);
	pointer-events: none;
}

.snow-drifts {
	position: absolute;
	left: -5%;
	right: -5%;
	bottom: -3%;
	height: 34%;
	background:
		radial-gradient(circle at 14% 84%, #f6fdff 0 18%, transparent 19%),
		radial-gradient(circle at 38% 88%, #f6fdff 0 22%, transparent 23%),
		radial-gradient(circle at 68% 82%, #f6fdff 0 21%, transparent 22%),
		radial-gradient(circle at 92% 88%, #f6fdff 0 18%, transparent 19%),
		linear-gradient(180deg, transparent 0%, transparent 38%, #f6fdff 39%, #ebf8ff 100%);
}

.snowman {
	--snowman-scale: 1;
	--snowman-melt-scale: 0.94;
	position: absolute;
	left: 50%;
	bottom: 54px;
	width: 240px;
	height: 290px;
	transform: translateX(-50%) scale(var(--snowman-scale));
	transform-origin: center bottom;
	transition: transform 0.35s ease, filter 0.35s ease, opacity 0.35s ease;
}

.snowman-base,
.snowman-middle,
.snowman-head {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	border-radius: 50%;
	background: linear-gradient(180deg, #ffffff 0%, #edf8ff 80%, #d7edff 100%);
	box-shadow: inset -16px -18px 0 rgba(190, 223, 255, 0.78);
	transition: transform 0.35s ease, opacity 0.35s ease, filter 0.35s ease;
}

.snowman-base {
	bottom: 0;
	width: 150px;
	height: 120px;
}

.snowman-middle {
	bottom: 86px;
	width: 116px;
	height: 94px;
}

.snowman-head {
	bottom: 154px;
	width: 88px;
	height: 82px;
}

.button,
.eye,
.nose,
.smile,
.arm,
.hat,
.hat-brim,
.melt-puddle {
	position: absolute;
	transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
}

.button {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #20324f;
	top: 28px;
}

.button-a {
	left: 36px;
}

.button-b {
	right: 36px;
}

.arm {
	top: 34px;
	width: 64px;
	height: 6px;
	border-radius: 999px;
	background: #8c5d33;
	transform-origin: center;
}

.arm::before,
.arm::after {
	content: '';
	position: absolute;
	width: 24px;
	height: 5px;
	border-radius: 999px;
	background: #8c5d33;
	top: -6px;
}

.arm::after {
	top: 7px;
}

.arm-left {
	left: -32px;
	transform: rotate(18deg);
}

.arm-left::before,
.arm-left::after {
	left: -10px;
	transform: rotate(-26deg);
}

.arm-right {
	right: -32px;
	transform: rotate(-18deg);
}

.arm-right::before,
.arm-right::after {
	right: -10px;
	transform: rotate(26deg);
}

.eye {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #1c304d;
	top: 25px;
}

.eye-left {
	left: 24px;
}

.eye-right {
	right: 24px;
}

.nose {
	left: 50%;
	top: 36px;
	width: 26px;
	height: 10px;
	background: linear-gradient(90deg, #ffcf71, #ff8b29);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
	transform: translateX(-2px);
	transform-origin: left center;
}

.smile {
	left: 50%;
	bottom: 18px;
	width: 34px;
	height: 16px;
	border-bottom: 4px solid #1c304d;
	border-radius: 0 0 30px 30px;
	transform: translateX(-50%);
}

.hat {
	left: 22px;
	top: -24px;
	width: 42px;
	height: 28px;
	border-radius: 12px 12px 4px 4px;
	background: #22304d;
}

.hat-brim {
	left: 16px;
	top: 0;
	width: 54px;
	height: 8px;
	border-radius: 999px;
	background: #1b2740;
}

.melt-puddle {
	left: 50%;
	bottom: -4px;
	width: 170px;
	height: 30px;
	border-radius: 999px;
	background: rgba(120, 196, 255, 0.3);
	transform: translateX(-50%) scaleX(0.45);
	opacity: 0.18;
	filter: blur(3px);
}

.scene-caption {
	margin-top: 1rem;
	color: var(--muted);
	font-weight: 600;
	text-align: center;
}

.word-slots {
	display: flex;
	flex-wrap: wrap;
	gap: 0.7rem;
	margin: 1rem 0 0.8rem;
	min-height: 72px;
	align-items: center;
}

.word-slot {
	min-width: 46px;
	height: 60px;
	border-radius: 1rem;
	border: 2px dashed rgba(42, 108, 229, 0.32);
	background: rgba(255, 255, 255, 0.74);
	display: grid;
	place-items: center;
	font-family: 'Fredoka', 'Segoe UI', sans-serif;
	font-size: clamp(1.6rem, 5vw, 2.2rem);
	font-weight: 700;
	text-transform: uppercase;
	box-shadow: inset 0 -6px 0 rgba(190, 223, 255, 0.48);
}

.word-slot.revealed {
	border-style: solid;
	background: linear-gradient(180deg, #fdfefe 0%, #dbf0ff 100%);
}

.helper-text {
	color: var(--muted);
	line-height: 1.45;
	margin-bottom: 1rem;
}

.letter-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 0.6rem;
}

.letter-button {
	border: 0;
	border-radius: 1rem;
	padding: 0.8rem 0;
	background: linear-gradient(180deg, #7dc8ff 0%, #4f8cff 100%);
	color: #fff;
	font-family: 'Fredoka', 'Segoe UI', sans-serif;
	font-size: 1.1rem;
	font-weight: 700;
	box-shadow: 0 10px 0 rgba(42, 108, 229, 0.5);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	text-transform: uppercase;
}

.letter-button:hover,
.letter-button:focus-visible {
	outline: none;
	transform: translateY(-2px);
	box-shadow: 0 14px 0 rgba(42, 108, 229, 0.44);
}

.letter-button:active {
	transform: translateY(2px);
	box-shadow: 0 7px 0 rgba(42, 108, 229, 0.44);
}

.letter-button.correct {
	background: linear-gradient(180deg, #72e2b0 0%, #37b87d 100%);
	box-shadow: 0 10px 0 rgba(34, 132, 89, 0.44);
}

.letter-button.wrong {
	background: linear-gradient(180deg, #ffb3bd 0%, var(--danger) 100%);
	box-shadow: 0 10px 0 rgba(214, 75, 105, 0.42);
}

.letter-button:disabled {
	cursor: default;
	opacity: 0.92;
	transform: none;
}

.used-row {
	margin-top: 1rem;
}

.guessed-letters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.55rem;
	min-height: 2.25rem;
}

.guessed-letters:empty::before {
	content: 'No letters guessed yet.';
	color: var(--muted);
	font-size: 0.95rem;
}

.guess-chip {
	border-radius: 999px;
	padding: 0.42rem 0.72rem;
	background: rgba(79, 140, 255, 0.14);
	font-weight: 700;
	text-transform: uppercase;
}

.bottom-actions {
	justify-content: center;
	margin: 1rem auto 0;
	border-radius: 1.2rem;
	padding: 1rem;
}

button {
	border: 0;
	border-radius: 999px;
	padding: 0.72rem 1.05rem;
	background: linear-gradient(180deg, #7dc8ff 0%, #4f8cff 100%);
	color: #fff;
	font-weight: 700;
	box-shadow: 0 10px 24px rgba(42, 108, 229, 0.28);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#goBack {
	background: linear-gradient(180deg, #ff6b6b 0%, #e03131 100%);
	color: #fff;
	border: 2px solid rgba(255, 255, 255, 0.4);
	box-shadow: 0 8px 18px rgba(224, 49, 49, 0.32);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.55rem 0.92rem;
	font-weight: 700;
	text-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
	border-radius: 999px;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#goBack:hover,
#goBack:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 12px 24px rgba(224, 49, 49, 0.38);
	outline: 3px solid rgba(255, 107, 107, 0.3);
	outline-offset: 2px;
}

#goBack:active,
button:active {
	transform: translateY(1px);
}

button:hover,
button:focus-visible {
	outline: none;
	transform: translateY(-2px);
	box-shadow: 0 14px 28px rgba(42, 108, 229, 0.32);
}

#soundToggle[aria-pressed='false'] {
	background: linear-gradient(180deg, #bdd6ff 0%, #9dbdff 100%);
	color: #214690;
}

#celebrationLayer {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 4;
	overflow: hidden;
}

.snowburst {
	position: absolute;
	top: -8vh;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 0 16px rgba(255, 255, 255, 0.85);
	animation: snowburst-fall var(--duration, 1800ms) linear forwards;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.snowman.misses-1 .hat,
.snowman.misses-1 .hat-brim,
.snowman.misses-2 .hat,
.snowman.misses-2 .hat-brim,
.snowman.misses-3 .hat,
.snowman.misses-3 .hat-brim,
.snowman.misses-4 .hat,
.snowman.misses-4 .hat-brim,
.snowman.misses-5 .hat,
.snowman.misses-5 .hat-brim {
	transform: translateY(4px) rotate(-12deg);
}

.snowman.misses-2 .arm-left,
.snowman.misses-2 .arm-left::before,
.snowman.misses-2 .arm-left::after,
.snowman.misses-3 .arm-left,
.snowman.misses-3 .arm-left::before,
.snowman.misses-3 .arm-left::after,
.snowman.misses-4 .arm-left,
.snowman.misses-4 .arm-left::before,
.snowman.misses-4 .arm-left::after,
.snowman.misses-5 .arm-left,
.snowman.misses-5 .arm-left::before,
.snowman.misses-5 .arm-left::after,
.snowman.misses-6 .arm-left,
.snowman.misses-6 .arm-left::before,
.snowman.misses-6 .arm-left::after {
	opacity: 0;
	transform: translateY(20px) rotate(-24deg);
}

.snowman.misses-3 .arm-right,
.snowman.misses-3 .arm-right::before,
.snowman.misses-3 .arm-right::after,
.snowman.misses-4 .arm-right,
.snowman.misses-4 .arm-right::before,
.snowman.misses-4 .arm-right::after,
.snowman.misses-5 .arm-right,
.snowman.misses-5 .arm-right::before,
.snowman.misses-5 .arm-right::after,
.snowman.misses-6 .arm-right,
.snowman.misses-6 .arm-right::before,
.snowman.misses-6 .arm-right::after {
	opacity: 0;
	transform: translateY(20px) rotate(24deg);
}

.snowman.misses-4 .smile,
.snowman.misses-5 .smile {
	transform: translateX(-50%) scaleY(-1);
	bottom: 12px;
}

.snowman.misses-5 .snowman-head {
	transform: translateX(-50%) translateY(12px);
	filter: saturate(0.86);
}

.snowman.misses-5 .melt-puddle {
	opacity: 0.45;
	transform: translateX(-50%) scaleX(0.8);
}

.snowman.misses-6 {
	transform: translateX(-50%) translateY(12px) scale(var(--snowman-melt-scale));
	filter: saturate(0.84);
}

.snowman.misses-6 .snowman-base,
.snowman.misses-6 .snowman-head {
	transform: translateX(-50%) translateY(64px) scaleY(0.18) scaleX(1.2);
	opacity: 0;
}

.snowman.misses-6 .snowman-middle {
	transform: translateX(-50%) translateY(72px) scaleY(0.16) scaleX(1.22);
	opacity: 0;
}

.snowman.misses-6 .button,
.snowman.misses-6 .eye,
.snowman.misses-6 .nose,
.snowman.misses-6 .smile,
.snowman.misses-6 .hat,
.snowman.misses-6 .hat-brim {
	opacity: 0;
	transform: translateY(44px) scale(0.35);
}

.snowman.misses-6 .melt-puddle {
	opacity: 0.9;
	transform: translateX(-50%) scaleX(1.25);
	height: 44px;
}

@keyframes snowburst-fall {
	0% {
		opacity: 0;
		transform: translate3d(0, -10vh, 0) scale(0.5);
	}
	10% {
		opacity: 1;
	}
	100% {
		opacity: 0;
		transform: translate3d(var(--drift, 0px), 112vh, 0) scale(1);
	}
}

@media (max-width: 900px) {
	.game-layout {
		grid-template-columns: 1fr;
		gap: 0.85rem;
	}

	.snow-scene {
		height: clamp(270px, 42vh, 360px);
		min-height: 0;
	}

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

@media (max-width: 640px) {
	.app-shell {
		padding: 0.6rem;
	}

	h1 {
		font-size: clamp(1.55rem, 8vw, 2rem);
	}

	h2 {
		font-size: clamp(0.95rem, 4.4vw, 1.12rem);
	}

	h3 {
		font-size: clamp(1.15rem, 6vw, 1.55rem);
	}

	.toolbar,
	.status-card,
	.scene-card,
	.puzzle-card,
	.bottom-actions {
		border-radius: 1.15rem;
	}

	.toolbar,
	.status-card,
	.bottom-actions {
		padding: 0.75rem 0.85rem;
	}

	.scene-card,
	.puzzle-card {
		padding: 0.75rem;
	}

	.status-card {
		align-items: flex-start;
		flex-direction: column;
		gap: 0.6rem;
	}

	.score-panel {
		align-items: stretch;
		width: 100%;
		min-width: 0;
	}

	.toolbar {
		gap: 0.65rem;
		margin-bottom: 0.75rem;
	}

	.status-card {
		margin-bottom: 0.75rem;
	}

	.score-row,
	.toolbar-actions,
	.bottom-actions {
		gap: 0.45rem;
	}

	.score-row span {
		padding: 0.44rem 0.64rem;
		font-size: 0.92rem;
	}

	.chance-meter {
		max-width: none;
		gap: 0.28rem;
		padding: 0.32rem;
	}

	.chance-step {
		height: 0.72rem;
	}

	.snow-scene {
		height: clamp(220px, 38vh, 280px);
	}

	.scene-caption {
		margin-top: 0.55rem;
		font-size: 0.92rem;
	}

	.letter-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: 0.38rem;
	}

	.letter-button {
		min-height: 42px;
		border-radius: 0.75rem;
		padding: 0.48rem 0;
		font-size: 1rem;
		box-shadow: 0 6px 0 rgba(42, 108, 229, 0.5);
	}

	.letter-button:hover,
	.letter-button:focus-visible {
		box-shadow: 0 9px 0 rgba(42, 108, 229, 0.44);
	}

	.letter-button:active {
		box-shadow: 0 4px 0 rgba(42, 108, 229, 0.44);
	}

	.word-slots {
		justify-content: center;
		gap: 0.35rem;
		min-height: 46px;
		margin: 0.6rem 0 0.55rem;
	}

	.word-slot {
		min-width: 36px;
		height: 46px;
		border-radius: 0.75rem;
		font-size: clamp(1.25rem, 8vw, 1.75rem);
	}

	.helper-text {
		margin-bottom: 0.65rem;
		font-size: 0.95rem;
		line-height: 1.35;
	}

	.used-row,
	.guessed-letters {
		margin-top: 0.65rem;
	}

	.guessed-letters {
		gap: 0.35rem;
		min-height: 1.9rem;
	}

	.guess-chip {
		padding: 0.32rem 0.54rem;
	}

	.bottom-actions {
		margin-top: 0.75rem;
	}

	button,
	#goBack {
		padding: 0.6rem 0.82rem;
		font-size: 0.95rem;
	}

	.snowman {
		--snowman-scale: 0.86;
		--snowman-melt-scale: 0.8;
		bottom: 28px;
		width: 210px;
		height: 258px;
	}

	.snowman-base {
		width: 132px;
		height: 108px;
	}

	.snowman-middle {
		bottom: 78px;
		width: 104px;
		height: 84px;
	}

	.snowman-head {
		bottom: 140px;
		width: 80px;
		height: 74px;
	}
}

@media (max-width: 380px) {
	.app-shell {
		padding: 0.45rem;
	}

	.toolbar,
	.status-card,
	.scene-card,
	.puzzle-card,
	.bottom-actions {
		border-radius: 0.95rem;
	}

	.toolbar,
	.status-card,
	.bottom-actions {
		padding: 0.65rem;
	}

	.scene-card,
	.puzzle-card {
		padding: 0.65rem;
	}

	.snow-scene {
		height: 210px;
	}

	.letter-grid {
		gap: 0.32rem;
	}

	.letter-button {
		min-height: 40px;
		border-radius: 0.65rem;
		font-size: 0.95rem;
		box-shadow: 0 5px 0 rgba(42, 108, 229, 0.5);
	}

	.word-slot {
		min-width: 32px;
		height: 42px;
	}

	.snowman {
		--snowman-scale: 0.76;
		--snowman-melt-scale: 0.72;
		bottom: 18px;
	}
}
