/* Página del juego (demo web). El lienzo va en un marco vertical 9:16 (el juego es 720×1280 y se
   estira en alto, "expand"): en móvil en vertical ocupa toda la pantalla; en escritorio queda
   centrado, con el panel de controles al lado si cabe. play.js calcula el tamaño exacto. */

@font-face {
	font-family: "Sora";
	font-style: normal;
	font-weight: 400 800;
	font-display: swap;
	src: url("/assets/fonts/sora-latin.woff2") format("woff2");
}

:root {
	color-scheme: dark;
	--void: #070a18;
	--s1: #121a36;
	--s2: #1a2448;
	--stroke: rgba(158, 184, 255, 0.22);
	--stroke-subtle: rgba(158, 184, 255, 0.1);
	--t1: #eef3ff;
	--t2: #a9b8d9;
	--t3: #7384ab;
	--primary: #3d7fe6;
	--primary-lip: #224f9c;
	--echo: #6fe7ff;
	--present: #ff7a3d;
	--danger: #ff4d5e;
	--font: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body {
	margin: 0; height: 100%; overflow: hidden; background: var(--void); color: var(--t1);
	font-family: var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
	overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
	-webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
[hidden] { display: none !important; }

.stage {
	position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; gap: 40px;
	background:
		radial-gradient(60% 50% at 50% 0%, rgba(22, 33, 90, 0.9), transparent 70%),
		radial-gradient(40% 40% at 80% 100%, rgba(79, 216, 255, 0.08), transparent 70%),
		var(--void);
}

/* ───────────── Marco del juego ───────────── */
.frame { position: relative; flex: none; background: var(--void); overflow: hidden; }
.frame.windowed {
	border-radius: 18px; border: 1px solid var(--stroke);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.4);
}
#canvas {
	display: block; width: 100%; height: 100%; outline: none; border: 0;
	touch-action: none; background: var(--void);
}

/* ───────────── Carga ───────────── */
.boot {
	position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center;
	justify-content: center; gap: 10px; padding: 24px; text-align: center; background: var(--void);
	transition: opacity 0.35s ease;
}
.boot.done { opacity: 0; pointer-events: none; }
.emblem { width: 112px; height: 112px; margin-bottom: 6px; }
.emblem .hand { transform-origin: 100px 100px; animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wordmark { margin: 0; font-weight: 800; font-size: 34px; letter-spacing: 0.17em; padding-left: 0.17em; }
.badge {
	margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--echo);
}
.progress {
	width: min(240px, 70%); height: 6px; margin-top: 18px; border-radius: 99px; background: var(--s2); overflow: hidden;
}
.progress span {
	display: block; height: 100%; width: 0; border-radius: inherit; background: var(--echo);
	box-shadow: 0 0 12px var(--echo); transition: width 0.2s ease;
}
.progress.indeterminate span { width: 30%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.status { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--t2); font-variant-numeric: tabular-nums; }
.note { margin: 0; max-width: 280px; font-size: 12px; line-height: 1.5; color: var(--t3); }

.error { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 320px; margin-top: 10px; }
.error h1 { margin: 0; font-size: 18px; line-height: 1.3; color: var(--t1); }
.error p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--t2); }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.boot.failed .progress, .boot.failed .status, .boot.failed .note { display: none; }
.boot.failed .emblem .hand { animation: none; }

/* ───────────── Botones (como los de la web) ───────────── */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
	border-radius: 14px; border: 1px solid var(--stroke); background: var(--s2); color: var(--t1);
	font: 700 14px/1.2 var(--font); text-decoration: none; cursor: pointer; box-shadow: 0 4px 0 #0c1330;
	transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.16s ease;
}
.btn:hover { background: #202c56; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0c1330; }
.btn-primary { background: var(--primary); border-color: transparent; box-shadow: 0 4px 0 var(--primary-lip); }
.btn-primary:hover { background: #4a8bf0; }
.btn-primary:active { box-shadow: 0 1px 0 var(--primary-lip); }
.btn:focus-visible { outline: 2px solid var(--echo); outline-offset: 3px; }

/* ───────────── Panel lateral (escritorio) ───────────── */
.side { width: 250px; flex: none; display: flex; flex-direction: column; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--t1); text-decoration: none; font-weight: 800; letter-spacing: 0.17em; font-size: 15px; }
.brand img { border-radius: 8px; }
.side h2 { margin: 10px 0 0; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--t3); }
.keys { margin: 0; display: grid; gap: 8px; }
.keys div { display: flex; align-items: center; gap: 12px; }
.keys dt { display: flex; gap: 4px; min-width: 74px; }
.keys dd { margin: 0; font-size: 14px; color: var(--t2); }
kbd {
	display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 28px; padding: 0 7px;
	border-radius: 7px; border: 1px solid var(--stroke); border-bottom-width: 3px; background: var(--s1);
	font: 700 12px/1 var(--font); color: var(--t1);
}
kbd.wide { min-width: 56px; }
.side-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ───────────── Móvil en horizontal ───────────── */
.rotate {
	position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
	padding: 16px; background: rgba(7, 10, 24, 0.94); text-align: center;
}
.rotate p { margin: 0; font-size: 14px; font-weight: 700; color: var(--t1); }

@media (prefers-reduced-motion: reduce) {
	.emblem .hand, .progress.indeterminate span { animation: none; }
}
