.balg-wrap {
	--balg-bg: #06120d;
	--balg-panel: #0d281c;
	--balg-panel-soft: #123323;
	--balg-field: #07140f;
	--balg-border: rgba(116, 154, 118, 0.34);
	--balg-border-strong: rgba(224, 183, 92, 0.62);
	--balg-text: #ffffff;
	--balg-muted: #c9d9d0;
	--balg-gold: #e0b75c;
	--balg-good: #65d6a6;
	--balg-bad: #ff8a7a;
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	margin: 0 auto;
	padding: clamp(18px, 3vw, 30px);
	border: 1px solid var(--balg-border);
	border-radius: 8px;
	background:
		linear-gradient(135deg, rgba(224, 183, 92, 0.08), transparent 34%),
		linear-gradient(180deg, var(--balg-panel), var(--balg-bg));
	color: var(--balg-text);
	font-family: inherit;
}

.balg-wrap *,
.balg-wrap *::before,
.balg-wrap *::after {
	box-sizing: inherit;
}

html.balg-big-screen-open,
body.balg-big-screen-open {
	overflow: hidden !important;
}

.balg-wrap:fullscreen,
.balg-wrap.is-big-screen {
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	margin: 0;
	padding: clamp(14px, 2vw, 28px);
	border-radius: 0;
	overflow-x: hidden;
	overflow-y: auto;
	background:
		linear-gradient(135deg, rgba(224, 183, 92, 0.08), transparent 34%),
		linear-gradient(180deg, var(--balg-panel), var(--balg-bg));
}

.balg-wrap:-webkit-full-screen {
	width: 100vw;
	max-width: none;
	height: 100vh;
	margin: 0;
	padding: clamp(14px, 2vw, 28px);
	border-radius: 0;
	overflow-x: hidden;
	overflow-y: auto;
	background:
		linear-gradient(135deg, rgba(224, 183, 92, 0.08), transparent 34%),
		linear-gradient(180deg, var(--balg-panel), var(--balg-bg));
}

.balg-wrap.is-big-screen {
	position: fixed;
	inset: 0;
	z-index: 999999;
}

.balg-wrap:fullscreen .balg-head,
.balg-wrap.is-big-screen .balg-head {
	display: none;
}

.balg-wrap:-webkit-full-screen .balg-head {
	display: none;
}

.balg-head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 18px;
	align-items: start;
	margin-bottom: 16px;
}

.balg-eyebrow,
.balg-answer span {
	display: block;
	margin: 0 0 7px;
	color: var(--balg-gold);
	font-size: 13px;
	font-weight: 850;
	line-height: 1.2;
	text-transform: uppercase;
}

.balg-head h2 {
	margin: 0;
	color: #fff;
	font-size: clamp(30px, 4vw, 46px);
	line-height: 1.05;
	letter-spacing: 0;
}

.balg-head p {
	max-width: 760px;
	margin: 9px 0 0;
	color: var(--balg-muted);
	font-size: 17px;
	line-height: 1.5;
}

.balg-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(82px, 1fr));
	gap: 8px;
	min-width: 310px;
}

.balg-stats span,
.balg-levels,
.balg-game,
.balg-expression,
.balg-answer,
.balg-feedback {
	border: 1px solid var(--balg-border);
	border-radius: 8px;
	background: rgba(5, 19, 13, 0.7);
}

.balg-stats span {
	display: grid;
	gap: 4px;
	padding: 12px;
	color: var(--balg-muted);
	font-size: 13px;
	text-align: center;
}

.balg-stats strong {
	color: #fff;
	font-size: 23px;
	line-height: 1;
}

.balg-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 14px;
	align-items: start;
}

.balg-levels,
.balg-game {
	width: 100%;
	min-width: 0;
	padding: 14px;
}

.balg-reward-note {
	margin: 14px 0 0;
	padding: 12px 14px;
	border: 1px dashed rgba(224, 183, 92, 0.48);
	border-radius: 10px;
	color: #d9ddd6;
	font-size: 14px;
	line-height: 1.5;
}

.balg-panel-head {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: start;
	margin-bottom: 12px;
}

.balg-panel-head h3 {
	margin: 0;
	color: #fff;
	font-size: clamp(22px, 3vw, 32px);
	line-height: 1.1;
	letter-spacing: 0;
}

.balg-panel-head > span {
	display: inline-grid;
	place-items: center;
	min-width: 60px;
	min-height: 34px;
	padding: 7px 10px;
	border: 1px solid var(--balg-border);
	border-radius: 8px;
	color: var(--balg-muted);
	background: rgba(5, 19, 13, 0.75);
	font-weight: 850;
}

.balg-panel-tools {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
}

.balg-panel-tools > span {
	display: inline-grid;
	place-items: center;
	min-width: 60px;
	min-height: 34px;
	padding: 7px 10px;
	border: 1px solid var(--balg-border);
	border-radius: 8px;
	color: var(--balg-muted);
	background: rgba(5, 19, 13, 0.75);
	font-weight: 850;
}

.balg-panel-tools [data-balg-fullscreen] {
	min-width: 132px;
	padding: 7px 12px;
}

.balg-level-grid {
	display: grid;
	grid-template-columns: repeat(10, minmax(0, 1fr));
	gap: 8px;
}

.balg-level-btn,
.balg-panel-head button,
.balg-keypad button,
.balg-actions button {
	min-height: 42px;
	border: 1px solid rgba(224, 183, 92, 0.44);
	border-radius: 8px;
	background: rgba(224, 183, 92, 0.14);
	color: var(--balg-gold);
	font: inherit;
	font-size: 15px;
	font-weight: 850;
	line-height: 1;
	cursor: pointer;
}

.balg-level-btn:hover,
.balg-level-btn:focus-visible,
.balg-level-btn.is-active,
.balg-panel-head button:hover,
.balg-panel-head button:focus-visible,
.balg-keypad button:hover,
.balg-keypad button:focus-visible,
.balg-actions button:hover,
.balg-actions button:focus-visible {
	border-color: rgba(224, 183, 92, 0.84);
	background: rgba(224, 183, 92, 0.23);
	outline: none;
}

.balg-level-btn.is-done {
	border-color: rgba(101, 214, 166, 0.58);
	color: var(--balg-good);
	background: rgba(101, 214, 166, 0.12);
}

.balg-level-btn.is-locked {
	opacity: 0.44;
	cursor: not-allowed;
}

.balg-expression {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	gap: 12px;
	align-items: center;
	min-height: 190px;
	margin-bottom: 12px;
	padding: 16px;
	background:
		linear-gradient(145deg, rgba(224, 183, 92, 0.08), transparent 44%),
		rgba(5, 19, 13, 0.76);
}

.balg-number {
	display: grid;
	place-items: center;
	min-height: 116px;
	padding: 10px;
	border: 1px solid rgba(116, 154, 118, 0.24);
	border-radius: 8px;
	background: rgba(2, 16, 10, 0.62);
	overflow-x: auto;
}

.balg-number svg {
	max-width: 100%;
	height: 76px;
}

.balg-op {
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	border-radius: 999px;
	border: 1px solid var(--balg-border-strong);
	background: rgba(224, 183, 92, 0.12);
	color: var(--balg-gold);
	font-size: 32px;
	font-weight: 900;
	line-height: 1;
}

.balg-op svg {
	display: block;
	width: 44px;
	height: 44px;
}

.balg-answer {
	margin-bottom: 12px;
	padding: 13px;
}

.balg-answer code {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 50px;
	padding: 10px 12px;
	border: 1px solid rgba(116, 154, 118, 0.24);
	border-radius: 8px;
	background: var(--balg-field);
	color: #fff;
	font-size: clamp(24px, 4vw, 42px);
	font-weight: 900;
	line-height: 1.1;
	letter-spacing: 0;
	overflow-wrap: anywhere;
}

.balg-answer code svg {
	display: block;
	width: auto;
	max-width: 100%;
	height: 76px;
}

.balg-keypad {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 9px;
	margin-bottom: 12px;
}

.balg-keypad button {
	display: grid;
	gap: 4px;
	place-items: center;
	min-height: 68px;
	background: rgba(2, 16, 10, 0.82);
	color: #fff;
}

.balg-keypad svg {
	width: 52px;
	height: 48px;
	color: var(--balg-gold);
}

.balg-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
	margin-bottom: 12px;
}

.balg-actions [data-balg-check],
.balg-actions [data-balg-next] {
	border-color: rgba(101, 214, 166, 0.62);
	color: var(--balg-good);
	background: rgba(101, 214, 166, 0.13);
}

.balg-feedback {
	min-height: 54px;
	padding: 13px;
	color: var(--balg-muted);
	font-size: 17px;
	font-weight: 750;
	line-height: 1.45;
}

.balg-feedback.is-good {
	border-color: rgba(101, 214, 166, 0.74);
	color: #dfffee;
}

.balg-feedback.is-bad {
	border-color: rgba(255, 138, 122, 0.74);
	color: #ffe0dc;
}

@media (max-width: 960px) {
	.balg-head,
	.balg-expression {
		grid-template-columns: 1fr;
	}

	.balg-level-grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.balg-stats {
		width: 100%;
		min-width: 0;
	}

	.balg-op {
		margin: 0 auto;
	}
}

@media (max-width: 560px) {
	.balg-wrap {
		padding: 14px;
	}

	.balg-level-grid,
	.balg-keypad {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.balg-actions button {
		width: 100%;
	}
}
