:root{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;color:#fff;--navy:#0c2756;--gold:#ffd954}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#071d3d;overscroll-behavior:none;touch-action:none}
button{font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation}
#shell{position:fixed;inset:0;width:100vw;height:100dvh;display:flex;align-items:center;justify-content:center;overflow:hidden;background:radial-gradient(ellipse at 50% 20%,#286397,#06152f 80%);padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
#stage{width:min(100%,calc(100dvh * 16 / 9));height:auto;aspect-ratio:16/9;position:relative;overflow:hidden;border:2px solid #f4d974;border-radius:13px;box-shadow:0 8px 45px #0008;background:#4c99d4;isolation:isolate}
#playfield,#view{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
#view{display:block}
.cover{position:absolute;inset:0;display:flex;z-index:4;overflow:hidden}.cover.hidden{display:none!important}
#welcome{background:#6dbde4 url('../assets/checa_renovada.webp') center/cover no-repeat}
.menu-shade{position:absolute;inset:0;background:linear-gradient(100deg,#0b2854f7 0%,#0c326ecc 32%,#0f3a6ca6 72%,#0b2757dc 100%)}
.cover-header{position:absolute;left:4%;top:4%;width:92%;text-align:center;z-index:1;text-shadow:0 3px 3px #101e40}
.cover-header .spark{display:inline-block;padding:3px 10px;background:#ed5c32;border-radius:14px;letter-spacing:1.8px;font-size:clamp(9px,1.5vw,14px);font-weight:900}
.cover-header h1{margin:3px 0 1px;font-weight:1000;font-size:clamp(24px,4.2vw,54px);line-height:1.02;letter-spacing:.2px;color:white;-webkit-text-stroke:.7px #182952}
.cover-header h1 span{color:#ffe35d}
.cover-header p{font-size:clamp(10px,1.35vw,17px);font-weight:750;margin:3px 0;color:#e8f4ff}
.cover-katy{position:absolute;left:0%;bottom:-9%;width:26%;height:70%;object-fit:contain;filter:drop-shadow(0 3px 12px #061d4f);z-index:1;animation:cover-breathe 1.5s ease-in-out infinite alternate}
@keyframes cover-breathe{from{transform:translateY(0) rotate(-2deg)}to{transform:translateY(-6px) rotate(1deg)}}
.menu-content{position:absolute;left:26.5%;right:3.2%;top:30%;bottom:8%;z-index:2;display:flex;flex-direction:column;align-items:center;justify-content:flex-start}
.menu-content h2{font-weight:1000;letter-spacing:1px;text-align:center;font-size:clamp(10px,1.9vw,22px);margin:0 0 4px;color:#fff7c4;text-shadow:0 2px 3px #142b4d}
.pick{width:100%;min-height:0;flex:1;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1.3%}
.hero-card{min-width:0;height:100%;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center;background:linear-gradient(#183f82dd,#0b2a53f2);border:2px solid #7d9fc8a6;border-bottom:4px solid var(--character);border-radius:14px;padding:1px;gap:1px;color:#fff;transition:transform .12s,box-shadow .15s}
.hero-card:focus-visible{outline:3px solid #ffdb55;outline-offset:-2px}.hero-card.selected{transform:translateY(-2px);border-color:#ffe080;box-shadow:0 0 0 2px #f2a42b,0 0 16px #ffce59ab;background:linear-gradient(#32629f,#0a2f60)}
.hero-card img{object-fit:contain;object-position:center center;flex:1;min-height:0;width:100%;max-width:100px;filter:drop-shadow(0 1px 4px #000b)}
.hero-card strong{font-size:clamp(10px,1.7vw,19px);line-height:1.05}.hero-card small{font-size:clamp(8px,1vw,13px);line-height:1.1;white-space:nowrap;color:#cfe8ff;padding-bottom:2px}
.menu-bottom{width:100%;flex:0 0 auto;display:flex;flex-direction:column;align-items:center;gap:4px}
.consent{font-size:clamp(8px,.83vw,11px);line-height:1.12;color:#d5eafb;text-align:center;display:flex;align-items:center;justify-content:center;gap:5px;max-width:98%;cursor:pointer;touch-action:manipulation;display:none}
.consent input{width:13px;height:13px;min-width:13px;accent-color:#ffd655;touch-action:manipulation}
.start-row{display:flex;justify-content:center;align-items:center;gap:8px;width:100%}
.primary{border:2px solid #fff6c6;color:#173051;font-weight:1000;font-size:clamp(12px,2vw,22px);background:linear-gradient(#fff0a5,#ffbb28);text-shadow:0 1px #ffffff8c;border-radius:100px;min-width:40%;padding:7px 15px;box-shadow:0 3px 0 #a7721c,0 5px 12px #0006;line-height:1.05}
.primary:disabled{opacity:.68;cursor:not-allowed}.primary:not(:disabled):active{transform:translateY(2px);box-shadow:0 1px 0 #96650d}
.sound-toggle{border:2px solid #ffffff99;background:#173b70df;color:white;border-radius:50%;width:36px;height:36px;font-size:19px;display:grid;place-items:center}
.menu-tip{position:absolute;bottom:1.2%;left:2%;right:2%;text-align:center;font-size:clamp(8px,1vw,13px);color:#ffe0a9;font-weight:900;letter-spacing:2px;z-index:3}
.menu-tip span{color:#fff}
#pauseBtn{position:absolute;right:2%;top:2%;z-index:3;display:none;border:2px solid #ffeea2;border-radius:9px;background:#173a65d9;color:#fff4d5;padding:4px 11px;font-size:clamp(15px,2vw,24px);font-weight:900}
#pauseBtn.visible{display:block}
#pauseScreen{align-items:center;justify-content:center;background:#061e47d9;z-index:5}
.dialog{text-align:center;background:#11346ef0;border:3px solid #ffe081;border-radius:20px;padding:25px 40px;box-shadow:0 20px 40px #0009}
.dialog h2{font-size:clamp(25px,4vw,46px);color:#ffe07e;margin:5px 0}.dialog p{font-size:clamp(13px,1.7vw,19px)}
#result{background:url('../assets/checa_renovada.webp') center/cover no-repeat;align-items:center;justify-content:center;z-index:5}
#result.lose{background:linear-gradient(#071e46d8,#071e46de),url('../assets/checa_deteriorada.webp') center/cover}
#result .result-illustration{display:none;position:absolute;inset:0;pointer-events:none}
#result.win .result-illustration{display:block}
#result.win .winner{position:absolute;bottom:2%;height:60%;width:22%;object-fit:contain;object-position:bottom;filter:drop-shadow(0 5px 9px #1323338a);animation:bounce .65s ease-in-out infinite alternate}
#result.win .winner-memo{left:3%;height:45%;bottom:8%;animation-delay:-.17s}
#result.win .winner-chuck{left:23%;height:49%;bottom:5%;animation-delay:-.26s}
#result.win .winner-katy{left:47%;height:65%;bottom:3%;animation-delay:-.4s}
#result.win .winner-lyna{left:72%;height:52%;bottom:5%;animation-delay:-.12s}
@keyframes bounce{from{transform:translateY(3px) rotate(-2deg)}to{transform:translateY(-7px) rotate(2deg)}}
#result .result-shade{position:absolute;inset:0;pointer-events:none;background:linear-gradient(#041c49da,#15356810 48%,#071e49bb 87%)}
#result .card{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:space-between;text-align:center;padding:3.8% 5% 3%;z-index:2}
#result #resultTitle{font-size:clamp(22px,4.1vw,48px);line-height:1.1;font-weight:1000;color:#fff084;text-shadow:0 3px 1px #a34420,0 5px 7px #111e48;margin:0;max-width:90%}
#result #resultMessage{color:#fff;font-weight:1000;font-size:clamp(11px,2.6vw,29px);line-height:1.16;margin:0;padding:6px 16px;border-radius:13px;text-shadow:0 2px 3px #111b40;background:#072c56d4}
#result.win #resultMessage{margin-top:auto;margin-bottom:1.3%}
#result.win #resultTitle{font-size:clamp(20px,4.1vw,48px)}
#result.lose #resultTitle{margin-top:17%}
#result.lose #resultMessage{margin:auto 0}
#again{font-size:clamp(12px,1.9vw,21px);min-width:24%;padding:9px 16px;color:#134333;background:linear-gradient(#a2ff6d,#35ce57)}
#hudControls{position:absolute;inset:0;display:none;pointer-events:none;z-index:2}#hudControls.live{display:block}
.group{position:absolute;display:flex;gap:clamp(6px,1.1vw,15px);align-items:flex-end;bottom:5%;}
.group.left{left:2.5%;flex-direction:row}.group.right{right:2.5%;flex-direction:row}
.control{pointer-events:auto;touch-action:none;min-width:0;min-height:0;flex-shrink:0;width:clamp(43px,6.3vw,79px);height:clamp(43px,6.3vw,79px);border:2px solid #fff5d9b8;border-radius:50%;color:#fff;font-size:clamp(18px,2.7vw,31px);font-weight:950;background:#1557a28a;box-shadow:0 3px 0 #082e6099,0 5px 9px #011c375c;text-shadow:0 2px #142c4e;opacity:.75;display:grid;place-items:center}
.control.jump{background:#188bd58c}.control.shoot{background:#da3c448e}.control.power{background:#a650e58e}
.control.pressed{opacity:1;transform:scale(.92);background:#ffe274cf;color:#092b58}
#rotate{display:none;position:absolute;inset:0;z-index:10;align-items:center;justify-content:center;flex-direction:column;background:#092650ed;padding:12%;text-align:center;font-size:clamp(17px,4vw,28px);font-weight:850;color:#ffec8b;pointer-events:none}
#rotate span{font-size:54px}
@media (orientation:portrait) and (max-width:740px){#stage{width:100%;border:0;border-radius:0}#rotate{display:flex}}
@media (max-width:1000px){#stage{border-width:1px;border-radius:5px}}
@media (max-height:450px) and (orientation:landscape){
 .cover-header{top:1.5%}.cover-header h1{font-size:clamp(19px,4.1vw,33px)}.cover-header p{font-size:clamp(8px,1.4vw,11px);margin:0}
 .cover-katy{height:63%}.menu-content{top:27%;bottom:8%}.hero-card img{max-width:65px}
 .hero-card{border-radius:7px}.hero-card strong{font-size:clamp(9px,1.5vw,14px)}.hero-card small{font-size:clamp(7px,.96vw,10px)}
 .primary{padding:5px 14px}.sound-toggle{width:27px;height:27px;font-size:16px}.consent{font-size:clamp(7px,.9vw,9px);line-height:1.05}.menu-tip{font-size:8px}
 .control{width:clamp(39px,6.5vw,54px);height:clamp(39px,6.5vw,54px);font-size:19px}.group{bottom:3%}
}

#soundHud{position:absolute;right:7.3%;top:2%;z-index:3;display:none;width:33px;height:33px;border-radius:10px;font-size:18px;background:#173b70dc;border-color:#ffe9acb5}#soundHud.visible{display:grid}
@media(max-height:450px){#soundHud{width:29px;height:29px;font-size:16px}}

/* V19: a fifth avatar only appears after winning with all four original heroes. */
.pick.legendary-ready{grid-template-columns:repeat(5,minmax(0,1fr));gap:.9%}
.hero-card.legend-card[hidden]{display:none!important}
.pick.legendary-ready .legend-card{display:flex;background:linear-gradient(#4f4c17ef,#163d28fa);border-color:#ffdf64;box-shadow:inset 0 0 13px #ffdf537d}
.pick.legendary-ready .legend-card strong{font-size:clamp(8px,1.15vw,15px)}
.pick.legendary-ready .hero-card img{max-width:96px}
.unlock-progress{margin:3px auto 2px;font-size:clamp(8px,1.08vw,12px);font-weight:800;text-align:center;color:#fff3ac;line-height:1.15;text-shadow:0 2px 4px #081e40;min-height:11px}
#result.win{background:#0b2b50;overflow:hidden}
#result.win .victory-poster{position:absolute;left:0;top:0;width:81.5%;height:100%;object-fit:contain;object-position:center center;display:block}
#result .victory-poster{display:none}
#result.win .result-shade{display:none}
#result.win .card{position:absolute;right:0;left:auto;top:0;bottom:0;width:18.5%;padding:2% .6%;background:linear-gradient(150deg,#154677,#051d42);border-left:2px solid #e0bf4d;justify-content:center;gap:18px;box-sizing:border-box}
#result.win #resultTitle,#result.win #resultMessage{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#result.win #again{width:98%;min-width:0;font-size:clamp(10px,1.35vw,16px);padding:11px 3px;line-height:1.1;border-radius:13px}
#result.win .victory-progress{width:100%;font-size:clamp(9px,1.2vw,16px);line-height:1.25;color:#fff9c5;font-weight:900;text-align:center}
#result.lose .victory-progress{display:none}
#result.lose .victory-poster{display:none}
#result.lose .card{z-index:2}
@media (max-height:450px) and (orientation:landscape){
 .unlock-progress{font-size:clamp(7px,.9vw,10px);margin:1px auto}
 .menu-content{bottom:7%}
 .pick.legendary-ready .hero-card strong{font-size:clamp(8px,1.2vw,11px)}
 .pick.legendary-ready .hero-card small{font-size:clamp(7px,.9vw,9px)}
 #result.win #again{font-size:clamp(8px,1.3vw,12px);padding:7px 2px}
 #result.win .victory-progress{font-size:clamp(8px,1.1vw,11px)}
}

/* V21 · Cinemática retro de créditos con fondo negro y perspectiva */
#legendCredits{z-index:8;display:block!important;background:#000!important;isolation:isolate;color:#f9da66;overflow:hidden}
#legendCredits.hidden{display:none!important}
#legendCredits .credits-viewport{position:absolute;inset:0 0 9% 0;overflow:hidden;perspective:650px;perspective-origin:50% 14%;mask-image:linear-gradient(to bottom,transparent 0%,black 13%,black 88%,transparent 100%);-webkit-mask-image:linear-gradient(to bottom,transparent 0%,black 13%,black 88%,transparent 100%)}
#legendCredits .credits-angle{position:absolute;inset:0;width:100%;height:100%;transform:rotateX(21deg);transform-origin:50% 84%;transform-style:preserve-3d}
#legendCredits .credits-crawl{position:absolute;top:100%;left:7%;width:86%;height:max-content;text-align:center;color:#f7d86f;text-shadow:0 0 3px #e2af3038;font-family:system-ui,-apple-system,"Segoe UI",sans-serif;font-weight:900;line-height:1.35;animation:credits-rise 29s linear both;will-change:transform}
#legendCredits .credits-overline{font-size:clamp(12px,1.6vw,17px);letter-spacing:.35em;color:#ddbb56;margin:0 0 .8em}
#legendCredits .credits-crawl h2{font-size:clamp(29px,4.7vw,53px);line-height:1.08;margin:0 0 1.35em;letter-spacing:.05em;color:#ffda60}
#legendCredits .credits-crawl h3{font-size:clamp(21px,3.15vw,35px);line-height:1.22;margin:0 0 1.8em;color:#ffe08b}
#legendCredits .credits-crawl ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;align-items:center;gap:clamp(19px,4vh,38px)}
#legendCredits .credits-crawl li{font-size:clamp(19px,3.15vw,36px);line-height:1.2;max-width:100%}
#legendCredits .credits-crawl .credits-thanks{font-size:clamp(28px,4vw,48px);color:#ffe78c;margin:2em auto 0;line-height:1.14}
@keyframes credits-rise{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,calc(-100% - var(--credits-height,540px)),0)}}
#legendCredits .credits-finale{position:absolute;top:40%;left:5%;width:90%;margin:0;text-align:center;color:#ffde72;font-size:clamp(24px,4.6vw,52px);font-weight:1000;text-shadow:0 0 15px #d29c2844;opacity:0;pointer-events:none;animation:credits-hold 32s linear both}
@keyframes credits-hold{0%,89%{opacity:0}93%,100%{opacity:1}}
#legendCredits .credits-replay{position:absolute;z-index:3;bottom:3.2%;left:50%;transform:translateX(-50%);width:max-content;min-width:0;font-size:clamp(12px,1.6vw,19px);padding:clamp(7px,.9vw,12px) clamp(18px,3vw,35px);white-space:nowrap;box-shadow:0 3px 0 #a7721c,0 6px 18px #0009}
#legendCredits .credits-replay:active{transform:translateX(-50%) translateY(2px)}
@media(max-height:450px) and (orientation:landscape){
 #legendCredits .credits-crawl h2{font-size:clamp(25px,4.5vw,37px)}
 #legendCredits .credits-crawl h3{font-size:clamp(19px,3vw,27px)}
 #legendCredits .credits-crawl li{font-size:clamp(18px,2.8vw,24px)}
 #legendCredits .credits-crawl ul{gap:clamp(18px,4vh,27px)}
 #legendCredits .credits-replay{bottom:2%;font-size:clamp(11px,1.5vw,15px);padding:6px 20px}
}
@media(prefers-reduced-motion:reduce){
 #legendCredits .credits-viewport{overflow:auto;touch-action:pan-y;mask-image:none;-webkit-mask-image:none;bottom:16%}
 #legendCredits .credits-angle{transform:none;position:relative;inset:auto;height:auto}
 #legendCredits .credits-crawl{position:relative;top:auto;left:6%;width:88%;padding:10px 0;animation:none;transform:none}
 #legendCredits .credits-crawl ul{gap:8px}
 #legendCredits .credits-crawl h2{margin-bottom:10px}
 #legendCredits .credits-crawl h3{margin-bottom:10px}
 #legendCredits .credits-crawl .credits-thanks{margin:20px 0}
 #legendCredits .credits-finale{display:none}
}
