:root { --fondo: #0f1712; --carta: #1b2a1f; --carta2: #233527; --borde: #3c5740; --tinta: #eef3df; --suave: #a8b89c; --toxico: #9be15d; --sangre: #d9483b; --hueso: #e9e2cc; --ambar: #f2c35b; color-scheme: dark; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body { min-height: 100vh; min-height: 100dvh; color: var(--tinta); font: 16px/1.4 ui-rounded, "SF Pro Rounded", system-ui, sans-serif; background: radial-gradient(90% 55% at 85% 0%, #25402b, transparent 70%), radial-gradient(80% 50% at 0% 60%, #2a2138, transparent 70%), var(--fondo); background-attachment: fixed; overflow-x: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--toxico); outline-offset: 2px; }
h1, h2, .titulo b { font-family: Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif; font-weight: 400; letter-spacing: .03em; }
h2 { font-size: 1.75rem; line-height: 1.15; }
#pantalla { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 10px) 14px calc(24px + env(safe-area-inset-bottom)); }

.redondo { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--carta2); border: 2px solid var(--borde); font-size: 1.15rem; font-weight: 800; display: grid; place-items: center; }
#sonido { position: fixed; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 8; opacity: .85; }
.boton { padding: 11px 18px; border-radius: 14px; background: var(--carta2); border: 2px solid var(--borde); font-weight: 800; box-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.boton:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.boton:disabled { opacity: .4; }
.boton.principal { background: linear-gradient(180deg, #b5ee73, #74bd3c); border-color: #2f5418; color: #13210a; }
.boton.grande { display: block; width: 100%; font-size: 1.12rem; padding: 15px; }
.boton.grande small { display: block; font-size: .8rem; font-weight: 600; opacity: .75; }
.boton.fantasma { background: transparent; box-shadow: none; color: var(--suave); }
.boton.mini { padding: 7px 11px; font-size: .85rem; border-radius: 11px; }
.boton.activo { border-color: var(--toxico); background: #35542a; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.tarjeta { background: linear-gradient(180deg, var(--carta2), var(--carta)); border: 2px solid var(--borde); border-radius: 22px; padding: 22px 18px; text-align: center; box-shadow: 0 18px 40px -18px #000; }
.zombi, .heroe { display: block; overflow: visible; }
.latido { transform-box: fill-box; }

/* Portada */
.cartel { position: relative; margin: 0 -14px; height: 250px; overflow: hidden; }
.ciudad { position: absolute; inset: 0; width: 100%; height: 100%; }
.cartel h1 { position: absolute; left: 0; right: 0; top: 34px; text-align: center; font-size: clamp(3rem, 15vw, 4.9rem); line-height: .92; text-transform: uppercase; color: var(--hueso); text-shadow: 0 5px 0 #182414, 0 0 26px #000; transform: rotate(-3deg); }
.cartel h1 em { display: block; font-style: normal; color: var(--toxico); text-shadow: 0 5px 0 #1f3a10, 0 0 30px rgba(155, 225, 93, .45); }
.lema { text-align: center; color: var(--suave); margin: 14px 0 16px; }
.menu { display: grid; gap: 11px; max-width: 360px; margin: 0 auto; }
.record { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--ambar); }
.desfile { display: flex; justify-content: center; gap: 4px; margin-top: 18px; }
.desfile .zombi { width: 62px; animation: bamboleo 2.6s ease-in-out infinite; }
.desfile .zombi:nth-child(2n) { animation-delay: -1.1s; margin-top: 8px; }
@keyframes bamboleo { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-6px); } }

.centrada { display: grid; align-items: center; min-height: 86vh; }
.historia { text-align: center; display: grid; justify-items: center; gap: 14px; }
.historia p { color: var(--suave); max-width: 380px; }
.historia h2 { font-size: 2.4rem; color: var(--hueso); }
.historia .boton.grande { max-width: 340px; }
.heroe.grande { width: 140px; animation: flota 2.4s ease-in-out infinite; }
@keyframes flota { 50% { transform: translateY(-8px); } }
.zona { text-transform: uppercase; letter-spacing: .18em; font-size: .8rem; }
.premio { color: var(--ambar) !important; font-weight: 800; }
.barco { font-size: 6rem; animation: flota 3s ease-in-out infinite; }
.grupo-z { display: flex; justify-content: center; margin-bottom: 8px; }
.grupo-z .zombi { width: 70px; margin: 0 -6px; }
.grupo-z.grandes .zombi { width: 110px; }
.zombi.cargando { width: 110px; animation: bamboleo 1.2s ease-in-out infinite; }
.barracarga { width: 240px; height: 10px; background: #0007; border-radius: 9px; overflow: hidden; }
.barracarga b { display: block; width: 0; height: 100%; background: var(--toxico); }

/* Barra superior */
.barra { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.titulo { flex: 1; min-width: 0; line-height: 1.15; }
.titulo small { display: block; color: var(--suave); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.titulo b { font-size: 1.45rem; }
.contadores { display: flex; gap: 6px; font-weight: 800; font-size: .92rem; white-space: nowrap; }
.contadores span { background: #0006; border-radius: 99px; padding: 5px 10px; }
.contadores:empty { display: none; }

/* Tablero */
.tablero { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important; }
.tablero ~ dialog { margin: auto; }
body:has(.tablero) #sonido, body:has(.enjuego) #sonido { display: none; }
.distancia { text-align: center; font-size: .9rem; padding: 6px; border-radius: 12px; background: #0005; margin-bottom: 8px; }
.distancia.peligro { background: rgba(217, 72, 59, .3); animation: alarma 1s ease-in-out infinite; }
@keyframes alarma { 50% { background: rgba(217, 72, 59, .6); } }
.mapa { flex: 1; min-height: 150px; overflow-y: auto; border-radius: 22px; border: 2px solid var(--borde); background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .06), transparent 30%), radial-gradient(circle at 80% 70%, rgba(0, 0, 0, .35), transparent 45%), var(--tono); box-shadow: inset 0 0 60px #000a; }
.mapa svg { display: block; width: 100%; max-width: 430px; margin: 0 auto; }
.senda { fill: none; stroke: #8a7a58; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; }
.senda.borde { stroke: #241e14; stroke-width: 34; }
.senda.rayas { stroke: #e9e2cc; stroke-width: 2.5; stroke-dasharray: 7 12; opacity: .55; }
.casilla circle { fill: #e9e2cc; stroke: #241e14; stroke-width: 3.5; }
.casilla.pasada circle { fill: #9be15d; }
.casilla text { text-anchor: middle; font: 800 15px ui-rounded, system-ui, sans-serif; fill: #241e14; }
.deco { font-size: 28px; text-anchor: middle; opacity: .8; }
.destino { text-anchor: middle; font: 20px Impact, sans-serif; fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 4px; }
.ficha-heroe, .ficha-horda { transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
.ficha-horda { transition-duration: .7s; filter: drop-shadow(0 0 7px rgba(217, 72, 59, .9)); }
.acciones { padding-top: 8px; }
.mochila { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-weight: 800; }
.elige { text-align: center; margin: 7px 0 6px; font-size: .9rem; color: var(--suave); }
.elige b { color: var(--ambar); }
.moviendo .acciones { visibility: hidden; }
.ofertas { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.oferta { display: grid; justify-items: center; align-content: start; gap: 2px; text-align: center; padding: 10px 8px; border-radius: 18px; background: linear-gradient(180deg, var(--carta2), var(--carta)); border: 2px solid var(--borde); box-shadow: 0 5px 0 rgba(0, 0, 0, .4); }
.oferta:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.oferta:disabled { opacity: .45; }
.oferta span { font-size: 1.7rem; }
.oferta b { font-size: 1rem; }
.oferta small { font-size: .76rem; color: var(--suave); line-height: 1.25; }
.oferta em { font-style: normal; color: var(--ambar); font-weight: 800; letter-spacing: 2px; }
.ofertas.columna { grid-template-columns: 1fr; margin-top: 12px; }
.oferta.ancha { grid-template-columns: 40px 1fr auto; justify-items: start; align-items: center; column-gap: 8px; text-align: left; }
.oferta.ancha span { grid-row: span 2; }
.oferta.ancha em { grid-column: 3; grid-row: 1 / span 2; letter-spacing: 0; }
.dificultad { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.ofertas.rejilla .oferta:last-child:nth-child(odd) { grid-column: span 2; }

/* Ventanas */
dialog { margin: auto; width: min(420px, calc(100vw - 28px)); max-height: 88vh; overflow: auto; text-align: center; color: var(--tinta); background: linear-gradient(180deg, var(--carta2), var(--carta)); border: 2px solid var(--borde); border-radius: 24px; padding: 22px 18px; }
dialog::backdrop { background: rgba(3, 8, 4, .72); backdrop-filter: blur(4px); }
dialog p { margin-top: 10px; }
#confeti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* Elementos comunes de los retos */
.intro { margin-top: 12px; }
.intro p { color: var(--suave); margin: 10px 0 18px; }
.zombi.asoma { width: 110px; margin: 0 auto 8px; animation: bamboleo 3s ease-in-out infinite; }
.resultado { margin-bottom: 14px; animation: subir .4s ease-out; }
.resultado p { margin: 8px 0 14px; }
.resultado small { color: var(--suave); }
.resultado .boton + .boton { margin-top: 9px; }
.juego.terminado .area { opacity: .55; pointer-events: none; }
@keyframes subir { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.estrellas { font-size: 3.1rem; line-height: 1; color: #51634b; }
.estrellas span { display: inline-block; margin: 0 3px; }
.estrellas span.on { color: var(--ambar); text-shadow: 0 0 18px rgba(242, 195, 91, .7); animation: estrella .5s calc(var(--i) * .2s) backwards cubic-bezier(.2, 1.9, .4, 1); }
@keyframes estrella { from { transform: scale(0) rotate(-90deg); } }
.consigna { text-align: center; color: var(--suave); font-size: .94rem; margin-bottom: 10px; }
.marcador { text-align: center; font-weight: 800; margin: 6px 0; }
.mensaje { text-align: center; min-height: 2.9em; margin: 8px 0 0; display: flex; align-items: center; justify-content: center; font-size: .95rem; color: var(--ambar); }
.entrada { display: flex; gap: 8px; padding: 6px; background: #0b110c; border: 2px solid var(--borde); border-radius: 18px; position: sticky; top: 6px; z-index: 4; }
.entrada:focus-within { border-color: var(--toxico); }
.entrada input { flex: 1; min-width: 0; background: none; border: 0; padding: 8px 12px; font-size: 1.15rem; font-weight: 700; }
.entrada input:focus { outline: none; }
.entrada button { padding: 9px 18px; border-radius: 12px; font-weight: 800; background: linear-gradient(180deg, #b5ee73, #74bd3c); color: #13210a; }
.temblor { animation: temblor .4s; }
@keyframes temblor { 25% { transform: translateX(-8px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }
.tiempo { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tiempo i { flex: 1; height: 11px; background: #0008; border-radius: 9px; overflow: hidden; }
.tiempo b { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #74bd3c, #b5ee73); }
.tiempo b.apurado { background: var(--sangre); }
.tiempo span { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.teclado { display: grid; gap: 6px; margin-top: 12px; }
.teclado div { display: flex; gap: 4px; justify-content: center; }
.teclado button { flex: 1; min-width: 0; max-width: 46px; height: 50px; border-radius: 8px; background: #33472f; font-weight: 800; text-transform: uppercase; box-shadow: 0 3px 0 #0007; }
.teclado button.ancha { max-width: 70px; flex: 1.7; font-size: .78rem; }
.teclado button.si, .teclado .m2 { background: #4f9d3a; }
.teclado button.m1 { background: #c69a2c; }
.teclado button.no, .teclado .m0 { background: #151b15; color: #66735f; box-shadow: none; }

/* 1. Rastreador */
.radar { border-radius: 22px; padding: 6px; margin-bottom: 4px; background: radial-gradient(circle, #23452a 0, #102016 55%, #08100a 100%); border: 2px solid var(--borde); }
.radar svg { display: block; width: 100%; max-width: min(300px, 74vw); margin: 0 auto; overflow: visible; }
.anillo { fill: none; stroke: rgba(155, 225, 93, .28); stroke-dasharray: 2 5; }
.cifra { fill: rgba(190, 240, 140, .6); font-size: 8px; text-anchor: middle; }
.barrido { fill: rgba(155, 225, 93, .13); transform-origin: 150px 150px; animation: girar 6s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.rotulo { fill: #fff; font-size: 12px; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: #08100a; stroke-width: 4px; stroke-linejoin: round; }
.estado { text-align: center; font-weight: 800; margin: 4px 0 8px; }
.lista { list-style: none; display: grid; gap: 6px; margin-top: 12px; }
.fila { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--carta); border-radius: 12px; border-left: 6px solid var(--c); overflow: hidden; }
.fila.ultima { outline: 2px solid var(--c); }
.fila i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c); opacity: .26; }
.fila span, .fila b, .fila em { position: relative; }
.fila span { flex: 1; font-weight: 800; }
.fila em { font-size: .75rem; color: var(--suave); }

/* 2. Infectado */
.grupo { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.superviviente { grid-column: span 2; display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 18px; background: var(--carta); border: 2px solid var(--borde); box-shadow: 0 5px 0 #0007; min-width: 0; }
.superviviente:nth-child(4) { grid-column: 2 / span 2; }
.superviviente svg { width: 62px; height: 62px; }
.superviviente span { font-weight: 800; font-size: .98rem; overflow-wrap: anywhere; }
.superviviente.infectado { background: #3d5c22; border-color: var(--toxico); animation: temblor .5s 2; }
.superviviente.error { background: #5a211c; border-color: var(--sangre); }

/* 3. Antídoto */
.huecos { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.hueco { flex: 1; max-width: 48px; height: 56px; display: grid; place-items: center; border-radius: 10px; background: #0b110c; border: 2px solid var(--borde); border-bottom-width: 5px; font-size: 1.55rem; font-weight: 900; text-transform: uppercase; }
.hueco.fija { border-color: var(--ambar); color: var(--ambar); }
.hueco.revelada { color: var(--sangre); }
.huecos.bien .hueco { background: #3d5c22; border-color: var(--toxico); }
.frascos { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.frasco { position: relative; width: 56px; height: 76px; border-radius: 12px 12px 20px 20px; border: 3px solid #b9d9c9; background: linear-gradient(180deg, rgba(190, 230, 215, .12) 0 34%, #63b233 34% 100%); margin-top: 9px; }
.frasco::before { content: ""; position: absolute; left: 11px; right: 11px; top: -12px; height: 10px; border-radius: 4px; background: #8b6a44; }
.frasco span { font-size: 1.8rem; font-weight: 900; text-transform: uppercase; text-shadow: 0 2px 4px #000; }
.frasco:disabled { opacity: .22; }

/* 4. Barricada */
.puerta { --cerca: 0; position: relative; width: 210px; height: 190px; margin: 0 auto; border-radius: 100px 100px 6px 6px; border: 8px solid #5a4128; background: radial-gradient(circle at 50% 55%, #2d4a22, #050805 70%); overflow: hidden; }
.puerta .atacante { position: absolute; width: 150px; left: 22px; bottom: -12px; transform: scale(calc(.62 + var(--cerca) * .55)); transform-origin: 50% 100%; transition: transform .5s; }
.tablones i { position: absolute; left: -12px; right: -12px; height: 23px; top: calc(14px + var(--i) * 28px); background: linear-gradient(180deg, #b0824f, #8a6038); border: 2px solid #3d2917; border-radius: 4px; transform: rotate(calc((var(--i) - 2.5) * 2.2deg)); transition: transform .6s ease-in, opacity .6s ease-in; }
.tablones i::before, .tablones i::after { content: ""; position: absolute; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: #2b2b2b; left: 20px; }
.tablones i::after { left: auto; right: 20px; }
.tablones i.roto { transform: translateY(170px) rotate(calc((var(--i) - 2.5) * 22deg)); opacity: 0; }
.enjuego .huecos { gap: 4px; }

/* 5. Búnker */
.clave { display: grid; gap: 6px; justify-content: center; }
.clave div { display: flex; gap: 6px; }
.clave span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; background: #0b110c; border: 2px solid var(--borde); font-size: 1.5rem; font-weight: 900; text-transform: uppercase; }
.clave span.llena { border-color: var(--hueso); }
.clave span.m2 { background: #4f9d3a; border-color: #7fd160; animation: voltear .45s calc(var(--i) * .1s) backwards; }
.clave span.m1 { background: #c69a2c; border-color: #efc654; animation: voltear .45s calc(var(--i) * .1s) backwards; }
.clave span.m0 { background: #2b332b; border-color: #3a453a; animation: voltear .45s calc(var(--i) * .1s) backwards; }
@keyframes voltear { from { transform: rotateX(90deg); } }

/* 6. Horda */
.calle { position: relative; height: 92px; border-radius: 18px; overflow: hidden; border: 2px solid var(--borde); background: linear-gradient(180deg, #1b2740 0 56%, #3b3d3a 56% 100%); }
.calle .defensor { position: absolute; left: 8px; bottom: 6px; width: 62px; }
.hordaz { --avance: 0; position: absolute; bottom: 6px; display: flex; left: calc(100% - 150px - (100% - 230px) * var(--avance)); transition: left .25s linear; }
.hordaz .zombi { width: 56px; margin-right: -20px; animation: bamboleo .9s ease-in-out infinite; }
.hordaz .zombi:nth-child(2n) { animation-delay: -.4s; margin-bottom: 10px; }
.fichas { display: flex; gap: 5px; justify-content: center; margin: 4px 0 10px; }
.ficha { flex: 1 1 0; min-width: 0; max-width: 44px; height: 48px; border-radius: 9px; background: var(--hueso); color: #1c2418; font-size: 1.5rem; font-weight: 900; text-transform: uppercase; box-shadow: 0 4px 0 #8d856a; }
.ficha:active { transform: translateY(3px); box-shadow: 0 1px 0 #8d856a; }
.nube { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.nube span { background: var(--carta2); border-radius: 99px; padding: 5px 11px; font-weight: 700; animation: subir .3s; }
.nube b { color: var(--toxico); }

/* 7. Puente */
.puentev { display: flex; flex-direction: column; align-items: center; margin-bottom: 12px; padding: 12px; border-radius: 22px; border: 2px solid var(--borde); background: repeating-linear-gradient(172deg, #17384a 0 14px, #143142 14px 28px); }
.orilla { width: 100%; text-align: center; padding: 10px; border-radius: 14px; background: #4b6b31; border: 2px solid #22350f; font: 1.5rem Impact, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.orilla.meta { background: #7a5a24; border-color: #3d2b0c; }
.orilla.meta::after { content: " 🏁"; }
.tablon { width: 74%; margin: 4px 0; padding: 7px 14px; display: flex; justify-content: space-between; border-radius: 6px; background: linear-gradient(180deg, #b0824f, #8a6038); border: 2px solid #3d2917; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; animation: subir .3s; }
.tablon small { opacity: .75; }
.hueco-puente { margin: 10px 0; font-size: .85rem; color: #b9d7e6; }
.union { margin: 6px 0; color: var(--toxico); font-size: 1.5rem; }

@media (max-height: 700px) {
  .tablero .oferta small { display: none; }
  .puerta { transform: scale(.82); margin-bottom: -30px; margin-top: -16px; }
  .clave span { width: 42px; height: 42px; font-size: 1.3rem; }
  .teclado button { height: 44px; }
}
@media (max-width: 360px) { .clave span { width: 42px; height: 42px; } .superviviente svg { width: 50px; height: 50px; } .hueco { font-size: 1.2rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
