:root {
  /* This ensures a fallback of 20px if the device doesn't report a safe area */
  --safe-top: env(safe-area-inset-top, 20px);
}
* {
	user-select: none;
	-webkit-user-select: none;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}

body {
	background: #0a0a0a;
	height: 100dvh;
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
	font-family: 'Segoe UI', sans-serif;
	touch-action: none;
}

#game-container {
	position: relative;
	width: 100vw;
	max-width: 400px;
	height: 100dvh;
	/*background: linear-gradient(163deg, #00385a, #02080c, #021018, #000000);*/
    background: linear-gradient(163deg, #996527, #714d35, #3a220d, #000000);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.overlay {
	position: absolute;
	inset: 0;
	background: rgba(16, 10, 0, 0.98);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 100;
	text-align: center;
	padding: 30px;
	color: #fff;
}

#overlay {
	/*background: rgb(6 20 37 / 95%);*/
    /*background: rgb(138 96 45 / 95%);*/
    background: background: rgb(0 0 0 / 71%);
}
@font-face {
    font-family: 'Anton';
    src: url('./Anton-Regular.ttf') format('truetype');
}
#logo{
    display: inline-flex;
    align-items: center; /* Centers them vertically */
    gap: 4px;
    font-family: 'Anton', sans-serif;
    font-weight: 900;
    font-size: 4rem;
    transform: scaleX(1.2);
    transform-origin: center;
}

#logo span {
    display: inline-block;
    transform-origin: center; /* Now scaling from the middle */
    transform: skewX(-5deg); /* The aggressive Doom look */
}

#logo span:nth-child(1) { transform: scaleY(1.6) skewX(0deg) translateY(-1px); }
#logo span:nth-child(2) { transform: scaleY(1.3) skewX(0deg) translateY(-5px); }
#logo span:nth-child(3) { transform: scaleY(1.2) skewX(0deg) translateY(-6px); }
#logo span:nth-child(4) { transform: scaleY(1.0) skewX(0deg) translateY(-10px); }
#logo span:nth-child(5) { transform: scaleY(1.0) skewX(0deg) translateY(-10px); }
#logo span:nth-child(6) { transform: scaleY(1.2) skewX(0deg) translateY(-6px); }
#logo span:nth-child(7) { transform: scaleY(1.34) skewX(0deg) translateY(-4px); }
#logo span:nth-child(8) { transform: scaleY(1.47) skewX(0deg) translateY(-3px); }

#start-menu {
	/*background: linear-gradient(to bottom, #061625, #000000);*/
    background: linear-gradient(to bottom, #a78339, #3d2200);
	border:none;
}

/* Style for the new instruction text */
.menu-instruction {
	font-size: 1.2rem;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 0px 2px 10px #fff1c5;
    margin-bottom: 25px;
    opacity: 0.7;
}

#options-bar {
	display: flex;
    align-items:center;
	justify-content: center;
	gap: 8px;
	padding: 10px;
	/*background: #021628;
    border-bottom: 2px solid #052545;*/
    background: #583d20;
    border-bottom: 2px solid #8b8070;
	flex-shrink: 0;
    padding-top: var(--safe-top);
    
    /* Optional: If the buttons feel too tight, add a bit more breathing room */
    padding-top: calc(var(--safe-top) + 10px);
}

.opt-btn {
	/*background: #1b395b;*/
    background: #7b5e3c;
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: bold;
    box-shadow: 0 2px 0 #00101a;
}
#mute-btn {
    margin-left: auto; /* Pushes the button to the far right */
    background: #7b5e3c;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
}

#mute-btn svg {
    fill: white;
    width: 100%;
    height: 100%;
}
#header {
	padding: 15px 10px;
	text-align: center;
	color: #fff;
	flex-shrink: 0;
}

#lvl-title {
	font-size: 1.4rem;
	color: #f1c40f;
	text-shadow: 2px 2px 4px #000;
}

#grid-container {
	position: relative;
    margin: auto;
    /*background-color: #87a6b4;*/
    background-color: #ccb79a;
    background-image: repeating-conic-gradient(#5a717d 0% 3%, transparent 0% 22%);
    background-size: 3px 3px;
    background-blend-mode: overlay;
    display: grid;
    /*border: 8px solid #253946;*/
    border: 8px solid #7b6042;
    border-radius: 12px;
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.8);
    max-width: 92vw;
    max-height: 55vh;
}

.cell {
    position:relative;
    border: none;
    box-shadow: 0px 1px 1px rgb(67 41 0 / 50%);
	position: relative;
}

.wall-right {
	border-right: 6px solid #362107 !important;
}

.wall-left { border-left: 6px solid #000; }

.wall-bottom {
	border-bottom: 6px solid #362107 !important;
}

/* Entities */
.entity {
	position: absolute;
	width: 76%;
	height: 76%;
	border-radius: 50%;
	top: 12%;
	left: 12%;
	transition: all 0.15s ease-out;
	z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* PLAYER - WHITE */
#player {
    /*background: radial-gradient(circle at 30% 30%, #dac330, #af7e00);
    border: 2px solid #dab611;
	box-shadow: 0 4px 8px rgba(0,0,0,0.4);
	z-index: 20;*/
}

/* WHITE MUMMY - BLACK CIRCLE */
.monster-white {
    /*background: radial-gradient(circle at 30% 30%, #fff, #bdc3c7);
	border: 2px solid #7f8c8d;
	box-shadow: 0 4px 10px rgba(0,0,0,0.7);*/
}

/* RED MUMMY - RED CIRCLE */
.monster-red {
	/*background: radial-gradient(circle at 30% 30%, #ff7675, #d63031);
	border: 2px solid #822727;
	box-shadow: 0 0 10px rgba(214,48,49,0.4);*/
}

/* Add this to your <style> tag */
.monster-black { filter: grayscale(1) brightness(0.2); } /* Quick way to make it black and menacing */

#player, .monster-white, .monster-red, .monster-black  {
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center center; /* This ensures it rotates on its axis */
    transition: rotate 0.15s ease-out; /* Makes the turn look smooth */
}

.monster-dying {
	transform: scale(0);
	opacity: 0;
}

#exit {
	position: absolute;
	/*background: radial-gradient(circle, #fff9e1 30% 10%, #c0b28e 80%);*/
    background: radial-gradient(circle, #fff9e1 38% 13%, #e0d8c1 80%);
	width: 100%;
	height: 100%;
	opacity: 0.6;
	animation: pulse 2s infinite;
}

@keyframes pulse {
	0% { opacity: 0.4; }
	50% { opacity: 0.8; }
	100% { opacity: 0.4; }
}

.hole {
	position: absolute;
	background: #000;
	width: 80%;
	height: 80%;
	top: 10%;
	left: 10%;
	clip-path: polygon(50% 0%, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0% 60%, 10% 20%);
}

#controls {
	padding: 15px 10px 40px 10px;
	background: rgba(0,0,0,0.3);
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	justify-items: center;
}

.btn {
	width: 62px;
	height: 62px;
	/*background: #1e3a4e;*/
    background: #73614b;
	color: white;
	border: none;
	border-radius: 15px;
	font-weight: bold;
	font-size: 0.8rem;
	box-shadow: 0 5px 0 #352f23;
	display: flex;
	align-items: center;
	justify-content: center;
}

.btn:active {
	transform: translateY(3px);
	box-shadow: 0 2px 0 #3d1a00;
}

.btn:disabled {
	background: #3d2b26 !important;
	opacity: 0.5;
	box-shadow: none !important;
	transform: translateY(3px);
	color: #777;
}

#action-btn:disabled {
	background: #555 !important;
	color: #aaa !important;
	cursor: not-allowed;
}

.stars {
	font-size: 2.5rem;
	color: #f1c40f;
	margin-bottom: 15px;
}

#move-count {
	font-size: 1.1rem;
	font-weight: bold;
	color: #edc9af;
}

#level-display {
	display: none;
}

.copy-text {
	font-size: 0.7rem;
	/*color: #76b3dc;*/
    color: #dcb276;
	margin-top: 30px;
	text-transform: uppercase;
	letter-spacing: 2px;
}

#start-menu a {
	transition: background 0.3s;
}

#start-menu a:active {
	background: rgba(255, 255, 255, 0.15) !important;
}

/* LEVEL SELECT OVERLAY SPECIFICS */
.level-select-content {
    background: #4a3721; /* Dark sandstone container */
    padding: 10px;
    border-radius: 15px;
    border: 3px solid #7b6042;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.stage-btn {
    padding: 10px 20px;
    border: none;
    background: #555;
    color: white;
    cursor: pointer;
}

.stage-btn.active {
    background: #7b5e3c; /* Matches your CHOOSE LEVEL button color */
    font-weight: bold;
    outline: 2px solid white;
}
/* The Tablet Buttons */
.ls-btn {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.1s;
    
    /* Stone texture and color */
    background: #c2a373; 
    color: #3e270d;
    
    /* This creates the 'carved' stone effect */
    box-shadow: 
        inset 2px 2px 0px rgba(255,255,255,0.3), /* Highlight */
        inset -3px -3px 0px rgba(0,0,0,0.2),      /* Shadow */
        0px 4px 0px #7b5e3c;                     /* Bottom thickness */
}

/* Locked Stone State */
.ls-btn.locked {
    background: #5d4a37;
    color: #3d2b1a;
    box-shadow: 0px 2px 0px #2a1f14;
    cursor: not-allowed;
    filter: brightness(0.7);
}

/* Active/Hover State */
.ls-btn:active:not(.locked) {
    transform: translateY(2px);
    box-shadow: 
        inset 1px 1px 0px rgba(255,255,255,0.3),
        inset -1px -1px 0px rgba(0,0,0,0.2),
        0px 2px 0px #7b5e3c;
}

/* Highlight the current level they are on */
.ls-btn.current {
    background: #f1c40f;
    color: #000;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.5), inset 2px 2px 0px rgba(255,255,255,0.5);
    border: 2px solid #fff;
}

/* Custom Scrollbar for the Level Grid (keeps it looking ancient) */
#ls-grid::-webkit-scrollbar {
    width: 6px;
}
#ls-grid::-webkit-scrollbar-track {
    background: #2a1f14;
    border-radius: 10px;
}
#ls-grid::-webkit-scrollbar-thumb {
    background: #7b6042;
    border-radius: 10px;
}


/* Eratic shaking */
.mummy-shaking {
    animation: jitter 0.1s infinite;
}

@keyframes jitter {
    0% { transform: translate(1px, 1px); }
    25% { transform: translate(-1px, -2px); }
    50% { transform: translate(-3px, 0px); }
    75% { transform: translate(2px, 1px); }
    100% { transform: translate(1px, -1px); }
}

/* Smoke effect */
.smoke-puff {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #555;
    border-radius: 50%;
    opacity: 0.6;
    animation: expandAndFade 0.6s forwards;
    pointer-events: none;
}

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

.star-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: gold;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: starExplosion 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes starExplosion {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0.5) translate(var(--tx), var(--ty)); opacity: 0; }
}
