.minesweeper-page {
	font-family: Tahoma, Verdana, Arial, sans-serif;
}

.minesweeper-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.minesweeper-prize {
	padding: 0.75rem;
	margin: 0 0 1rem;
	background: var(--face-soft);
	border: 2px solid;
	border-color: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
}

.minesweeper-prize p {
	margin: 0 0 0.75rem;
}

.minesweeper-donation {
	display: flex;
	min-height: 36px;
	align-items: center;
	gap: 0.5rem;
	padding-top: 0.65rem;
	border-top: 1px dotted var(--border);
	cursor: pointer;
}

.minesweeper-donation input {
	position: relative;
	width: 18px;
	height: 18px;
	flex: 0 0 18px;
	margin: 0;
	appearance: none;
	background: var(--field);
	border: 2px solid;
	border-color: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
	border-radius: 0;
}

.minesweeper-donation input:checked::after {
	position: absolute;
	top: -5px;
	left: 2px;
	content: "\2713";
	color: var(--text);
	font:
		900 20px / 1 Tahoma,
		Arial,
		sans-serif;
}

.minesweeper-donation:has(input:disabled) {
	cursor: default;
}

.minesweeper-donation input:disabled {
	color: var(--text);
	background: var(--field);
	border-color: var(--border);
	opacity: 1;
}

.minesweeper-console {
	padding: 0.75rem;
	background: var(--face);
	border: 2px solid;
	border-color: var(--highlight) var(--deep-shadow) var(--deep-shadow) var(--highlight);
}

.minesweeper-toolbar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem;
	border: 2px solid;
	border-color: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
}

.minesweeper-counter {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	min-width: 0;
	font-size: 1.35rem;
}

.minesweeper-counter-time {
	justify-content: flex-end;
}

.minesweeper-counter output {
	min-width: 3.25rem;
	padding: 0.2rem 0.35rem;
	color: light-dark(#8b0000, #ffb0a8);
	background: var(--field);
	border: 2px solid;
	border-color: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
	font:
		700 1.15rem / 1.2 "Lucida Console",
		Consolas,
		monospace;
	text-align: center;
}

.minesweeper-reset {
	display: grid;
	width: 3.5rem;
	height: 3.5rem;
	min-height: 3.5rem;
	padding: 0;
	place-items: center;
	font-size: 2rem;
	line-height: 1;
}

.minesweeper-result {
	padding: 0.35rem 0.5rem;
	margin: 0.75rem 0;
	background: var(--field);
	border: 1px solid var(--border);
}

.minesweeper-board-scroll {
	min-width: 0;
	max-width: 100%;
	margin: 0.75rem 0 0;
	overflow: auto;
	padding: 0.35rem;
	background: var(--face-soft);
	border: 2px solid;
	border-color: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
}

.minesweeper-flag-help {
	margin: 0.75rem 0 0;
}
.minesweeper-touch-help {
	display: none;
}
@media (pointer: coarse) {
	.minesweeper-mouse-help {
		display: none;
	}
	.minesweeper-touch-help {
		display: inline;
	}
}

.minesweeper-board {
	display: grid;
	grid-template-columns: repeat(var(--minesweeper-columns), max(30px, 1.875rem));
	width: max-content;
	margin: 0 auto;
	background: var(--border);
	border: 1px solid var(--deep-shadow);
}

.minesweeper-cell {
	display: grid;
	width: max(30px, 1.875rem);
	height: max(30px, 1.875rem);
	min-height: 0;
	padding: 0;
	place-items: center;
	font:
		700 1rem / 1 Tahoma,
		"Segoe UI Emoji",
		"Apple Color Emoji",
		sans-serif;
	touch-action: manipulation;
	user-select: none;
	-webkit-touch-callout: none;
}

.minesweeper-cell[data-flagged="true"] {
	font-size: 0.9rem;
}

.minesweeper-cell[data-revealed="true"],
.minesweeper-cell[data-revealed="true"]:hover,
.minesweeper-cell[data-revealed="true"]:active {
	background: var(--face-soft);
	border: 1px solid var(--border);
	box-shadow: none;
}

.minesweeper-cell[data-mine="true"]:disabled {
	color: var(--text);
}

.minesweeper-cell[data-exploded="true"]:disabled {
	color: light-dark(#7b0000, #ffbbb3);
	background: light-dark(#e8b6b1, #6e3531);
}

.minesweeper-cell[data-flagged="true"]:not([data-revealed="true"]) {
	color: light-dark(#5e0000, #ffd0ca);
}

.minesweeper-cell:disabled {
	border-color: var(--border);
	box-shadow: none;
	opacity: 1;
}

.minesweeper-cell:focus-visible {
	position: relative;
	z-index: 1;
	outline-offset: -3px;
}

@media (max-width: 34rem) {
	.minesweeper-toolbar {
		grid-template-columns: minmax(0, 1fr) 3rem minmax(0, 1fr);
		padding-inline: 0.35rem;
	}

	.minesweeper-counter {
		gap: 0.2rem;
		font-size: 1.1rem;
	}

	.minesweeper-counter output {
		min-width: 2.8rem;
		padding-inline: 0.2rem;
		font-size: 1rem;
	}

	.minesweeper-reset {
		width: 3rem;
		height: 3rem;
		min-height: 3rem;
		font-size: 1.65rem;
	}

	.minesweeper-board {
		margin-inline: 0;
	}
}

@media (forced-colors: active) {
	.minesweeper-cell[data-exploded="true"]:disabled {
		color: CanvasText;
		background: Canvas;
	}
}
