.mag-wrapper {
	--mag-accent: #ffb400;
	--mag-bg-top: #6ec6ff;
	--mag-bg-bottom: #bfe9ff;
	--mag-dark: #1c2733;
	max-width: 100%;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

.mag-stage {
	position: relative;
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
	aspect-ratio: var(--mag-aspect, 6 / 7);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	background: #000000;
	touch-action: none;
	user-select: none;
}

.mag-canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.mag-hud {
	position: absolute;
	top: 10px;
	left: 10px;
	right: 10px;
	display: flex;
	justify-content: space-between;
	pointer-events: none;
	z-index: 3;
}

.mag-hud-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	background: rgba(0, 0, 0, 0.28);
	border-radius: 10px;
	padding: 4px 14px;
	color: #fff;
}

.mag-hud-label {
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.75;
}

.mag-hud-score,
.mag-hud-moves {
	font-size: 1.3rem;
	font-weight: 800;
	line-height: 1.2;
}

.mag-btn--finish {
	align-self: center;
	padding: 8px 16px;
	font-size: 0.8rem;
	pointer-events: auto;
}

.mag-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	text-align: center;
	background: rgba(15, 23, 32, 0.55);
	backdrop-filter: blur(2px);
	color: #fff;
	z-index: 5;
}

.mag-overlay[hidden] {
	display: none;
}

.mag-title {
	margin: 0;
	font-size: 1.6rem;
	font-weight: 800;
}

.mag-instructions {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.4;
	opacity: 0.9;
	max-width: 300px;
}

.mag-btn {
	appearance: none;
	border: none;
	border-radius: 999px;
	padding: 12px 28px;
	font-size: 1rem;
	font-weight: 700;
	color: #1c2733;
	background: var(--mag-accent);
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
	transition: transform 0.08s ease;
}

.mag-btn:active {
	transform: scale(0.96);
}

.mag-score-line {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
}

.mag-best-line {
	opacity: 0.85;
	font-size: 0.95rem;
	margin-bottom: 4px;
}

.mag-name-entry {
	display: flex;
	gap: 8px;
	margin-top: 4px;
	flex-wrap: wrap;
	justify-content: center;
}

.mag-name-input {
	border-radius: 999px;
	border: none;
	padding: 10px 16px;
	font-size: 0.95rem;
	width: 160px;
	max-width: 60vw;
	text-align: center;
}

.mag-leaderboard {
	margin-top: 10px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	padding: 10px 18px;
	max-height: 160px;
	overflow-y: auto;
	width: 100%;
	max-width: 260px;
}

.mag-leaderboard h3 {
	margin: 0 0 6px 0;
	font-size: 0.95rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	opacity: 0.8;
}

.mag-leaderboard-list {
	margin: 0;
	padding-left: 20px;
	text-align: left;
	font-size: 0.9rem;
	line-height: 1.6;
}

@media (max-width: 380px) {
	.mag-title {
		font-size: 1.3rem;
	}
	.mag-hud {
		font-size: 1.6rem;
	}
	.mag-btn {
		padding: 10px 22px;
		font-size: 0.9rem;
	}
}
