@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&display=swap');

html,
body {
	height: 100%;
	margin: 0;
	padding: 0;
	background-color: #0f0f0f;
	font-family: 'JetBrains Mono', 'Fira Code', monospace;
	color: #fff;
	display: flex;
	justify-content: center;
	align-items: start;
	/* Align to top to allow natural flow */
	overflow-x: hidden;
	overflow-y: auto;
	/* Allow vertical scroll if needed */
	touch-action: manipulation;
}

body {
	min-height: 100dvh;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	box-sizing: border-box;
	font-size: 1rem;
	display: flex;
	justify-content: center;
	align-items: center;
}

.game-container {
	text-align: center;
	/* max-width: 90vw; */
	padding: 2rem 0;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Responsive grid that scales with viewport */
.grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(2.5rem, 15vw));
	gap: 0.5rem;
	margin-top: 1.25rem;
	justify-content: center;
}

/* Grid tile styling */
.tile {
	width: calc(100% - 0.25rem);
	aspect-ratio: 1 / 1;
	background-color: #1a1a1a;
	border: 0.125rem solid #333;
	border-radius: 0.375rem;
	font-size: 1.75rem;
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.tile:hover {
	background-color: #2a2a2a;
}

.tile.safe {
	background-color: #1f3f1f; /* Default safe green */
}

/* Solid warn levels: green → orange → red */
.tile.warn1 {
	background-color: #3f6f1f; /* dull green */
}

.tile.warn2 {
	background-color: #7f7f1f; /* olive */
}

.tile.warn3 {
	background-color: #af5f1f; /* brownish orange */
}

.tile.warn4 {
	background-color: #cf3f1f; /* muted orange-red */
}

.tile.warn5 {
	background-color: #ef2f1f; /* strong orange-red */
}

.tile.warn6 {
	background-color: #ff1f1f; /* light red */
}

.tile.warn7 {
	background-color: #ff0000; /* classic red */
}

.tile.warn8 {
	background-color: #8b0000; /* dark red / danger max */
}

.tile.bomb {
	background-color: #3f1f1f; /* dark red for bomb */
}

/* Controls above the grid */
.controls {
	margin-bottom: 0.625rem;
}

button {
	background-color: #222;
	color: #fff;
	border: 0.0625rem solid #555;
	padding: 0.625rem 1rem;
	margin: 0 0.5rem;
	border-radius: 0.25rem;
	cursor: pointer;
	font-family: inherit;
	font-size: 1rem;
}

button:hover {
	background-color: #333;
}

#bombCount {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: textfield;
	/* hide spinner on Firefox */
	background-color: #111;
	color: #fff;
	border: 0.0625rem solid #444;
	border-radius: 50%;
	padding: 0.5rem;
	width: 1.5rem;
	height: 1.5rem;
	font-family: inherit;
	font-size: 16px;
	text-align: center;
	font-weight: bold;
	transition: all 0.2s ease;
	outline: none;
	margin: 0;
}

#bombCount:focus {
	color: #fff;
	outline: none;
}

#bombCountWrap {
	display: inline-flex;
	position: relative;
	z-index: 1;
	margin: 0;
	padding: 0;
	height: auto;
	width: auto;
}

#bombCountWrap::before {
	content: '';
	display: block;
	position: absolute;
	top: 10%;
	left: 50%;
	width: 50%;
	height: 10%;
	background-color: #111;
	border: 0.0625rem solid #444;
	border-right: 0.1rem solid #ff9a00;
	transform: rotate(-45deg);
	z-index: -1;
}

/* Remove spinner arrows on iOS/Safari */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Status below the grid */
.status {
	margin-top: 1rem;
	font-size: 1.125rem;
}

/* Optional: shrink font size on short screens */
@media (max-height: 700px) {
	.tile {
		font-size: 1.25rem;
	}
}