*,
*::before,
*::after {
	box-sizing: border-box;
}

#left,
#right,
#up,
#attack {
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

@font-face {
	font-family: Mercantile;
	src: url("./assets/fonts/Crescent\ Mercantile.otf") format("opentype");
}

body {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background-image: url(./assets/img/background/bg-website.jpg);
	background-repeat: no-repeat;
	background-size: cover;
	color: white;
	font-family: sans-serif;
	margin: 0;
	min-height: 100vh;
}

h1 {
	margin-bottom: 20px;
	font-family: Mercantile;
	color: black;
}

.game-container {
	position: relative;
	width: 720px;
	height: 480px;
}

#canvas {
	width: 720px;
	height: 480px;
	background-color: black;
	display: block;
}

.audio-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10;
}

.start-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10;
}

.start-screen-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: fill;
	z-index: 1;
}

.mute-button {
	position: absolute;
	top: 13%;
	right: 8px;
	z-index: 30;
	padding: 5px 10px;
	font-size: 12px;
	font-weight: bold;
	color: white;
	background-color: black;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
	transition:
		transform 0.1s ease,
		background-color 0.2s;
}

.green-text {
	color: green;
}

.red-text {
	color: red;
}

.mute-button:hover {
	background-color: rgb(57, 0, 0);
	transform: scale(1.05);
}

.start-button,
.menu-button {
	position: relative;
	margin-top: 30px;
	z-index: 2;
	padding: 5px 10px;
	font-size: 19px;
	font-family: Mercantile;
	letter-spacing: 3px;
	font-weight: bold;
	color: black;
	background-color: orange;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
	transition:
		transform 0.1s ease,
		background-color 0.2s;
}

.menu-button {
	margin-top: 60px;
}

.start-container {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}
.start-button:hover {
	background-color: red;
	transform: scale(1.05);
}

.d-none {
	display: none;
}

/* hide for desktop users */
.controls-overlay {
	display: none;
}

/* show controls ONLY on devices without hover ability */
@media (hover: none) {
	.controls-overlay {
		position: absolute;
		bottom: 12px;
		left: 0;
		right: 0;
		pointer-events: none;
		display: flex;
		justify-content: space-between;
		padding: 0 16px;
		box-sizing: border-box;
		z-index: 5;
	}

	/* Re-enable clicks on button containers */
	.dpad-movement,
	.dpad-actions {
		pointer-events: auto;
		display: flex;
		align-items: center;
		gap: 8px;
	}
	.btn {
		width: 44px;
		height: 44px;
		background: rgba(0, 0, 0, 0.379);
		border: 2px solid rgba(195, 85, 0, 0.972);
		color: #ffffff;
		border-radius: 8px;
		backdrop-filter: blur(4px);
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		touch-action: none; /* Disables default scrolling on the button */
	}

	.action-btn {
		background: rgba(255, 0, 0, 0.558);
		border-color: rgba(255, 80, 80, 0.7);
	}
}

@media only screen and (max-width: 720px) {
	#canvas {
		width: 100%;
		height: auto;
	}

	.game-container {
		width: 100%;
		height: auto;
	}

	.start-button {
		font-size: 18px;
		padding: 4px 8px;
	}
}

@media screen and (max-width: 520px) {
	.btn {
		width: 22px;
		height: 22px;
	}

	.start-button {
		font-size: 16px;
		padding: 4px 8px;
	}
}

@media only screen and (max-height: 480px) {
	#canvas {
		height: 95vh;
	}

	.game-container {
		height: 95vh;
	}

	body > h1 {
		display: none;
	}

	.start-button {
		font-size: 14px;
		padding: 4px 8px;
	}
	a {
		height: 5vh;
	}
}

.rotate-device-notice {
	display: none;
}

@media screen and (orientation: portrait) and (hover: none) {
	.rotate-device-notice {
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		inset: 0;
		background-color: black;
		color: white;
		z-index: 9999;
		text-align: center;
		padding: 20px;
		font-family: system-ui, sans-serif;
	}
}
