/* Arcade HTML5 — styles communs à tous les jeux */
:root {
	--bg: #0d1b2a;
	--panel: rgba(9, 18, 30, .86);
	--text: #f1f5fb;
	--muted: #9fb3c8;
	--accent: #38d39f;
	--accent-2: #ffcc4d;
	--danger: #ff6b6b;
	--font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	overflow: hidden;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: none;
}

body { display: flex; align-items: center; justify-content: center; }

#wrap {
	position: relative;
	overflow: hidden;
	background: var(--bg);
}

#wrap canvas {
	display: block;
	width: 100%;
	height: 100%;
	image-rendering: auto;
}

/* Écrans (accueil / pause / fin) */
.ag-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(5, 12, 22, .62);
	backdrop-filter: blur(2px);
	z-index: 10;
	padding: 6%;
}
.ag-overlay[hidden] { display: none; }

.ag-card {
	width: 100%;
	max-width: 340px;
	background: var(--panel);
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: 16px;
	padding: 20px 18px 18px;
	text-align: center;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
	animation: ag-in .22s ease-out;
}
@keyframes ag-in { from { transform: translateY(10px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.ag-card h1 {
	margin: 0 0 6px;
	font-size: 30px;
	letter-spacing: .5px;
	color: var(--accent-2);
	text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.ag-card p { margin: 6px 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.ag-card .ag-big { font-size: 38px; font-weight: bold; color: var(--text); margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.ag-card .ag-result { min-height: 1.4em; color: var(--accent); font-weight: bold; }
.ag-card .ag-result.is-bad { color: var(--danger); }
.ag-card .ag-result.is-record { color: var(--accent-2); }

.ag-btn {
	display: inline-block;
	margin-top: 12px;
	padding: 11px 26px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(#45e0ac, #22b07f);
	color: #062418;
	font: bold 18px var(--font);
	cursor: pointer;
	box-shadow: 0 4px 0 #157a57, 0 8px 18px rgba(0, 0, 0, .3);
	transition: transform .08s ease;
}
.ag-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #157a57; }
.ag-btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }

.ag-keys { font-size: 13px !important; opacity: .85; }
.ag-keys kbd {
	display: inline-block;
	min-width: 22px;
	padding: 1px 6px;
	border-radius: 5px;
	background: rgba(255, 255, 255, .12);
	border: 1px solid rgba(255, 255, 255, .18);
	color: var(--text);
	font: bold 12px var(--font);
}

/* Bouton son */
.ag-mute {
	position: absolute;
	z-index: 20;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, .2);
	background: rgba(0, 0, 0, .35);
	color: var(--text);
	font-size: 16px;
	line-height: 32px;
	cursor: pointer;
	padding: 0;
}

.ag-mute-bottom-right { right: 8px; bottom: 8px; }
.ag-mute-top-right { right: 8px; top: 8px; }
.ag-mute-top-left { left: 8px; top: 8px; }
.ag-mute-bottom-left { left: 8px; bottom: 8px; }

/* Boutons tactiles (jeux qui en ont besoin) */
.ag-pad {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: none;
	justify-content: space-between;
	gap: 6px;
	padding: 8px;
	z-index: 5;
	pointer-events: none;
}
.ag-pad button {
	pointer-events: auto;
	flex: 1;
	height: 54px;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, .18);
	background: rgba(255, 255, 255, .1);
	color: var(--text);
	font: bold 22px var(--font);
	touch-action: none;
}
.ag-pad button:active { background: rgba(255, 255, 255, .25); }
.is-touch .ag-pad { display: flex; }
