/* ¡Rebú!: pantallas, HUD de pelea y controles táctiles. Estilo: noche de barrio, neón y cómic. */
:root {
  --ink: #120a22;
  --night: #1a0f2e;
  --pink: #ff3fa4;
  --yellow: #ffe14d;
  --cyan: #3fd0ff;
  --lime: #9dff3f;
  --red: #ff2e4d;
  --paper: #fff8ec;
  --font: 'Luckiest Guy', 'Arial Black', sans-serif;
  --plain: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  --top: max(env(safe-area-inset-top), var(--tint, 0px));
  --bottom: env(safe-area-inset-bottom);
  --left: env(safe-area-inset-left);
  --right: env(safe-area-inset-right);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
body { font-family: var(--font); color: #fff; -webkit-user-select: none; user-select: none; }
#game canvas { display: block; width: 100%; height: 100%; }
h1, h2, .btn, .logo span, .bigtxt, .float, .banner b, .vsn b, .vsBig, .combo b, .superBanner b, .timer, .side .name b, .optRow span, .wait, .earn, .cont {
  -webkit-text-stroke: 0.15em var(--ink); paint-order: stroke fill;
}

/* ---------- Pantallas ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: none; flex-direction: column; align-items: center; gap: 12px;
  padding: calc(var(--top) + 14px) calc(var(--right) + 16px) calc(var(--bottom) + 16px) calc(var(--left) + 16px); overflow-y: auto; overscroll-behavior: contain; }
.screen.on { display: flex; }
.screen > * { width: 100%; max-width: 560px; flex-shrink: 0; }
.screen.scroll { background: linear-gradient(180deg, rgba(18, 10, 34, .9), rgba(42, 20, 70, .82) 60%, rgba(90, 20, 70, .78)); }
.screen.storyScreen { background: linear-gradient(180deg, rgba(18, 10, 34, .15), rgba(18, 10, 34, .7)); justify-content: flex-end; }
h1 { font-size: clamp(30px, 8vw, 46px); margin: 6px 0 0; text-align: center; font-weight: 400; letter-spacing: .02em; color: var(--yellow); }
h2 { font-size: 28px; margin: 0 0 6px; text-align: center; font-weight: 400; }
p { margin: 0; }
.hint { font-family: var(--plain); font-size: 15px; line-height: 1.35; text-align: center; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.err { font-family: var(--plain); font-weight: 700; font-size: 15px; text-align: center; min-height: 20px; color: var(--yellow); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.err.busy { color: #fff; opacity: .9; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.spacer { flex: 1; }
.spacer.tall { min-height: 30vh; }

.back { position: absolute; left: calc(var(--left) + 12px); top: calc(var(--top) + 10px); width: 48px; height: 48px; border-radius: 14px; border: 3px solid var(--ink);
  background: #fff; color: var(--ink); font-size: 26px; box-shadow: 0 4px 0 var(--ink); z-index: 2; cursor: pointer; }
.screen > .back { width: 48px; }

/* Botones gordos de cómic */
.btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 3px solid var(--ink); border-radius: 18px; background: linear-gradient(180deg, #ff6aa0, var(--pink)); color: #fff;
  box-shadow: 0 6px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, .15), inset 0 4px 0 rgba(255, 255, 255, .3);
  padding: 12px 14px; font-size: 22px; letter-spacing: .02em; cursor: pointer; transition: transform .06s; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, .15); }
.btn:disabled { filter: grayscale(.6) brightness(.8); opacity: .7; cursor: default; }
.btn small { font-family: var(--plain); font-size: 12px; font-weight: 700; -webkit-text-stroke: 0; opacity: .95; letter-spacing: 0; text-shadow: 0 1px 1px rgba(0, 0, 0, .4); }
.btn.big { font-size: clamp(22px, 6.4vw, 30px); padding: 14px 10px 12px; }
.btn.mid { font-size: clamp(15px, 4.6vw, 21px); padding: 11px 8px; white-space: nowrap; }
.btn.small { font-size: 15px; padding: 8px 12px; border-radius: 14px; box-shadow: 0 4px 0 var(--ink); }
.btn.play { background: linear-gradient(180deg, #ff6aa0, var(--pink) 60%, #e0207f); }
.btn.blue { background: linear-gradient(180deg, #6fe0ff, #1fa8e0); }
.btn.green { background: linear-gradient(180deg, #b6ff6a, #4fcf2a); }
.btn.yellow { background: linear-gradient(180deg, #fff07a, #ffc21f); }
.btn.purple { background: linear-gradient(180deg, #c49bff, #8a4cf0); }
.btn.red { background: linear-gradient(180deg, #ff6b6b, #e02434); }
.btn.ghost { background: linear-gradient(180deg, #ffffff, #e8ddff); color: var(--ink); -webkit-text-stroke: 0; }
.link { background: none; border: 0; color: #fff; text-decoration: underline; font-family: var(--plain); font-size: 14px; cursor: pointer; }

/* ---------- Menú ---------- */
.screen.menu { justify-content: space-between; background: linear-gradient(180deg, rgba(18, 10, 34, .55), transparent 30%, transparent 50%, rgba(18, 10, 34, .78)); }
.menuTop { display: flex; justify-content: space-between; align-items: center; }
.meBtn { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .94); border: 3px solid var(--ink); border-radius: 99px;
  padding: 2px 14px 2px 2px; color: var(--ink); font-size: 16px; box-shadow: 0 3px 0 var(--ink); cursor: pointer; max-width: 60%; }
.meBtn img { width: 40px; height: 40px; border-radius: 50%; background: #ffd6ec; object-fit: cover; }
.meBtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coins { background: rgba(255, 255, 255, .94); border: 3px solid var(--ink); border-radius: 99px; padding: 7px 14px; color: var(--ink); font-size: 18px; box-shadow: 0 3px 0 var(--ink); }
.screen.scroll .coins, .shopScreen .coins { position: absolute; right: 12px; top: calc(var(--top) + 12px); width: auto; }
.logo { display: flex; align-items: flex-end; justify-content: center; flex-wrap: wrap; line-height: .85; margin-top: 1vh; animation: bob 2.4s ease-in-out infinite; }
.logo .l1 { font-size: clamp(64px, 20vw, 120px); color: var(--yellow); transform: rotate(-6deg) translateY(4px); text-shadow: 0 0 24px rgba(255, 225, 77, .6), 0 8px 0 var(--ink); }
.logo .l2 { font-size: clamp(76px, 24vw, 144px); color: var(--pink); transform: rotate(-6deg); text-shadow: 0 0 30px rgba(255, 63, 164, .7), 0 8px 0 var(--ink); }
.logo small { width: 100%; text-align: center; margin-top: 12px; font-size: clamp(13px, 3.8vw, 18px); color: #fff; -webkit-text-stroke: .2em var(--ink); paint-order: stroke fill; letter-spacing: .12em; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.menuBtns { display: flex; flex-direction: column; gap: 12px; }
.ver { text-align: center; font-family: var(--plain); font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }

/* ---------- Historia y finales ---------- */
.story { display: flex; flex-direction: column; gap: 14px; margin-bottom: 4vh; align-items: center; }
.panel { width: 100%; background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; padding: 18px 20px 20px; color: var(--ink); box-shadow: 0 8px 0 var(--ink); animation: pop .35s ease-out; }
.panel.dark { background: #241a33; color: #fff; }
.panel.dark h2 { color: var(--yellow); }
.panel small { font-size: 14px; color: #8a4cf0; }
.panel h2 { color: var(--pink); text-align: left; font-size: 28px; -webkit-text-stroke: 0; }
.panel p { font-family: var(--plain); font-size: 17px; line-height: 1.42; font-weight: 600; }
.story .row { width: 100%; }
.endFace { width: 150px; height: 150px; animation: pop .5s ease-out; filter: drop-shadow(0 6px 0 var(--ink)); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ---------- Tarjetas (cómo se juega) ---------- */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: rgba(255, 255, 255, .96); border: 3px solid var(--ink); border-radius: 16px; padding: 12px 14px; color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.card b { font-size: 19px; font-weight: 400; color: #8a1f5c; }
.card p { font-family: var(--plain); font-size: 15px; line-height: 1.38; margin-top: 4px; }
.card.mv { display: flex; gap: 10px; align-items: center; border-left: 10px solid var(--c); }
.card.mv img { width: 64px; height: 64px; flex-shrink: 0; }
.card.mv p { font-size: 13.5px; }
.card.mv .sp { font-family: var(--plain); font-weight: 800; font-size: 13.5px; color: var(--ink); }

/* ---------- Elegir personaje ---------- */
.screen.shopScreen { background: linear-gradient(180deg, rgba(18, 10, 34, .6), transparent 22%, transparent 40%, rgba(18, 10, 34, .85) 62%); gap: 8px; }
.pickTitle { margin-top: 4px; }
.showcase { display: flex; align-items: center; justify-content: space-between; flex: 1; min-height: 30vh; }
.arrow { width: 34px; height: 44px; border-radius: 12px; border: 2px solid var(--ink); background: var(--yellow); color: var(--ink); font-size: 16px; cursor: pointer; flex-shrink: 0; }
.arrow.big { width: 52px; height: 68px; font-size: 24px; box-shadow: 0 4px 0 var(--ink); }
.charInfo { display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(255, 255, 255, .96); border: 3px solid var(--ink); border-top: 8px solid var(--c, var(--pink));
  border-radius: 20px; padding: 10px 12px; color: var(--ink); box-shadow: 0 5px 0 var(--ink); }
.charInfo .role { font-size: 13px; color: #8a4cf0; letter-spacing: .08em; }
.charInfo > b { font-size: clamp(24px, 7vw, 32px); font-weight: 400; color: var(--ink); line-height: 1; text-align: center; }
.charInfo p { font-family: var(--plain); font-size: 14px; text-align: center; line-height: 1.35; }
.charInfo .parody { font-family: var(--plain); font-size: 11.5px; color: #7a6a8a; font-weight: 600; }
.charInfo .mvline { font-weight: 800; font-size: 13px; }
.charInfo .err { color: var(--red); text-shadow: none; min-height: 0; }
.stats { width: 100%; display: flex; flex-direction: column; gap: 3px; }
.stat { display: flex; align-items: center; gap: 8px; }
.stat span { width: 92px; font-size: 12px; text-align: right; }
.stat i { flex: 1; height: 10px; background: #e6dcf2; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.stat i b { display: block; height: 100%; background: var(--c, var(--pink)); }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.gi { position: relative; padding: 0; border: 3px solid var(--ink); border-radius: 10px; background: linear-gradient(180deg, #fff, var(--c)); aspect-ratio: 1; cursor: pointer; overflow: hidden; }
.gi.on { outline: 3px solid var(--yellow); transform: translateY(-3px); }
.gi img { width: 100%; height: 100%; display: block; object-fit: cover; }
.gi.locked img { filter: brightness(.45) saturate(.3); }
.gi i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 16px; }

/* ---------- Pantalla VS ---------- */
.screen.vsScreen { justify-content: space-between; background: linear-gradient(180deg, rgba(18, 10, 34, .7), transparent 25%, transparent 60%, rgba(18, 10, 34, .85)); }
.vsWrap { display: flex; flex-direction: column; align-items: center; justify-content: space-between; height: 100%; gap: 10px; max-width: 900px !important; }
.vsTop { display: flex; flex-direction: column; align-items: center; }
.vsTop small { font-size: 16px; color: var(--yellow); letter-spacing: .1em; }
.vsTop span { font-size: clamp(22px, 6vw, 34px); -webkit-text-stroke: .15em var(--ink); paint-order: stroke fill; }
.vsNames { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.vsn { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; animation: slideL .4s ease-out; }
.vsn.r { align-items: flex-end; text-align: right; animation-name: slideR; }
.vsn b { font-size: clamp(22px, 6.2vw, 36px); color: var(--c); line-height: 1; overflow-wrap: anywhere; }
.vsn small { font-family: var(--plain); font-weight: 800; font-size: 12px; text-shadow: 0 1px 2px #000; }
.bubble { margin-top: 6px; background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 10px; font-family: var(--plain); font-weight: 700; font-size: 13px; line-height: 1.3; box-shadow: 0 3px 0 var(--ink); animation: pop .4s .5s backwards; }
.vsBig { font-size: clamp(54px, 15vw, 96px); color: var(--yellow); transform: rotate(-8deg); animation: vsPop .5s cubic-bezier(.2, 1.6, .4, 1) .2s backwards; text-shadow: 0 0 30px rgba(255, 225, 77, .8); }
.vsMini { font-size: 34px; color: var(--yellow); align-self: center; -webkit-text-stroke: .15em var(--ink); paint-order: stroke fill; transform: rotate(-8deg); }
@keyframes vsPop { from { transform: scale(3) rotate(-8deg); opacity: 0; } }
@keyframes slideL { from { transform: translateX(-60px); opacity: 0; } }
@keyframes slideR { from { transform: translateX(60px); opacity: 0; } }

/* ---------- VERSUS y TORNEO ---------- */
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { position: relative; display: flex; align-items: center; gap: 8px; background: #fff; border: 3px solid var(--ink); border-left: 12px solid var(--c);
  border-radius: 18px; padding: 6px 8px; color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.face { position: relative; padding: 0; border: 2px solid var(--ink); border-radius: 12px; background: linear-gradient(180deg, #fff, #ffd6ec); cursor: pointer; overflow: hidden; flex-shrink: 0; }
.slot .face img { width: 72px; height: 72px; display: block; }
.face i { position: absolute; left: 0; right: 0; bottom: 0; font-style: normal; font-size: 10px; background: var(--ink); color: #fff; }
.slot .who { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.slot .who b { font-size: 19px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot .who span { font-family: var(--plain); font-size: 13px; font-weight: 700; color: #6a4a7a; }
.ctls { display: flex; gap: 6px; flex-wrap: wrap; }
.ctl { border: 2px solid var(--ink); border-radius: 10px; background: #f0e6ff; padding: 4px 9px; font-size: 14px; color: var(--ink); cursor: pointer; }
.ctl.lvl { background: var(--yellow); }
.optRow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.optRow span { font-size: 15px; width: 100%; text-align: center; }
.pill { border: 3px solid var(--ink); border-radius: 99px; background: rgba(255, 255, 255, .92); color: var(--ink); padding: 6px 13px; font-size: 15px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.pill.on { background: var(--yellow); }
.tabs { display: flex; gap: 8px; justify-content: center; }
.tslots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tslot { display: flex; align-items: center; gap: 6px; background: #fff; border: 3px solid var(--ink); border-bottom: 7px solid var(--c); border-radius: 14px; padding: 4px; color: var(--ink); min-width: 0; }
.tslot.cpu { background: #efe8f8; }
.tslot .face img { width: 46px; height: 46px; display: block; }
.tslot input { flex: 1; min-width: 0; border: 2px solid var(--ink); border-radius: 8px; padding: 6px; font-family: var(--plain); font-weight: 700; font-size: 14px; }
.tslot b { flex: 1; min-width: 0; font-size: 15px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bracket { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.bround { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; min-width: 132px; flex: 1; }
.bround small { text-align: center; font-size: 13px; color: var(--yellow); }
.bm { display: flex; flex-direction: column; gap: 2px; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .3); border-radius: 12px; padding: 4px; }
.bm.now { border-color: var(--yellow); box-shadow: 0 0 14px rgba(255, 225, 77, .6); }
.bp { display: flex; align-items: center; gap: 5px; background: #fff; border: 2px solid var(--ink); border-radius: 9px; padding: 1px 6px 1px 1px; color: var(--ink); font-size: 13px; }
.bp img { width: 30px; height: 30px; }
.bp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp.empty { justify-content: center; height: 34px; opacity: .5; }
.won .bp { background: var(--yellow); }
.lost .bp { opacity: .45; filter: grayscale(1); }

/* ---------- Historia: la escalera ---------- */
.ladder { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; }
.step img { width: 52px; height: 52px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; }
.step small { font-size: 12px; }
.step.done img { filter: grayscale(1) brightness(.6); }
.step.done::after { content: '✕'; position: absolute; top: 4px; font-size: 40px; color: var(--red); -webkit-text-stroke: .1em var(--ink); paint-order: stroke fill; }
.step.now img { border-color: var(--yellow); box-shadow: 0 0 16px var(--yellow); transform: scale(1.12); }
.step.boss img { background: #2a2a2a; }

/* ---------- En línea ---------- */
.onlineMe { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .94); border: 3px solid var(--ink); border-radius: 18px; padding: 4px 8px 4px 4px; color: var(--ink); font-family: var(--plain); font-size: 14px; }
.onlineMe img { width: 54px; height: 54px; }
.onlineMe span { flex: 1; }
.join { display: flex; gap: 8px; }
.join input, .form input { flex: 1; min-width: 0; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; font-family: var(--font); font-size: 22px; color: var(--ink); background: #fff; outline: none; text-align: center; letter-spacing: .12em; }
.code { display: flex; flex-direction: column; align-items: center; background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; padding: 10px; color: var(--ink); box-shadow: 0 6px 0 var(--ink); gap: 6px; }
.code small { font-size: 14px; color: #8a4cf0; }
.code b { font-size: 50px; letter-spacing: .14em; font-weight: 400; color: var(--pink); line-height: 1; }
.lplayers { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.lp { display: flex; flex-direction: column; align-items: center; background: #fff; border: 3px solid var(--ink); border-bottom: 8px solid var(--c, #a9a); border-radius: 18px; padding: 6px; color: var(--ink); min-width: 0; }
.lp.off { opacity: .55; }
.lp.bot { background: rgba(255, 255, 255, .55); border-style: dashed; }
.lp img { width: 76px; height: 76px; }
.lp .botFace { font-size: 44px; height: 76px; display: flex; align-items: center; }
.lp b { font-size: 17px; font-weight: 400; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp span { font-family: var(--plain); font-size: 12px; font-weight: 700; text-align: center; }
.wait { text-align: center; font-size: 20px; animation: bob 1.4s infinite; }

/* ---------- Ranking ---------- */
.board { display: flex; flex-direction: column; gap: 6px; }
.brow { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .95); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 12px 4px 8px; color: var(--ink); }
.brow.me { background: var(--yellow); }
.brow span { width: 30px; font-size: 18px; text-align: center; }
.brow img { width: 42px; height: 42px; }
.brow b { flex: 1; font-family: var(--plain); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow em { font-style: normal; font-size: 20px; color: #8a1f5c; }

/* ---------- Cuenta ---------- */
.form { display: flex; flex-direction: column; gap: 8px; align-items: stretch; background: rgba(255, 255, 255, .12); border-radius: 18px; padding: 10px; }
.form input { text-align: left; letter-spacing: 0; font-family: var(--plain); font-size: 17px; font-weight: 600; }

/* ---------- Resultados ---------- */
.screen.resultsScreen { background: linear-gradient(180deg, rgba(18, 10, 34, .82), rgba(18, 10, 34, .3) 30%, rgba(18, 10, 34, .3) 50%, rgba(18, 10, 34, .9) 70%); }
.screen.resultsScreen:not(.champ) { background: linear-gradient(180deg, rgba(18, 10, 34, .88), rgba(60, 20, 70, .85)); }
.results { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 100%; }
.results .crown { font-size: 54px; animation: bob 1.6s infinite; margin-top: 2vh; }
.results h1 { font-size: clamp(34px, 10vw, 56px); margin: 0; }
.results .sub { font-size: 20px; -webkit-text-stroke: .15em var(--ink); paint-order: stroke fill; }
.results .winner { width: 150px; height: 150px; animation: pop .5s ease-out; }
.results .row { width: 100%; }
.quote { font-family: var(--plain); font-weight: 800; font-size: 16px; text-align: center; background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 12px; box-shadow: 0 4px 0 var(--ink); }
.rlist { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.rrow { display: flex; align-items: center; gap: 8px; background: #fff; border: 3px solid var(--ink); border-left: 10px solid var(--c); border-radius: 14px; padding: 3px 12px 3px 8px; color: var(--ink); }
.rrow.me { background: #fff6cc; }
.rrow img { width: 44px; height: 44px; }
.rrow b { flex: 1; font-size: 18px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow em { font-style: normal; font-size: 14px; }
.rrow small { font-family: var(--plain); font-weight: 700; font-size: 13px; width: 44px; text-align: right; }
.earn { font-size: 26px; color: var(--lime); animation: pop .5s .4s backwards; }
.cont { font-size: 28px; color: var(--yellow); }
.cont b { font-weight: 400; color: #fff; }

/* ---------- Ventanitas ---------- */
#modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(10, 5, 20, .6); padding: 20px; }
#modal.on { display: flex; }
#modal .box { width: 100%; max-width: 380px; max-height: 100%; overflow-y: auto; background: var(--paper); border: 4px solid var(--ink); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 12px; color: var(--ink); box-shadow: 0 8px 0 var(--ink); animation: pop .25s ease-out; }
#modal h2 { color: var(--pink); -webkit-text-stroke: 0; }
#modal p { font-family: var(--plain); font-size: 16px; text-align: center; line-height: 1.4; }
#modal .mvhelp { font-size: 14px; text-align: left; }
/* Controles (las primeras peleas) */
#modal .box.wide { max-width: 760px; }
.hblocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.hblock { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 10px; }
.hblock small { display: block; font-size: 15px; color: var(--pink); margin-bottom: 4px; }
.hblock ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hblock li { display: flex; align-items: center; gap: 8px; font-family: var(--plain); font-size: 13.5px; line-height: 1.3; }
.hblock kbd { flex-shrink: 0; min-width: 74px; text-align: center; font-family: var(--font); font-size: 13px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 4px 6px; box-shadow: 0 2px 0 var(--ink); }
#modal .tip { font-size: 14px; }
#modal .link { color: var(--ink); align-self: center; }
.toggle { display: flex; justify-content: space-between; align-items: center; border: 3px solid var(--ink); border-radius: 16px; background: #fff; padding: 10px 14px; font-size: 20px; color: var(--ink); cursor: pointer; }
.toggle i { font-style: normal; background: #d6cfe0; border-radius: 99px; padding: 3px 12px; font-size: 16px; }
.toggle.on i { background: #4fcf2a; color: #fff; }
.uitoast { position: fixed; left: 50%; top: calc(var(--top) + 70px); transform: translateX(-50%); z-index: 45; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 14px; font-size: 17px; box-shadow: 0 4px 0 var(--ink); animation: pop .25s ease-out; white-space: nowrap; }

/* ---------- HUD de pelea ---------- */
#hud { position: fixed; inset: 0; z-index: 6; pointer-events: none; display: none; }
#hud.on { display: block; }
.hudTop { position: absolute; left: calc(var(--left) + 6px); right: calc(var(--right) + 6px); top: calc(var(--top) + 6px); display: flex; align-items: flex-start; gap: 6px; }
.side { flex: 1; display: flex; align-items: flex-start; gap: 5px; min-width: 0; }
.side.s1 { flex-direction: row-reverse; }
.side .face { width: 46px; height: 46px; border: 2px solid var(--ink); border-radius: 10px; background: linear-gradient(180deg, #fff, var(--c)); flex-shrink: 0; }
.side .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.side .name { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.side.s1 .name { flex-direction: row-reverse; }
.side .name b { font-size: clamp(12px, 3.4vw, 17px); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pips { display: flex; gap: 3px; }
.pips i { width: 11px; height: 11px; border-radius: 50%; background: rgba(0, 0, 0, .45); border: 2px solid #fff; }
.pips i.won { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.bar { position: relative; height: clamp(14px, 3.6vw, 20px); background: #2a1a33; border: 2px solid #fff; outline: 2px solid var(--ink); border-radius: 6px; overflow: hidden; transform: skewX(-14deg); }
.side.s1 .bar { transform: skewX(14deg); }
.bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; }
.side.s1 .bar i { left: auto; right: 0; }
.bar .lag { background: #ff4b3e; transition: none; }
.bar .hp { background: linear-gradient(180deg, #fff27a, #ffc21f 55%, #f08c00); transition: width .08s linear; }
.bar .hp.low { background: linear-gradient(180deg, #ff9a9a, #ff2e4d); animation: blink .5s infinite; }
@keyframes blink { 50% { filter: brightness(1.5); } }
.meter { position: relative; height: 10px; width: 78%; background: rgba(0, 0, 0, .55); border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.side.s1 .meter { align-self: flex-end; }
.meter i { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, #3fd0ff, #9dff3f); }
.side.s1 .meter i { left: auto; right: 0; }
.meter span { position: absolute; inset: 0; font-size: 8px; line-height: 7px; text-align: center; color: #fff; letter-spacing: .1em; }
.meter.full i { background: linear-gradient(90deg, #ff3fa4, #ffe14d, #ff3fa4); background-size: 200% 100%; animation: shine .6s linear infinite; }
.meter.full { box-shadow: 0 0 10px var(--pink); }
@keyframes shine { to { background-position: 200% 0; } }
.mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timer { font-size: clamp(26px, 7vw, 38px); line-height: 1; color: #fff; min-width: 48px; text-align: center; }
.timer.hot { color: var(--red); animation: beat .5s infinite; }
@keyframes beat { 50% { transform: scale(1.15); } }
.hbtn { pointer-events: auto; width: 38px; height: 34px; border-radius: 10px; border: 2px solid var(--ink); background: rgba(255, 255, 255, .9); color: var(--ink); font-size: 14px; cursor: pointer; }
.fx { position: absolute; inset: 0; overflow: hidden; }
.banner { position: absolute; left: 0; right: 0; top: 34%; display: flex; flex-direction: column; align-items: center; animation: bannerIn 2.4s ease-out forwards; }
.banner b { font-size: clamp(40px, 12vw, 76px); color: var(--yellow); font-weight: 400; }
.banner span { font-size: 20px; -webkit-text-stroke: .15em var(--ink); paint-order: stroke fill; }
@keyframes bannerIn { 0% { transform: scale(2.2); opacity: 0; } 12% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(.95); } }
.bigtxt { position: absolute; left: 0; right: 0; top: 36%; text-align: center; font-size: clamp(54px, 15vw, 108px); color: #fff; animation: bigIn 1.7s ease-out forwards; }
.bigtxt.go { color: var(--yellow); }
.bigtxt.ko { color: var(--red); font-size: clamp(60px, 17vw, 130px); text-shadow: 0 0 30px rgba(255, 46, 77, .7); }
.bigtxt.perfect { color: var(--lime); top: 52%; font-size: clamp(36px, 10vw, 64px); }
.bigtxt.time { font-size: clamp(32px, 9vw, 60px); color: var(--cyan); }
.bigtxt.dark { font-size: clamp(30px, 8vw, 54px); color: var(--yellow); top: 22%; }
@keyframes bigIn { 0% { transform: scale(2.6) rotate(-6deg); opacity: 0; } 14% { transform: scale(1) rotate(-6deg); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1) rotate(-6deg); } }
.float { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 22px; color: #fff; animation: floatUp 1.5s ease-out forwards; }
.float.special { color: var(--yellow); font-size: 24px; }
.float.small { font-size: 17px; color: var(--lime); }
.float.react { font-size: 40px; -webkit-text-stroke: 0; }
.float.quote { font-family: var(--plain); font-weight: 800; font-size: 14px; -webkit-text-stroke: 0; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 10px; white-space: normal; width: max-content; max-width: 46vw; text-align: center; box-shadow: 0 3px 0 var(--ink); animation: quoteIn 2.3s ease-out forwards; }
@keyframes floatUp { 0% { transform: translate(-50%, -60%) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -100%) scale(1.1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -180%); opacity: 0; } }
@keyframes quoteIn { 0% { transform: translate(-50%, -80%) scale(.6); opacity: 0; } 10% { transform: translate(-50%, -100%) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.combo { position: absolute; top: 24%; display: flex; flex-direction: column; align-items: center; transform: rotate(-6deg); }
.combo.l { left: calc(var(--left) + 10px); }
.combo.r { right: calc(var(--right) + 10px); transform: rotate(6deg); }
.combo b { font-size: clamp(44px, 11vw, 72px); color: var(--c); font-weight: 400; line-height: .9; }
.combo span { font-size: 16px; -webkit-text-stroke: .15em var(--ink); paint-order: stroke fill; }
.combo.pop b { animation: comboPop .25s ease-out; }
@keyframes comboPop { from { transform: scale(1.6); } }
.superBanner { position: absolute; left: -10%; right: -10%; top: 40%; height: clamp(70px, 18vw, 110px); display: flex; align-items: center; gap: 14px; padding: 0 16%;
  background: linear-gradient(90deg, transparent, var(--c) 18%, var(--c) 82%, transparent); transform: skewY(-6deg); animation: superIn 1.3s ease-out forwards; box-shadow: 0 0 0 4px var(--ink); }
.superBanner.r { flex-direction: row-reverse; text-align: right; }
.superBanner img { height: 130%; filter: drop-shadow(0 4px 0 var(--ink)); }
.superBanner div { display: flex; flex-direction: column; }
.superBanner small { font-size: 16px; color: #fff; -webkit-text-stroke: .15em var(--ink); paint-order: stroke fill; }
.superBanner b { font-size: clamp(26px, 7vw, 48px); font-weight: 400; color: #fff; line-height: 1; }
@keyframes superIn { 0% { transform: skewY(-6deg) translateX(-100%); } 18% { transform: skewY(-6deg) translateX(0); } 80% { opacity: 1; transform: skewY(-6deg) translateX(0); } 100% { opacity: 0; transform: skewY(-6deg) translateX(30%); } }
.superBanner.r { animation-name: superInR; }
@keyframes superInR { 0% { transform: skewY(6deg) translateX(100%); } 18% { transform: skewY(6deg) translateX(0); } 80% { opacity: 1; transform: skewY(6deg) translateX(0); } 100% { opacity: 0; transform: skewY(6deg) translateX(-30%); } }
.toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); background: rgba(18, 10, 34, .85); border-radius: 12px; padding: 6px 12px; font-family: var(--plain); font-weight: 700; font-size: 14px; }
.reacts { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--top) + 96px); display: flex; gap: 4px; pointer-events: auto; }
.reacts button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); background: rgba(255, 255, 255, .85); font-size: 18px; padding: 0; cursor: pointer; }

/* ---------- Controles táctiles ---------- */
#touch { position: fixed; inset: 0; z-index: 7; display: none; touch-action: none; }
#touch.on { display: block; }
#touch .half { position: absolute; top: 30%; bottom: 0; left: 0; right: 0; }
#touch.two .half.p1 { right: 50%; }
#touch.two .half.p2 { left: 50%; }
.stick { position: absolute; left: 22%; top: 72%; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .45); background: rgba(18, 10, 34, .25); opacity: .55; pointer-events: none; transition: opacity .15s; }
.stick.live { opacity: 1; }
.stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, .85); border: 3px solid var(--ink); }
.pad { position: absolute; right: calc(var(--right) + 12px); bottom: calc(var(--bottom) + 14px); width: 214px; height: 200px; }
.tb { position: absolute; border-radius: 50%; border: 3px solid var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  box-shadow: 0 5px 0 var(--ink), inset 0 -5px 0 rgba(0, 0, 0, .18); font-size: 12px; opacity: .92; }
.tb span { -webkit-text-stroke: .14em var(--ink); paint-order: stroke fill; letter-spacing: .02em; }
.tb.press { transform: translateY(3px) scale(.95); box-shadow: 0 2px 0 var(--ink); filter: brightness(1.2); }
.b-a { width: 80px; height: 80px; right: 92px; bottom: 0; background: radial-gradient(circle at 40% 30%, #ff8a8a, #ff2e4d); font-size: 14px; }
.b-b { width: 80px; height: 80px; right: 0; bottom: 18px; background: radial-gradient(circle at 40% 30%, #8ae8ff, #1fa8e0); font-size: 14px; }
.b-j { width: 60px; height: 60px; right: 10px; bottom: 112px; background: radial-gradient(circle at 40% 30%, #fff, #c9c0d8); color: var(--ink); }
.b-j span { -webkit-text-stroke: 0; }
.b-c { width: 66px; height: 66px; right: 102px; bottom: 92px; background: conic-gradient(var(--yellow) calc(var(--cd, 1) * 360deg), #8a7a40 0); font-size: 11px; }
.b-s { width: 70px; height: 50px; border-radius: 16px; right: 166px; bottom: 154px; background: #5a4a6a; font-size: 13px; opacity: .55; }
.b-s.ready { background: linear-gradient(90deg, #ff3fa4, #ffe14d, #ff3fa4); background-size: 200% 100%; animation: shine .6s linear infinite, beat .6s infinite; opacity: 1; }
/* dos jugadores en el mismo celular: botones más chicos, el de la derecha al revés */
#touch.two .pad { transform: scale(.78); transform-origin: right bottom; }
#touch.two .half.p1 .pad { right: auto; left: 46%; transform-origin: left bottom; }
#touch.two .half.p1 .stick { left: 18%; }
#touch.two .tb { opacity: .8; }
#touch.two .half.p2 .pad { right: calc(var(--right) + 8px); }
#touch.two .half.p1 .stick, #touch.two .half.p1 .pad { margin-left: var(--left); }

/* acostado (pantalla ancha y bajita): todo más compacto */
@media (orientation: landscape) and (max-height: 520px) {
  .screen { gap: 8px; padding-top: calc(var(--top) + 8px); }
  h1 { font-size: 30px; }
  .logo .l1 { font-size: 64px; } .logo .l2 { font-size: 78px; }
  .menuBtns { gap: 8px; }
  .btn.big { font-size: 22px; padding: 9px 8px; }
  .btn.mid { padding: 8px; }
  .showcase { min-height: 46vh; }
  .grid { grid-template-columns: repeat(13, 1fr); }
  .pad { transform: scale(.82); transform-origin: right bottom; }
  #touch .half { top: 22%; }
  .stick { top: 66%; }
  .hudTop { top: calc(var(--top) + 4px); }
  .side .face { width: 38px; height: 38px; }
  #modal { padding: 8px; }
  #modal .box.help { padding: 10px 12px; gap: 6px; }
  #modal .box.help h2 { font-size: 22px; margin: 0; }
  .hblock { padding: 5px 8px; }
  .hblock ul { gap: 3px; }
  .hblock li { font-size: 12px; line-height: 1.2; }
  .hblock kbd { padding: 2px 4px; font-size: 11px; min-width: 64px; }
  #modal .box.help .tip { display: none; }
  #modal .box.help .btn { padding: 7px; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(13, 1fr); }
  .screen > * { max-width: 640px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo, .vsBig, .banner, .bigtxt, .float, .combo b, .superBanner, .wait, .results .crown { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}
