/*
Theme Name: Retro Desktop
Theme URI: https://justinknapp.com
Author: Justin Knapp
Description: Full-screen retro synthwave desktop experience for justinknapp.com. Clickable icons open draggable windows.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: retro-desktop
*/

/* ---------- Design tokens ---------- */
:root {
	--color-bg: #0d0d1a;
	--color-bg-alt: #15152b;
	--color-purple: #723dae;
	--color-purple-dim: #4a2874;
	--color-cyan: #31f8cc;
	--color-text: #e8e6f3;
	--color-text-dim: #9c98b8;
	--color-danger: #ff5f7e;
	--font-chrome: "VT323", "Courier New", monospace;
	--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
		Arial, sans-serif;
	--window-radius: 6px;
	--menu-bar-height: 40px;
}

@font-face {
	font-family: "VT323";
	src: url("assets/fonts/VT323-Regular.ttf") format("truetype");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
	padding: 0;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	overflow: hidden;
}

body.retro-desktop {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100vh;
	background: radial-gradient(
			ellipse at 50% 0%,
			rgba(114, 61, 174, 0.25),
			transparent 60%
		),
		var(--color-bg);
}

a {
	color: var(--color-cyan);
}

button {
	font-family: inherit;
}

/* ---------- CRT scanline overlay ---------- */
.crt-overlay {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 9999;
	background: repeating-linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0.035) 0px,
		rgba(255, 255, 255, 0.035) 1px,
		transparent 1px,
		transparent 3px
	);
	mix-blend-mode: overlay;
	opacity: 0.5;
}

/* ---------- Boot sequence ---------- */
.boot-screen {
	position: fixed;
	inset: 0;
	z-index: 9998;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--color-bg);
	font-family: var(--font-chrome);
	transition: opacity 0.5s ease;
}

.boot-screen.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.boot-screen[hidden] {
	display: none;
}

.boot-poweron {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 28px;
	background: #000;
	transition: opacity 0.5s ease;
}

.boot-poweron.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.boot-poweron[hidden] {
	display: none;
}

.boot-power-btn {
	width: 96px;
	height: 96px;
	padding: 0;
	border: 2px solid var(--color-cyan);
	border-radius: 50%;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 0 16px rgba(49, 248, 204, 0.5),
		inset 0 0 12px rgba(49, 248, 204, 0.15);
	animation: boot-power-pulse 2.2s ease-in-out infinite;
}

.boot-power-btn:hover,
.boot-power-btn:focus-visible {
	box-shadow: 0 0 28px rgba(49, 248, 204, 0.8),
		inset 0 0 16px rgba(49, 248, 204, 0.25);
	outline: none;
}

.boot-power-icon {
	width: 44px;
	height: 44px;
	fill: none;
	stroke: var(--color-cyan);
	stroke-width: 2;
	stroke-linecap: round;
}

@keyframes boot-power-pulse {
	0%,
	100% {
		box-shadow: 0 0 16px rgba(49, 248, 204, 0.5),
			inset 0 0 12px rgba(49, 248, 204, 0.15);
	}
	50% {
		box-shadow: 0 0 30px rgba(49, 248, 204, 0.85),
			inset 0 0 18px rgba(49, 248, 204, 0.3);
	}
}

.boot-power-label {
	font-family: var(--font-chrome);
	font-size: 1.3rem;
	letter-spacing: 1px;
	color: var(--color-cyan);
	text-shadow: 0 0 8px rgba(49, 248, 204, 0.6);
}

@media (prefers-reduced-motion: reduce) {
	.boot-power-btn {
		animation: none;
	}
}

.boot-lines {
	position: absolute;
	top: 6vh;
	left: 6vw;
	right: 6vw;
	color: var(--color-cyan);
	font-size: 1.1rem;
	line-height: 1.6;
	white-space: pre-wrap;
	text-shadow: 0 0 4px rgba(49, 248, 204, 0.4);
	transition: opacity 0.4s ease;
}

.boot-lines.is-hidden {
	opacity: 0;
}

.boot-line {
	opacity: 0;
	animation: boot-line-in 0.15s ease forwards;
}

@keyframes boot-line-in {
	to {
		opacity: 1;
	}
}

.boot-line-bar {
	display: inline-block;
	width: 90px;
	height: 8px;
	margin-left: 6px;
	vertical-align: middle;
	border: 1px solid var(--color-purple);
	border-radius: 2px;
	overflow: hidden;
	background: var(--color-bg-alt);
}

.boot-line-bar-fill {
	display: block;
	height: 100%;
	width: 0%;
	background: linear-gradient(to right, var(--color-purple), var(--color-cyan));
	transition: width 0.28s linear;
}

.boot-logo {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 24px;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.boot-logo.is-visible {
	opacity: 1;
	transform: translateY(0);
}

.boot-logo-img {
	width: min(420px, 70vw);
	height: auto;
	/* No CSS drop-shadow here -- the artwork already has its own glow
	   baked in, and a fixed-px filter blur gets proportionally huge (and
	   boxy-looking) once the image shrinks down on mobile. */
}

.boot-progress {
	width: min(320px, 60vw);
	height: 6px;
	border: 1px solid var(--color-purple);
	border-radius: 3px;
	overflow: hidden;
	background: var(--color-bg-alt);
}

.boot-progress-bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(to right, var(--color-purple), var(--color-cyan));
	transition: width 1.2s ease;
}

.boot-skip-hint {
	position: absolute;
	bottom: 6vh;
	left: 0;
	right: 0;
	text-align: center;
	color: var(--color-text-dim);
	font-size: 0.9rem;
	letter-spacing: 0.5px;
	opacity: 0.7;
}

@media (max-width: 768px) {
	.boot-lines {
		font-size: 0.9rem;
		top: 5vh;
		left: 5vw;
		right: 5vw;
	}
}

/* ---------- Menu bar ---------- */
.menu-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--menu-bar-height);
	flex: 0 0 auto;
	padding: 0 16px;
	background: rgba(13, 13, 26, 0.85);
	border-bottom: 1px solid var(--color-purple-dim);
	font-family: var(--font-chrome);
	font-size: 1.3rem;
	letter-spacing: 0.5px;
	backdrop-filter: blur(4px);
	position: relative;
	/* Higher than any window (windows start at z-index 11 and only ever
	   increment from there on focus) so the dropdown menu below is never
	   covered by an open window. */
	z-index: 500;
}

.menu-bar-left {
	position: relative;
	display: flex;
	align-items: center;
	color: var(--color-cyan);
	text-shadow: 0 0 6px rgba(49, 248, 204, 0.6);
}

.menu-bar-right {
	color: var(--color-text-dim);
}

.menu-logo-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	height: calc(var(--menu-bar-height) - 14px);
	padding: 0 8px;
	background: transparent;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.menu-logo-btn:hover,
.menu-logo-btn[aria-expanded="true"] {
	background: rgba(114, 61, 174, 0.35);
}

.menu-logo-img {
	height: 100%;
	width: auto;
	display: block;
	filter: drop-shadow(0 0 4px rgba(49, 248, 204, 0.5));
}

.menu-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 6px;
	min-width: 200px;
	padding: 6px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-purple);
	border-radius: 6px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(114, 61, 174, 0.25);
}

.menu-dropdown[hidden] {
	display: none;
}

.menu-dropdown-item {
	display: block;
	width: 100%;
	box-sizing: border-box;
	text-align: left;
	padding: 8px 12px;
	background: transparent;
	border: none;
	border-radius: 4px;
	font-family: var(--font-chrome);
	font-size: 1.05rem;
	letter-spacing: 0.3px;
	color: var(--color-text);
	text-decoration: none;
	cursor: pointer;
}

.menu-dropdown-item:hover,
.menu-dropdown-item:focus-visible {
	background: rgba(114, 61, 174, 0.35);
	color: var(--color-cyan);
	outline: none;
}

.menu-dropdown-heading {
	padding: 8px 12px 4px;
	font-family: var(--font-chrome);
	font-size: 0.8rem;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--color-text-dim);
}

.menu-dropdown-separator {
	height: 1px;
	margin: 6px 4px;
	background: var(--color-purple-dim);
}

/* ---------- Desktop / icon grid ---------- */
.desktop {
	flex: 1 1 auto;
	position: relative;
	overflow: hidden;
}

.icon-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, 96px);
	gap: 24px;
	padding: 32px;
	align-content: start;
}

.desktop-icon {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 96px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	border-radius: var(--window-radius);
	text-decoration: none;
	color: var(--color-text);
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
	background: rgba(114, 61, 174, 0.2);
	outline: 1px solid var(--color-purple);
}

.icon-glyph {
	width: 48px;
	height: 48px;
	display: block;
	position: relative;
	background: linear-gradient(
		145deg,
		var(--color-purple),
		var(--color-purple-dim)
	);
	border-radius: 10px;
	box-shadow: 0 0 12px rgba(114, 61, 174, 0.6);
}

.icon-glyph::before,
.icon-glyph::after {
	content: "";
	position: absolute;
	background: var(--color-cyan);
}

/* About: abstract head + shoulders */
.icon-about {
	border-radius: 50%;
}
.icon-about::before {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	top: 10px;
	left: 15px;
}
.icon-about::after {
	width: 30px;
	height: 14px;
	border-radius: 10px 10px 0 0;
	bottom: 6px;
	left: 9px;
}

/* Business: briefcase */
.icon-business::before {
	width: 34px;
	height: 22px;
	border-radius: 3px;
	bottom: 10px;
	left: 7px;
	background: var(--color-cyan);
}
.icon-business::after {
	width: 14px;
	height: 8px;
	border: 3px solid var(--color-cyan);
	background: transparent;
	border-bottom: none;
	border-radius: 4px 4px 0 0;
	top: 10px;
	left: 17px;
}

/* Resume: document with lines */
.icon-resume {
	border-radius: 4px;
}
.icon-resume::before {
	width: 26px;
	height: 34px;
	top: 7px;
	left: 11px;
	background: var(--color-cyan);
	clip-path: polygon(
		0 0,
		70% 0,
		100% 30%,
		100% 100%,
		0 100%
	);
}
.icon-resume::after {
	width: 14px;
	height: 3px;
	top: 20px;
	left: 17px;
	background: var(--color-purple-dim);
	box-shadow: 0 6px 0 var(--color-purple-dim), 0 12px 0 var(--color-purple-dim);
}

/* Contact: envelope */
.icon-contact::before {
	width: 34px;
	height: 24px;
	border-radius: 3px;
	top: 12px;
	left: 7px;
	background: var(--color-cyan);
}
.icon-contact::after {
	width: 0;
	height: 0;
	top: 12px;
	left: 7px;
	background: transparent;
	border-left: 17px solid transparent;
	border-right: 17px solid transparent;
	border-top: 12px solid var(--color-bg-alt);
}

/* Blog: chat bubble with external-link tick */
.icon-blog::before {
	width: 32px;
	height: 24px;
	border-radius: 6px;
	top: 9px;
	left: 8px;
	background: var(--color-cyan);
}
.icon-blog::after {
	width: 0;
	height: 0;
	bottom: 8px;
	left: 14px;
	background: transparent;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 8px solid var(--color-cyan);
}

/* Minesweeper: mine glyph */
.icon-minesweeper::before {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	top: 16px;
	left: 12px;
	background: var(--color-bg-alt);
	box-shadow:
		0 0 0 3px var(--color-cyan) inset,
		0 -10px 0 -8px var(--color-cyan),
		0 10px 0 -8px var(--color-cyan),
		-10px 0 0 -8px var(--color-cyan),
		10px 0 0 -8px var(--color-cyan);
}
.icon-minesweeper::after {
	width: 3px;
	height: 11px;
	top: 4px;
	left: 26px;
	background: var(--color-cyan);
	border-radius: 2px;
	transform: rotate(25deg);
	box-shadow: 5px -5px 0 -3px var(--color-cyan);
}

/* Solitaire: stacked cards */
.icon-solitaire::before {
	width: 24px;
	height: 32px;
	top: 11px;
	left: 8px;
	background: var(--color-bg-alt);
	border: 2px solid var(--color-cyan);
	border-radius: 3px;
}
.icon-solitaire::after {
	width: 24px;
	height: 32px;
	top: 6px;
	left: 16px;
	background: var(--color-cyan);
	border-radius: 3px;
}

/* FreeCell: 4 free cells + a card */
.icon-freecell::before {
	width: 30px;
	height: 20px;
	top: 22px;
	left: 9px;
	background: var(--color-cyan);
	border-radius: 3px;
}
.icon-freecell::after {
	width: 6px;
	height: 6px;
	top: 10px;
	left: 9px;
	background: var(--color-cyan);
	border-radius: 1px;
	box-shadow:
		9px 0 0 var(--color-cyan),
		18px 0 0 var(--color-cyan),
		27px 0 0 var(--color-cyan);
}

/* Hearts: heart glyph (two circles + a diamond) */
.icon-hearts::before {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	top: 11px;
	left: 8px;
	box-shadow: 12px 0 0 var(--color-cyan);
}
.icon-hearts::after {
	width: 16px;
	height: 16px;
	top: 16px;
	left: 12px;
	transform: rotate(45deg);
}

/* Pinball: ball + flipper */
.icon-pinball::before {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	top: 10px;
	left: 17px;
}
.icon-pinball::after {
	width: 26px;
	height: 6px;
	bottom: 10px;
	left: 6px;
	border-radius: 3px;
	transform: rotate(-20deg);
}

.icon-label {
	font-family: var(--font-chrome);
	font-size: 1.35rem;
	text-align: center;
	line-height: 1.1;
	text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

/* ---------- Windows ---------- */
.window-layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.retro-window {
	position: absolute;
	top: 80px;
	left: 140px;
	width: min(560px, 90vw);
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-purple);
	border-radius: var(--window-radius);
	box-shadow: 0 0 0 1px rgba(114, 61, 174, 0.3), 0 12px 40px rgba(0, 0, 0, 0.6);
	pointer-events: auto;
	overflow: hidden;
}

.retro-window.is-focused {
	border-color: var(--color-cyan);
	box-shadow: 0 0 0 1px rgba(49, 248, 204, 0.5),
		0 0 24px rgba(49, 248, 204, 0.35), 0 12px 40px rgba(0, 0, 0, 0.6);
}

.window-titlebar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 10px;
	background: linear-gradient(
		to bottom,
		var(--color-purple-dim),
		rgba(74, 40, 116, 0.4)
	);
	border-bottom: 1px solid var(--color-purple-dim);
	cursor: move;
	user-select: none;
	touch-action: none;
	flex: 0 0 auto;
}

.retro-window.is-focused .window-titlebar {
	background: linear-gradient(to bottom, var(--color-purple), var(--color-purple-dim));
}

.window-title {
	font-family: var(--font-chrome);
	font-size: 1.25rem;
	letter-spacing: 0.5px;
	color: var(--color-text);
}

.window-close {
	width: 22px;
	height: 22px;
	line-height: 1;
	border: 1px solid var(--color-cyan);
	background: transparent;
	color: var(--color-cyan);
	border-radius: 4px;
	cursor: pointer;
	font-size: 1rem;
}

.window-close:hover {
	background: var(--color-danger);
	border-color: var(--color-danger);
	color: var(--color-bg);
}

.window-body {
	padding: 20px 24px;
	overflow-y: auto;
	font-family: var(--font-body);
	line-height: 1.6;
	color: var(--color-text);
}

.window-body h1,
.window-body h2,
.window-body h3 {
	font-family: var(--font-chrome);
	color: var(--color-cyan);
	letter-spacing: 0.5px;
}

.window-body :first-child {
	margin-top: 0;
}

.placeholder-notice {
	display: inline-block;
	margin-bottom: 12px;
	padding: 4px 8px;
	font-family: var(--font-chrome);
	font-size: 1rem;
	color: var(--color-bg);
	background: var(--color-cyan);
	border-radius: 3px;
}

/* ---------- Resume ---------- */
.resume-download {
	display: inline-block;
	margin-bottom: 16px;
	padding: 8px 16px;
	font-family: var(--font-chrome);
	font-size: 1.15rem;
	color: var(--color-bg);
	background: var(--color-cyan);
	border-radius: 4px;
	text-decoration: none;
}

.resume-download:hover {
	background: var(--color-text);
}

/* ---------- Contact form ---------- */
.contact-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 16px;
}

.contact-form label {
	font-family: var(--font-chrome);
	font-size: 1.1rem;
	color: var(--color-text-dim);
}

.contact-form input,
.contact-form textarea {
	width: 100%;
	padding: 8px 10px;
	background: var(--color-bg);
	border: 1px solid var(--color-purple-dim);
	border-radius: 4px;
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: 0.95rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
	outline: none;
	border-color: var(--color-cyan);
}

.contact-form textarea {
	resize: vertical;
	min-height: 100px;
}

.contact-form-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.contact-submit {
	align-self: flex-start;
	padding: 8px 20px;
	font-family: var(--font-chrome);
	font-size: 1.15rem;
	color: var(--color-bg);
	background: var(--color-cyan);
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.contact-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.contact-status {
	font-size: 0.9rem;
	min-height: 1.2em;
}

.contact-status.is-success {
	color: var(--color-cyan);
}

.contact-status.is-error {
	color: var(--color-danger);
}

/* ---------- 404 ---------- */
.not-found {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	text-align: center;
	font-family: var(--font-chrome);
	gap: 12px;
}

.not-found h1 {
	font-size: 3rem;
	color: var(--color-cyan);
	margin: 0;
	text-shadow: 0 0 12px rgba(49, 248, 204, 0.6);
}

/* ---------- Minesweeper ---------- */
@media (min-width: 769px) {
	.window-id-minesweeper {
		width: min(640px, 94vw);
		max-height: 94vh;
	}
}

.ms-app {
	font-family: var(--font-chrome);
}

.ms-toolbar {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-bottom: 12px;
}

.ms-diff-btn {
	font-family: var(--font-chrome);
	font-size: 1rem;
	letter-spacing: 0.5px;
	padding: 6px 12px;
	background: transparent;
	border: 1px solid var(--color-purple-dim);
	border-radius: 4px;
	color: var(--color-text-dim);
	cursor: pointer;
}

.ms-diff-btn:hover {
	color: var(--color-text);
}

.ms-diff-btn.is-active {
	border-color: var(--color-cyan);
	color: var(--color-cyan);
	box-shadow: 0 0 8px rgba(49, 248, 204, 0.4);
}

.ms-status-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
	padding: 8px 10px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-purple-dim);
	border-radius: 4px;
}

.ms-counter {
	min-width: 3ch;
	padding: 4px 8px;
	background: #000;
	border-radius: 3px;
	font-family: var(--font-chrome);
	font-size: 1.4rem;
	letter-spacing: 2px;
	color: var(--color-danger);
	text-shadow: 0 0 6px rgba(255, 95, 126, 0.7);
	text-align: center;
}

.ms-face {
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--color-purple);
	background: var(--color-bg);
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ms-face:hover {
	filter: brightness(1.2);
}

.ms-board-wrap {
	display: flex;
	justify-content: center;
	overflow-x: auto;
	padding-bottom: 4px;
}

.ms-board {
	display: grid;
	gap: 2px;
	grid-template-columns: repeat(var(--ms-cols), var(--ms-cell-size));
}

.ms-board--beginner {
	--ms-cell-size: 30px;
}

.ms-board--intermediate {
	--ms-cell-size: 24px;
}

.ms-board--expert {
	--ms-cell-size: 16px;
}

.ms-cell {
	box-sizing: border-box;
	width: var(--ms-cell-size);
	height: var(--ms-cell-size);
	padding: 0;
	border: none;
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-chrome);
	font-size: calc(var(--ms-cell-size) * 0.55);
	line-height: 1;
	color: var(--color-text);
	background: linear-gradient(145deg, var(--color-purple), var(--color-purple-dim));
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 0 rgba(0, 0, 0, 0.25);
	cursor: pointer;
	touch-action: manipulation;
	user-select: none;
}

.ms-cell:hover:not(.is-revealed) {
	filter: brightness(1.15);
}

.ms-cell.is-revealed {
	background: var(--color-bg-alt);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
	cursor: default;
}

.ms-cell.is-exploded {
	background: var(--color-danger);
}

.ms-best-time {
	margin: 10px 0 0;
	text-align: center;
	font-size: 0.85rem;
	color: var(--color-text-dim);
}

.ms-hint {
	margin: 10px 0 0;
	text-align: center;
	font-family: var(--font-body);
	font-size: 0.8rem;
	color: var(--color-text-dim);
}

@media (max-width: 768px) {
	.ms-board--beginner {
		--ms-cell-size: 28px;
	}

	.ms-board--intermediate {
		--ms-cell-size: 20px;
	}

	.ms-board--expert {
		--ms-cell-size: 14px;
	}

	.ms-hint {
		display: none;
	}
}

/* ---------- Playing cards (shared: Solitaire / FreeCell / Hearts) ---------- */
.pc-card {
	position: relative;
	box-sizing: border-box;
	width: var(--pc-card-w, 60px);
	height: var(--pc-card-h, 84px);
	border-radius: 6px;
	background: #eceaf5;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.4);
	font-family: var(--font-chrome);
	user-select: none;
	flex: 0 0 auto;
}

.pc-card.is-red {
	color: var(--color-danger);
}

.pc-card.is-black {
	color: #14141f;
}

.pc-card.is-facedown {
	background: repeating-linear-gradient(
		45deg,
		var(--color-purple),
		var(--color-purple) 5px,
		var(--color-purple-dim) 5px,
		var(--color-purple-dim) 10px
	);
	box-shadow: 0 0 0 1px var(--color-cyan) inset, 0 2px 4px rgba(0, 0, 0, 0.4);
}

.pc-card-corner {
	position: absolute;
	font-size: calc(var(--pc-card-w, 60px) * 0.22);
	line-height: 1;
	font-weight: bold;
}

.pc-card-corner-tl {
	top: 4px;
	left: 5px;
}

.pc-card-corner-br {
	bottom: 4px;
	right: 5px;
	transform: rotate(180deg);
}

.pc-card-center {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc(var(--pc-card-w, 60px) * 0.4);
}

.pc-card.is-selected {
	outline: 3px solid var(--color-cyan);
	outline-offset: -1px;
	box-shadow: 0 0 12px rgba(49, 248, 204, 0.7), 0 2px 4px rgba(0, 0, 0, 0.4);
	transform: translateY(-8px);
}

.pc-tableau-card {
	position: absolute;
	left: 0;
	cursor: pointer;
}

.pc-slot {
	box-sizing: border-box;
	width: var(--pc-card-w, 60px);
	height: var(--pc-card-h, 84px);
	border-radius: 6px;
	border: 2px dashed rgba(156, 152, 184, 0.4);
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc(var(--pc-card-w, 60px) * 0.42);
	cursor: pointer;
}

.pc-foundation-slot.is-red-slot {
	color: rgba(255, 95, 126, 0.4);
}

.pc-foundation-slot.is-black-slot {
	color: rgba(156, 152, 184, 0.4);
}

.pc-pile {
	position: relative;
	cursor: pointer;
}

.pc-app {
	--pc-card-w: 60px;
	--pc-card-h: 84px;
	font-family: var(--font-body);
}

.pc-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.pc-new-btn {
	font-family: var(--font-chrome);
	font-size: 1rem;
	letter-spacing: 0.5px;
	padding: 6px 14px;
	background: transparent;
	border: 1px solid var(--color-cyan);
	border-radius: 4px;
	color: var(--color-cyan);
	cursor: pointer;
}

.pc-new-btn:hover {
	box-shadow: 0 0 8px rgba(49, 248, 204, 0.4);
}

.pc-status {
	display: flex;
	gap: 16px;
	font-family: var(--font-chrome);
	font-size: 1.1rem;
	color: var(--color-text-dim);
}

.pc-win-message {
	margin: 14px 0 0;
	text-align: center;
	font-family: var(--font-chrome);
	font-size: 1.4rem;
	color: var(--color-cyan);
	text-shadow: 0 0 10px rgba(49, 248, 204, 0.6);
}

.pc-hint {
	margin: 12px 0 0;
	text-align: center;
	font-family: var(--font-body);
	font-size: 0.8rem;
	color: var(--color-text-dim);
}

/* ---------- Solitaire ---------- */
@media (min-width: 769px) {
	.window-id-solitaire {
		width: min(680px, 96vw);
		max-height: 94vh;
	}
}

.pc-top-row {
	display: flex;
	justify-content: space-between;
	margin-bottom: 20px;
}

.sol-stock-waste {
	display: flex;
	gap: 10px;
}

.pc-foundations-row {
	display: flex;
	gap: 10px;
}

.pc-tableau-row {
	display: flex;
	gap: 10px;
	justify-content: space-between;
}

.pc-column {
	position: relative;
	flex: 1 1 0;
	min-height: var(--pc-card-h);
}

@media (max-width: 768px) {
	.pc-app {
		--pc-card-w: 42px;
		--pc-card-h: 60px;
	}

	.pc-tableau-row,
	.pc-top-row {
		gap: 4px;
	}

	.pc-hint {
		display: none;
	}
}

/* ---------- FreeCell ---------- */
@media (min-width: 769px) {
	.window-id-freecell {
		width: min(720px, 96vw);
		max-height: 94vh;
	}
}

.fc-freecells {
	display: flex;
	gap: 10px;
}

.fc-tableau-row {
	margin-top: 4px;
}

/* ---------- Hearts ---------- */
@media (min-width: 769px) {
	.window-id-hearts {
		width: min(640px, 96vw);
		max-height: 94vh;
	}
}

.hearts-opponents {
	display: flex;
	justify-content: space-around;
	margin-bottom: 16px;
}

.hearts-opponent {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.hearts-opp-card {
	width: calc(var(--pc-card-w) * 0.7);
	height: calc(var(--pc-card-h) * 0.7);
}

.hearts-opp-label {
	font-family: var(--font-chrome);
	font-size: 0.95rem;
	color: var(--color-text-dim);
}

.hearts-trick {
	display: flex;
	justify-content: center;
	align-items: flex-end;
	gap: 14px;
	min-height: calc(var(--pc-card-h) + 24px);
	margin-bottom: 12px;
}

.hearts-trick-entry {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.hearts-trick-label {
	font-family: var(--font-chrome);
	font-size: 0.85rem;
	color: var(--color-cyan);
}

.hearts-message {
	text-align: center;
	font-family: var(--font-chrome);
	font-size: 1.1rem;
	color: var(--color-text);
	min-height: 1.4em;
	margin: 0 0 10px;
}

.hearts-pass-controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
}

.hearts-pass-controls p {
	margin: 0;
	font-family: var(--font-chrome);
	color: var(--color-text-dim);
}

.hearts-next-btn {
	display: block;
	margin: 0 auto 14px;
}

.hearts-hand-wrap {
	display: flex;
	justify-content: center;
	padding-top: 10px;
}

.hearts-hand {
	position: relative;
	height: var(--pc-card-h);
}

.hearts-hand-card {
	position: absolute;
	top: 0;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.hearts-hand-card:hover {
	transform: translateY(-8px);
}

.hearts-hand-card.is-illegal {
	opacity: 0.45;
	cursor: default;
}

.hearts-hand-card.is-illegal:hover {
	transform: none;
}

@media (max-width: 768px) {
	.hearts-opp-label {
		font-size: 0.8rem;
	}

	.hearts-message {
		font-size: 0.95rem;
	}
}

/* ---------- Pinball ---------- */
@media (min-width: 769px) {
	.window-id-pinball {
		width: min(460px, 96vw);
		max-height: 90vh;
	}
}

.pb-app {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.pb-title {
	font-family: var(--font-chrome);
	font-size: 1.3rem;
	letter-spacing: 1px;
	color: var(--color-cyan);
	text-shadow: 0 0 8px rgba(49, 248, 204, 0.6);
	margin-bottom: 10px;
	text-align: center;
}

.pb-table-wrap {
	position: relative;
}

.pb-canvas {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 50vh;
	margin: 0 auto;
	border-radius: 10px;
	border: 1px solid var(--color-purple-dim);
	box-shadow: 0 0 20px rgba(114, 61, 174, 0.4);
}

.pb-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	background: rgba(13, 13, 26, 0.85);
	border-radius: 10px;
	text-align: center;
	padding: 20px;
}

.pb-overlay[hidden] {
	display: none;
}

.pb-overlay p {
	font-family: var(--font-chrome);
	font-size: 1.2rem;
	color: var(--color-text);
	margin: 0;
}

.pb-controls {
	display: flex;
	justify-content: center;
	gap: 10px;
	margin-top: 14px;
	width: 100%;
}

.pb-flip-btn,
.pb-launch-btn {
	font-family: var(--font-chrome);
	font-size: 1rem;
	letter-spacing: 0.5px;
	padding: 10px 16px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-cyan);
	border-radius: 6px;
	color: var(--color-cyan);
	cursor: pointer;
	touch-action: none;
	user-select: none;
	flex: 1 1 0;
}

.pb-launch-btn {
	border-color: var(--color-danger);
	color: var(--color-danger);
}

.pb-flip-btn:active,
.pb-launch-btn:active {
	box-shadow: 0 0 10px currentColor;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	.retro-window {
		position: fixed;
		inset: 0;
		top: var(--menu-bar-height);
		width: 100%;
		max-height: none;
		border-radius: 0;
	}

	.window-titlebar {
		cursor: default;
	}

	.icon-grid {
		grid-template-columns: repeat(auto-fill, 84px);
		gap: 16px;
		padding: 20px;
	}

	.desktop-icon {
		width: 84px;
	}
}
