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

@font-face {
	font-family: DelfinoFont;
	src: url("font/Delfino.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: 13px;
	--header-tile-width: clamp(42px, 3.6vw, 64px);
	--header-height: calc(var(--header-tile-width) * 2.78125);
}

* {
	box-sizing: border-box;
}

/* Hide scrollbar globally */
::-webkit-scrollbar {
	display: none;
}

html {
	min-height: 100%;
	background: #000;
	-ms-overflow-style: none;
	/* IE and Edge */
	scrollbar-width: none;
	/* Firefox */
}

body {
	position: relative;
	height: 100vh;
	margin: 0;
	overflow: hidden;
	background-color: #000;
	background-image: linear-gradient(180deg, #2a2c2e, #141517);
	background-attachment: fixed;
	background-size: cover;
	font-family: MarioFont, "Trebuchet MS", sans-serif;
	color: #fff;
	text-shadow: var(--text-shadow);
	-ms-overflow-style: none;
	/* IE and Edge */
	scrollbar-width: none;
	/* Firefox */
	display: flex;
	flex-direction: column;
}

a {
	font: inherit;
}

.background {
	position: fixed;
	inset: 0;
	left: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	background-image: url("img/diamond.png");
	opacity: 0.5;
	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: relative;
	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(24px, 5vw, 64px) 0;
	background-image: url("img/header_8x.png");
	background-repeat: repeat-x;
	background-size: auto 100%;
}

.stage-screen {
	position: relative;
	z-index: 1;
	width: 100%;
	height: clamp(800px, 100vh, 1200px);
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	padding: 48px clamp(18px, 8vw, 260px) 140px;
}

.stage-header h1 {
	position: relative;
	margin: 0 auto;
	width: min(100%, 1530px);
	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: 10px 15px 0 rgba(0, 0, 0, 0.25);
}

.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;
}


.level-list {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 72px;
	width: min(100%, 1530px);
	margin: 0 auto;
	transition: opacity 0.25s ease, transform 0.25s ease;
	position: relative;
}

.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: 128px;
	padding: 24px 48px;
	border: 0;
	border-radius: 10px;
	color: #f6ffe9;
	text-decoration: none;
	background-image:
		linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.025) 15%, transparent 85%, rgba(255, 255, 255, 0.8)),
		linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.025) 5%, transparent 95%, rgba(255, 255, 255, 0.8)),
		var(--level-bg);
	background-position: center;
	background-size: cover;
	box-shadow:
		0 0 0 5px #fff,
		inset 0 0 5px #fff,
		15px 20px 0 rgba(0, 0, 0, 0.25);
	cursor: pointer;
	transition: 0.2s;
}

.level-button::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: radial-gradient(32px 32px at 1% 2%, rgba(255, 255, 255) 60%, transparent 100%);
	pointer-events: none;
}

.level-button:hover {
	z-index: 2;
	transform: scale(1.07);
}

.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 {
	position: absolute;
	width: 48px;
	height: 48px;
	z-index: 4;
	display: none;
	background-size: contain;
	background-repeat: no-repeat;
	image-rendering: pixelated;
}

.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 {
	top: -8px;
	left: -8px;
	transform: translate(-10px, -10px);
	animation: scale-anim-1 2s infinite ease-in-out, select-anim 1s infinite step-end;
}

.gbcorner2 {
	top: -8px;
	right: -8px;
	transform: scaleX(-1) translate(-10px, -10px);
	animation: scale-anim-2 2s infinite ease-in-out, select-anim 1s infinite step-end;
}

.gbcorner3 {
	bottom: -8px;
	left: -8px;
	transform: scaleY(-1) translate(-10px, -10px);
	animation: scale-anim-3 2s infinite ease-in-out, select-anim 1s infinite step-end;
}

.gbcorner4 {
	bottom: -8px;
	right: -8px;
	transform: scaleX(-1) scaleY(-1) translate(-10px, -10px);
	animation: scale-anim-4 2s infinite ease-in-out, select-anim 1s infinite step-end;
}

@keyframes scale-anim-1 {

	0%,
	100% {
		transform: translate(-10px, -10px) scale(1);
	}

	50% {
		transform: translate(-15px, -15px) scale(1.10);
	}
}

@keyframes scale-anim-2 {

	0%,
	100% {
		transform: scaleX(-1) translate(-10px, -10px) scale(1);
	}

	50% {
		transform: scaleX(-1) translate(-15px, -15px) scale(1.10);
	}
}

@keyframes scale-anim-3 {

	0%,
	100% {
		transform: scaleY(-1) translate(-10px, -10px) scale(1);
	}

	50% {
		transform: scaleY(-1) translate(-15px, -15px) scale(1.10);
	}
}

@keyframes scale-anim-4 {

	0%,
	100% {
		transform: scaleX(-1) scaleY(-1) translate(-10px, -10px) scale(1);
	}

	50% {
		transform: scaleX(-1) scaleY(-1) translate(-15px, -15px) scale(1.10);
	}
}

@keyframes select-anim {
	0% {
		background-image: url("img/select0.png");
	}

	50% {
		background-image: url("img/select1.png");
	}
}

@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;
	}
}

/* Pagination system styling */
.pagination-container {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
	position: absolute;
	bottom: 2.5%;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	margin: 0;
	padding: 0;
}

.page-text {
	font-family: DelfinoFont, "Trebuchet MS", sans-serif;
	font-size: 48px;
	font-weight: bold;
	color: #fff;
	text-shadow:
		-3px -3px 0 #000,
		3px -3px 0 #000,
		-3px 3px 0 #000,
		3px 3px 0 #000,
		0px 3px 0 #000,
		3px 0px 0 #000,
		-3px 0px 0 #000,
		0px -3px 0 #000;
	letter-spacing: 2px;
	display: inline-block;
}

.page-arrow {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, opacity 0.15s ease;
	width: 128px;
	height: 128px;
	text-shadow: none;
}

.prev-page {
	position: absolute;
	right: calc(50% + min(100%, 1530px) * 0.55);
	top: 50%;
	transform: translateY(-50%);
	z-index: 30;
}

.next-page {
	position: absolute;
	left: calc(50% + min(100%, 1530px) * 0.55);
	top: 50%;
	transform: translateY(-50%);
	z-index: 30;
}

.page-arrow img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.prev-page img {
	transform: rotate(-90deg);
}

.next-page img {
	transform: rotate(90deg);
}

.page-arrow:hover:not(:disabled) {
	transform: translateY(-50%) scale(1.15);
}

.page-arrow:active:not(:disabled) {
	transform: translateY(-50%) scale(0.95);
}

.page-arrow:disabled {
	display: none;
}

/* Page slide transition animations */
.level-list.slide-out-left {
	opacity: 0;
	transform: translateX(-150px);
}

.level-list.slide-out-right {
	opacity: 0;
	transform: translateX(150px);
}

.level-list.slide-in-right {
	animation: slideInRight 0.25s forwards cubic-bezier(0.25, 1, 0.5, 1);
}

.level-list.slide-in-left {
	animation: slideInLeft 0.25s forwards cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes slideInRight {
	0% {
		opacity: 0;
		transform: translateX(150px);
	}

	100% {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes slideInLeft {
	0% {
		opacity: 0;
		transform: translateX(-150px);
	}

	100% {
		opacity: 1;
		transform: translateX(0);
	}
}