/* Pantalla de carga de la web (ver loader.js): paño del menú, logo, consejo y barra. */
@font-face { font-family: Jersey10; src: url(Jersey10-Regular.ttf); font-display: swap; }

/* Paño en remolino del menú (WebGL), agrandado sin suavizar y recortado al
   centro: en el celular parado, estirarlo a la pantalla lo deformaba. */
.loader-felt {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	image-rendering: pixelated;
}

.loader {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(20px, 5vh, 48px);
	padding: 16px;
	box-sizing: border-box;
	overflow: hidden;
	color: #fffaf0;
	font-family: Jersey10, monospace;
	text-align: center;
}

/* Logo de Godot: solo se ve si no cargan las piezas del logo animado. */
.loader #status-splash {
	position: static;
	width: 60vw;
	max-width: 760px;
	height: auto;
	max-height: 40vh;
	object-fit: contain;
	margin: 0;
	flex: none;
}

/* Logo animado como el título del menú (main_menu.gd). Las medidas salen de
   las piezas de assets/logo en unidades --u: letras de 74x86, carta de
   81x105, rayos de 220x220 y 12 de solapamiento: la fila mide 577 de ancho. */
.loader-logo {
	--u: calc(min(60vw, 760px, 30vh * 577 / 105) / 577);
	position: relative;
	flex: none;
	display: flex;
	align-items: flex-start;
	width: calc(var(--u) * 577);
	height: calc(var(--u) * 105);
	margin: calc(var(--u) * 30) 0;
}
.loader-piece {
	position: relative;
	flex: none;
	width: calc(var(--u) * 74);
	height: calc(var(--u) * 86);
	margin-left: calc(var(--u) * -12);
	animation: loader-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
	animation-delay: calc(0.08s + var(--i) * 0.06s);
}
.loader-piece:nth-child(2) { margin-left: 0; }
.loader-piece-card { width: calc(var(--u) * 81); height: calc(var(--u) * 105); }
.loader-bob {
	position: absolute;
	inset: 0;
	animation: loader-bob 2.856s ease-in-out infinite;
	animation-delay: calc(var(--i) * -0.25s);
}
.loader-glyph {
	display: block;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	animation: loader-wobble 3.927s ease-in-out infinite;
	animation-delay: calc(var(--i) * -0.5s);
}
.loader-piece-card .loader-glyph { animation: loader-sway 4.833s ease-in-out infinite; }
/* Centrados en la carta: 3 letras (3 x 62) más media carta. */
.loader-rays-bob {
	inset: auto;
	left: calc(var(--u) * (186 + 40.5 - 110));
	top: calc(var(--u) * (52.5 - 110));
	width: calc(var(--u) * 220);
	height: calc(var(--u) * 220);
}
.loader-rays {
	display: block;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	animation: loader-rays-in 0.6s 0.5s both, loader-rays 25.13s linear infinite;
}
@keyframes loader-pop { from { transform: scale(0); } to { transform: none; } }
/* La onda del menú: 10 px a escala 2. */
@keyframes loader-bob {
	0%, 100% { transform: translateY(calc(var(--u) * 5)); }
	50% { transform: translateY(calc(var(--u) * -5)); }
}
@keyframes loader-wobble {
	0%, 100% { transform: rotate(2.3deg); }
	50% { transform: rotate(-2.3deg); }
}
@keyframes loader-sway {
	0%, 100% { transform: rotate(-4.6deg); }
	50% { transform: rotate(-10.3deg); }
}
@keyframes loader-rays-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes loader-rays {
	0% { transform: rotate(0deg) scale(1); }
	12.5% { transform: rotate(45deg) scale(1.05); }
	25% { transform: rotate(90deg) scale(1); }
	37.5% { transform: rotate(135deg) scale(0.95); }
	50% { transform: rotate(180deg) scale(1); }
	62.5% { transform: rotate(225deg) scale(1.05); }
	75% { transform: rotate(270deg) scale(1); }
	87.5% { transform: rotate(315deg) scale(0.95); }
	100% { transform: rotate(360deg) scale(1); }
}

/* Cartel de la versión de prueba, abajo del logo. */
.loader-demo {
	flex: none;
	margin-top: calc(clamp(20px, 5vh, 48px) * -0.6);
	padding: 0 16px 3px;
	font-size: clamp(26px, 4.5vh, 44px);
	line-height: 1;
	letter-spacing: 6px;
	color: #2a1d16;
	background: #e9b52f;
	border: 3px solid #2a1d16;
	box-shadow: inset 0 -3px 0 #a86f17, 0 4px 0 rgba(0, 0, 0, 0.3);
	transform: rotate(-3deg);
}
.loader-thanks {
	flex: none;
	max-width: min(100%, 640px);
	font-size: clamp(18px, 2.6vh, 24px);
	line-height: 1.15;
	color: #fffaf0;
	text-shadow: 0 2px 0 #2a1d16;
}

.loader-tip {
	flex: none;
	box-sizing: border-box;
	width: min(100%, 640px);
	padding: 10px 18px 12px;
	background: #12382a;
	border: 3px solid #2a1d16;
	box-shadow: inset 0 0 0 2px #1f5440, 0 4px 0 rgba(0, 0, 0, 0.3);
}
.loader-tip-title {
	font-size: clamp(18px, 2.6vh, 26px);
	color: #e9b52f;
	letter-spacing: 1px;
	text-transform: uppercase;
}
.loader-tip-text {
	min-height: 2.2em;
	font-size: clamp(20px, 3vh, 30px);
	line-height: 1.1;
}
.loader-tip-text.loader-in { animation: loader-tip 0.45s both; }
@keyframes loader-tip {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

/* Barra con el número adentro. */
.loader-bar {
	position: relative;
	flex: none;
	width: min(100%, 520px);
}
.loader #status-progress {
	position: static;
	display: block;
	width: 100%;
	margin: 0;
}
#status-progress { appearance: none; -webkit-appearance: none; height: 30px; border: 3px solid #2a1d16; border-radius: 0; background: #0d3021; box-sizing: border-box; }
#status-progress::-webkit-progress-bar { background: #0d3021; }
#status-progress::-webkit-progress-value { background: #e9b52f; }
#status-progress::-moz-progress-bar { background: #e9b52f; }

.loader-status {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	color: #fffaf0;
	text-shadow: 0 2px 0 #2a1d16, 2px 0 0 #2a1d16, -2px 0 0 #2a1d16, 0 -2px 0 #2a1d16;
}

/* Instalar como app (PWA): botón en Android, instrucciones en iPhone. */
.loader-install {
	flex: none;
	max-width: min(100%, 640px);
	font-size: clamp(18px, 2.6vh, 24px);
	line-height: 1.15;
	color: #fffaf0;
	text-shadow: 0 2px 0 #2a1d16;
}
.loader-install:empty { display: none; }
.loader-install b { color: #e9b52f; font-weight: normal; }
/* Ícono de Compartir de iOS: cuadradito con flecha para arriba. */
.loader-install-share {
	display: inline-block;
	position: relative;
	width: 0.6em;
	height: 0.6em;
	margin: 0 0.2em -0.05em;
	border: 2px solid #e9b52f;
	border-top-color: transparent;
}
.loader-install-share::before {
	content: '';
	position: absolute;
	left: 50%;
	bottom: 0.15em;
	width: 2px;
	height: 0.75em;
	margin-left: -1px;
	background: #e9b52f;
}
.loader-install-share::after {
	content: '';
	position: absolute;
	left: 50%;
	top: -0.45em;
	width: 0.3em;
	height: 0.3em;
	margin-left: calc(-0.15em - 1px);
	border-left: 2px solid #e9b52f;
	border-top: 2px solid #e9b52f;
	transform: rotate(45deg);
}
.loader-install-button {
	font: inherit;
	font-size: clamp(20px, 3vh, 28px);
	color: #2a1d16;
	background: #e9b52f;
	border: 3px solid #2a1d16;
	border-radius: 0;
	padding: 4px 18px 6px;
	box-shadow: inset 0 -3px 0 #a86f17, 0 4px 0 rgba(0, 0, 0, 0.3);
	cursor: pointer;
}
.loader-failed { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.loader-install-button:active { transform: translateY(2px); box-shadow: inset 0 -3px 0 #a86f17; }

/* Celular acostado: lo justo. */
@media (max-height: 480px) {
	.loader { gap: 10px; padding: 8px 16px; }
	.loader #status-splash { max-height: 32vh; }
	.loader-logo { --u: calc(min(60vw, 760px, 26vh * 577 / 105) / 577); }
	.loader-tip { padding: 4px 12px 6px; }
	.loader-tip-title { display: none; }
	.loader-tip-text { min-height: 0; }
	.loader-install, .loader-thanks { font-size: 16px; }
	.loader-demo { margin-top: -4px; font-size: 22px; }
	.loader-install-button { font-size: 18px; padding: 2px 12px 4px; }
}

@media (prefers-reduced-motion: reduce) {
	.loader-tip-text.loader-in, .loader-piece, .loader-bob, .loader-glyph, .loader-rays { animation: none; }
	.loader-piece-card .loader-glyph { transform: rotate(-7.4deg); }
}
