/* ==========================================================================
   keiberup.dev — portfolio
   Sin dependencias, sin build step. Tema día/noche con los fondos del juego.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
	--bg: #f5f0e4;
	--bg-2: #ece4d2;
	--panel: #fffaf0;
	--ink: #171423;
	--ink-soft: #57506b;
	--line: #171423;
	--accent: #2f7a4a;
	--accent-ink: #f7fff6;
	--accent-2: #6c4f8c;
	--coin: #efb32b;
	--coin-hi: #ffe293;
	--coin-lo: #a86f10;
	--shadow: #171423;
	--focus: #c23f86;
	--strip-bg: #0b0916;
	--strip-h: 88px;
	--max: 1120px;
	--font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--border: 2px solid var(--line);
	--bg-1: url("/img/background/day/1.png");
	--bg-2-img: url("/img/background/day/2.png");
	--bg-3: url("/img/background/day/3.png");
	--bg-4: url("/img/background/day/4.png");
	--stars-op: .35;
	color-scheme: light;
}

[data-theme="night"] {
	--bg: #0d0b16;
	--bg-2: #141026;
	--panel: #181330;
	--ink: #f1edff;
	--ink-soft: #a99fc9;
	--line: #f1edff;
	--accent: #8ce0a8;
	--accent-ink: #0b1a10;
	--accent-2: #c39ce8;
	--coin: #ffcc4d;
	--coin-hi: #fff0b8;
	--coin-lo: #b07a12;
	--shadow: #000;
	--focus: #ff7ac2;
	--strip-bg: #07060d;
	--bg-1: url("/img/background/night/1.png");
	--bg-2-img: url("/img/background/night/2.png");
	--bg-3: url("/img/background/night/3.png");
	--bg-4: url("/img/background/night/4.png");
	--stars-op: .85;
	color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
	scroll-behavior: smooth;
	scroll-padding-top: 88px;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	padding-bottom: calc(var(--strip-h) + 12px);
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, iframe { display: block; max-width: 100%; }
a { color: inherit; }
strong { font-weight: 700; }
code {
	font-family: var(--font-mono);
	font-size: .85em;
	background: var(--bg-2);
	border: 1px solid var(--line);
	padding: .05em .3em;
}

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 3px;
}

.wrap {
	width: 100%;
	max-width: var(--max);
	margin-inline: auto;
	padding-inline: 24px;
}

.muted { color: var(--ink-soft); }
.small { font-size: .8rem; }

.skip-link {
	position: absolute;
	left: 16px;
	top: -80px;
	z-index: 100;
	background: var(--accent);
	color: var(--accent-ink);
	padding: 10px 16px;
	border: var(--border);
	font-family: var(--font-mono);
	font-size: .8rem;
	text-transform: uppercase;
	text-decoration: none;
}
.skip-link:focus { top: 16px; }

.eyebrow {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-mono);
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--ink-soft);
	margin-bottom: 16px;
}
.eyebrow::after {
	content: "";
	flex: 0 0 40px;
	height: 2px;
	background: var(--line);
	opacity: .3;
}
.blink { color: var(--accent); animation: blink 1.1s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

h1, h2, h3, h4, .brand-text, .btn, .level-link, .chips li, .coin-text strong {
	font-family: var(--font-mono);
}

h2 {
	font-size: clamp(1.8rem, 3.6vw, 2.9rem);
	line-height: 1.05;
	letter-spacing: -.03em;
	text-transform: uppercase;
}

.lead {
	max-width: 56ch;
	font-size: 1.05rem;
	color: var(--ink-soft);
}

/* ---------- Botones ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	padding: .8em 1.15em;
	border: var(--border);
	background: var(--panel);
	color: var(--ink);
	font-family: var(--font-mono);
	font-size: .8rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .05em;
	text-transform: uppercase;
	text-decoration: none;
	box-shadow: 4px 4px 0 var(--shadow);
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-sm { padding: .65em .8em; font-size: .72rem; box-shadow: 3px 3px 0 var(--shadow); }
.btn-lg { padding: 1em 1.4em; font-size: .9rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }

.icon-btn {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border: var(--border);
	background: var(--panel);
	color: var(--ink);
	font-family: var(--font-mono);
	font-size: 1rem;
	box-shadow: 3px 3px 0 var(--shadow);
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease;
}
.icon-btn:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }

/* ---------- Header ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: var(--border);
}
.header-inner {
	display: flex;
	align-items: center;
	gap: 20px;
	min-height: 64px;
	padding-block: 10px;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	margin-right: auto;
}
.brand-mark {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	background: var(--accent);
	color: var(--accent-ink);
	border: var(--border);
	box-shadow: 3px 3px 0 var(--shadow);
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 1.05rem;
}
.brand-text {
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -.02em;
}
.brand-dim { color: var(--ink-soft); }
.brand-dot { color: var(--accent); }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
	display: inline-block;
	padding: 8px 10px;
	font-family: var(--font-mono);
	font-size: .72rem;
	letter-spacing: .06em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--ink-soft);
	border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a[aria-current="true"] {
	color: var(--ink);
	border-bottom-color: var(--accent);
}

.header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Hero ---------- */
.hero {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	border-bottom: var(--border);
	background: var(--bg);
}
.hero-bg { position: absolute; inset: 0; z-index: -2; }
.bg-layer {
	position: absolute;
	inset: -6%;
	background-position: center bottom;
	background-size: cover;
	background-repeat: no-repeat;
	will-change: transform;
}
.bg-1 { background-image: var(--bg-1); }
.bg-2 { background-image: var(--bg-2-img); opacity: var(--stars-op); }
.bg-3 { background-image: var(--bg-3); opacity: .8; animation: drift 46s ease-in-out infinite alternate; }
.bg-4 { background-image: var(--bg-4); opacity: .55; animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translateX(-2.5%); } }

.hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 92%, transparent) 34%, color-mix(in srgb, var(--bg) 20%, transparent) 62%, transparent 78%),
		linear-gradient(180deg, transparent 62%, var(--bg) 100%);
	pointer-events: none;
}

.hero-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
	align-items: center;
	gap: 48px;
	min-height: calc(100svh - 160px);
	padding-block: 64px 72px;
}

.hero-copy h1 {
	margin: 0 0 22px;
	font-size: clamp(2.2rem, 5.2vw, 4.3rem);
	line-height: .98;
	letter-spacing: -.045em;
	text-transform: uppercase;
}
.hl {
	background: var(--accent);
	color: var(--accent-ink);
	padding: 0 .1em;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}
.hero-copy .lead { margin-bottom: 28px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 32px; }

.hero-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	font-family: var(--font-mono);
	font-size: .68rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
}
.hero-facts li { display: flex; align-items: center; gap: 8px; }
.hero-facts li::before {
	content: "";
	width: 7px;
	height: 7px;
	background: var(--accent);
	border: 1px solid var(--line);
}

/* Escena / mini juego */
.hero-art { display: flex; flex-direction: column; gap: 12px; justify-self: end; width: 100%; max-width: 480px; }
.scene {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	padding: 0;
	border: 3px solid var(--line);
	background: #0b0916;
	box-shadow: 10px 10px 0 var(--shadow);
	overflow: hidden;
	cursor: pointer;
	appearance: none;
	text-align: left;
	color: inherit;
	text-decoration: none;
}
.scene::after {
	content: "";
	position: absolute;
	inset: 0;
	background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 4px);
	pointer-events: none;
	z-index: 4;
}
.scene-sky,
.scene-clouds,
.scene-stars {
	position: absolute;
	inset: -4%;
	background-size: cover;
	background-position: center;
}
.scene-sky { background-image: var(--bg-1); }
.scene-stars { background-image: var(--bg-2-img); opacity: .8; }
.scene-clouds { background-image: var(--bg-4); opacity: .85; animation: drift 26s ease-in-out infinite alternate; }

.scene-platform {
	position: absolute;
	left: 50%;
	bottom: 16%;
	width: 192px;
	height: 60px;
	margin-left: -96px;
	background: url("/assets/ui/platform.png") 0 0 / 100% 100% no-repeat;
	image-rendering: pixelated;
	z-index: 2;
}
.scene-char {
	position: absolute;
	left: 50%;
	bottom: calc(16% + 54px);
	width: 96px;
	height: 96px;
	margin-left: -48px;
	z-index: 3;
}
.sprite.scene-char.is-jumping { animation: hop-big .46s steps(6, end); }
@keyframes hop-big {
	0% { translate: 0 0; }
	35% { translate: 0 -38px; }
	65% { translate: 0 -30px; }
	100% { translate: 0 0; }
}

.scene-coin {
	position: absolute;
	right: 22%;
	bottom: 46%;
	width: 16px;
	height: 22px;
	border: 2px solid #171423;
	border-radius: 50% / 40%;
	background: linear-gradient(90deg, var(--coin-lo) 0 18%, var(--coin) 18% 82%, var(--coin-lo) 82%);
	box-shadow: inset 2px 0 0 var(--coin-hi), inset -2px 0 0 #7a4f08;
	animation: bob 2.4s steps(4, end) infinite;
	z-index: 3;
}
@keyframes bob { 50% { translate: 0 -8px; } }

.scene-hud {
	position: absolute;
	top: 10px;
	left: 12px;
	right: 12px;
	z-index: 3;
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-family: var(--font-mono);
	font-size: .62rem;
	font-weight: 700;
	letter-spacing: .08em;
	color: #fff;
	text-shadow: 0 2px 0 rgba(0, 0, 0, .8);
}
.hearts { color: #ff6b9d; }
.hud-coins { color: var(--coin); }

.scene-hint {
	position: absolute;
	left: 50%;
	bottom: 10px;
	translate: -50% 0;
	z-index: 3;
	padding: 4px 8px;
	border: 1px solid rgba(255, 255, 255, .4);
	background: rgba(8, 6, 16, .55);
	color: #fff;
	font-family: var(--font-mono);
	font-size: .58rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	white-space: nowrap;
}
.art-caption {
	font-family: var(--font-mono);
	font-size: .62rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
	text-align: right;
}

/* ---------- Secciones ---------- */
.section { padding-block: 96px; scroll-margin-top: 76px; }
.section-alt {
	background: var(--bg-2);
	border-block: var(--border);
}
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-head .section-sub { margin-top: 14px; color: var(--ink-soft); max-width: 60ch; }

/* ---------- Proyectos ---------- */
.levels-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 28px;
}
.level-card {
	display: flex;
	flex-direction: column;
	background: var(--panel);
	border: var(--border);
	box-shadow: 6px 6px 0 var(--shadow);
	transition: transform .15s ease, box-shadow .15s ease;
}
.level-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--shadow); }

.thumb {
	position: relative;
	height: 172px;
	overflow: hidden;
	border-bottom: var(--border);
	background-color: #0d0b1a;
	background-image: url("/img/background/night/4.png");
	background-size: cover;
	background-position: center;
}
.thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 4px);
	pointer-events: none;
}
.thumb--night {
	background-color: #0b0916;
	background-image:
		url("/img/background/night/2.png"),
		url("/img/background/night/3.png"),
		url("/img/background/night/4.png"),
		url("/img/background/night/1.png");
}
.thumb--sunset { background-color: #4a2a5a; background-image: linear-gradient(180deg, #7b3f6d, #c06a7a 55%, #f0a06a), url("/img/background/day/4.png"); background-blend-mode: normal, multiply; }
.thumb--day { background-color: #8fc4dd; background-image: url("/img/background/day/3.png"); }

.thumb-num,
.thumb-tag {
	position: absolute;
	top: 12px;
	z-index: 2;
	padding: 4px 7px;
	border: 1px solid var(--line);
	font-family: var(--font-mono);
	font-size: .6rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.thumb-num { left: 12px; background: var(--panel); color: var(--ink); }
.thumb-tag { right: 12px; background: var(--coin); color: #171423; }

.thumb-platform {
	position: absolute;
	left: 50%;
	bottom: 16px;
	width: 96px;
	height: 30px;
	margin-left: -48px;
	background: url("/assets/ui/platform.png") 0 0 / 100% 100% no-repeat;
	image-rendering: pixelated;
	z-index: 1;
}
.thumb-char {
	position: absolute;
	left: 50%;
	bottom: 43px;
	width: 48px;
	height: 48px;
	margin-left: -24px;
	z-index: 2;
}

.level-body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 20px;
}
.level-body h3 {
	font-size: 1.02rem;
	text-transform: uppercase;
	letter-spacing: -.01em;
	margin-bottom: 10px;
}
.level-body > p { color: var(--ink-soft); font-size: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.chips li {
	padding: 3px 7px;
	border: 1px solid var(--line);
	background: var(--bg-2);
	font-family: var(--font-mono);
	font-size: .58rem;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

.case { margin-top: 14px; border-top: 1px dashed color-mix(in srgb, var(--line) 40%, transparent); }
.case summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 10px 0 6px;
	font-family: var(--font-mono);
	font-size: .64rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
	cursor: pointer;
	list-style: none;
}
.case summary::-webkit-details-marker { display: none; }
.case summary::after { content: "+"; font-size: 1rem; color: var(--accent); }
.case[open] summary::after { content: "−"; }
.case summary:hover { color: var(--ink); }
.case-body {
	padding: 6px 0 4px 12px;
	border-left: 2px solid var(--accent);
	font-size: .84rem;
	color: var(--ink-soft);
}
.case-body p + p { margin-top: 8px; }
.case-body strong { color: var(--ink); }

.level-link {
	margin-top: auto;
	padding-top: 18px;
	font-family: var(--font-mono);
	font-size: .68rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--ink);
	border-bottom: 2px solid transparent;
	align-self: flex-start;
}
.level-link:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------- Experiencia ---------- */
.xp-list { border-top: var(--border); }
.xp-item {
	display: grid;
	grid-template-columns: 170px minmax(0, 1fr);
	gap: 28px;
	padding: 26px 4px;
	border-bottom: 1px dashed color-mix(in srgb, var(--line) 32%, transparent);
	transition: background-color .15s ease;
}
.xp-item:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.xp-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.xp-badge {
	padding: 2px 6px;
	border: 1px solid var(--line);
	background: var(--bg-2);
	font-family: var(--font-mono);
	font-size: .58rem;
	font-weight: 700;
	color: var(--accent);
}
.xp-dates {
	font-family: var(--font-mono);
	font-size: .64rem;
	line-height: 1.5;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ink-soft);
}
.xp-mode {
	padding: 1px 5px;
	border: 1px solid color-mix(in srgb, var(--line) 45%, transparent);
	font-family: var(--font-mono);
	font-size: .54rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
}
.xp-body h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: -.01em; }
.xp-company {
	margin-top: 4px;
	font-family: var(--font-mono);
	font-size: .68rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--accent);
}
.xp-company a { text-decoration: none; border-bottom: 2px solid transparent; }
.xp-company a:hover { border-bottom-color: var(--accent); }
.xp-desc { margin-top: 10px; max-width: 68ch; color: var(--ink-soft); font-size: .9rem; }
.xp-body .chips { margin-top: 14px; }

/* ---------- Proyecto lateral ---------- */
.lateral {
	display: grid;
	grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
	background: var(--panel);
	border: var(--border);
	box-shadow: 6px 6px 0 var(--shadow);
}
.lateral .thumb {
	height: auto;
	min-height: 300px;
	border-bottom: 0;
	border-right: var(--border);
}
.lateral .level-body { padding: 28px; }
.lateral .level-body .eyebrow { margin-bottom: 12px; }
.lateral .thumb-platform {
	width: 128px;
	height: 40px;
	margin-left: -64px;
	bottom: 22px;
}
.lateral .thumb-char {
	width: 64px;
	height: 64px;
	margin-left: -32px;
	bottom: 58px;
}

/* ---------- Skills ---------- */
.coins {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
}
.coin-card {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border: var(--border);
	background: var(--panel);
	box-shadow: 4px 4px 0 var(--shadow);
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.coin-card:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }
.coin-card.is-collected { background: var(--bg-2); box-shadow: 2px 2px 0 var(--shadow); }
.coin-card.is-collected::after {
	content: "✓";
	position: absolute;
	top: 5px;
	right: 8px;
	font-family: var(--font-mono);
	font-weight: 700;
	color: var(--accent);
}

.coin-art {
	position: relative;
	flex: 0 0 22px;
	width: 22px;
	height: 28px;
	border: 2px solid var(--line);
	border-radius: 50% / 40%;
	background: linear-gradient(90deg, var(--coin-lo) 0 18%, var(--coin) 18% 82%, var(--coin-lo) 82%);
	box-shadow: inset 2px 0 0 var(--coin-hi), inset -2px 0 0 #7a4f08;
}
.coin-art::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 5px;
	width: 3px;
	height: 9px;
	background: var(--coin-hi);
	opacity: .85;
}
.is-collected .coin-art { filter: grayscale(1) opacity(.45); animation: coin-pop .42s steps(4, end); }
@keyframes coin-pop { 50% { translate: 0 -10px; scale: 1.15; } }

.coin-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.coin-text strong { font-size: .72rem; letter-spacing: .03em; text-transform: uppercase; }
.coin-text span { font-size: .72rem; color: var(--ink-soft); line-height: 1.3; }

.coin-status {
	margin-top: 22px;
	font-family: var(--font-mono);
	font-size: .68rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ink-soft);
}
.coin-status strong { color: var(--accent); font-size: .8rem; }

/* ---------- Sobre mí ---------- */
.about {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	gap: 56px;
	align-items: start;
}
.about-copy h2 { margin-bottom: 20px; }
.about-copy p { color: var(--ink-soft); max-width: 62ch; }
.about-copy p + p { margin-top: 14px; }

.timeline { margin-top: 32px; }
.timeline li {
	display: flex;
	gap: 16px;
	align-items: baseline;
	padding: 10px 0 10px 18px;
	border-left: 2px solid color-mix(in srgb, var(--line) 35%, transparent);
	position: relative;
	font-size: .9rem;
}
.timeline li::before {
	content: "";
	position: absolute;
	left: -5px;
	top: 18px;
	width: 8px;
	height: 8px;
	background: var(--accent);
	border: 1px solid var(--line);
}
.timeline span {
	flex: 0 0 58px;
	font-family: var(--font-mono);
	font-size: .62rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

.checkpoints {
	padding: 24px;
	border: var(--border);
	background: var(--panel);
	box-shadow: 6px 6px 0 var(--shadow);
}
.checkpoints h3 {
	font-size: .7rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--ink-soft);
	margin-bottom: 12px;
}
.checkpoints li {
	display: flex;
	gap: 14px;
	padding: 16px 0;
	border-top: 1px dashed color-mix(in srgb, var(--line) 35%, transparent);
}
.checkpoints li:first-child { border-top: 0; padding-top: 4px; }
.cp-num {
	flex: 0 0 auto;
	padding: 2px 5px;
	border: 1px solid var(--line);
	background: var(--bg-2);
	font-family: var(--font-mono);
	font-size: .58rem;
	font-weight: 700;
	color: var(--accent);
	height: fit-content;
}
.checkpoints h4 { font-size: .8rem; text-transform: uppercase; margin-bottom: 4px; }
.checkpoints p { font-size: .82rem; color: var(--ink-soft); }

/* ---------- Contacto ---------- */
.contact-inner {
	max-width: 780px;
	margin-inline: auto;
	padding: 52px 32px;
	border: var(--border);
	background: var(--panel);
	box-shadow: 10px 10px 0 var(--shadow);
	text-align: center;
}
.contact-inner .eyebrow { justify-content: center; }
.contact-inner h2 { margin-bottom: 18px; }
.contact-inner .lead { margin: 0 auto 28px; }
.contact-inner .lead + .btn { margin-bottom: 26px; }

.socials {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 22px;
	margin-bottom: 20px;
}
.socials a {
	font-family: var(--font-mono);
	font-size: .68rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 2px solid var(--accent);
	padding-bottom: 2px;
}
.socials a:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: var(--border); padding-block: 26px; }
.footer-inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 24px;
	font-family: var(--font-mono);
	font-size: .62rem;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

/* ---------- Sprites ---------- */
.sprite {
	display: block;
	width: 48px;
	height: 48px;
	background-image: url("/assets/images/sprites/character.png");
	background-repeat: no-repeat;
	background-size: 240px 48px;
	background-position: -96px 0;
	image-rendering: pixelated;
}
.sprite.is-flipped { transform: scaleX(-1); }
.sprite.is-jumping { animation: hop .42s steps(5, end); }
@keyframes hop {
	0% { translate: 0 0; }
	35% { translate: 0 -20px; }
	70% { translate: 0 -14px; }
	100% { translate: 0 0; }
}

.scene-char { width: 96px; height: 96px; background-size: 480px 96px; background-position: -192px 0; }
.thumb-char { width: 48px; height: 48px; }

/* ---------- Franja de nivel (HUD) ---------- */
.level-strip {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 40;
	height: var(--strip-h);
	background: var(--strip-bg);
	border-top: var(--border);
	overflow: hidden;
	pointer-events: none;
}
.strip-progress {
	position: absolute;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	background: var(--accent);
	z-index: 5;
	transition: width .12s linear;
}
.strip-sky {
	position: absolute;
	inset: 0 0 30px 0;
	background:
		url("/img/background/night/2.png") repeat-x bottom / auto 190px,
		linear-gradient(180deg, #0b0916 0%, #211540 100%);
}
.strip-clouds {
	position: absolute;
	inset: 0 0 30px 0;
	background: url("/img/background/night/4.png") repeat-x bottom / auto 260px;
	opacity: .38;
	background-position-x: 0;
}
.strip-ground {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 30px;
	background: url("/assets/ui/ground.png") repeat-x 0 0 / 32px 30px;
	image-rendering: pixelated;
	background-position-x: 0;
}
.strip-avatar {
	position: absolute;
	left: 6%;
	bottom: 27px;
	z-index: 3;
	transition: left .1s linear;
}
.sprite--strip {
	width: 48px;
	height: 48px;
	filter: drop-shadow(0 0 0 transparent);
}
.strip-label {
	position: absolute;
	top: 10px;
	right: 14px;
	z-index: 4;
	display: flex;
	gap: 14px;
	font-family: var(--font-mono);
	font-size: .6rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .72);
}
.strip-coins b { color: var(--coin); }

/* ---------- Diálogo del juego ---------- */
.game-dialog {
	width: min(1180px, calc(100vw - 32px));
	max-width: none;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ink);
}
.game-dialog::backdrop {
	background: rgba(6, 4, 12, .84);
	backdrop-filter: blur(3px);
}
.game-shell {
	display: flex;
	flex-direction: column;
	max-height: calc(100dvh - 48px);
	border: var(--border);
	background: var(--panel);
	box-shadow: 12px 12px 0 rgba(0, 0, 0, .45);
}
.game-bar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 8px 12px;
	border-bottom: var(--border);
	background: var(--bg-2);
}
.game-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-mono);
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	margin-right: auto;
	white-space: nowrap;
}
.rec {
	width: 8px;
	height: 8px;
	background: #ff5a7a;
	border: 1px solid var(--line);
	animation: blink 1.4s steps(2, end) infinite;
}
.game-hint {
	font-family: var(--font-mono);
	font-size: .6rem;
	letter-spacing: .04em;
	color: var(--ink-soft);
	white-space: nowrap;
}
.game-actions { display: flex; align-items: center; gap: 12px; }
.game-link {
	font-family: var(--font-mono);
	font-size: .6rem;
	letter-spacing: .06em;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 2px solid var(--accent);
	white-space: nowrap;
}
.game-frame {
	position: relative;
	aspect-ratio: 16 / 9;
	max-height: calc(100dvh - 96px);
	min-height: 0;
	background: #000;
}
.game-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
}
.game-loading {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: grid;
	justify-items: center;
	place-content: center;
	gap: 12px;
	padding: 24px;
	background: radial-gradient(circle at 50% 38%, #2a1b46 0%, #0b0916 72%);
	color: #f4f0ff;
	text-align: center;
	transition: opacity .35s ease, visibility .35s ease;
}
.game-loading.is-ready { opacity: 0; visibility: hidden; }
.loader-sprite {
	width: 64px;
	height: 64px;
	background-size: 320px 64px;
	background-position: 0 0;
	animation: loader-walk .55s steps(2, end) infinite;
}
@keyframes loader-walk { to { background-position: -128px 0; } }
.loader-title {
	font-family: var(--font-mono);
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.loader-note {
	font-family: var(--font-mono);
	font-size: .58rem;
	letter-spacing: .05em;
	color: #a99fc9;
}
.loader-bar {
	display: block;
	width: 190px;
	height: 8px;
	border: 1px solid #6d5a99;
	background: #17122b;
	overflow: hidden;
}
.loader-bar span {
	display: block;
	width: 40%;
	height: 100%;
	background: var(--accent);
	animation: loader-slide 1.2s steps(12, end) infinite;
}
@keyframes loader-slide {
	from { transform: translateX(-110%); }
	to { transform: translateX(360%); }
}

/* Controles táctiles dentro de la demo */
.game-rotate { display: none; }
@media (max-width: 820px) and (orientation: portrait) {
	.game-frame {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		background: #050509;
	}
	.game-frame iframe {
		position: relative;
		inset: auto;
		width: 100%;
		height: auto;
		aspect-ratio: 16 / 9;
		border-block: 1px solid #27272a;
	}
	.game-rotate {
		display: block;
		position: static;
		order: -1;
		translate: none;
		z-index: 4;
		margin: 0 0 12px;
		padding: 4px 10px;
		border: 1px solid rgba(255, 255, 255, .35);
		background: rgba(11, 9, 22, .72);
		color: #fff;
		font-family: var(--font-mono);
		font-size: .56rem;
		letter-spacing: .08em;
		text-transform: uppercase;
		white-space: nowrap;
		pointer-events: none;
	}
}
.game-touch {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 3;
	display: none;
	justify-content: space-between;
	align-items: flex-end;
	gap: 12px;
	pointer-events: none;
}
.touch-pad { display: flex; gap: 8px; }
.game-touch button {
	width: 54px;
	height: 54px;
	display: grid;
	place-items: center;
	border: 2px solid rgba(255, 255, 255, .75);
	background: rgba(11, 9, 22, .72);
	color: #fff;
	font-family: var(--font-mono);
	font-size: 1.05rem;
	font-weight: 700;
	pointer-events: auto;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	cursor: pointer;
}
.game-touch button.is-down { background: var(--accent); color: var(--accent-ink); }
.game-touch .touch-jump {
	width: auto;
	padding-inline: 20px;
	font-size: .68rem;
	letter-spacing: .08em;
	text-transform: uppercase;
}

@media (hover: none), (pointer: coarse) {
	.game-touch { display: flex; }
}

/* ---------- 404 ---------- */
.page-404 {
	display: grid;
	place-items: center;
	min-height: 100svh;
	padding: 32px 24px;
	text-align: center;
}
.page-404 .wrap { max-width: 620px; }
.page-404 h1 {
	font-size: clamp(3rem, 12vw, 7rem);
	line-height: .9;
	letter-spacing: -.06em;
	text-transform: uppercase;
}
.page-404 .lead { margin: 18px auto 28px; }
.page-404 .cta-row { justify-content: center; }
.page-404 .small { margin-top: 24px; }
.pit {
	position: relative;
	height: 150px;
	margin: 16px auto 24px;
	max-width: 340px;
	overflow: hidden;
	border: var(--border);
	background: linear-gradient(180deg, #0b0916, #211540);
}
.pit .sprite {
	position: absolute;
	left: 50%;
	top: 18px;
	margin-left: -24px;
	animation: fall 2.2s steps(10, end) infinite;
}
.pit .strip-ground {
	z-index: 2;
}
@keyframes fall {
	0% { translate: 0 0; opacity: 1; }
	70% { translate: 0 70px; opacity: 1; }
	100% { translate: 0 96px; opacity: 0; }
}

.noscript-note {
	max-width: 720px;
	margin: 12px auto 0;
	padding: 10px 12px;
	border: var(--border);
	background: var(--panel);
	font-family: var(--font-mono);
	font-size: .68rem;
	box-shadow: 4px 4px 0 var(--shadow);
}

/* ---------- Reveal ---------- */
.js .reveal {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity .5s ease, transform .5s ease;
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Sin JavaScript, los controles que solo funcionan con JS no se muestran. */
html:not(.js) .icon-btn { display: none; }
html:not(.js) .scene { cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
	.hero-grid { grid-template-columns: 1fr; gap: 40px; min-height: 0; padding-block: 56px 64px; }
	.hero-art { justify-self: start; max-width: 460px; }
	.hero::before {
		background:
			linear-gradient(180deg, color-mix(in srgb, var(--bg) 86%, transparent) 0%, var(--bg) 58%),
			linear-gradient(180deg, transparent 70%, var(--bg) 100%);
	}
	.about { grid-template-columns: 1fr; gap: 40px; }
	.coins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
	.header-inner { flex-wrap: wrap; gap: 10px; }
	.site-nav {
		order: 3;
		width: 100%;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.site-nav::-webkit-scrollbar { display: none; }
	.site-nav a { padding: 6px 8px; }
	.header-actions { margin-left: auto; }
	.hero-copy h1 { font-size: clamp(2.1rem, 8vw, 3.2rem); }
	.section { padding-block: 72px; }
	.xp-item { grid-template-columns: 1fr; gap: 12px; }
	.xp-meta { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
	.lateral { grid-template-columns: 1fr; }
	.lateral .thumb {
		min-height: 190px;
		border-right: 0;
		border-bottom: var(--border);
	}
	.game-hint { display: none; }
	.game-dialog { width: 100vw; height: 100dvh; margin: 0; }
	.game-shell { height: 100dvh; max-height: 100dvh; border: 0; box-shadow: none; }
	.game-frame { aspect-ratio: auto; flex: 1; }
	.game-bar { flex-wrap: wrap; }
	html { scroll-padding-top: 104px; }
}

@media (max-width: 560px) {
	:root { --strip-h: 80px; }
	.wrap { padding-inline: 18px; }
	.game-bar { flex-wrap: nowrap; gap: 8px; padding: 6px 8px; }
	.game-title { font-size: .62rem; }
	.game-link { display: none; }
	.game-actions { gap: 8px; }
	.hero { border-bottom: var(--border); }
	.hero-grid { padding-block: 40px 56px; }
	.hero-art { max-width: 100%; }
	.cta-row .btn { flex: 1 1 auto; }
	.coins { grid-template-columns: 1fr; }
	.levels-grid { grid-template-columns: 1fr; }
	.level-card:hover { transform: none; box-shadow: 6px 6px 0 var(--shadow); }
	.contact-inner { padding: 36px 20px; box-shadow: 6px 6px 0 var(--shadow); }
	.strip-label { display: none; }
	.sprite--strip { width: 40px; height: 40px; }
	.scene-platform { width: 150px; height: 47px; margin-left: -75px; }
	.scene-char { width: 72px; height: 72px; margin-left: -36px; bottom: calc(16% + 43px); }
	.footer-inner { flex-direction: column; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}
	.js .reveal { opacity: 1; transform: none; }
	.bg-3, .bg-4 { animation: none; }
}
