/* Minesweeper — built by Devin / Cognition.
   Windows 3.1 desktop aesthetic. */

:root {
	/* Windows 3.1 palette */
	--desktop: #008080;
	--panel: #c0c0c0;
	--panel-dark: #808080;
	--panel-darker: #404040;
	--panel-light: #ffffff;
	--panel-lighter: #dfdfdf;
	--ink: #000000;
	--titlebar-active: linear-gradient(90deg, #000080 0%, #1084d0 100%);
	--titlebar-text: #ffffff;
	--menu-highlight: #000080;

	--font-sys: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	--font-mono: 'Courier New', Consolas, monospace;
}

* {
	box-sizing: border-box;
}
html,
body {
	height: 100%;
	margin: 0;
}

body {
	font-family: var(--font-sys);
	color: var(--ink);
	background: var(--desktop);
	min-height: 100vh;
	-webkit-font-smoothing: auto;
	-webkit-user-select: none;
	user-select: none;
	overflow: hidden;
}

/* ========== DESKTOP ========== */
.desktop {
	width: 100%;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

/* ---------- Desktop icons ---------- */
.desktop-icons {
	position: absolute;
	top: 16px;
	left: 16px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}
.desktop-icon {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	cursor: default;
	text-decoration: none;
	color: #fff;
	width: 64px;
}
.desktop-icon-img {
	width: 32px;
	height: 32px;
	image-rendering: pixelated;
}
.desktop-icon-label {
	font-size: 11px;
	text-align: center;
	color: #fff;
	text-shadow: 1px 1px 0 #000;
	line-height: 1.2;
	word-break: break-word;
}

/* ========== GAME WINDOW ========== */
.game-window {
	display: flex;
	justify-content: center;
	/* Draggable: positioned absolutely by JS */
}

.frame {
	background: var(--panel);
	padding: 3px;
	display: inline-block;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light),
		inset -2px -2px 0 var(--panel-darker),
		inset 2px 2px 0 var(--panel-lighter),
		2px 2px 8px rgba(0, 0, 0, 0.35);
}

/* ---------- Title bar ---------- */
.titlebar {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 22px;
	padding: 0 4px;
	background: var(--titlebar-active);
	color: var(--titlebar-text);
	font: 700 13px/1 var(--font-sys);
	margin: -1px -1px 0 -1px;
}
.titlebar-icon {
	display: inline-flex;
}
.titlebar-text {
	flex: 1;
	padding-left: 2px;
}
.titlebar-buttons {
	display: inline-flex;
	gap: 2px;
}
.tbtn {
	width: 16px;
	height: 14px;
	display: inline-grid;
	place-items: center;
	background: var(--panel);
	color: #000;
	font: 700 10px/1 var(--font-sys);
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light);
	border: 0;
	padding: 0;
	cursor: pointer;
	line-height: 1;
}
.tbtn-min {
	padding-bottom: 4px;
}

/* ---------- Menu bar ---------- */
.menubar {
	display: flex;
	background: var(--panel);
	padding: 1px 0;
	margin: 0 -1px;
	border-bottom: 1px solid var(--panel-dark);
	position: relative;
	z-index: 10;
}
.menu-item {
	position: relative;
}
.menu-trigger {
	background: none;
	border: none;
	padding: 3px 8px;
	font: 400 12px/1 var(--font-sys);
	color: var(--ink);
	cursor: default;
}
.menu-trigger u {
	text-decoration: underline;
}
.menu-trigger:hover,
.menu-item.open .menu-trigger {
	background: var(--menu-highlight);
	color: #fff;
}

.menu-dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	background: var(--panel);
	border: 1px solid var(--ink);
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light),
		2px 2px 0 rgba(0, 0, 0, 0.25);
	min-width: 180px;
	padding: 2px 0;
	z-index: 100;
}
.menu-item.open .menu-dropdown {
	display: block;
}

.menu-option {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 3px 20px 3px 8px;
	background: none;
	border: none;
	font: 400 12px/1.3 var(--font-sys);
	color: var(--ink);
	cursor: default;
	text-decoration: none;
	white-space: nowrap;
}
.menu-option:hover {
	background: var(--menu-highlight);
	color: #fff;
}
.menu-option:hover .menu-shortcut {
	color: #fff;
}
.menu-disabled {
	color: var(--panel-dark);
	cursor: default;
}
.menu-disabled:hover {
	background: none;
	color: var(--panel-dark);
}
.menu-check {
	display: inline-block;
	width: 16px;
	text-align: center;
	font-size: 12px;
}
.menu-shortcut {
	margin-left: auto;
	color: var(--panel-dark);
	font-size: 11px;
}
.menu-sep {
	height: 1px;
	margin: 3px 2px;
	background: var(--panel-dark);
	box-shadow: 0 1px 0 var(--panel-light);
}

/* ---------- HUD ---------- */
.hud {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 4px 4px;
	padding: 6px 8px;
	background: var(--panel);
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light),
		inset 2px 2px 0 var(--panel-darker),
		inset -2px -2px 0 var(--panel-lighter);
}
.hud > .face {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}
.seg {
	background: #000;
	color: #ff0000;
	font-family: 'DSEG7 Classic', 'Share Tech Mono', ui-monospace, Consolas, monospace;
	padding: 4px 8px;
	font-size: 24px;
	letter-spacing: 3px;
	min-width: 64px;
	text-align: center;
	box-shadow:
		inset 1px 1px 0 var(--panel-darker),
		inset -1px -1px 0 var(--panel);
}
.face {
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	border: 0;
	background: var(--panel);
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light),
		inset -2px -2px 0 var(--panel-darker),
		inset 2px 2px 0 var(--panel-lighter);
}
.face:active {
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light);
}
.face-svg {
	display: block;
}

/* ---------- Board ---------- */
.board-wrap {
	margin: 0 4px 4px;
}
.board {
	display: grid;
	gap: 0;
	padding: 4px;
	background: var(--panel);
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light),
		inset 2px 2px 0 var(--panel-darker),
		inset -2px -2px 0 var(--panel-lighter);
}

.cell {
	width: 24px;
	height: 24px;
	background: var(--panel);
	border: 0;
	padding: 0;
	cursor: pointer;
	position: relative;
	display: grid;
	place-items: center;
	font:
		700 15px/1 Tahoma,
		Verdana,
		var(--font-sys);
	color: transparent;
	box-shadow:
		inset -2px -2px 0 var(--panel-dark),
		inset 2px 2px 0 var(--panel-light);
}
.cell:active:not(.revealed):not(.flagged) {
	box-shadow: inset 1px 1px 0 var(--panel-dark);
}
.cell.kbd-cursor {
	outline: 2px solid #ffd400;
	outline-offset: -2px;
	z-index: 1;
}
.cell.revealed {
	background: var(--panel);
	box-shadow: inset 1px 1px 0 var(--panel-dark);
	color: #000;
	cursor: default;
}
.cell.revealed.empty {
	color: transparent;
}

.cell .num,
.cell .flag,
.cell .qmark,
.cell .bug {
	pointer-events: none;
}

/* Classic adjacency colors */
.cell.n1 .num {
	color: #0000ff;
}
.cell.n2 .num {
	color: #008000;
}
.cell.n3 .num {
	color: #ff0000;
}
.cell.n4 .num {
	color: #000080;
}
.cell.n5 .num {
	color: #800000;
}
.cell.n6 .num {
	color: #008080;
}
.cell.n7 .num {
	color: #000000;
}
.cell.n8 .num {
	color: #808080;
}

.cell .flag,
.cell .bug {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
}
.cell.question .qmark {
	font:
		800 16px/1 Verdana,
		var(--font-sys);
	color: #000;
}
.cell.question .qmark::before {
	content: '?';
}

.cell.bug-hit {
	background: #ff0000 !important;
	box-shadow: inset 1px 1px 0 #800000;
}
.cell.bug-wrong {
}
.cell.bug-wrong::after {
	content: '';
	position: absolute;
	inset: 4px;
	background: linear-gradient(45deg, transparent 45%, #ff0000 45%, #ff0000 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #ff0000 45%, #ff0000 55%, transparent 55%);
}

/* ---------- Win accent ---------- */
.frame.win .seg {
	color: #22ff5a;
}

/* ========== TASKBAR ========== */
.taskbar {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 32px;
	background: var(--panel);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 8px;
	box-shadow:
		inset 0 1px 0 var(--panel-light),
		inset 0 2px 0 var(--panel-lighter);
	border-top: 1px solid var(--panel-dark);
	font-size: 12px;
	z-index: 5;
}
.taskbar-left {
	display: flex;
	align-items: center;
	gap: 8px;
}
.taskbar-built {
	color: var(--ink);
	padding: 2px 8px;
}
.taskbar-link {
	color: var(--ink);
	text-decoration: none;
	font-weight: 700;
}
.taskbar-link:hover {
	text-decoration: underline;
}
.taskbar-cta {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: var(--panel);
	color: var(--ink);
	text-decoration: none;
	font: 500 11px/1 var(--font-sys);
	padding: 3px 10px;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light);
}
.taskbar-cta:hover {
	background: var(--panel-lighter);
}
.taskbar-cta:active {
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light);
}

/* ========== HELP DIALOG ========== */
dialog {
	background: var(--panel);
	color: #000;
	border: 0;
	padding: 0;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light),
		inset -2px -2px 0 var(--panel-darker),
		inset 2px 2px 0 var(--panel-lighter),
		4px 4px 0 rgba(0, 0, 0, 0.5);
	max-width: 480px;
}
dialog::backdrop {
	background: rgba(0, 0, 0, 0.4);
}
dialog article {
	padding: 18px 20px;
	font: 400 13px/1.5 var(--font-sys);
}
dialog h2 {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
}
dialog ul {
	padding-left: 18px;
}
dialog .ok {
	margin-top: 12px;
	background: var(--panel);
	color: #000;
	border: 0;
	padding: 4px 24px;
	cursor: pointer;
	font: 400 12px/1 var(--font-sys);
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light);
}
dialog .ok:active {
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light);
}

/* ========== WIN OVERLAY ========== */
.win-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0, 128, 128, 0.85);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	overflow-y: auto;
}
.win-overlay[hidden] {
	display: none;
}
.win-overlay-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	max-width: 900px;
	width: 100%;
}
.win-card {
	position: relative;
	background: var(--panel);
	padding: 0;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light),
		inset -2px -2px 0 var(--panel-darker),
		inset 2px 2px 0 var(--panel-lighter),
		4px 4px 0 rgba(0, 0, 0, 0.5);
	width: 100%;
	max-height: calc(100vh - 48px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.win-close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 16px;
	height: 14px;
	border: 0;
	background: var(--panel);
	color: #000;
	font: 700 10px/1 var(--font-sys);
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light);
	z-index: 2;
}
.win-close:active {
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light);
}

.win-card-body {
	display: grid;
	grid-template-columns: 51fr 49fr;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	border: 2px solid var(--panel-dark);
	margin: 20px 16px 0;
}

.win-left {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 36px 32px;
	gap: 0;
	background: #fff;
}

.win-headline {
	margin: 0 0 16px;
	font-family: 'Inter Tight', var(--font-sys);
	font-size: 34px;
	font-weight: 800;
	line-height: 1.15;
	color: #000;
	letter-spacing: -0.5px;
}
.win-time-inline {
	color: #000;
	font-weight: 800;
}

.win-tagline {
	margin: auto 0 0;
	font-family: 'Inter Tight', var(--font-sys);
	font-size: 28px;
	font-weight: 400;
	line-height: 1.2;
	color: #000080;
	padding-top: 20px;
}

.win-made-by {
	margin: 0;
	padding-top: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #808080;
}
.cognition-logo {
	height: 34px;
	width: auto;
}

.win-right {
	position: relative;
	overflow: hidden;
	min-height: 0;
	background: var(--panel);
}
.win-board-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Share actions */
.win-actions {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 20px;
	flex-shrink: 0;
	background: var(--panel);
}

.tweet-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #000;
	color: #fff;
	text-decoration: none;
	font: 600 13px/1 var(--font-sys);
	padding: 10px 20px;
	box-shadow:
		inset -1px -1px 0 #333,
		inset 1px 1px 0 #666;
	transition: background 0.12s;
	white-space: nowrap;
	flex-shrink: 0;
}
.tweet-btn:hover {
	background: #222;
}
.tweet-btn:active {
	box-shadow:
		inset 1px 1px 0 #000,
		inset -1px -1px 0 #666;
}

.win-promo {
	margin: 0;
	font-size: 12px;
	color: var(--panel-darker);
	line-height: 1.4;
}
.win-promo strong {
	color: var(--ink);
	font-weight: 700;
}

/* Hidden original sidebar (game.js still references .diff-btn elements) */
.sidebar {
	display: none;
}

/* ========== BOOT SCREEN ========== */
#bootScreen {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: #000;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	padding: 40px;
	font-family: 'Courier New', Consolas, monospace;
	font-size: 14px;
	color: #aaa;
	line-height: 1.6;
	overflow: hidden;
}
#bootScreen.hidden {
	opacity: 0;
	transition: opacity 0.6s ease;
	pointer-events: none;
}
#bootScreen.gone {
	display: none;
}
.boot-line {
	opacity: 0;
	white-space: pre;
}
.boot-line.visible {
	opacity: 1;
}
.boot-cursor::after {
	content: '█';
	animation: blink-cursor 0.6s step-end infinite;
}
@keyframes blink-cursor {
	50% {
		opacity: 0;
	}
}

/* Windows 3.1 splash */
#winSplash {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: #000080;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 20px;
}
#winSplash.active {
	display: flex;
}
#winSplash.hidden {
	opacity: 0;
	transition: opacity 0.5s ease;
	pointer-events: none;
}
#winSplash.gone {
	display: none;
}
.splash-logo {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}
.splash-windows {
	font-family: 'Segoe UI', Tahoma, sans-serif;
	font-size: 48px;
	font-weight: 700;
	color: #fff;
	letter-spacing: 4px;
	text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}
.splash-version {
	font-family: 'Segoe UI', Tahoma, sans-serif;
	font-size: 14px;
	color: #c0c0c0;
	letter-spacing: 2px;
}
.splash-flag {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 3px;
	width: 64px;
	height: 64px;
	transform: perspective(200px) rotateY(-8deg) skewY(-2deg);
}
.splash-flag div {
	border-radius: 1px;
}
.splash-flag .f-red {
	background: #ff0000;
}
.splash-flag .f-green {
	background: #00aa00;
}
.splash-flag .f-blue {
	background: #0000ff;
}
.splash-flag .f-yellow {
	background: #ffff00;
}
.splash-loading {
	color: #c0c0c0;
	font-family: 'Segoe UI', Tahoma, sans-serif;
	font-size: 12px;
	letter-spacing: 1px;
	margin-top: 20px;
}

/* ========== README WINDOW ========== */
.readme-window {
	position: absolute;
	top: 60px;
	left: 120px;
	width: 640px;
	height: 480px;
	z-index: 50;
	display: none;
	flex-direction: column;
}
.readme-window.open {
	display: flex;
}
.readme-window .frame {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}
.readme-window .titlebar {
	cursor: default;
	flex-shrink: 0;
}
.readme-window .readme-body {
	flex: 1;
	min-height: 0;
	background: #fff;
	margin: 0 2px 2px;
	border: 1px inset;
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light);
}
.readme-window .readme-content {
	padding: 12px 16px;
	font-family: 'Courier New', monospace;
	font-size: 13px;
	line-height: 1.5;
	color: #000;
	white-space: pre-wrap;
	overflow-y: auto;
	height: 100%;
}

/* ========== DRAGGABLE ========== */
.draggable {
	position: absolute;
}
.draggable .titlebar {
	cursor: grab;
}
.draggable .titlebar:active {
	cursor: grabbing;
}

/* Inactive window title bar */
.draggable .titlebar.inactive {
	background: linear-gradient(90deg, #808080 0%, #c0c0c0 100%);
}

/* ========== TASKBAR WINDOW BUTTONS ========== */
.taskbar-windows {
	display: flex;
	gap: 2px;
	flex: 1;
	min-width: 0;
	padding: 0 4px;
}
.taskbar-win-btn {
	background: var(--panel);
	border: 0;
	padding: 2px 8px;
	font: 400 11px/1 var(--font-sys);
	color: var(--ink);
	cursor: pointer;
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	box-shadow:
		inset -1px -1px 0 var(--panel-dark),
		inset 1px 1px 0 var(--panel-light);
}
.taskbar-win-btn.active {
	box-shadow:
		inset 1px 1px 0 var(--panel-dark),
		inset -1px -1px 0 var(--panel-light);
	font-weight: 700;
}

/* ========== MOBILE ========== */
@media (max-width: 820px) {
	body {
		overflow: auto;
	}
	.desktop {
		height: auto;
		min-height: 100vh;
		flex-direction: column;
		padding: 12px 8px 44px;
		gap: 16px;
	}
	#bootScreen {
		padding: 20px;
		font-size: 12px;
	}
	.splash-windows {
		font-size: 32px;
	}
	.splash-flag {
		width: 48px;
		height: 48px;
	}
	.desktop-icons {
		display: none;
	}
	.game-window {
		position: static !important;
		width: 100%;
		overflow-x: auto;
		transform: none !important;
	}
	.frame {
		margin: 0 auto;
	}
	.readme-window {
		position: static !important;
		width: 100% !important;
		height: 400px !important;
		transform: none !important;
		margin-bottom: 44px;
	}
	.taskbar {
		position: fixed;
	}

	.win-overlay {
		padding: 16px;
	}
	.win-overlay-inner {
		max-width: 100%;
	}
	.win-card-body {
		margin: 12px 12px 0;
	}
	.win-left {
		padding: 24px 20px;
	}
	.win-headline {
		font-size: 22px;
		margin-bottom: 12px;
	}
	.win-tagline {
		font-size: 18px;
		padding-top: 14px;
	}
	.win-made-by {
		font-size: 11px;
	}
	.cognition-logo {
		height: 26px;
	}
	.win-actions {
		padding: 12px 14px;
		gap: 12px;
	}
	.tweet-btn {
		font-size: 12px;
		padding: 8px 16px;
	}
	.win-promo {
		font-size: 10px;
	}
}

@media (max-width: 420px) {
	.win-overlay {
		padding: 8px;
	}
	.win-card-body {
		margin: 8px 8px 0;
	}
	.win-left {
		padding: 16px 14px;
	}
	.win-headline {
		font-size: 17px;
		margin-bottom: 8px;
	}
	.win-tagline {
		font-size: 15px;
		padding-top: 10px;
	}
	.win-made-by {
		font-size: 10px;
		padding-top: 6px;
	}
	.cognition-logo {
		height: 20px;
	}
	.win-actions {
		padding: 10px 10px;
		gap: 8px;
	}
	.tweet-btn {
		font-size: 11px;
		padding: 7px 12px;
	}
	.win-promo {
		font-size: 9px;
	}
}
