:root {
	--bg: #f4f7fb;
	--surface: #ffffff;
	--surface-soft: #f8fafc;
	--border: #e2e8f0;
	--text: #0f172a;
	--muted: #64748b;
	--primary: #4f46e5;
	--primary-dark: #4338ca;
	--success: #16a34a;
	--success-soft: #dcfce7;
	--danger: #dc2626;
	--danger-soft: #fee2e2;
	--shadow: 0 20px 50px rgba(15, 23, 42, .08);
	--radius: 20px;
}
button, input {
	font: inherit;
}
button {
	-webkit-tap-highlight-color: transparent;
}
.game-shell {
	width: min(1120px, calc(100% - 32px));
	margin: 0 auto;
}
.game-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 20px;
}
.brand h1 {
	margin: 0;
	font-size: clamp(1.7rem, 4vw, 2.4rem);
	line-height: 1;
	letter-spacing: -.04em;
}
.brand p {
	margin: 7px 0 0;
	color: var(--muted);
	font-size: .95rem;
}
.header-actions {
	display: flex;
	gap: 10px;
	align-items: center;
}
.button {
	border: 0;
	border-radius: 12px;
	min-height: 44px;
	padding: 0 17px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
}
.button:hover {
	transform: translateY(-1px);
}
.button:active {
	transform: translateY(1px) scale(.98);
}
.button:focus-visible, .mode-button:focus-visible, .keyboard-key:focus-visible, input:focus-visible {
	outline: 3px solid rgba(79, 70, 229, .22);
	outline-offset: 2px;
}
.button-primary {
	color: #fff;
	background: var(--primary);
	box-shadow: 0 8px 18px rgba(79, 70, 229, .2);
}
.button-primary:hover {
	background: var(--primary-dark);
}
.button-secondary {
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
}
.game-card {
	background: var(--surface);
	border: 1px solid rgba(226, 232, 240, .9);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}
.mode-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--border);
	background: rgba(248, 250, 252, .75);
}
.mode-switch {
	display: flex;
	padding: 4px;
	gap: 4px;
	background: #e9eef5;
	border-radius: 12px;
}
.mode-button {
	border: 0;
	min-height: 40px;
	padding: 0 18px;
	border-radius: 9px;
	background: transparent;
	color: var(--muted);
	font-weight: 800;
	cursor: pointer;
	transition: all .18s ease;
}
.mode-button.active {
	background: var(--surface);
	color: var(--text);
	box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.mode-label {
	color: var(--muted);
	font-size: .9rem;
	font-weight: 700;
}
.game-layout {
	display: grid;
	grid-template-columns: minmax(280px, .85fr) minmax(0, 1.15fr);
	gap: 0;
}
.illustration-panel {
	min-height: 500px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 30px;
	border-right: 1px solid var(--border);
	background: linear-gradient(180deg, #fbfdff 0%, #f7f9fc 100%);
}
.hangman-svg {
	width: min(100%, 360px);
	height: auto;
	overflow: visible;
}
.gallows {
	fill: none;
	stroke: #334155;
	stroke-width: 8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.hangman-part {
	fill: none;
	stroke: var(--danger);
	stroke-width: 8;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0;
	transform-origin: center;
	transform-box: fill-box;
}
.hangman-part.visible {
	opacity: 1;
	animation: draw-part .38s cubic-bezier(.2, .8, .2, 1);
}
@keyframes draw-part {
	0% {
		opacity: 0;
		transform: scale(.7);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}
.mistakes-label {
	margin-top: 8px;
	color: var(--muted);
	font-size: .9rem;
	font-weight: 700;
}
.mistakes-label strong {
	color: var(--text);
}
.game-panel {
	min-width: 0;
	padding: 30px;
}
.stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
	margin-bottom: 26px;
}
.stat {
	padding: 12px 8px;
	text-align: center;
	border: 1px solid var(--border);
	border-radius: 13px;
	background: var(--surface-soft);
}
.stat-value {
	display: block;
	font-size: 1.3rem;
	line-height: 1;
	font-weight: 900;
}
.stat-label {
	display: block;
	margin-top: 5px;
	color: var(--muted);
	font-size: .7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
}
.setup-card {
	margin-bottom: 24px;
	padding: 20px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--surface-soft);
}
.setup-card.hidden {
	display: none;
}
.setup-card h2 {
	margin: 0 0 6px;
	font-size: 1.1rem;
}
.setup-card p {
	margin: 0 0 16px;
	color: var(--muted);
	font-size: .9rem;
}
.field-group {
	margin-bottom: 12px;
}
.field-group:last-of-type {
	margin-bottom: 16px;
}
.field-label {
	display: block;
	margin-bottom: 7px;
	font-size: .82rem;
	font-weight: 800;
}
.text-input {
	width: 100%;
	height: 46px;
	padding: 0 13px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface);
	color: var(--text);
	outline: 0;
	transition: border-color .16s ease, box-shadow .16s ease;
}
.text-input:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}
.text-input.invalid {
	border-color: var(--danger);
	box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}
.validation-message {
	min-height: 19px;
	margin-top: 6px;
	color: var(--danger);
	font-size: .8rem;
	font-weight: 600;
}
.word-area {
	text-align: center;
	padding: 12px 0 22px;
}
.hint {
	min-height: 22px;
	margin-bottom: 14px;
	color: var(--muted);
	font-size: .88rem;
	font-weight: 700;
}
.hint span {
	color: var(--text);
}
.word {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: flex-end;
	gap: 7px;
	min-height: 68px;
}
.word-character {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 48px;
	border-bottom: 3px solid #94a3b8;
	color: var(--text);
	font-size: clamp(1.45rem, 4vw, 2rem);
	font-weight: 900;
	text-transform: uppercase;
	animation: reveal-letter .3s ease;
}
.word-character.space, .word-character.punctuation {
	width: 18px;
	border-bottom: 0;
}
.word-character.space::after {
	content: "";
}
.word-character.punctuation {
	font-size: 1.7rem;
}
.word-character.revealed {
	border-bottom-color: var(--primary);
}
@keyframes reveal-letter {
	0% {
		opacity: 0;
		transform: translateY(8px) scale(.8);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}
.result {
	min-height: 0;
	margin: 0 0 20px;
	border-radius: 14px;
	overflow: hidden;
	transition: all .25s ease;
}
.result:not(.visible) {
	max-height: 0;
	opacity: 0;
	margin-bottom: 0;
}
.result.visible {
	max-height: 180px;
	padding: 15px 17px;
	opacity: 1;
}
.result.win {
	color: #166534;
	background: var(--success-soft);
	border: 1px solid #bbf7d0;
}
.result.loss {
	color: #991b1b;
	background: var(--danger-soft);
	border: 1px solid #fecaca;
}
.result-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 900;
}
.result-message {
	margin: 4px 0 0;
	font-size: .88rem;
	font-weight: 600;
}
.keyboard-section {
	margin-top: 8px;
}
.keyboard-title {
	margin: 0 0 10px;
	color: var(--muted);
	font-size: .75rem;
	font-weight: 800;
	letter-spacing: .06em;
	text-align: center;
	text-transform: uppercase;
}
.keyboard {
	display: grid;
	grid-template-columns: repeat(13, minmax(0, 1fr));
	gap: 7px;
}
.keyboard-key {
	min-width: 0;
	height: 46px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface-soft);
	color: var(--text);
	font-weight: 900;
	cursor: pointer;
	transition: transform .12s ease, background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
}
.keyboard-key:hover:not(:disabled) {
	transform: translateY(-2px);
	border-color: #c7d2fe;
	background: #eef2ff;
}
.keyboard-key:active:not(:disabled) {
	transform: translateY(1px) scale(.96);
}
.keyboard-key:disabled {
	cursor: default;
	opacity: 1;
}
.keyboard-key.correct {
	color: #166534;
	border-color: #86efac;
	background: var(--success-soft);
}
.keyboard-key.incorrect {
	color: #991b1b;
	border-color: #fecaca;
	background: var(--danger-soft);
}
.game-footer {
	display: flex;
	justify-content: center;
	margin-top: 22px;
}
.reset-score {
	border: 0;
	padding: 6px 10px;
	background: transparent;
	color: var(--muted);
	font-size: .8rem;
	font-weight: 700;
	cursor: pointer;
}
.reset-score:hover {
	color: var(--danger);
}
.celebration {
	position: fixed;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
	z-index: 50;
}
.confetti {
	position: absolute;
	top: -20px;
	width: 8px;
	height: 14px;
	border-radius: 2px;
	background: var(--primary);
	animation: confetti-fall 1.5s ease-in forwards;
}
.confetti:nth-child(3n) {
	background: #16a34a;
}
.confetti:nth-child(4n) {
	background: #f59e0b;
}
.confetti:nth-child(5n) {
	background: #ec4899;
}
@keyframes confetti-fall {
	0% {
		transform: translate3d(0, -10px, 0) rotate(0);
		opacity: 1;
	}
	100% {
		transform: translate3d(var(--drift), 105vh, 0) rotate(720deg);
		opacity: 0;
	}
}
@media (max-width: 800px) {
	.game-layout {
		grid-template-columns: 1fr;
	}
	.illustration-panel {
		min-height: 330px;
		border-right: 0;
		border-bottom: 1px solid var(--border);
		padding: 20px;
	}
	.hangman-svg {
		width: min(100%, 280px);
	}
	.game-panel {
		padding: 24px 20px;
	}
}
@media (max-width: 560px) {
	.game-shell {
		width: min(100% - 18px, 1120px);
		padding-top: 12px;
		padding-bottom: 20px;
	}
	.game-header {
		align-items: flex-start;
	}
	.brand p {
		font-size: .82rem;
	}
	.header-actions .button-secondary {
		display: none;
	}
	.mode-bar {
		align-items: stretch;
		flex-direction: column;
		gap: 9px;
		padding: 12px;
	}
	.mode-switch {
		width: 100%;
	}
	.mode-button {
		flex: 1;
	}
	.illustration-panel {
		min-height: 285px;
	}
	.stats {
		gap: 5px;
	}
	.stat {
		padding: 10px 4px;
	}
	.stat-value {
		font-size: 1.1rem;
	}
	.stat-label {
		font-size: .62rem;
	}
	.word-character {
		width: 24px;
		height: 42px;
		font-size: 1.45rem;
	}
	.keyboard {
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 6px;
	}
	.keyboard-key {
		height: 43px;
	}
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		scroll-behavior: auto !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}