/*
  sweepem - Main Stylesheet
*/

/*--------------------------------------------------------------
# Root Variables
# - Color Palette, Sizing, Theming
--------------------------------------------------------------*/
:root {
	--cols: 40;
	--rows: 20;
	color-scheme: light dark;

	/* Color Palette */
	--theme-light: #f7faf9;
	--theme-colored: #03a688;
	--theme-dark: #026873;
	--theme-darker: #025e73;
	--theme-darkest: #011f26;
	--theme-highlight: #f2668b;

	/* Button Sizes & Colors */
	--button-size: 1.5em;
	--button-font-size: 1.5rem;
	--button-color: #d1d1d1;
	--button-clicked-color: #fafafa;
	--button-notclicked-color: #7c7c7c;
	--button-clicked-border-color: #f0f0f0;
	--button-hover-color: #f0f0f0;
	--button-border-color: #bbbbbb;
	--flag-color: #f20574;
	--button-radius: 4px;

	/* Backgrounds */
	--modal-background: #dae1e1;
	--body-background: #f7faf9;
	--app-background: #ffffff;

	/* Board Colors */
	--board-color-level-2: #7c9fcc;
	--board-color-level-3: #8fcc70;
	--board-color-level-4: #cccb7e;
	--board-color-level-5: #cc6c9e;
	--board-color-level-1: #956ecc;

	/* Monster Colors */
	--monster-r-bg: #04d9d9;
	--monster-r-border: #1b2c4d;
	--monster-z-bg: #abd904;
	--monster-z-border: #1b4d36;
	--monster-s-bg: #f2b705;
	--monster-s-border: #5a6b2c;
	--monster-g-bg: #f25c05;
	--monster-g-border: #3e2a4d;
	--monster-w-bg: #f20574;
	--monster-w-border: #4b4200;
	--monster-b-bg: #000000;
	--monster-b-border: #6b2c2c;
}

:root.dark {
	--theme-light: #ffffff;
	--theme-colored: #03a688;
	--theme-dark: #026873;
	--theme-darker: #424c5e;
	--theme-darkest: #011f26;
	--theme-highlight: #f2668b;

	--button-color: #5b616b;
	--button-clicked-color: #2d333b;
	--button-notclicked-color: #4b515b;
	--button-clicked-border-color: #36393e;
	--button-hover-color: #f2668b;
	--button-border-color: #4b515b;

	--body-background: #181a1b;
	--app-background: #2d333b;
	--modal-background: #23272f;
	color: #f5f6fa;

	/* Board Colors dark */
	--board-color-level-2: #9cc7ff;
	--board-color-level-3: #b3ff8c;
	--board-color-level-4: #f7f599;
	--board-color-level-5: #fc86c2;
	--board-color-level-1: #ba8aff;

	/* Monster Colors */
	--monster-r-bg: #04d9d9;
	--monster-z-bg: #abd904;
	--monster-s-bg: #f2b705;
	--monster-g-bg: #f25c05;
	--monster-w-bg: #f20574;
	--monster-b-bg: #ffffff;
}

/* Invert monster icon colors in dark mode */
:root.dark #app button.monster {
	color: var(--theme-light) !important;
	border-color: var(--theme-dark);
}
:root.dark #app button.monster.R,
:root.dark #app button.monster.Z,
:root.dark #app button.monster.S,
:root.dark #app button.monster.B {
	color: var(--theme-darkest) !important;
}
:root.dark .arrow {
	background: var(--theme-light);
}
:root.dark .icon-btn {
	background: var(--theme-light);
}
:root.dark .modal {
	background-color: var(--modal-background);
	color: var(--theme-light);
}
:root.dark .picker-icons > div {
	background: var(--theme-light);
}
:root.dark #modal-leaderboard li:hover {
	background: var(--theme-highlight);
	color: var(--theme-darkest);
}
:root.dark #app button.clicked {
	color: var(--theme-light);
}

/*--------------------------------------------------------------
# Global Styles
--------------------------------------------------------------*/
html,
body {
	overflow-x: auto;
	overflow-y: auto;
	margin: 0;
	height: 100%;
	min-height: 100vh;
	background: var(--body-background);
	color: var(--theme-darkest);

	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Noto Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji",
		"Segoe UI Emoji";
	line-height: 1.5em;
}

/* Remove default focus outline */
* :focus {
	outline: none;
}

/*--------------------------------------------------------------
# Layout Containers
--------------------------------------------------------------*/
#game-container {
	width: fit-content;
	height: fit-content;
	margin: auto;
	padding: 5em;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
	transform-origin: center center;
}

#game {
	width: fit-content;
	height: fit-content;
	margin: 3em auto;
	overflow: auto;
	background: var(--app-background);
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	padding: 1em;
}

#game .header {
	width: 100%;
	text-align: center;
	margin-bottom: 1em;
}

#game .header h1 {
	font-size: 1.6rem;
	font-weight: 600;
	color: var(--theme-light);
	margin: 0;
}

/*--------------------------------------------------------------
# Game Board
--------------------------------------------------------------*/
#app {
	display: grid;
	background-color: var(--app-background);
	grid-template-columns: repeat(var(--cols), 1fr);
	grid-template-rows: repeat(var(--rows), 1fr);
	width: fit-content;
	user-select: none;
	overflow: auto;
	border-radius: 4px;
	margin: auto;
	position: relative;
}

/* Board color levels */
#app.level-2 {
	--button-color: var(--board-color-level-2);
}
#app.level-3 {
	--button-color: var(--board-color-level-3);
}
#app.level-4 {
	--button-color: var(--board-color-level-4);
}
#app.level-5 {
	--button-color: var(--board-color-level-5);
}

/* Board cells (buttons) */
#app button {
	width: var(--button-size);
	height: var(--button-size);
	font-size: var(--button-font-size);
	border: none;
	background-color: var(--button-color);
	border-radius: var(--button-radius);
	transition: background 1s ease, transform 1s ease;
	position: relative;
	touch-action: manipulation;
}

#app button:hover {
	filter: brightness(1.15);
}

/* Cell states */
#app.highlight button {
	animation: highlight 1s reverse forwards;
	background-color: var(--theme-colored);
}

#app button.clicked {
	background-color: var(--button-clicked-color);
	border: 1px solid var(--button-clicked-border-color);
	color: var(--theme-darkest);
	transition: transform 1s linear;
	z-index: 1;
}

#app button.notClicked {
	background-color: var(--button-notclicked-color);
	border: 1px solid var(--button-border-color);
	color: var(--theme-darkest);
}

#app button.flagged {
	color: var(--flag-color);
	background-color: var(--flag-color) !important;
	padding: 0;
}

#app button.shrinked {
	animation: shrink 0.2s reverse forwards;
}

/* Monster cells */
#app button.monster {
	z-index: 3;
	-webkit-mask-size: 100%;
	mask-size: 100%;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	color: black;
	position: relative;
}

#app button.monster::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: var(--monster-current-bg);
	z-index: -1;
}

#app button.monster.R {
	-webkit-mask-image: url("./res/1.svg");
	mask-image: url("./res/1.svg");
	--monster-current-bg: var(--monster-r-bg);
}
#app button.monster.Z {
	-webkit-mask-image: url("./res/2.svg");
	mask-image: url("./res/2.svg");
	--monster-current-bg: var(--monster-z-bg);
}
#app button.monster.S {
	-webkit-mask-image: url("./res/3.svg");
	mask-image: url("./res/3.svg");
	--monster-current-bg: var(--monster-s-bg);
	padding-top: 0.3em;
}
#app button.monster.G {
	-webkit-mask-image: url("./res/4.svg");
	mask-image: url("./res/4.svg");
	--monster-current-bg: var(--monster-g-bg);
	padding-right: 8px;
}
#app button.monster.W {
	-webkit-mask-image: url("./res/5.svg");
	mask-image: url("./res/5.svg");
	--monster-current-bg: var(--monster-w-bg);
	padding-top: 0.3em;
}
#app button.monster.B {
	-webkit-mask-image: url("./res/6.svg");
	mask-image: url("./res/6.svg");
	--monster-current-bg: var(--monster-b-bg);
}

/*--------------------------------------------------------------
# Game UI & Menu
--------------------------------------------------------------*/
#menu {
	position: fixed;
	bottom: env(safe-area-inset-bottom, 0px);
	left: 50%;
	transform: translateX(-50%) scale(1);
	width: 95%;
	max-width: 600px;
	margin: 0 auto 1em auto;
	display: none;
	justify-content: space-between;
	align-items: center;
	background-color: var(--theme-darker);
	padding: 0.8em 1em;
	border-radius: 0.5em;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 1000;
}

#menu > * {
	height: 2.5em;
	display: flex;
	align-items: center;
}

#statSheet {
	width: fit-content;
	height: fit-content;
	display: flex;
	align-items: center;
	gap: 1em;
	color: var(--theme-light);
	p {
		margin: 0;
		font-size: 0.95rem;
	}
}

#statSheet p:first-child {
	margin-left: 0.5em;
}

#playerLevel {
	width: 2.2em;
	height: 2.2em;
	border-radius: 50%;
	border: 1px solid var(--theme-light);
	text-align: center;
	line-height: 2.2em;
	background: var(--theme-darker);
	color: var(--theme-light);
	font-weight: bold;
}

#playerClass {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin-left: 0.7em;
}

/* Health and Experience Bars */
#health {
	display: flex;
	align-items: center;
	gap: 0.3em;
}

#health .heart {
	width: 1.2em;
	height: 1.2em;
	background-color: var(--theme-light);
	-webkit-mask-image: url("./res/heart.svg");
	mask-image: url("./res/heart.svg");
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

#health .heart.colored {
	opacity: 0.4;
}

#experience[value] {
	appearance: none;
	-moz-appearance: none;
	width: 4em;
	height: 0.7em;
	border: 1px solid var(--theme-light);
	border-radius: 4px;
	background-color: var(--theme-darker);
	overflow: hidden;
}

#experience[value]::-webkit-progress-bar {
	background-color: var(--theme-darkest);
}

#experience[value]::-webkit-progress-value {
	background-color: var(--theme-dark);
}

#experience[value]:hover::after {
	background: var(--theme-dark);
	border: 1px solid var(--theme-colored);
	content: attr(value) "/" attr(max);
	display: block;
	transform: translateY(-150%);
	padding: 0.4em;
	position: absolute;
	text-align: center;
	width: fit-content;
	z-index: 3;
}

/* Menu Icons */
#openSettings,
#reset,
#openLeaderboard,
#specialAbility {
	width: 2em;
	height: 2em;
	font-size: 1em;
	padding: 0;
	margin-left: 0.8em;
	background: transparent;
	background-color: var(--theme-light);
	border: none;
	cursor: pointer;
	transition: filter 0.2s ease;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

#openSettings:hover,
#reset:hover,
#openLeaderboard:hover {
	filter: brightness(1.5);
}

#openSettings {
	-webkit-mask-image: url("./res/house.svg");
	mask-image: url("./res/house.svg");
}

#reset {
	-webkit-mask-image: url("./res/refresh.svg");
	mask-image: url("./res/refresh.svg");
}

#openLeaderboard {
	-webkit-mask-image: url("./res/leaderboard.svg");
	mask-image: url("./res/leaderboard.svg");
	transform: scale(1.4);
}

#specialAbility {
	display: none;
	transform: scaleX(1.5);
	-webkit-mask-image: url("./res/fire.svg");
	mask-image: url("./res/fire.svg");
	transition: background 0.5s ease;
}

#specialAbility.dagger {
	-webkit-mask-image: url("./res/dagger.svg");
	mask-image: url("./res/dagger.svg");
}

#specialAbility:active,
#specialAbility:hover {
	background: var(--theme-highlight);
}

#specialAbility.ability-ready,
#specialAbility.ability-waiting {
	display: block;
}

#specialAbility.ability-waiting {
	background: var(--theme-highlight);
}

/*--------------------------------------------------------------
# Modal Styles
--------------------------------------------------------------*/
.modal-bg {
	inset: 0;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
}

.modal {
	background-color: var(--modal-background);
	color: var(--theme-darkest);
	border-radius: 1em;
	padding: 2em 1.5em 1.2em 1.5em;
	width: 25em;
	max-width: 40em;
	min-width: 20em;
	margin: 0.5em auto;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	animation: modal-fade-in 0.25s ease-out;
	position: fixed;
	top: 0;
	gap: 0.6em;
	margin-top: 0.5em;
	padding-top: 2em; /* Default padding-top, can be overridden */
	z-index: 1001;
}

.modal h1,
.modal h2,
.modal h3 {
	margin-top: 0;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.modal h2 {
	margin-top: 1em;
}

#modal-title,
#modal-subtitle,
#modal-text,
#modal-class,
#modal-classDescription,
#modal-slot {
	padding: 0 1rem;

	ul {
		list-style: disc;
		padding-left: 1.5em;

		li {
			margin: 0.5em 0;

			div {
				-webkit-mask-size: contain;
				mask-size: contain;
				-webkit-mask-repeat: no-repeat;
				mask-repeat: no-repeat;
				-webkit-mask-position: center;
				mask-position: center;
				width: 2em;
				height: 2em;
				background-color: var(--theme-light);
			}

			.icon-container {
				display: flex;
				gap: 0.5em;
				align-items: center;
				margin-top: 0.5em;
				background-color: transparent;
				width: auto;
				height: auto;
			}

			div.dagger {
				-webkit-mask-image: url("./res/dagger.svg");
				mask-image: url("./res/dagger.svg");
			}

			div.fireball {
				-webkit-mask-image: url("./res/fire.svg");
				mask-image: url("./res/fire.svg");
				transform: scaleX(1.5);
			}
		}
	}
	p.copyright {
		text-align: center;
		font-size: 0.8em;
		opacity: 0.7;
		margin-top: 1em;
	}
	hr {
		border: none;
		border-top: 1px solid var(--theme-highlight);
		width: 60%;
		text-align: center;
		margin: auto;
		filter: opacity(0.5);
	}
}

.modal-image {
	max-width: 94%;
	margin: 1em auto 1rem;
	border-radius: 8px;
	object-fit: contain;
}

/* Modal Controls */
.modal .controls {
	display: flex;
	justify-content: flex-end;
	gap: 0.5em;
	margin: 2em 1em 0em 1em;
}

.info-modal .controls,
.settings-modal .controls,
.tutorial-modal .back,
.leaderboard-modal .controls {
	justify-content: start;
	margin-top: 0;
	margin-left: 1rem;
}

.info-modal {
	text-align: center;
}

.tutorial-modal {
	#modal-content {
		#modal-text {
			p {
				margin-bottom: 0;
			}
		}
	}
}

.modal button {
	background: var(--theme-darker);
	color: #fff;
	border: none;
	border-radius: 0.4em;
	font-size: 1rem;
	font-weight: 600;
	padding: 0.5em 1.2em;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.modal button:hover,
.modal button:focus,
.icon-btn:hover {
	background: var(--theme-highlight);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
	cursor: pointer;
}

.modal button.cancel {
	background: #fff;
	color: var(--theme-dark);
	border: 1px solid var(--theme-dark);
	padding: 0.45em 1.1em;
}

.modal button.cancel:hover,
.modal button.cancel:focus {
	background: var(--theme-dark);
	color: #fff;
}

#modal-secondary-confirm {
	display: none;
}

#modal-confirm {
	background: var(--theme-highlight);
}

#modal-confirm:hover,
#modal-confirm:focus {
	background: var(--theme-darker);
}

/* Specific Modal Types */
.start-modal {
	margin: auto;
	padding: 1em;
	display: flex;
	flex-direction: column;
	transform: translateY(-50%);
	top: 50%;
}

.tutorial-modal {
	height: calc(100dvh - 4em);
	display: flex;
	flex-direction: column;
}

.tutorial-modal #modal-content {
	flex-grow: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	background: var(--button-color);
	border-radius: 1em;
	width: 95%;
	margin: auto;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.tutorial-modal #modal-content::-webkit-scrollbar {
	display: none;
}

.tutorial-modal .controls {
	margin-top: auto;
	flex-shrink: 0;
	position: relative;
}

@media only screen and (min-width: 601px) {
	.leaderboard-modal {
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		margin: 0;
	}
}

.leaderboard-modal h1 {
	text-align: left;
	letter-spacing: 0.2em;
}

#modal-leaderboard {
	margin: 0;
	padding: 0 1rem;
}

#modal-leaderboard li {
	background: var(--theme-darker);
	color: var(--theme-light);
	margin: 0.3em 0;
	padding: 0.6em 1em;
	border-radius: 0.4em;
	font-size: 1.1em;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
	transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#modal-leaderboard li:hover {
	transform: translateX(5px) scale(1.02);
	background: var(--theme-colored);
	color: var(--theme-light);
}

#modal-leaderboard li:hover ~ li {
	transform: translateX(-2px);
}

/*--------------------------------------------------------------
# Components
--------------------------------------------------------------*/
/* --- Start Screen --- */
.logo {
	width: 100%;
	height: 10em;
	margin-top: 1em;
	background: url("./res/logo.svg") no-repeat center center;
	background-size: contain;
}

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.icon-btn {
	background: var(--theme-darker);
	width: 3em;
	height: 3em;
	cursor: pointer;
	display: grid;
	place-items: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-user-select: none;
	user-select: none;
}

.icon-btn.info {
	-webkit-mask-image: url("./res/info.svg");
	mask-image: url("./res/info.svg");
}

.icon-btn.settings {
	-webkit-mask-image: url("./res/gear.svg");
	mask-image: url("./res/gear.svg");
}

.icon-btn.back {
	-webkit-mask-image: url("./res/back.svg");
	mask-image: url("./res/back.svg");
	margin-bottom: 2rem;
	flex: 0 0 auto; /* Prevent flex sizing */
}

/* --- Pickers (Class, Size, Difficulty) --- */
.pickers {
	margin-top: 3em;
}

.picker {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5em;
	margin-top: 1em;
}

.picker-icons {
	display: flex;
	width: 3em;
	height: 3em;
	align-items: center;
	justify-content: center;
}

.picker-icons > div {
	width: 100%;
	height: 100%;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	background: var(--theme-darkest);
}

.picker-icons .difficulty {
	padding-top: 1em;
	-webkit-mask-position: bottom;
	mask-position: bottom;
	-webkit-mask-image: url("./res/difficulty.svg");
	mask-image: url("./res/difficulty.svg");
}

.picker-icons .dimension {
	-webkit-mask-image: url("./res/ruler.svg");
	mask-image: url("./res/ruler.svg");
}

.picker-icons .classes {
	-webkit-mask-image: url("./res/sword.svg");
	mask-image: url("./res/sword.svg");
}

.picker-row {
	width: 80%;
	display: grid;
	grid-template-columns: 56px 1fr 56px;
	align-items: center;
	gap: 12px;
}

.picker-label {
	text-align: center;
	font-size: 42px;
	font-weight: 600;
	letter-spacing: 0.5px;
	outline: none;
}

.arrow {
	width: 2em;
	height: 2em;
	background: var(--theme-darker);
	border: 1px solid var(--theme-darkest);
	border: none;
	cursor: pointer;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-image: url("./res/arrow_select.svg");
	mask-image: url("./res/arrow_select.svg");
}

.arrow.left {
	justify-self: end;
	transform: rotate(180deg);
}

.arrow.right {
	justify-self: start;
}

.picker-select {
	width: 100%;
	appearance: none;
	background: var(--theme-darker);
	color: var(--theme-light);
	border: none;
	border-radius: 0.5em;
	padding: 0.4em 0.8em;
	font-size: 1em;
	text-align: center;
	-webkit-user-select: none;
	user-select: none;
}
.picker-select:disabled {
	background: var(--theme-darker);
	color: var(--theme-light);
}

/* --- Settings Components (Toggle, Theme Select) --- */
#modal-slot {
	display: flex;
	flex-direction: column;
	height: 100%;
	/* justify-content: space-between; */
}

.logo-pickers-container {
	margin: auto 0;
}

.settings-modal {
	text-align: center;
}

.toggle {
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.1em;
	margin-top: 2rem;
	position: relative;
}

.toggle-switch {
	background: var(--button-border-color);
	border-radius: 16px;
	min-width: 60px;
	height: 34px;
	position: relative;
	transition: background 0.25s ease;
	flex-shrink: 0;
}

.toggle-label {
	display: inline-block;
	white-space: normal;
	word-break: break-word;
	flex: 1 1 0;
	min-width: 0;
}

.toggle-switch:before {
	content: "";
	display: block;
	background: var(--theme-light);
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
	width: 26px;
	height: 26px;
	position: absolute;
	top: 4px;
	left: 4px;
	transition: left 0.25s ease;
}

.toggle-checkbox {
	position: absolute;
	visibility: hidden;
}

.toggle-checkbox:checked + .toggle-switch {
	background: var(--theme-highlight);
}

.toggle-checkbox:checked + .toggle-switch:before {
	left: 30px;
}

.theme-label {
	margin-top: 2rem;
}

#themeSelect {
	display: block;
	margin-top: 0.5em;
	border: none;
	background-color: var(--theme-darker);
	padding: 0.5em 0.8em;
	color: var(--theme-light);
	font-weight: 500;
	border-radius: 0.4em;
	margin: auto;
	margin-bottom: 0.5em;
	margin-top: 0.5em;
}

/*--------------------------------------------------------------
# Animations
--------------------------------------------------------------*/
@keyframes highlight {
	from {
		background-color: var(--button-color);
	}
	to {
		background-color: var(--theme-colored);
	}
}

@keyframes shrink {
	from {
		transform: scale(1);
	}
	to {
		transform: scale(0);
	}
}

@keyframes monster-reveal {
	0% {
		transform: scale(1) rotate(0deg);
	}
	30% {
		transform: scale(1.5) rotate(-12deg);
	}
	60% {
		transform: scale(0.8) rotate(12deg);
	}
	100% {
		transform: scale(1) rotate(0deg);
	}
}

.monster-reveal-anim {
	animation: monster-reveal 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
}

.monster-defeat-anim {
	position: relative;
	overflow: visible !important;
}

@keyframes fadeOutAndScale {
	0% {
		opacity: 1;
		transform: scale(0.5);
	}
	50% {
		opacity: 1;
		transform: scale(1.2);
	}
	100% {
		opacity: 0;
		transform: scale(2);
	}
}

.defeat-star {
	position: absolute;
	pointer-events: none;
	z-index: 100;
	animation: star-animation 0.4s forwards;
	opacity: 0;
	filter: sepia(1) saturate(20) hue-rotate(320deg) brightness(1.5)
		drop-shadow(0 0 4px rgb(255, 196, 0));
	will-change: transform, opacity;
}

@keyframes star-animation {
	0% {
		opacity: 0;
		transform: translate(0, 0) scale(var(--s, 1)) rotate(var(--r, 0deg));
	}
	20% {
		opacity: 1;
	}
	80% {
		opacity: 1;
	}
	100% {
		opacity: 0;
		transform: translate(var(--tx, 0), var(--ty, 0)) scale(var(--s, 1.2))
			rotate(var(--r, 0deg));
	}
}

@keyframes modal-fade-in {
	from {
		opacity: 0;
		transform: translateY(40px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/*--------------------------------------------------------------
# Media Queries
# - Mobile-responsive adjustments
--------------------------------------------------------------*/
@media only screen and (max-width: 600px) {
	body {
		/* Hide scrollbar for IE, Edge and Firefox */
		-ms-overflow-style: none; /* IE and Edge */
		scrollbar-width: none; /* Firefox */
	}
	body::-webkit-scrollbar {
		display: none;
	}
	#game-container {
		padding: 10em;
	}
	#game {
		margin: 2em auto;
		padding: 0.8em;
	}
	#app {
		overflow: auto;
	}
	#menu {
		position: fixed;
		bottom: 0;
		width: 90%;
		padding: 0.6em 0.8em;
		left: 50%;
		transform: translateX(-50%);
		margin: 0.5em auto;
	}
	#playerClass {
		display: none;
	}

	#playerLevel {
		min-width: 2em;
		height: 2em;
		line-height: 2em;
	}

	#experience[value] {
		transform: rotate(270deg);
		width: 40%;
	}
	#experience[value]:hover::after {
		transform: rotate(90deg);
		position: absolute;
		left: 5em;
		top: 4em;
	}
	#app button {
		width: var(--button-size);
		height: var(--button-size);
		font-size: var(--button-font-size);
		font-weight: lighter;
		padding: 0;
	}
	.modal {
		width: 100%;
		height: 100%;
		border-radius: unset;
		overflow-y: auto;
		margin: 0;
		padding: 1em 1em;
		padding-top: 2em;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
	}
	.modal-bg {
		align-items: flex-start;
		padding: 0;
		position: fixed;
		overflow-y: auto;
		height: 100dvh;
		z-index: 999;
	}
	.modal #modal-content {
		padding-bottom: 0em;
		overflow-y: auto;
		flex-grow: 1;
	}
	.modal .controls {
		margin-top: 2em;
	}
	.start-modal {
		margin: auto;
		padding: 1em;
		display: flex;
		flex-direction: column;
		transform: translateY(0);
		top: 0;
	}

	#specialAbility {
		position: fixed;
		right: 1.5em;
		bottom: 4.5em;
		z-index: 2000;
		width: 3em;
		height: 3em;
		font-size: 1em;
		align-items: center;
		justify-content: center;
		transition: background 0.2s ease;
		background: var(--theme-darker);
	}
	:root.dark #specialAbility {
		background: var(--theme-light);
	}
	#specialAbility.ability-waiting {
		background: var(--theme-highlight) !important;
	}

	.execute-mode-active #app button {
		cursor: crosshair;
	}

	.execute-mode-active #app button:not(.clicked):hover {
		background-color: #ff6b6b !important;
		transform: scale(1.1);
	}

	/* Tutorial modal specific styles */
	.tutorial-modal {
		height: 100dvh;
		display: flex;
		flex-direction: column;
	}

	.tutorial-modal #modal-content {
		flex-grow: 1;
		overflow-y: auto;
		display: flex;
		flex-direction: column;
	}

	.tutorial-modal .controls {
		margin-top: 0;
		flex-shrink: 0;
	}

	.settings-modal #modal-slot {
		height: auto;
	}
}
