/* Patotero. Paleta: agua de laguna (verde azulado), crema, amarillo huevo y naranja pico. */
:root {
    --agua: #1b6f7c;
    --hondo: #0e4f5a;
    --noche: #082830;
    --crema: #fbf6e9;
    --huevo: #ffd166;
    --pico: #ff8c5a;
    --texto: #fbf6e9;
    --suave: rgba(251, 246, 233, .72);
    --panel: rgba(8, 40, 48, .88);
    --borde: rgba(251, 246, 233, .16);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--hondo);
    color: var(--texto);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--huevo); }
[hidden] { display: none !important; }

h1 {
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: .9;
    margin: 0;
}
h1 span { color: var(--huevo); }

.kicker {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    font-weight: 800;
    color: var(--suave);
    margin: 0 0 .6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 0;
    border-radius: 14px;
    padding: .7rem 1.2rem;
    font: inherit;
    font-weight: 800;
    color: #1b1b1b;
    background: var(--huevo);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 0 #c9982f;
    transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c9982f; }
.btn.grande { font-size: 1.15rem; padding: .9rem 1.6rem; }
.btn.chico { padding: .45rem .8rem; font-size: .9rem; box-shadow: 0 3px 0 #c9982f; }
.btn.claro { background: var(--crema); box-shadow: 0 4px 0 #bdb5a0; }

/* ---------------- Portada ---------------- */
.hero {
    position: relative;
    min-height: min(92vh, 760px);
    display: flex;
    align-items: center;
    overflow: hidden;
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(8, 40, 48, .85) 0%, rgba(8, 40, 48, .45) 45%, rgba(8, 40, 48, 0) 70%);
    pointer-events: none;
}
.hero-in {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.25rem;
}
.hero h1 { font-size: clamp(3.4rem, 13vw, 8rem); text-shadow: 0 6px 0 rgba(0, 0, 0, .25); }
.bajada { font-size: clamp(1.05rem, 2.4vw, 1.35rem); max-width: 34rem; margin: 1rem 0 1.5rem; }
.cta { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.unirse { display: flex; gap: .5rem; }
.unirse input {
    width: 7.5rem;
    border-radius: 14px;
    border: 2px solid var(--borde);
    background: rgba(8, 40, 48, .7);
    color: var(--texto);
    font: inherit;
    font-weight: 800;
    letter-spacing: .2em;
    text-align: center;
    padding: .6rem;
    text-transform: uppercase;
}
.nota { color: var(--suave); font-size: .95rem; margin-top: 1.2rem; max-width: 30rem; }

@media (max-width: 800px) {
    .hero { align-items: flex-start; min-height: 100svh; }
    .hero::after { background: linear-gradient(180deg, rgba(8, 40, 48, .9) 0%, rgba(8, 40, 48, .6) 55%, rgba(8, 40, 48, .1) 80%); }
    .hero-in { padding-top: 2rem; }
}

main { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
main section { padding: 3.5rem 0 1rem; }
main h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; margin: 0 0 1.2rem; letter-spacing: -.01em; }
.sub { color: var(--suave); margin-top: -.6rem; }

.pasos ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: paso; }
.pasos li {
    counter-increment: paso;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--borde);
    border-radius: 18px;
    padding: 1.1rem 1.2rem 1.2rem;
}
.pasos li::before {
    content: counter(paso);
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: var(--huevo);
    color: #1b1b1b;
    font-weight: 900;
    margin-bottom: .6rem;
}
.pasos b { display: block; font-size: 1.08rem; }

.dos, .grilla { display: grid; gap: 1rem; }
.dos { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grilla { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.heroes article, .bichos article {
    background: var(--agua);
    border: 1px solid var(--borde);
    border-radius: 18px;
    padding: 1rem 1.2rem 1.2rem;
}
.heroes canvas { width: 100%; height: 150px; display: block; }
.bichos canvas { width: 100%; height: 120px; display: block; }
.heroes h3, .bichos h3 { margin: .3rem 0 .3rem; font-size: 1.3rem; font-weight: 900; }
.bichos h3 { font-size: 1.1rem; }
.heroes p, .bichos p { margin: 0 0 .6rem; color: var(--suave); }
.bichos p { font-size: .95rem; }
.poder { background: rgba(8, 40, 48, .45); border-radius: 12px; padding: .6rem .8rem; color: var(--texto) !important; }
.poder b, .patoteada b { color: var(--huevo); }
.patoteada { margin-top: 1rem; background: rgba(255, 140, 90, .12); border: 1px solid rgba(255, 140, 90, .4); border-radius: 18px; padding: 1rem 1.2rem; }
.final { text-align: center; padding: 3rem 0 4rem !important; }
.pie { text-align: center; color: var(--suave); padding: 2rem 1rem 3rem; font-size: .9rem; }

/* Portada con la misma estética arcade que el juego */
body.portada { --px: "Press Start 2P", ui-monospace, monospace; background: #0b1416; }
.portada .hero-in .logo-px { font-size: clamp(2.2rem, 11vw, 5.5rem); margin: .3rem 0 0; }
.portada .edad { display: inline-block; margin-left: .5rem; padding: .1rem .4rem; background: #d62828; color: #fff; }
.portada .btn-px { display: inline-block; text-decoration: none; }
.portada .unirse input { font-family: var(--px); font-size: .7rem; border-radius: 0; box-shadow: 0 0 0 3px #1b1b1b; border: 0; }
.portada main h2 { font-family: var(--px); font-size: clamp(1rem, 4vw, 1.5rem); line-height: 1.4; }
.portada .heroes article, .portada .bichos article, .portada .pasos li { border-radius: 0; background: #10202a; border: 0; box-shadow: 0 0 0 3px #33505a; }
.portada .pasos li::before { border-radius: 0; font-family: var(--px); font-size: .8rem; }
.portada .patoteada { border-radius: 0; }
.portada .poder { border-radius: 0; }
.portada .heroes canvas, .portada .bichos canvas { image-rendering: pixelated; }
.portada .hero::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .15) 0 1px, transparent 1px 3px); }

/* ---------------- Juego (estética arcade retro) ---------------- */
body.juego {
    --px: "Press Start 2P", ui-monospace, monospace;
    overflow: hidden;
    position: fixed;
    inset: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    background: #0b1416;
}
#cv { position: fixed; inset: 0; display: block; image-rendering: pixelated; }
.blink { animation: parpadeo 1s steps(1) infinite; }
@keyframes parpadeo { 50% { opacity: 0; } }

.btn-px {
    font-family: var(--px);
    font-size: .8rem;
    color: #1b1b1b;
    background: var(--huevo);
    border: 0;
    padding: .9rem 1.2rem;
    cursor: pointer;
    box-shadow: 0 0 0 3px #1b1b1b, 4px 4px 0 3px #1b1b1b;
    text-transform: uppercase;
}
.btn-px:active { transform: translate(3px, 3px); box-shadow: 0 0 0 3px #1b1b1b, 1px 1px 0 3px #1b1b1b; }
.btn-px.chico { font-size: .6rem; padding: .55rem .7rem; }
.btn-px.claro { background: var(--crema); }
.btn-px:disabled { opacity: .45; cursor: not-allowed; }

/* Pantalla de elección */
.arcade {
    position: fixed;
    inset: 0;
    z-index: 5;
    overflow: auto;
    background: rgba(6, 4, 24, .78);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 18px 12px 30px;
    font-family: var(--px);
}
.arcade::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
}
.arcade-in { width: min(560px, 100%); text-align: center; }
.arcade-top { display: flex; justify-content: space-between; font-size: .55rem; color: var(--suave); margin: 0 0 1rem; }
.logo-px {
    font-family: var(--px);
    font-size: clamp(1.8rem, 9vw, 3rem);
    letter-spacing: 0;
    line-height: 1;
    color: #fff;
    text-shadow: 4px 4px 0 #d62828, 8px 8px 0 #1b1b1b;
    margin: 0 0 1.2rem;
}
.logo-px span { color: var(--huevo); }
.elegi { font-size: .75rem; color: #ff8fab; margin: 0 0 1rem; }
.personajes { display: flex; align-items: center; justify-content: center; gap: .8rem; }
.pj {
    position: relative;
    font-family: var(--px);
    background: #10202a;
    color: #fff;
    border: 0;
    box-shadow: 0 0 0 4px #33505a;
    padding: 1.4rem .8rem .8rem;
    width: 44%;
    max-width: 200px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
}
.pj canvas { width: 144px; height: 144px; image-rendering: pixelated; max-width: 100%; }
.pj b { font-size: .95rem; }
.pj small { font-size: .5rem; color: var(--suave); }
.pj .p1 { position: absolute; top: .4rem; left: 50%; transform: translateX(-50%); font-size: .55rem; color: var(--huevo); visibility: hidden; }
.pj.sel { box-shadow: 0 0 0 4px var(--huevo), 0 0 24px rgba(255, 209, 102, .45); background: #1d2b1f; }
.pj.sel .p1 { visibility: visible; animation: parpadeo .6s steps(1) infinite; }
.vs { font-size: 1rem; color: #d62828; text-shadow: 2px 2px 0 #1b1b1b; }
.vs small { font-size: .45rem; color: var(--suave); }

.sel-info {
    margin: 1.2rem 0 1rem;
    background: #0e1a20;
    box-shadow: 0 0 0 3px #33505a;
    padding: .9rem .9rem .6rem;
    text-align: left;
}
.rol { font-size: .6rem; line-height: 1.7; margin: 0 0 .8rem; color: #fff; }
.rol b { color: #1b1b1b; background: var(--huevo); padding: .15rem .35rem; margin-right: .4rem; }
.stats-px { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 1rem; margin-bottom: .8rem; }
.st { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .5rem; color: var(--suave); }
.st i { display: flex; gap: 3px; }
.st b, .st em { width: 10px; height: 10px; display: block; }
.st b { background: #7bd389; box-shadow: inset -2px -2px 0 #3f8a4f; }
.st em { background: #22343a; }
.pod-t { font-size: .6rem; color: #ff8fab; margin: 0 0 .5rem; }
.poderes { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.poderes li { display: flex; gap: .6rem; align-items: flex-start; }
.poderes kbd {
    flex: 0 0 auto;
    min-width: 5.2rem;
    text-align: center;
    font-family: var(--px);
    font-size: .45rem;
    background: #22343a;
    color: var(--huevo);
    padding: .35rem .3rem;
    box-shadow: 0 2px 0 #0a1216;
}
.poderes span { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: .85rem; line-height: 1.35; color: #e8e2d0; }
.poderes span b { color: #fff; }
.k-tel { display: none; }
@media (pointer: coarse) { .k-pc { display: none !important; } .k-tel { display: inline-block; } }

.campo-px { display: block; text-align: left; font-size: .55rem; color: var(--suave); margin-bottom: 1rem; }
.campo-px input {
    display: block;
    width: 100%;
    margin-top: .5rem;
    font-family: var(--px);
    font-size: .8rem;
    color: #fff;
    background: #0e1a20;
    border: 0;
    box-shadow: 0 0 0 3px #33505a;
    padding: .8rem;
    user-select: text;
    text-transform: uppercase;
}
.campo-px input:focus { outline: none; box-shadow: 0 0 0 3px var(--huevo); }
.arcade .btn-px { width: 100%; font-size: 1rem; padding: 1.1rem; }
.press-start { font-size: .5rem; color: var(--suave); margin: 1rem 0 0; }
.error { color: #ff9b9b; min-height: 1.2em; margin: .6rem 0 0; font-size: .6rem; font-family: var(--px); line-height: 1.6; }
.volver { font-size: .5rem; color: var(--suave); }

/* Paneles durante el juego */
.panel {
    position: fixed;
    z-index: 5;
    background: rgba(8, 10, 20, .92);
    box-shadow: 0 0 0 3px #33505a, 8px 8px 0 3px rgba(0, 0, 0, .5);
}
.barra-sup { position: fixed; z-index: 4; right: 10px; top: 10px; display: flex; gap: 8px; }
.chip {
    font-family: var(--px);
    font-size: .5rem;
    color: #fff;
    background: rgba(8, 10, 20, .8);
    border: 0;
    box-shadow: 0 0 0 2px #33505a;
    padding: .5rem .6rem;
    cursor: pointer;
}
.espera {
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(580px, calc(100vw - 24px));
    padding: 1rem;
    text-align: center;
    font-size: .9rem;
}
.espera p { margin: 0 0 .6rem; }
.espera b { font-family: var(--px); font-size: .6rem; color: var(--huevo); }
.link { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; align-items: center; margin-bottom: .7rem; }
.link code { font-family: var(--px); font-size: .55rem; background: #0e1a20; padding: .55rem .6rem; user-select: all; }
.trip { font-family: var(--px); font-size: .5rem !important; color: var(--suave); }
.tripulacion { list-style: none; margin: 0 0 .7rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.tripulacion li {
    border-left: 5px solid var(--c);
    background: #0e1a20;
    padding: .25rem .6rem;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    gap: .8rem;
    justify-content: space-between;
}
.ayuda { font-size: .75rem; color: var(--suave); line-height: 1.6; }
.ayuda b { font-family: var(--px); font-size: .5rem; color: #fff; background: #22343a; padding: .15rem .3rem; }
@media (pointer: coarse) { .ayuda { display: none; } }
.sin-patos { background: rgba(214, 40, 40, .18); box-shadow: 0 0 0 2px #d62828; padding: .6rem; font-size: .85rem; }
.sin-patos .btn-px { margin-top: .5rem; }
.espera > .btn-px { margin-top: .3rem; }

.fin {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 24px));
    padding: 1.4rem 1.2rem;
    text-align: center;
    animation: entrar .35s steps(4);
}
.game-over { font-family: var(--px); font-size: .7rem; color: #d62828; margin: 0 0 .8rem; }
.fin h2 { margin: 0; font-family: var(--px); font-size: 1rem; line-height: 1.5; color: var(--huevo); }
.fin-sub { color: var(--suave); margin: .4rem 0 1rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stats div { background: #0e1a20; padding: .7rem .3rem; }
.stats b { display: block; font-family: var(--px); font-size: 1.1rem; margin-bottom: .4rem; }
.stats span { font-family: var(--px); font-size: .45rem; color: var(--suave); }
.fin .tripulacion { flex-direction: column; }
.acciones { display: flex; gap: .8rem; justify-content: center; }
@keyframes entrar { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }

/* Botones de juego (celular): pensados para el pulgar derecho */
.controles { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.controles button {
    pointer-events: auto;
    position: absolute;
    border: 0;
    font-family: var(--px);
    color: #1b1b1b;
    touch-action: none;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #1b1b1b, 0 5px 0 3px #1b1b1b;
    line-height: 1.3;
}
.controles button.on { transform: translateY(4px); box-shadow: 0 0 0 3px #1b1b1b, 0 1px 0 3px #1b1b1b; }
.b-a { right: calc(18px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 92px; height: 92px; background: var(--huevo); font-size: .55rem; }
.b-b { right: calc(122px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); width: 78px; height: 78px; background: #ff6b6b; font-size: .5rem; }
.b-b small { display: block; font-size: .5rem; }
.b-b.especial { background: #ffb627; animation: latido .8s infinite; }
.b-c { right: calc(112px + env(safe-area-inset-right)); bottom: calc(118px + env(safe-area-inset-bottom)); width: 62px; height: 62px; background: var(--pico); font-size: .4rem; }
.b-poder {
    --carga: 0%;
    right: calc(30px + env(safe-area-inset-right));
    bottom: calc(134px + env(safe-area-inset-bottom));
    width: 64px;
    height: 64px;
    background: conic-gradient(var(--huevo) var(--carga), #22343a 0);
    padding: 6px;
}
.b-poder::after {
    content: attr(data-label);
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #0b1416;
    color: var(--suave);
    font-size: .4rem;
}
.b-poder.listo::after { background: #fff4d0; color: #1b1b1b; animation: latido .7s infinite; }
.patoteada-btn {
    --carga: 0%;
    left: 50% !important;
    top: calc(44px + env(safe-area-inset-top));
    transform: translateX(-50%);
    border-radius: 0 !important;
    width: min(260px, 56vw);
    height: 26px;
    padding: 0;
    background: linear-gradient(90deg, #ff6b1f var(--carga), #10202a 0) !important;
    box-shadow: 0 0 0 3px #1b1b1b !important;
}
.patoteada-btn span { color: #fff; font-size: .45rem; text-shadow: 2px 2px 0 #000; }
.patoteada-btn.listo { animation: latidoX .6s steps(2) infinite; }
.patoteada-btn.listo span::after { content: " ¡TIRALA! (E)"; }
@keyframes latido { 50% { transform: scale(.9); } }
@keyframes latidoX { 50% { transform: translateX(-50%) scale(1.08); } }
@media (max-width: 600px) {
    .patoteada-btn { top: calc(78px + env(safe-area-inset-top)); width: min(280px, 72vw); }
}
@media (pointer: fine) {
    .b-a, .b-b, .b-c, .b-poder { display: none; }
}

.joy {
    position: fixed;
    z-index: 3;
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .35);
    background: rgba(8, 10, 20, .3);
    pointer-events: none;
}
.joy-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .8);
    transform: translate(-50%, -50%);
}
