@font-face {
	font-family: MarioFont;
	src: url("font/MARIO_Font_v3_Solid.otf");
}

:root {
	--text-shadow: 0 4px 0 #050505, 3px 0 0 #050505, -3px 0 0 #050505, 0 -3px 0 #050505, 2px 2px 0 #050505, -2px 2px 0 #050505, 2px -2px 0 #050505, -2px -2px 0 #050505;
	--title-stroke: clamp(8px, 1.25vw, 18px);
	--header-tile-width: clamp(42px, 3.6vw, 64px);
	--header-height: calc(var(--header-tile-width) * 2.78125);
}

* {
	box-sizing: border-box;
}

html {
	min-height: 100%;
	background: #000;
}

body {
	position: relative;
	min-height: 100vh;
	margin: 0;
	overflow-x: hidden;
	background-color: #000;
	background-image: url("img/background.png");
	background-attachment: fixed;
	background-size: cover;
	font-family: MarioFont, "Trebuchet MS", sans-serif;
	color: #fff;
	text-shadow: var(--text-shadow);
}

a {
	font: inherit;
}

.background {
	position: fixed;
	inset: 0;
	left: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	background-image: url("img/diamond.png");
	background-size: auto auto;
	animation: checker 5s linear infinite;
	pointer-events: none;
}

@keyframes checker {
	0% {
		background-position: 0 0;
	}

	100% {
		background-position: 136px 136px;
	}
}

body.mobile-failsafe {
	background-image: url("img/mobileBg.png");
	background-attachment: scroll;
}

body.mobile-failsafe .background {
	background-blend-mode: normal;
	opacity: 0.45;
}

.stage-header {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 20;
	display: flex;
	align-items: flex-start;
	justify-content: flex-start;
	width: 100%;
	height: var(--header-height);
	padding: calc(var(--header-height) * 0.13) clamp(28px, 12vw, 250px) 0;
	background-image: url("img/header_8x.png");
	background-position: top center;
	background-repeat: repeat-x;
	background-size: var(--header-tile-width) auto;
}

.stage-screen {
	position: relative;
	z-index: 1;
}

.stage-header h1 {
	position: relative;
	margin: 0;
	color: transparent;
	font-size: clamp(35px, 5vw, 72px);
	font-weight: 400;
	line-height: 1.04;
	letter-spacing: 0;
	-webkit-text-stroke: var(--title-stroke) #050505;
	text-shadow: 5px 8px 0 rgba(0, 0, 0, 0.7);
}

.stage-header h1::after {
	content: attr(data-title);
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, #b9f7ff 0%, #8decff 24%, #5fdbff 48%, #3acaff 70%, #23bdf0 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	-webkit-text-stroke: 0;
	text-shadow: none;
	pointer-events: none;
}

.level-button:focus-visible {
	outline: 4px solid #ffd93d;
	outline-offset: 8px;
}

.stage-screen {
	width: 100%;
	min-height: 100vh;
	padding: calc(var(--header-height) + 74px) clamp(18px, 8vw, 260px) 72px;
}

.level-list {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(32px, 5vw, 64px);
	width: min(100%, 1530px);
	margin: 0 auto;
}

.level-status {
	margin: clamp(36px, 8vw, 80px) 0 0;
	font-size: clamp(24px, 3vw, 42px);
	text-align: center;
}

.level-button {
	--level-bg: linear-gradient(90deg, #c6b75e, #0d93b9 44%, #071447 72%, #129cc6);
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: 1fr 1px 1fr;
	align-items: center;
	width: min(100%, 1530px);
	min-height: clamp(104px, 9.4vw, 158px);
	padding: clamp(16px, 1.4vw, 24px) clamp(34px, 4vw, 68px);
	border: 0;
	border-radius: 8px;
	color: #f6ffe9;
	text-decoration: none;
	background-image:
		linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.04) 16%, rgba(0, 0, 0, 0.1) 82%, rgba(255, 255, 255, 0.55)),
		linear-gradient(90deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.02) 28%, rgba(0, 0, 0, 0.36)),
		var(--level-bg);
	background-position: center;
	background-size: cover;
	box-shadow:
		0 0 0 5px #fff,
		0 0 0 9px rgba(76, 76, 76, 0.95),
		inset 0 0 10px rgba(255, 255, 255, 0.8),
		0 8px 12px rgba(0, 0, 0, 0.85);
	cursor: pointer;
	transition: transform 0.12s ease, filter 0.12s ease;
}

.level-button::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background:
		radial-gradient(circle at 4% 8%, rgba(255, 255, 255, 0.82) 0 8px, transparent 9px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.42), transparent 16%, transparent 84%, rgba(255, 255, 255, 0.42));
	pointer-events: none;
}

.level-button:hover {
	z-index: 2;
	filter: brightness(1.08) saturate(1.08);
	transform: scale(1.035);
}

.level-title,
.level-author,
.level-plays {
	position: relative;
	z-index: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0.13em 0.24em 0.16em;
}

.level-title {
	grid-column: 1;
	grid-row: 1;
	font-size: clamp(26px, 3.4vw, 54px);
	line-height: 1.12;
}

.level-author {
	grid-column: 2;
	grid-row: 1;
	max-width: min(40vw, 520px);
	padding-left: 18px;
	padding-right: 0.24em;
	font-size: clamp(18px, 2.3vw, 38px);
	line-height: 1.14;
	text-align: right;
}

.level-divider {
	position: relative;
	z-index: 1;
	grid-column: 1 / -1;
	grid-row: 2;
	width: 100%;
	height: 0;
	border-top: clamp(3px, 0.35vw, 5px) dashed rgba(255, 255, 255, 0.84);
	filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.72));
}

.level-meta {
	position: relative;
	z-index: 1;
	grid-column: 1;
	grid-row: 3;
	display: flex;
	align-items: center;
	gap: clamp(6px, 0.7vw, 12px);
	min-width: 0;
	align-self: end;
}

.level-code-button {
	display: block;
	width: clamp(30px, 3.7vw, 58px);
	height: clamp(30px, 3.7vw, 58px);
	object-fit: contain;
	image-rendering: auto;
	filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.78));
	user-select: none;
}

.level-plays {
	grid-column: 2;
	grid-row: 3;
	align-self: end;
	max-width: min(48vw, 700px);
	padding-left: 22px;
	padding-right: 0.24em;
	font-size: clamp(18px, 2.25vw, 38px);
	line-height: 1.14;
	text-align: right;
}

.gbcorner1,
.gbcorner2,
.gbcorner3,
.gbcorner4,
.gbcorner1::after,
.gbcorner2::after,
.gbcorner3::after,
.gbcorner4::after {
	position: absolute;
	width: 32px;
	height: 32px;
}

.gbcorner1,
.gbcorner2,
.gbcorner3,
.gbcorner4 {
	z-index: 4;
	display: none;
	background-color: #030303;
}

.level-button:hover .gbcorner1,
.level-button:hover .gbcorner2,
.level-button:hover .gbcorner3,
.level-button:hover .gbcorner4,
.level-button:focus-visible .gbcorner1,
.level-button:focus-visible .gbcorner2,
.level-button:focus-visible .gbcorner3,
.level-button:focus-visible .gbcorner4 {
	display: block;
}

.gbcorner1::after,
.gbcorner2::after,
.gbcorner3::after,
.gbcorner4::after {
	content: "";
	z-index: 5;
	background-color: #f9da3b;
}

.gbcorner1,
.gbcorner2,
.gbcorner3,
.gbcorner4 {
	clip-path: polygon(14% 8.75%, 90.25% 6%, 89.5% 52.25%, 53% 49.75%, 53% 99.25%, 10.25% 97.75%);
}

.gbcorner1::after,
.gbcorner2::after,
.gbcorner3::after,
.gbcorner4::after {
	clip-path: polygon(22.75% 19.5%, 79.75% 16.5%, 79.5% 40.25%, 41% 35.5%, 44% 86.75%, 23.25% 85.25%);
}

.gbcorner1 {
	animation: cursor-anim-1 1s infinite step-end;
}

.gbcorner2 {
	animation: cursor-anim-2 1s infinite step-end;
	transform: scaleX(-1);
}

.gbcorner3 {
	animation: cursor-anim-3 1s infinite step-end;
	transform: scaleY(-1);
}

.gbcorner4 {
	animation: cursor-anim-4 1s infinite step-end;
	transform: scaleX(-1) scaleY(-1);
}

@keyframes cursor-anim-1 {
	0% { top: -20px; left: -20px; }
	50% { top: -8px; left: -8px; }
}

@keyframes cursor-anim-2 {
	0% { top: -20px; right: -20px; }
	50% { top: -8px; right: -8px; }
}

@keyframes cursor-anim-3 {
	0% { bottom: -20px; left: -20px; }
	50% { bottom: -8px; left: -8px; }
}

@keyframes cursor-anim-4 {
	0% { bottom: -20px; right: -20px; }
	50% { bottom: -8px; right: -8px; }
}

@media (max-width: 760px) {
	.stage-header {
		padding-left: 18px;
	}

	.stage-header h1 {
		max-width: 64vw;
		font-size: clamp(30px, 10.4vw, 50px);
	}

	.stage-screen {
		padding: calc(var(--header-height) + 52px) 18px 48px;
	}

	.level-list {
		gap: 28px;
	}

	.level-button {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-rows: 1fr 1px 1fr;
		min-height: 116px;
		padding: 16px 24px 18px;
	}

	.level-title {
		grid-column: 1;
		grid-row: 1;
	}

	.level-author {
		grid-column: 2;
		grid-row: 1;
		max-width: 34vw;
		padding-left: 10px;
		text-align: right;
	}

	.level-divider {
		grid-column: 1 / -1;
		grid-row: 2;
		margin: 8px 0;
	}

	.level-meta {
		grid-column: 1;
		grid-row: 3;
	}

	.level-plays {
		grid-column: 2;
		grid-row: 3;
		max-width: none;
		padding-left: 12px;
		text-align: right;
	}
}
