/**
 * Minesweeper Stylesheet for EXS.LV
 */

#minesweeper-container {
	padding: 15px;
	background: #f8fafc;
	border-radius: 8px;
}

.ms-wrapper {
	max-width: 900px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.ms-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	max-width: 600px;
	margin-bottom: 15px;
}

.ms-diff-selector label {
	font-weight: bold;
	margin-right: 8px;
	color: #334155;
	display: inline-block;
}

.ms-select {
	padding: 6px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background: #ffffff;
	font-weight: bold;
	color: #0f172a;
	cursor: pointer;
}

.ms-stat-badge {
	background: #e2e8f0;
	padding: 6px 14px;
	border-radius: 6px;
	font-size: 13px;
	color: #334155;
}

/* Minesweeper Window Frame */
.ms-window {
	background: #c0c0c0;
	border: 3px inset #ffffff;
	box-shadow: 0 4px 10px rgba(0,0,0,0.15);
	padding: 10px;
	border-radius: 4px;
	display: inline-block;
	user-select: none;
}

.ms-header {
	background: #c0c0c0;
	border: 2px inset #ffffff;
	padding: 6px 10px;
	margin-bottom: 10px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.ms-digital-counter {
	background: #000000;
	color: #ff0000;
	font-family: 'Courier New', Courier, monospace;
	font-size: 24px;
	font-weight: bold;
	padding: 2px 6px;
	border: 1px inset #808080;
	letter-spacing: 2px;
	min-width: 54px;
	text-align: center;
}

.ms-btn-face {
	width: 36px;
	height: 36px;
	font-size: 20px;
	background: #c0c0c0;
	border: 2px outset #ffffff;
	border-radius: 4px;
	cursor: pointer;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 0;
	line-height: 1;
}

.ms-btn-face:active {
	border-style: inset;
}

/* Board & Scroll Container */
.ms-board-scroll {
	max-width: 100%;
	overflow-x: auto;
	border: 3px inset #ffffff;
}

.ms-board {
	display: grid;
	gap: 0px;
	background: #7b7b7b;
}

.ms-cell {
	width: 28px;
	height: 28px;
	background: #c0c0c0;
	border: 2px outset #ffffff;
	box-sizing: border-box;
	display: flex;
	justify-content: center;
	align-items: center;
	font-weight: 900;
	font-size: 15px;
	font-family: Arial, sans-serif;
	cursor: pointer;
	user-select: none;
}

.ms-medium .ms-cell {
	width: 24px;
	height: 24px;
	font-size: 13px;
}

.ms-hard .ms-cell {
	width: 18px;
	height: 18px;
	font-size: 11px;
	border-width: 1px;
}

.ms-hard .ms-cell.flagged {
	font-size: 10px;
}

.ms-cell:active:not(.revealed):not(.flagged) {
	border: 1px solid #7b7b7b;
	background: #bdbdbd;
}

.ms-cell.revealed {
	border: 1px solid #7b7b7b;
	background: #bdbdbd;
	cursor: default;
}

.ms-cell.flagged {
	font-size: 13px;
}

.ms-cell.mine {
	background: #e2e8f0;
}

.ms-cell.exploded {
	background: #ef4444 !important;
	color: #ffffff;
}

.ms-cell.false-flag {
	background: #fee2e2;
}

/* Number Colors */
.ms-cell.num-1 { color: #0000ff; }
.ms-cell.num-2 { color: #007b00; }
.ms-cell.num-3 { color: #ff0000; }
.ms-cell.num-4 { color: #00007b; }
.ms-cell.num-5 { color: #7b0000; }
.ms-cell.num-6 { color: #007b7b; }
.ms-cell.num-7 { color: #000000; }
.ms-cell.num-8 { color: #7b7b7b; }

/* Mobile Toolbar Mode Bar */
.ms-mobile-mode-bar {
	display: flex;
	gap: 10px;
	margin-top: 15px;
}

.ms-mode-btn {
	padding: 8px 16px;
	font-weight: bold;
	font-size: 14px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s;
}

.ms-mode-btn.active {
	background: #3b82f6;
	color: #ffffff;
	border-color: #2563eb;
}

/* Guide Box */
.ms-guide-box {
	margin-top: 20px;
	padding: 15px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	color: #475569;
	width: 100%;
	max-width: 600px;
}

.ms-guide-box h4 {
	margin: 0 0 10px 0;
	color: #0f172a;
	font-size: 15px;
}

.ms-guide-box ul {
	margin: 0;
	padding-left: 20px;
}

.ms-guide-box li {
	margin-bottom: 6px;
	font-size: 13px;
}

/* Dark Mode Overrides */
@media (prefers-color-scheme: dark) {
	#minesweeper-container {
		background: #181c24;
	}

	.ms-diff-selector label {
		color: #e2e8f0;
	}

	.ms-select {
		background: #252d3a;
		border-color: #3b4658;
		color: #f8fafc;
	}

	.ms-stat-badge {
		background: #252d3a;
		color: #cbd5e1;
	}

	.ms-window {
		background: #2d3748;
		border-color: #4a5568;
	}

	.ms-header {
		background: #2d3748;
		border-color: #4a5568;
	}

	.ms-btn-face {
		background: #2d3748;
		border-color: #4a5568;
	}

	.ms-board-scroll {
		border-color: #4a5568;
	}

	.ms-board {
		background: #1a202c;
	}

	.ms-cell {
		background: #3a475a;
		border-color: #4a5568;
		color: #f8fafc;
	}

	.ms-cell:active:not(.revealed):not(.flagged) {
		background: #2d3748;
		border-color: #1a202c;
	}

	.ms-cell.revealed {
		background: #222a36;
		border-color: #1a202c;
	}

	.ms-cell.num-1 { color: #60a5fa; }
	.ms-cell.num-2 { color: #4ade80; }
	.ms-cell.num-3 { color: #f87171; }
	.ms-cell.num-4 { color: #a78bfa; }
	.ms-cell.num-5 { color: #fb923c; }
	.ms-cell.num-6 { color: #38bdf8; }
	.ms-cell.num-7 { color: #facc15; }
	.ms-cell.num-8 { color: #cbd5e1; }

	.ms-mode-btn {
		background: #252d3a;
		border-color: #3b4658;
		color: #e2e8f0;
	}

	.ms-guide-box {
		background: #1e2430;
		border-color: #2e3848;
		color: #cbd5e1;
	}

	.ms-guide-box h4 {
		color: #58a6ff;
	}

	.ms-top-heading {
		color: #f1f5f9;
		border-bottom-color: #334155;
	}
}

/* Leaderboard Sections per Difficulty */
.ms-top-section {
	margin-bottom: 30px;
}

.ms-top-heading {
	font-size: 16px;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 10px 0;
	padding-bottom: 6px;
	border-bottom: 2px solid #e2e8f0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.ms-top-icon {
	font-size: 16px;
}

.ms-top-table {
	margin-bottom: 0;
}

.ms-no-scores {
	margin-bottom: 0;
}
