/* ---- TIPOGRAFÍA ----
   La fuente del juego es fonts/angies-new-house.ttf ("Angie's New House", LeFly Fonts, gratis en
   dafont.com). Para cambiarla, reemplaza el archivo (o cambia la ruta de abajo) y ajusta el nombre
   en --font. Los glifos que la fuente no tenga caen en Orbitron.
   Los tamaños de letra (--f-xs ... --f-title) los calcula game.js (setFontSizes) para que la
   cuadrícula de la fuente caiga en píxeles enteros; aquí van con un valor de respaldo.
*/
@font-face {
  font-family: 'AngiesNewHouse';
  src: url('fonts/angies-new-house.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
:root { --font: 'AngiesNewHouse', 'Orbitron', 'Courier New', monospace; --ui: #ffffff; --bg: #000000; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #e9ebf0; color: #fff; font-family: var(--font); user-select: none; -webkit-user-select: none; }

/* ---- Marco tipo teléfono: #app se centra y mantiene la proporción; el JS (layoutApp) le da el tamaño.
   Todas las medidas de la UI usan cqw/cqh (relativas al marco), no a la ventana. ---- */
#app { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background: #000; container-type: size; z-index: 1; }
#app.framed { border-radius: 26px; box-shadow: 0 0 70px 6px rgba(0,0,0,.55), 0 0 18px rgba(0,0,0,.35); }

/* ---- Fondo de la página por mapa (pantallas anchas). Cada .bd es un fondo; el activo lleva .on
   y cambian con un fundido. Las animaciones solo corren en el fondo visible. ---- */
#backdrop { position: fixed; inset: 0; z-index: 0; background: #111; }
.bd { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity .9s ease; }
.bd.on { opacity: 1; }
.bd::before, .bd::after { content: ''; position: absolute; }

/* DEFAULT: blanco con luces cian y rosa, y un piso de losas que avanza como el camino */
.bd-default { background:
  radial-gradient(60vmax 60vmax at 10% 15%, rgba(37,201,184,.42), transparent 62%),
  radial-gradient(55vmax 55vmax at 90% 88%, rgba(233,143,210,.48), transparent 62%), #eef0f5; }
.bd-default::before { left: -50%; right: -50%; top: 45%; bottom: -40%;
  background-image: linear-gradient(rgba(31,58,166,.10) 3px, transparent 3px), linear-gradient(90deg, rgba(31,58,166,.10) 3px, transparent 3px);
  background-size: 70px 70px; transform: perspective(500px) rotateX(58deg); transform-origin: top;
  -webkit-mask-image: linear-gradient(transparent, #000 40%); mask-image: linear-gradient(transparent, #000 40%); }
.bd-default.on::before { animation: bdTiles 2.4s linear infinite; }
@keyframes bdTiles { to { background-position: 0 70px; } }

/* ARCOIRIS: noche con un arco iris gigante detrás del juego (asoma por los dos lados) y luces de
   colores que flotan despacio. Las bandas son los colores de los carriles. */
.bd-rainbow { background: linear-gradient(#0c0b1d, #1c1840 70%, #2a2050); }
.bd-rainbow .arc { position: absolute; left: 50%; top: 100%; width: 170vmin; height: 170vmin; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle closest-side, transparent 58%,
    #a23bff 58% 66%, #3b8bff 66% 74%, #3bff6e 74% 82%, #ffe83b 82% 90%, #ff3b3b 90% 98%, transparent 98%);
  opacity: .8; filter: blur(1.5px) drop-shadow(0 0 30px rgba(255,255,255,.18)); }
.bd-rainbow.on .arc { animation: bdBreathe 6s ease-in-out infinite alternate; }
@keyframes bdBreathe { from { opacity: .62; } to { opacity: .9; } }
.bd-rainbow::before { inset: -10%; background:
  radial-gradient(9vmax 9vmax at 12% 20%, rgba(255,59,59,.30), transparent 70%),
  radial-gradient(7vmax 7vmax at 88% 14%, rgba(255,232,59,.26), transparent 70%),
  radial-gradient(10vmax 10vmax at 82% 48%, rgba(59,255,110,.20), transparent 70%),
  radial-gradient(8vmax 8vmax at 8% 58%, rgba(59,139,255,.30), transparent 70%),
  radial-gradient(9vmax 9vmax at 20% 88%, rgba(162,59,255,.28), transparent 70%); }
.bd-rainbow.on::before { animation: bdFloat 16s ease-in-out infinite alternate; }
@keyframes bdFloat { from { transform: translate(-2%, 2%); } to { transform: translate(2%, -3%); } }

/* ORO: resplandor dorado, rombos grabados y destellos */
.bd-gold { background: radial-gradient(70vmax 55vmax at 50% 40%, #6b4a0c, #22170a 58%, #0b0703); }
.bd-gold::before { inset: 0;
  background: repeating-linear-gradient(45deg, rgba(230,180,34,.13) 0 2px, transparent 2px 48px),
              repeating-linear-gradient(-45deg, rgba(230,180,34,.13) 0 2px, transparent 2px 48px); }
.bd-gold::after { inset: 0; background:
  radial-gradient(3px 3px at 12% 22%, #fff6c8, transparent), radial-gradient(2px 2px at 26% 70%, #ffe27a, transparent),
  radial-gradient(3px 3px at 80% 18%, #fff6c8, transparent), radial-gradient(2px 2px at 88% 64%, #ffe27a, transparent),
  radial-gradient(2px 2px at 70% 86%, #fff6c8, transparent), radial-gradient(3px 3px at 18% 90%, #ffe27a, transparent),
  radial-gradient(2px 2px at 40% 10%, #fff6c8, transparent), radial-gradient(3px 3px at 62% 44%, #ffe27a, transparent); }
.bd-gold.on::after { animation: bdTwinkle 3.2s ease-in-out infinite alternate; }
@keyframes bdTwinkle { from { opacity: .25; } to { opacity: 1; } }

/* SYNTHWAVE: atardecer retro, sol con franjas y piso de rejilla neón */
.bd-synthwave { background: linear-gradient(#0b0016 0%, #240640 38%, #5a0f6a 54%, #c2187a 62%, #0b0016 62.1%); }
.bd-synthwave .sun { position: absolute; left: 50%; top: 62%; width: 100vmin; height: 100vmin;   /* grande: asoma por los dos lados del juego */ transform: translate(-50%, -50%); border-radius: 50%;
  background: linear-gradient(#ffe066, #ff8a3d 45%, #ff2bd6 80%);
  -webkit-mask-image: linear-gradient(#000 52%, transparent 52% 56%, #000 56% 63%, transparent 63% 67%, #000 67% 73%, transparent 73% 78%, #000 78% 84%, transparent 84% 90%, #000 90%);
  mask-image: linear-gradient(#000 52%, transparent 52% 56%, #000 56% 63%, transparent 63% 67%, #000 67% 73%, transparent 73% 78%, #000 78% 84%, transparent 84% 90%, #000 90%);
  clip-path: inset(-20% -20% 50% -20%);   /* solo la mitad de arriba: se oculta tras el horizonte */
  filter: drop-shadow(0 0 40px rgba(255,43,214,.6)); }
.bd-synthwave .floor { position: absolute; left: -60%; right: -60%; top: 62%; height: 120%; background-color: #0b0016;
  background-image: linear-gradient(rgba(255,43,214,.85) 2px, transparent 2px), linear-gradient(90deg, rgba(255,43,214,.85) 2px, transparent 2px);
  background-size: 80px 80px; transform: perspective(400px) rotateX(62deg); transform-origin: top;
  -webkit-mask-image: linear-gradient(rgba(0,0,0,.35), #000 30%); mask-image: linear-gradient(rgba(0,0,0,.35), #000 30%); }
.bd-synthwave.on .floor { animation: bdGrid 1.6s linear infinite; }
@keyframes bdGrid { to { background-position: 0 80px; } }

/* ESPACIO: nebulosas azul, morada y rosa que giran despacio, estrellas a la deriva en dos capas
   (paralaje) que parpadean, y estrellas fugaces de vez en cuando a los lados del juego */
.bd-space { background: #04030c; }
.bd-space .neb { position: absolute; inset: -25%; background:
  radial-gradient(40vmax 32vmax at 30% 35%, rgba(76,111,255,.55), transparent 62%),
  radial-gradient(36vmax 28vmax at 72% 28%, rgba(168,85,247,.5), transparent 62%),
  radial-gradient(40vmax 32vmax at 66% 74%, rgba(236,72,153,.42), transparent 62%); }
.bd-space.on .neb { animation: bdNeb 90s linear infinite; }
@keyframes bdNeb { 0% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(1.12); } 100% { transform: rotate(360deg) scale(1); } }
.bd-space::before, .bd-space::after { inset: 0; z-index: 1; background-image:
  radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 90px 120px, #fff, transparent),
  radial-gradient(1.5px 1.5px at 160px 60px, #cfd8ff, transparent), radial-gradient(1px 1px at 230px 190px, #fff, transparent); }
.bd-space::before { background-size: 251px 211px; }
.bd-space::after { background-size: 383px 307px; background-position: 70px 40px; }
.bd-space.on::before { animation: bdDriftA 140s linear infinite; }
.bd-space.on::after { animation: bdDriftB 90s linear infinite, bdTwinkle 2.6s ease-in-out infinite alternate; }
@keyframes bdDriftA { to { background-position: 251px -211px; } }
@keyframes bdDriftB { from { background-position: 70px 40px; } to { background-position: -313px 347px; } }
.bd-space .shoot { position: absolute; z-index: 2; width: 18vmin; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.9)); transform: rotate(-28deg); }
.bd-space .s1 { left: 6%; top: 18%; }
.bd-space .s2 { right: 10%; top: 52%; }
.bd-space.on .s1 { animation: bdShoot 7s ease-in 1.5s infinite; }
.bd-space.on .s2 { animation: bdShoot 9s ease-in 5s infinite; }
@keyframes bdShoot {
  0% { opacity: 0; transform: rotate(-28deg) translateX(0); }
  2% { opacity: 1; }
  9% { opacity: 0; transform: rotate(-28deg) translateX(28vmin); }
  100% { opacity: 0; transform: rotate(-28deg) translateX(28vmin); }
}

/* BICOLOR: degradado azul -> morado -> rojo que va y viene, con luces amarilla, verde y celeste */
.bd-bicolor { background: linear-gradient(120deg, #2f6bff, #c21cff 50%, #ff3b3b); background-size: 300% 300%; }
.bd-bicolor.on { animation: bdShift 12s ease-in-out infinite alternate; }
@keyframes bdShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.bd-bicolor::before { inset: 0; background:
  radial-gradient(35vmax 35vmax at 15% 80%, rgba(255,226,59,.35), transparent 60%),
  radial-gradient(30vmax 30vmax at 85% 25%, rgba(78,230,255,.35), transparent 60%),
  radial-gradient(28vmax 28vmax at 75% 85%, rgba(61,255,138,.25), transparent 60%); }
.bd-bicolor::after { inset: 0; background: radial-gradient(ellipse 60% 90% at 50% 50%, rgba(18,18,28,.55), transparent 75%); }

@media (prefers-reduced-motion: reduce) {
  .bd, .bd::before, .bd::after, .bd * { animation: none !important; }
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 22px; padding: 24px; }
.screen.solid { background: #000; --ui: #fff; --bg: #000; }
.screen.dim { background: rgba(0,0,0,.75); --ui: #fff; --bg: #000; }
#menu, #hud, #maps { color: var(--ui); }
.hidden { display: none !important; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px; }

.big { font-size: var(--f-xl, 40px); line-height: 1; }
.small { font-size: var(--f-s, 20px); opacity: .85; letter-spacing: .05em; line-height: 1.3; }

.btn { font-family: var(--font); font-size: var(--f-m, 20px); padding: 14px 26px; border: 4px solid var(--ui); background: transparent; color: var(--ui); cursor: pointer; letter-spacing: .05em; line-height: 1; transition: transform .1s, background .15s, color .15s; }
.btn:hover { background: var(--ui); color: var(--bg); }
.btn:active { transform: scale(.95); }
.btn.big { font-size: var(--f-l, 26px); padding: 22px 34px; }
.btn.tiny-btn { font-size: var(--f-s, 20px); padding: 8px 14px; border-width: 3px; }

/* ---- Menú principal: título arriba, "toca para jugar" + récord en medio y los botones justo
   debajo del camino (game.js les pone el top) ---- */
#menu { justify-content: flex-start; padding: 6cqh 16px; cursor: pointer; }
.title { line-height: 0; }
.title canvas { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* zoom: todo el grupo (toca para jugar + highscore) un poco más chico sin cambiar sus proporciones;
   los tamaños de letra van en la cuadrícula de la fuente y solo saltan de 20 en 20 cuadritos */
.menu-tap { margin: auto 0; padding-bottom: 22cqh; display: flex; flex-direction: column; align-items: center; gap: 4cqh; zoom: .85; }
/* "Respira": crece y se aclara suave, en lugar de parpadear */
.tap { font-size: var(--f-tap, 30px); letter-spacing: .05em; text-shadow: 0 3px 0 rgba(0,0,0,.25); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.94); opacity: .55; } 50% { transform: scale(1.04); opacity: 1; } }
/* La palabra Highscore y abajo el número, un poco más grande */
.menu-best { font-size: var(--f-m, 20px); letter-spacing: .05em; opacity: .9; display: flex; flex-direction: column; align-items: center; gap: .3em; }
.menu-best-n { font-size: var(--f-tap, 30px); line-height: 1; }
.menu-buttons { position: absolute; left: 50%; top: 80%; transform: translateX(-50%); width: min(92cqw, 560px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3cqw; }
.menu-buttons .btn { width: 100%; padding: 14px 0; }
@media (prefers-reduced-motion: reduce) { .tap { animation: none; } }

/* ---- HUD ---- */
/* La pausa y el puntaje se miden en cuadritos de la fuente (--hud-u, lo pone game.js en píxeles
   enteros): las barras de la pausa miden 17 de alto, igual que los números, y ambos empiezan en la
   misma línea (--hud-t) y a la misma distancia del borde (--hud-m). --score-dy: del borde de la caja del texto
   a la parte de arriba de los números (depende de la fuente; game.js lo mide). */
#hud { position: absolute; inset: 0; pointer-events: none; --hud-u: 2px; --hud-m: clamp(14px, 6cqw, 36px); --score-dy: -1.3; --hit: calc(var(--hud-u) * 5); }
#btn-pause { pointer-events: auto; position: absolute; top: calc(var(--hud-t, 40px) - var(--hit)); left: calc(var(--hud-m) - var(--hit)); padding: var(--hit);
  background: transparent; border: 0; cursor: pointer; display: flex; gap: calc(var(--hud-u) * 4); }
#btn-pause span { display: block; width: calc(var(--hud-u) * 5); height: calc(var(--hud-u) * 17); background: var(--ui); }
#score-wrap { position: absolute; top: calc(var(--hud-t, 40px) + var(--hud-u) * var(--score-dy)); right: calc(var(--hud-m) - var(--hud-u)); text-align: right; }
#score { font-size: calc(var(--hud-u) * 20); line-height: 1; display: block; transform-origin: 80% 50%; }
#score.bump { animation: bump .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.22); } 100% { transform: scale(1); } }
.float { position: absolute; right: 4px; top: 100%; font-size: var(--f-m, 20px); animation: floatUp .7s ease-out forwards; }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
#countdown { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: var(--f-cd, 100px); line-height: 1; }
#countdown.pop { animation: pop .95s ease-out; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.9); opacity: .6; } }
/* Controles: teclado W / A S D (teclas blancas con borde gris, como un teclado real) */
#controls { position: absolute; left: 50%; top: 14cqh; transform: translateX(-50%); }
.kb { --k: clamp(44px, 14cqw, 92px); display: flex; flex-direction: column; align-items: center; gap: calc(var(--k) * .12); }
.kb-row { display: flex; gap: calc(var(--k) * .12); align-items: flex-start; }
.kb-item { display: flex; flex-direction: column; align-items: center; gap: 6px; width: calc(var(--k) * 1.25); }
.key { width: var(--k); height: var(--k); display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--k) * .42); line-height: 1; color: #1b1b22; background: linear-gradient(#ffffff, #ececf0);
  border: calc(var(--k) * .07) solid #a3a3ab; border-bottom-width: calc(var(--k) * .16); border-radius: calc(var(--k) * .16);
  box-shadow: 0 3px 0 rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.25); }
.kb-dim .key { opacity: .45; }
.kb-empty { visibility: hidden; }
.kb-label { min-height: 1.2em; font-size: var(--f-xs, 14px); letter-spacing: .04em; text-align: center; line-height: 1.2;
  padding: 2px 6px; background: var(--bg); color: var(--ui); }
.kb-label:empty { background: none; }
#ctrl-board .kb { --k: clamp(48px, 15cqw, 96px); }
#ctrl-board .td { width: min(46cqw, 240px); }

/* ---- Controles táctiles ---- */
svg polyline { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: square; stroke-linejoin: miter; }
/* Zonas: tres columnas; solo la parte de abajo muestra divisiones y flechas tenues (no tapan el camino) */
#touch-zones { position: absolute; inset: 0; display: flex; pointer-events: none; }
.tz { flex: 3; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; padding-bottom: 4cqh; }
.tz:nth-child(2) { flex: 4; }   /* centro 40%, lados 30% (ZONE_SIDE en game.js) */
.tz + .tz::before { content: ''; position: absolute; left: 0; bottom: 0; height: 30cqh; border-left: 2px dashed var(--ui); opacity: .22;
  -webkit-mask-image: linear-gradient(transparent, #000 60%); mask-image: linear-gradient(transparent, #000 60%); }
.tz-arrow { width: clamp(26px, 9cqw, 54px); height: clamp(26px, 9cqw, 54px); color: var(--ui); opacity: .28; }
.tz-label { font-size: var(--f-s, 20px); padding: 3px 8px; background: var(--bg); color: var(--ui); opacity: 0; transition: opacity .3s; }
#hud.teach .tz-label { opacity: 1; }
#hud.teach .tz-arrow { opacity: .9; }
#hud.teach .tz + .tz::before { opacity: .6; }
/* Botones: tres botones abajo (← ↑ →) */
#touch-buttons { position: absolute; left: 0; right: 0; bottom: 8cqh; display: flex; justify-content: center; gap: 3cqw; pointer-events: none; }
.tb-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tb { pointer-events: auto; touch-action: none; width: 29cqw; height: 20cqw; display: flex; align-items: center; justify-content: center; padding: 3cqw;
  border: 3px solid var(--ui); color: var(--ui); background: color-mix(in srgb, var(--bg) 55%, transparent); cursor: pointer; transition: transform .08s, background .08s; }
.tb:active { transform: scale(.94); background: color-mix(in srgb, var(--ui) 35%, transparent); }
.tb svg { width: 100%; height: 100%; }
.tb-label { font-size: var(--f-s, 20px); padding: 3px 8px; background: var(--bg); color: var(--ui); opacity: 0; transition: opacity .3s; }
#hud.teach .tb-label { opacity: 1; }
/* Diagrama del teléfono en la pantalla CONTROLES */
.td { width: min(60cqw, 300px); aspect-ratio: 9 / 14; border: 4px solid #fff; border-radius: 18px; padding: 8px; }
.td-screen { height: 100%; display: flex; border-radius: 10px; overflow: hidden; }
.td-zone { flex: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.td-zone:nth-child(2) { flex: 4; }
.td-zone + .td-zone { border-left: 2px dashed rgba(255,255,255,.5); }
.td-arrow { width: 40%; color: #fff; }
.td-label { font-size: var(--f-xs, 14px); }
.td-buttons .td-screen { align-items: flex-end; justify-content: center; gap: 6%; padding-bottom: 10%; }
.td-col { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 28%; }
.td-btn { width: 100%; aspect-ratio: 8 / 5; border: 3px solid #fff; display: flex; align-items: center; justify-content: center; padding: 10%; }
.td-btn svg { height: 100%; }
.td-text { max-width: 80cqw; }
/* Ajustes: pestañas SONIDO / CONTROLES / CUENTA y un panel por pestaña */
#settings { justify-content: flex-start; gap: 3cqh; padding-top: 6cqh; }
.set-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(92cqw, 560px); }
.set-tabs .btn { padding-left: 0; padding-right: 0; }
.set-panel { flex: 1; min-height: 0; width: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.4cqh; }
.set-panel-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.acc-name { font-size: var(--f-name, 40px); }
.opt { opacity: .5; }
.opt.on { opacity: 1; background: var(--ui); color: var(--bg); }
.set-grid { display: grid; grid-template-columns: auto auto; align-items: center; gap: 12px 18px; }
.set-grid .small { text-align: right; }
#ctrl-board .kb-label { background: none; color: #fff; font-size: var(--f-s, 20px); }
#hud.shake { animation: shake .18s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---- Pausa: botones uno arriba del otro, del mismo ancho ---- */
.pause-list { display: flex; flex-direction: column; gap: 14px; width: min(64cqw, 340px); }

/* ---- Game over: puntajes grandes arriba (el highscore más) y abajo iconos como en el original:
   [estilo] [REINTENTAR] [x2] y debajo [configuración] [clasificación] ---- */
#gameover { justify-content: flex-start; gap: 3cqh; padding-top: 10cqh; }
#go-score { font-size: var(--f-score, 70px); }
#go-best { font-size: var(--f-high, 86px); }
#gameover .small { font-size: var(--f-m, 20px); }
.go-icons { display: flex; flex-direction: column; align-items: center; gap: 3cqh; margin-top: 1cqh; }
.go-row { display: flex; align-items: center; justify-content: center; gap: 9cqw; }
#go-maps, #go-x2 { position: relative; top: 4cqh; }   /* estilo y x2 un poco más abajo que el centro de reintentar */
.ico { background: transparent; border: 0; padding: 0; color: var(--ui); cursor: pointer; width: 15cqw; max-width: 90px; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center; font-family: var(--font); font-size: var(--f-xl, 40px); line-height: 1; transition: transform .1s, opacity .15s; }
.ico svg { width: 100%; height: 100%; display: block; }
.ico.big { width: 38cqw; max-width: 220px; }
.ico:hover { transform: scale(1.08); }
.ico:active { transform: scale(.92); }
.ico.gone { visibility: hidden; }
/* Animación (la dirige game.js: runGameOverAnim). Los bloques entran rebotando; los iconos saltan
   uno por uno (--i); reintentar da una vuelta cada tanto para invitar a jugar otra vez.
   .still: al volver al game over (de mapas, ajustes o el anuncio) ya no se anima la entrada. */
#gameover.flash::before { content: ''; position: absolute; inset: 0; background: #fff; pointer-events: none; animation: goFlash .3s ease-out forwards; }
@keyframes goFlash { from { opacity: .35; } to { opacity: 0; } }
.go-block { opacity: 0; pointer-events: none; }
.go-block.show { opacity: 1; pointer-events: auto; animation: goIn .4s cubic-bezier(.2, 1.5, .45, 1) backwards; }
@keyframes goIn { 0% { opacity: 0; transform: translateY(4cqh) scale(.5); } 50% { opacity: 1; } }
#go-score-block { position: relative; }
#go-score { will-change: transform; }
.go-icons.show { animation: none; }
.go-icons .ico { opacity: 0; }
.go-icons.show .ico { opacity: 1; animation: icoIn .45s cubic-bezier(.2, 1.7, .45, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes icoIn { 0% { opacity: 0; transform: scale(.2) rotate(-30deg); } 40% { opacity: 1; } }
#go-retry svg { transform-origin: 50% 55%; }
.go-icons.show #go-retry svg { animation: retrySpin 2.6s cubic-bezier(.6, 0, .3, 1) 1.2s infinite; }
@keyframes retrySpin { 0%, 70% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
#gameover.still .go-block.show, #gameover.still .go-icons.show .ico { animation: none; }
.go-ring { position: absolute; left: 50%; width: 40cqw; aspect-ratio: 1; border: max(3px, 1cqw) solid currentColor; pointer-events: none;
  transform: translate(-50%, -50%) rotate(45deg) scale(.2); opacity: .9; animation: goRing .6s cubic-bezier(.1, .6, .3, 1) forwards; }
@keyframes goRing { to { transform: translate(-50%, -50%) rotate(45deg) scale(1.5); opacity: 0; } }
#go-new { margin-top: 8px; visibility: hidden; }
#go-new.stamp { visibility: visible; opacity: 1; color: #ffe066;
  background: linear-gradient(100deg, #ffd23d 0%, #ffd23d 35%, #fff7d1 50%, #ffd23d 65%, #ffd23d 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) backwards, shimmer 2s linear .5s infinite; }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.8) rotate(-12deg); } 50% { opacity: 1; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
#gameover.still #go-new.stamp { animation: shimmer 2s linear infinite; }
.confetti { position: absolute; width: max(6px, 1.8cqw); aspect-ratio: 1; margin: calc(max(6px, 1.8cqw) / -2) 0 0 calc(max(6px, 1.8cqw) / -2); pointer-events: none;
  animation: confetti 1s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes confetti {
  60% { transform: translate(var(--dx), var(--dy)) rotate(calc(var(--r) * .7)); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.1), calc(var(--dy) + 14cqh)) rotate(var(--r)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .go-block.show, .go-icons.show .ico, .go-icons.show #go-retry svg, #go-new.stamp { animation: none; }
  #gameover.flash::before, .go-ring, .confetti { display: none; }
}

/* ---- Anuncio ---- */
#ad { background: #111; }
.ad-bar { width: min(70cqw, 420px); height: 14px; border: 3px solid #fff; }
#ad-fill { height: 100%; width: 0; background: #fff; transition: width 1s linear; }

/* ---- Mapas (tienda): nombre arriba, maqueta en medio, PLAY abajo ---- */
#maps { justify-content: flex-start; padding: 6cqh 24px 4cqh; touch-action: none; user-select: none; }
.maps-mid { position: relative; margin: auto 0; width: 100%; height: 120px; pointer-events: none; }
.maps-mid .lock { position: absolute; left: 50%; top: 0; transform: translateX(-50%); }
.maps-bottom { margin-top: auto; margin-bottom: 18px; }
#maps-back { position: absolute; top: 18px; left: 18px; }
.maps-top, .maps-bottom { perspective: 900px; }
.maps-top { margin-top: 44px; }
.map-name { font-size: var(--f-xl, 40px); line-height: 1; text-shadow: 0 6px 0 rgba(0,0,0,.25); }
.maps-bottom { display: flex; align-items: center; justify-content: center; }
#maps-action { min-width: 200px; display: flex; justify-content: center; }
.play { font-family: var(--font); font-size: var(--f-xl, 40px); line-height: 1; background: transparent; border: 0; color: var(--ui); opacity: .92; cursor: pointer; text-shadow: 0 6px 0 rgba(0,0,0,.25); transition: transform .1s; }
.play:hover { transform: scale(1.06); }
.play:active { transform: scale(.95); }
.nav { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--font); font-size: var(--f-xl, 40px); line-height: 1; background: transparent; border: 0; color: var(--ui); opacity: .45; cursor: pointer; padding: 0 12px; }
.nav:hover { opacity: 1; }
.nav svg { width: clamp(28px, 9cqw, 56px); height: clamp(28px, 9cqw, 56px); display: block; }
.nav.left { left: 4px; }
.nav.right { right: 4px; }
.lock { color: var(--ui); opacity: .95; }
#maps-dots { display: flex; gap: 12px; }
#maps-dots span { width: 12px; height: 12px; background: var(--ui); opacity: .35; }
#maps-dots span.on { opacity: 1; }

/* ---- Cuenta y ranking ---- */
.input { font-family: var(--font); font-size: var(--f-m, 20px); text-transform: uppercase; padding: 10px 14px; width: 12ch; border: 4px solid var(--ui); background: transparent; color: var(--ui); outline: none; letter-spacing: .05em; }
.tiny-note { font-size: var(--f-xs, 14px); opacity: .55; max-width: 80cqw; }
#acc-msg.err { color: #ff6b6b; }
#acc-msg.ok { color: #7dffb0; }
.rank-list { list-style: none; width: min(88cqw, 460px); max-height: 52cqh; overflow-y: auto; font-size: var(--f-s, 20px); text-align: left; border-top: 3px solid var(--ui); border-bottom: 3px solid var(--ui); }
.rank-list li { display: flex; gap: 12px; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.15); }
.rank-list li .n { width: 3.5ch; opacity: .6; text-align: right; }
.rank-list li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list li.me { background: var(--ui); color: var(--bg); }
.rank-list li.me .n { opacity: 1; }
.rank-join { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 84cqw; }

/* Enlaces a Acerca de / Privacidad: en Ajustes y, en pantallas anchas, abajo de la página */
.set-links { display: flex; gap: 1.4em; justify-content: center; }
.set-links a { color: inherit; opacity: .75; }
.site-links { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; gap: 18px; padding: 4px 12px;
  font: 13px/1.4 system-ui, sans-serif; background: rgba(0,0,0,.4); border-radius: 8px 8px 0 0; z-index: 5; }
.site-links a { color: #fff; opacity: .85; text-decoration: none; }
.site-links a:hover { opacity: 1; text-decoration: underline; }
#app:not(.framed) ~ .site-links { display: none; }

/* ---- Pantallas angostas (teléfono en vertical) ---- */
@container (max-width: 520px) {
  .screen { padding: 16px 10px; }
  .row { gap: 8px; }
  .btn { padding: 12px 8px; border-width: 3px; }
  .btn.big { padding: 16px 12px; }
  #maps-action { min-width: 150px; }
}
