* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

body {
	margin: 0;
	font-family: Arial, sans-serif;
	background-image: url("assets/BG_desktop_sub.png"), url("assets/BG_desktop.png");
	background-size: contain, cover;
	background-repeat: no-repeat;
	background-position: bottom, top left;
}

html {
	font-size: 62.5%;
}

#home-screen,
#game-screen,
#end-screen {
	position: relative;
	width: 100%;
	height: 100vh;
	text-align: center;
}

.main-image {
	width: 42%;
	/* height: 55%; */

	position: absolute;
	top: 1%;
	left: 1%;
}

.secondary-image {
	width: 42%;
	/* height: 23%; */

	position: absolute;
	top: 18%;
	left: 50%;
}

#start-game-button {
	font-size: 1.8rem;
	color: #000;
	border-radius: 50%;

	width: 10%;
	aspect-ratio: 1/1;

	display: flex;
	align-items: center;
	justify-content: center;

	text-align: center;

	border: none;
	background-color: #012239;
	color: #fff;

	position: absolute;

	top: 50%;
	left: 72%;
	transform: translateX(-50%);

	transition: all 0.3s;

	cursor: pointer;
}

#start-game-button:hover {
	filter: brightness(1.1);
}
#start-game-button::after {
	content: "Play";
	position: absolute;
	top: 110%;
	font-size: 2.4rem;
}

.highscore {
	position: absolute;
	top: 20px;
	right: 20px;
	font-size: 3.2rem;
	color: #fff;
}

#restart-button {
	padding: 10px 20px;
	font-size: 18px;
	margin-top: 20px;
	border: 0;
	background-color: transparent;

	transition: all 0.3s;
}

#restart-button:hover img {
	filter: brightness(1.1);
}

#restart-button img {
	width: 8rem;
	height: 8rem;
}

#game-board {
	width: 100%;
	height: 100%;
	margin: 0 auto;
	position: relative;
}

#game-reset {
	position: absolute;
	top: 20px;
	left: 20px;
	color: #fff;
	cursor: pointer;
	background: transparent;
	border: none;
}

#game-reset img {
	width: 4.8rem;
	height: 4.8rem;
}

#game-reset:hover img {
	filter: brightness(1.1);
}

.brick {
	width: 6rem;
	height: 10rem;
	border-radius: 6px;
	position: relative;
	cursor: pointer;

	background-image: url("assets/tile_base.png");
	background-size: cover;
	background-repeat: no-repeat;
	background-position: top left;

	transition: all 0.3s;
}

@keyframes fadeIn {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}

.brick img {
	width: 78%;
	height: 70%;
	position: absolute;
	top: 40%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.brick img.animated {
	animation: fadeIn 0.3s ease-out forwards;
}

.brick::after {
	z-index: 100;
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0);

	border-radius: 6px;

	transition: all 0.3s;
}

@keyframes shakeAndFade {
	0% {
		transform: translateX(0);
		opacity: 1;
	}
	25% {
		transform: translateX(-5px);
	}

	75% {
		transform: translateX(5px);
	}
	100% {
		transform: translateX(0);
		opacity: 0;
	}
}

.brick.falling {
	animation: shakeAndFade 0.3s ease-out forwards;
}

.deactivated::after {
	z-index: 100;
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);

	border-radius: 6px;

	transition: all 0.3s;
}

.brick-left {
	position: absolute;
	top: calc(50% + 10rem - 6.8rem + 1.5px);
	left: calc(50% - 6rem * 7 / 2 - 0.5rem);

	/* transform: translateY(-50%); */
}

.brick-right {
	position: absolute;
	top: calc(50% + 10rem - 6.8rem + 1.5px);
	left: calc(50% + 2.5 * 6rem + 0.5rem);

	/* transform: translateY(-50%); */
}

.level {
	display: grid;
	justify-content: center;
	align-content: center;
	gap: 0.1rem;

	position: absolute;
	top: calc(50% - 5rem);
	left: 50%;

	transform: translate(-50%, -50%);

	cursor: pointer;
}

.level-5 {
	grid-template-columns: repeat(5, 6rem);
	grid-template-rows: repeat(5, 10rem);
	height: calc(5 * 10rem);
	width: calc(5 * 6rem);
}

.level-4 {
	grid-template-columns: repeat(4, 6rem);
	grid-template-rows: repeat(4, 10rem);

	width: calc(4 * 6rem);
	height: calc(4 * 10rem);
}
.level-3 {
	grid-template-columns: repeat(3, 6rem);
	grid-template-rows: repeat(3, 10rem);
	width: calc(3 * 6rem);
	height: calc(3 * 10rem);
}
.level-2 {
	grid-template-columns: repeat(2, 6rem);
	grid-template-rows: repeat(2, 10rem);
	width: calc(2 * 6rem);
	height: calc(2 * 10rem);
}
.level-1 {
	grid-template-columns: repeat(1, 6rem);
	grid-template-rows: repeat(1, 10rem);
	width: 6rem;
	height: 10rem;
}

#board-row {
	display: flex;
	justify-content: center;

	position: absolute;
	top: calc(100dvh - 5rem - 10rem);
	left: 50%;
	transform: translateX(-50%);

	gap: 0.3rem;
}

#score {
	position: absolute;
	top: 20px;
	right: 20px;
	font-size: 3.2rem;
	color: #fff;
}

#end-screen .overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	backdrop-filter: blur(5px);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.end-screen-content {
	background-color: rgba(255, 255, 255, 0.8);
	padding: 5rem 2rem;
}

.end-screen-content h1 {
	font-size: 3.6rem;
	color: #000;
	margin-bottom: 12rem;
	margin-top: 3rem;

	text-transform: uppercase;

	max-width: min(30rem, 80vw);
}

.finish-banner {
	width: min(30rem, 80vw);
}

@media (orientation: portrait) {
	html {
		font-size: 50%;
	}
	body {
		background-image: url("assets/BG_mobile_sub.png"), url("assets/BG_mobile.png");
		background-repeat: no-repeat, no-repeat;
		background-position: bottom left, bottom left;
		background-size: contain, cover;
	}

	.main-image {
		width: max(min(75%, 400px), 340px);
		height: 31%;
		left: 50%;
		transform: translateX(-50%);

		top: 4%;
	}

	.secondary-image {
		width: max(min(70%, 350px), 340px);
		height: 13%;
		left: 50%;
		transform: translateX(-50%);

		top: 35%;
	}

	#start-game-button {
		width: min(20vw, 12vh);
		left: 50%;
		transform: translateX(-50%);

		top: 50%;
	}
	.highscore {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
	}

	#score {
		left: 50%;
		transform: translateX(-50%);
	}

	#start-game-button::after {
		content: "Play";
		position: absolute;
		top: 110%;
		font-size: 3.2rem;
	}
}
@media (max-height: 600px) {
	html {
		font-size: 50%;
	}
}

@media (max-height: 560px) {
	html {
		font-size: 43%;
	}
}

@media (max-width: 400px) {
	html {
		font-size: 43%;
	}
}
@media (max-height: 485px) {
	html {
		font-size: 35%;
	}
}

@media (max-width: 310px) {
	html {
		font-size: 33%;
	}
}

@media (max-width: 230px) {
    html {
        font-size: 23%;
    }
}

@media (max-width: 180px) {
    html {
        font-size: 20%;
    }
}

@media (max-height: 415px) {
	html {
		font-size: 30%;
	}
}
