* {
	margin: 0;
	padding: 0;
	outline: 0 none;
	text-decoration: none;
	-webkit-user-select: none;
	   -moz-user-select: none;
		-ms-user-select: none;
		 -o-user-select: none;
			user-select: none;
	font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

html, body {
	width: 100%;
	height: 100%;
	direction: rtl;
	overflow-x: hidden;
}

body {
	display: flex;
	position: relative;
	flex-flow: row wrap;
	align-items: center;
	justify-content: center;
	background-color: gainsboro;
	background-image: linear-gradient(135deg, #363636, #1e1e1e);
	padding: 10px;
	box-sizing: border-box;
}

#gameContainer {
	width: 100%;
	max-width: 480px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin: 0 auto;
}

#gameHeader {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	padding: 8px 10px;
	box-sizing: border-box;
	gap: 5px;
	background-color: #2c3e50;
	border-radius: 8px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
	flex-wrap: wrap;
}

.counter {
	color: white;
	font-size: 14px; /* Slightly smaller base font */
	font-weight: 600;
	background-color: #34495e;
	padding: 6px 8px;
	border-radius: 6px;
	min-width: 120px;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 4px;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
	flex: 1;
	min-width: 100px;
}

.counter span {
	font-weight: bold;
	font-size: 16px; /* Larger font for the numbers */
	min-width: 30px;
	display: inline-block;
	text-align: center;
	background-color: #2c3e50;
	padding: 2px 4px;
	border-radius: 4px;
}

#resetGame {
	width: 140px;
	height: 40px;
	color: gray;
	border: none;
	cursor: pointer;
	font-size: 12pt;
	line-height: 40px;
	background-color: white;
	font-family: 'Vazirmatn', 'Tahoma', sans-serif;
	-webkit-transition: all .5s ease;
	   -moz-transition: all .5s ease;
		-ms-transition: all .5s ease;
		 -o-transition: all .5s ease;
			transition: all .5s ease;
	-webkit-border-radius: 6px;
	   -moz-border-radius: 6px;
		-ms-border-radius: 6px;
		 -o-border-radius: 6px;
			border-radius: 6px;
	background-image: url('../img/resetIcon.png');
	background-position: 96% center; /* Flipped for RTL */
	background-size: 18%;
	background-repeat: no-repeat;
	flex: 0 0 auto;
}

#resetGame:hover {
	transform: scale(1.05);
}

#mineSweeper {
	width: 100%;
	height: auto;
	position: relative;
	box-shadow: 0 0 2px gray, 0 2px 2px gray;
	aspect-ratio: 1/1; /* Maintain square aspect ratio */
	max-width: 480px;
}

canvas {
	position: absolute;
	top: 0px;
	right: 0px; /* Changed from left to right for RTL */
	margin: auto;
	z-index: 10;
	width: 100%;
	height: 100%;
	max-width: 480px;
	max-height: 480px;
}

/* Media queries for responsive design */
@media (max-width: 520px) {
	#gameHeader {
		flex-direction: column;
		gap: 8px;
		padding: 6px 8px;
	}
	
	.counter {
		font-size: 13px;
		padding: 5px 6px;
		min-width: 100px;
	}
	
	.counter span {
		font-size: 14px;
		min-width: 25px;
		padding: 2px 3px;
	}
	
	#resetGame {
		width: 100%;
		max-width: 150px;
		height: 40px;
		font-size: 10pt;
	}
	
	#gameContainer {
		gap: 8px;
	}
}

@media (max-width: 350px) {
	.counter {
		font-size: 12px;
		padding: 4px 5px;
		min-width: 90px;
	}
	
	.counter span {
		font-size: 13px;
		min-width: 20px;
		padding: 1px 2px;
	}
	
	#resetGame {
		font-size: 9pt;
	}
}

#resetGame {
	width: 140px;
	height: 35px;
	color: gray;
	border: none;
	cursor: pointer;
	font-size: 11pt;
	line-height: 35px;
	background-color: white;
	font-family: 'Vazirmatn', 'Tahoma', sans-serif;
	-webkit-transition: all .5s ease;
	   -moz-transition: all .5s ease;
		-ms-transition: all .5s ease;
		 -o-transition: all .5s ease;
			transition: all .5s ease;
	-webkit-border-radius: 4px;
	   -moz-border-radius: 4px;
		-ms-border-radius: 4px;
		 -o-border-radius: 4px;
			border-radius: 4px;
	background-image: url('../img/resetIcon.png');
	background-position: 96% center; /* Flipped for RTL */
	background-size: 18%;
	background-repeat: no-repeat;
}

#resetGame:hover {
	transform: scale(1.05);
}

#mineSweeper {
	width: 480px;
	height: 480px;
	position: relative;
	box-shadow: 0 0 2px gray, 0 2px 2px gray;
}

canvas {
	position: absolute;
	top: 0px;
	right: 0px; /* Changed from left to right for RTL */
	margin: auto;
	z-index: 10;
}

/* Message overlay for win/lose messages */
.message-overlay {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	z-index: 100;
	justify-content: center;
	align-items: center;
}

.message-text {
	color: white;
	font-size: 24px;
	font-weight: bold;
	text-align: center;
	padding: 20px;
	background-color: rgba(0, 0, 0, 0.8);
	border-radius: 10px;
	box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* RTL specific adjustments */
[dir="rtl"] {
	text-align: right;
}
