:root {
	--game-display-width: 960px;
	--game-display-height: 720px;

	--game-shell-padding: 42px;
	--game-shell-radius: 32px;

	--game-hud-height: 54px;
	--game-hud-gap: 14px;

	--game-page-background: #050505;
	--game-shell-border-color: #3f3f3f;
	--game-screen-border-color: #111111;
}

body {
	margin: 0;
	padding: 0;
	color: rgba(255, 255, 255, 0.87);
	background-color: var(--game-page-background);
}

#app {
	width: 100%;
	min-height: 100vh;
	overflow-x: hidden;
	overflow-y: auto;

	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;

	padding: 24px 12px;
	box-sizing: border-box;

	background: radial-gradient(circle at center, rgba(60, 60, 60, 0.55) 0%, rgba(5, 5, 5, 1) 72%);
}

/*
	Classes de taille testables directement dans index.html :

	<div id="app" class="game-size-small">
	<div id="app" class="game-size-medium">
	<div id="app" class="game-size-large">
*/

#app.game-size-small {
	--game-display-width: 640px;
	--game-display-height: 480px;
	--game-shell-padding: 32px;
}

#app.game-size-medium {
	--game-display-width: 960px;
	--game-display-height: 720px;
	--game-shell-padding: 42px;
}

#app.game-size-large {
	--game-display-width: 1280px;
	--game-display-height: 960px;
	--game-shell-padding: 52px;
}

/*
	Coque extérieure :
	c'est le décor autour du jeu.
	Tu peux ensuite remplacer ça par une vraie image de télévision,
	une borne arcade, un cockpit, un cadre gothique, etc.
*/

#game-shell {
	box-sizing: border-box;

	padding: var(--game-shell-padding);
	border-radius: var(--game-shell-radius);

	display: flex;
	flex-direction: column;
	gap: var(--game-hud-gap);

	background: linear-gradient(145deg, #2d2d2d 0%, #121212 45%, #050505 100%);

	border: 6px solid var(--game-shell-border-color);

	box-shadow:
		0 0 80px rgba(0, 0, 0, 0.9),
		inset 0 0 20px rgba(255, 255, 255, 0.08),
		inset 0 0 60px rgba(0, 0, 0, 0.75);
}

#game-shell:fullscreen {
	width: 100vw;
	height: 100vh;

	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;

	padding: var(--game-shell-padding);
	box-sizing: border-box;

	border-radius: 0;
	border: none;

	background: radial-gradient(circle at center, rgba(60, 60, 60, 0.55) 0%, rgba(5, 5, 5, 1) 72%);
}

#game-shell:fullscreen #game-hud-panel,
#game-shell:fullscreen #game-screen {
	max-width: calc(100vw - 120px);
}

#game-shell:fullscreen #game-screen {
	max-height: calc(100vh - 120px - var(--game-hud-height) - var(--game-hud-gap));
}

#game-shell:fullscreen::backdrop {
	background: #000000;
}

#game-shell:-webkit-full-screen {
	width: 100vw;
	height: 100vh;

	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;

	padding: var(--game-shell-padding);
	box-sizing: border-box;

	border-radius: 0;
	border: none;

	background: radial-gradient(circle at center, rgba(60, 60, 60, 0.55) 0%, rgba(5, 5, 5, 1) 72%);
}

#game-shell:-webkit-full-screen #game-hud-panel,
#game-shell:-webkit-full-screen #game-screen {
	max-width: calc(100vw - 120px);
}

#game-shell:-webkit-full-screen #game-screen {
	max-height: calc(100vh - 120px - var(--game-hud-height) - var(--game-hud-gap));
}

#game-hud-panel {
	box-sizing: border-box;

	width: var(--game-display-width);
	height: var(--game-hud-height);

	max-width: calc(100vw - 120px);

	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	align-items: center;
	gap: 10px;

	padding: 8px 12px;

	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)), #080808;

	border: 2px solid rgba(255, 255, 255, 0.14);
	border-radius: 12px;

	box-shadow:
		0 0 18px rgba(0, 0, 0, 0.75),
		inset 0 0 16px rgba(255, 255, 255, 0.04);

	font-family:
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		'Segoe UI',
		sans-serif;
}

.hud-stat {
	min-width: 0;

	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;

	white-space: nowrap;
}

.hud-stat__label {
	font-size: 10px;
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.56);
}

.hud-stat__value {
	font-size: 15px;
	line-height: 1;
	font-weight: 700;
	color: #7df9ff;
	text-shadow: 0 0 8px rgba(125, 249, 255, 0.28);
}

.hud-stat__status {
	font-size: 11px;
	line-height: 1;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.74);
}

.hud-dash {
	position: relative;

	width: 64px;
	height: 7px;

	overflow: hidden;

	background: rgba(255, 255, 255, 0.12);

	border: 1px solid rgba(255, 255, 255, 0.24);
	border-radius: 999px;
}

.hud-dash__fill {
	width: 100%;
	height: 100%;

	transform: scaleX(1);
	transform-origin: left center;

	background: #7df9ff;
	box-shadow: 0 0 10px rgba(125, 249, 255, 0.5);
}

/*
	Cadre intérieur, façon vitre / écran.
*/

#game-screen {
	box-sizing: border-box;

	position: relative;
	isolation: isolate;

	width: var(--game-display-width);
	height: var(--game-display-height);

	max-width: calc(100vw - 120px);
	max-height: calc(100vh - 120px - var(--game-hud-height) - var(--game-hud-gap));

	overflow: hidden;

	background: #000000;

	border: 10px solid var(--game-screen-border-color);
	border-radius: 10px;

	box-shadow:
		0 0 24px rgba(0, 0, 0, 0.95),
		inset 0 0 24px rgba(255, 255, 255, 0.06);
}

/*
	Effet CRT léger.
	Activé uniquement si l’option est active.
*/
.crt-effect-enabled #game-screen {
	border-radius: 18px;

	box-shadow:
		0 0 24px rgba(0, 0, 0, 0.95),
		inset 0 0 24px rgba(255, 255, 255, 0.06),
		inset 0 0 44px rgba(125, 249, 255, 0.08);
}

.crt-effect-enabled #game-container {
	transform: scale(1.012);
	transform-origin: center center;

	filter: contrast(1.06) saturate(1.08) brightness(0.98);
}

/*
	Scanlines + très léger effet écran.
	Ne bloque pas les clics.
*/
.crt-effect-enabled #game-screen::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 10;
	pointer-events: none;

	background: repeating-linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0.15) 0px,
		rgba(255, 255, 255, 0.15) 1px,
		rgba(0, 0, 0, 0.2) 2px,
		rgba(0, 0, 0, 0.2) 4px
	);

	mix-blend-mode: soft-light;
	opacity: 0.55;
}

/*
	Vignettage doux + reflet subtil.
*/
.crt-effect-enabled #game-screen::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 11;
	pointer-events: none;

	background: radial-gradient(
		circle at center,
		rgba(255, 255, 255, 0.055) 0%,
		rgba(255, 255, 255, 0.018) 42%,
		rgba(0, 0, 0, 0.2) 78%,
		rgba(0, 0, 0, 0.44) 100%
	);

	opacity: 0.88;
}

/*
	Conteneur utilisé par Phaser.
	Phaser injecte son canvas ici.
*/

#game-container {
	width: 100%;
	height: 100%;

	overflow: hidden;
	background: #000000;

	position: relative;
	z-index: 1;
}

/*
	Le canvas Phaser doit rester net en pixel art.
*/

.game-footer {
	width: min(100%, 960px);
	margin: 18px auto 0;
	padding: 16px 18px 20px;

	box-sizing: border-box;

	text-align: center;
	color: rgba(255, 255, 255, 0.72);

	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
		rgba(0, 0, 0, 0.22);

	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 14px;

	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);

	font-family:
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		'Segoe UI',
		sans-serif;
	font-size: 0.78rem;
	line-height: 1.55;
}

.game-footer p {
	margin: 0;
}

.game-footer p + p {
	margin-top: 8px;
}

.game-footer__copyright {
	color: rgba(255, 255, 255, 0.86);
	font-weight: 600;
}

.game-footer__notice {
	max-width: 760px;
	margin-inline: auto;
}

.game-footer__credits {
	color: rgba(255, 255, 255, 0.66);
}

.game-footer a {
	color: rgba(255, 255, 255, 0.92);
	text-decoration: none;
	border-bottom: 1px solid rgba(255, 255, 255, 0.32);
	transition:
		color 160ms ease,
		border-color 160ms ease;
}

.game-footer a:hover,
.game-footer a:focus-visible {
	color: #7df9ff;
	border-bottom-color: #7df9ff;
	outline: none;
}

@media (max-width: 700px) {
	.game-footer {
		margin-top: 14px;
		padding: 14px 14px 16px;
		border-radius: 10px;
		font-size: 0.72rem;
	}
}

@media (max-width: 720px) {
	#game-hud-panel {
		height: auto;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.hud-stat {
		justify-content: space-between;
	}

	.hud-stat__label {
		font-size: 9px;
	}

	.hud-stat__value {
		font-size: 13px;
	}
}

canvas {
	display: block;

	image-rendering: pixelated;
	image-rendering: -webkit-optimize-contrast;
	/* image-rendering: crisp-edges; */
	image-rendering: -webkit-optimize-contrast;
}
