:root {
	--bg: #0b0a08;
	--sand: #c9a66b;
	--ink: #f3e6c8;
	--muted: #9a8b72;
	--bar: #2a2318;
	--accent: #d4a24a;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	width: 100%;
	height: 100%;
	background: var(--bg);
	color: var(--ink);
	font-family: "Segoe UI", system-ui, sans-serif;
	overflow: hidden;
	overscroll-behavior: none;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.web-play {
	position: fixed;
	inset: 0;
	background: var(--bg);
}

.stage {
	position: fixed;
	inset: 0;
	background: #000;
	z-index: 1;
}

.game-container {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	touch-action: none;
	background: #000;
}

/* Native 765×503 game surface, scaled as a whole so the painted pixels stay intact. */
#cheerpjDisplay,
.cheerpjDisplay {
	position: absolute !important;
	left: 50% !important;
	top: 50% !important;
	width: 765px !important;
	height: 503px !important;
	margin: 0 !important;
	background: #000 !important;
	transform: translate(-50%, -50%) scale(var(--game-scale, 1));
	transform-origin: center center;
}

#cheerpjDisplay canvas,
.cheerpjDisplay canvas,
.game-container canvas {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	width: 765px !important;
	height: 503px !important;
	touch-action: none;
}

.fab-fs {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 4;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 1px solid rgba(201, 166, 107, 0.35);
	background: rgba(10, 9, 7, 0.65);
	color: var(--ink);
	cursor: pointer;
	opacity: 0.35;
	transition: opacity 0.2s;
}
.fab-fs:hover { opacity: 1; }

.boot {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: grid;
	place-items: center;
	padding: 24px;
	background:
		radial-gradient(1200px 600px at 50% -10%, rgba(212, 162, 74, 0.22), transparent 60%),
		linear-gradient(180deg, #12100c 0%, #0b0a08 100%);
	transition: opacity 0.45s ease, visibility 0.45s ease;
}

.boot.is-hiding {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.boot-card {
	width: min(440px, 100%);
	text-align: center;
}

.boot-logo {
	width: 96px;
	height: auto;
	margin-bottom: 12px;
}

.boot h1 {
	margin: 0 0 8px;
	font-size: 1.6rem;
	letter-spacing: 0.12em;
	color: var(--sand);
}

#boot-status {
	margin: 0 0 16px;
	color: var(--muted);
	font-size: 0.95rem;
	min-height: 1.4em;
}

.bar {
	height: 10px;
	border-radius: 999px;
	background: var(--bar);
	overflow: hidden;
	border: 1px solid rgba(201, 166, 107, 0.25);
}

.bar i {
	display: block;
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #8a6230, var(--accent));
	transition: width 0.2s ease;
}

.boot-hint {
	margin: 14px 0 0;
	font-size: 0.82rem;
	line-height: 1.45;
	color: var(--muted);
}

.boot-btn {
	margin-top: 16px;
	appearance: none;
	border: 1px solid rgba(201, 166, 107, 0.45);
	background: #1a150f;
	color: var(--ink);
	padding: 10px 18px;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 600;
}

.boot-back {
	display: inline-block;
	margin-top: 18px;
	color: var(--sand);
	text-decoration: none;
	font-size: 0.9rem;
}

/* Only hide known CheerpJ splash/loading overlays — NOT the game display */
#loading:not(#cheerpjDisplay):not(.cheerpjDisplay),
#cheerpjLoading,
.cheerpjLoading {
	display: none !important;
}
