/* Fuentes del juego, servidas desde el propio servidor (Bebas Neue y Rajdhani, licencia SIL OFL).
   Solo el subconjunto latino: incluye tildes, ñ, ¿ y ¡. Así la página no depende de internet para cargar. */
@font-face { font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/bebas-neue-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rajdhani'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/rajdhani-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rajdhani'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/rajdhani-600.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rajdhani'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/rajdhani-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #0a1020;
  --bg2: #121a33;
  --panel: #151e3b;
  --panel2: #1b2750;
  --line: #2b3968;
  --text: #eef2ff;
  --muted: #8f9cc8;
  --gold: #f5c542;
  --p0: #ff3b4e;
  --p1: #2f8bff;
  --ok: #2ee59d;
  --bad: #ff4d6a;
  --row: clamp(48px, calc((100vh - 205px) / 7), 128px);
  --title: 'Bebas Neue', Impact, 'Arial Narrow Bold', sans-serif;
  --body: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--body);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, #1b2a5c 0%, transparent 60%),
    radial-gradient(1000px 600px at 90% 110%, #3a1630 0%, transparent 55%),
    var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font-family: inherit; font-weight: 700; color: inherit; cursor: pointer; }

/* ---------- Barra superior ---------- */
#topbar {
  display: flex; align-items: center; gap: 14px; padding: 8px 16px;
  background: rgba(8, 12, 28, .85); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px); z-index: 5; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--title); letter-spacing: .06em; font-size: 22px; }
.brand em { font-style: normal; color: var(--gold); font-size: 22px; }
.brand-ico { font-size: 22px; }
.slots { display: flex; gap: 8px; margin-inline: auto; flex-wrap: wrap; }
.slot-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); font-size: 15px;
}
.slot-chip i { width: 9px; height: 9px; border-radius: 50%; background: #55608c; }
.slot-chip.on i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.slot-chip.off i { background: #ff9a3d; }
.slot-chip.s0 b { color: var(--p0); }
.slot-chip.s1 b { color: var(--p1); }
.slot-chip button { border: 0; border-radius: 999px; padding: 2px 10px; font-size: 14px; background: var(--gold); color: #1a1500; }
.top-right { display: flex; align-items: center; gap: 8px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 15px; }
.chip.p0 { border-color: var(--p0); color: #ffc2c8; }
.chip.p1 { border-color: var(--p1); color: #c4deff; }
.mini { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 15px; }
.mini:hover { border-color: var(--gold); }
.mini.off { opacity: .45; text-decoration: line-through; }

#main { flex: 1; min-height: 0; position: relative; overflow-y: auto; overflow-x: hidden; }
.view { min-height: 100%; padding: 14px 16px 24px; }

/* ---------- Botones ---------- */
.btn {
  border: 2px solid var(--line); background: var(--panel2); border-radius: 12px; padding: 10px 20px;
  font-size: 18px; letter-spacing: .04em; transition: transform .08s, box-shadow .15s, border-color .15s, background .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--gold); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { font-family: var(--title); font-size: 30px; padding: 14px 28px; display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 4px; }
.btn.big small { font-family: var(--body); font-size: 14px; color: var(--muted); letter-spacing: 0; }
.btn.p0 { border-color: var(--p0); background: linear-gradient(180deg, #3a1520, #2a0f18); }
.btn.p1 { border-color: var(--p1); background: linear-gradient(180deg, #11284f, #0c1c3a); }
.btn.p0:hover:not(:disabled) { box-shadow: 0 0 26px #ff3b4e66; }
.btn.p1:hover:not(:disabled) { box-shadow: 0 0 26px #2f8bff66; }
.btn.gold { background: var(--gold); color: #1c1600; border-color: #ffe08a; }
.btn.ghost { background: transparent; }

/* ---------- Menú ---------- */
#v-menu { display: grid; place-items: center; }
.menu-card {
  width: min(560px, 100%); text-align: center; padding: 28px 22px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(27,39,80,.85), rgba(15,22,48,.9)); border: 1px solid var(--line);
  box-shadow: 0 20px 60px #0008;
}
.menu-ico { font-size: 54px; }
.menu-card h1 { font-family: var(--title); font-weight: 400; font-size: clamp(46px, 9vw, 78px); line-height: .9; letter-spacing: .05em; }
.menu-card h1 span { display: block; color: var(--gold); }
.sub { margin: 14px 0 20px; color: var(--muted); font-size: 18px; }
.sub b { color: var(--text); }
.menu-btns { display: grid; gap: 12px; }
.note { margin-top: 14px; min-height: 22px; color: var(--muted); }

/* ---------- Selección de personajes (estilo Tekken 6) ---------- */
#v-select { display: flex; flex-direction: column; padding: 0 0 10px; }
.tk2 {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  --cw: clamp(40px, min(6.4vw, 8.4vh), 84px); --ch: calc(var(--cw) * 1.45);
}

/* Escenario: dos mitades, una por jugador, con el personaje grande */
.tk-stage2 {
  position: relative; flex: 1; min-height: 330px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden;
  background:
    radial-gradient(circle 120px at 70px 58px, #7fa0dd66, transparent 70%),
    radial-gradient(circle 30px at 70px 58px, #f6f9ff 0 72%, #a9c0ec 96%, transparent 100%),
    radial-gradient(ellipse at 25% 105%, #7a101c66, transparent 62%),
    linear-gradient(180deg, #0b1330 0%, #070914 62%, #1c0609 100%);
}
.tk-stage2::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, transparent 0 46px, #ffffff08 46px 48px); pointer-events: none; }
.tk-stage2::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); background: linear-gradient(180deg, transparent, #ffffffaa 18%, #ffffff55 82%, transparent); pointer-events: none; z-index: 4; }
.side { position: relative; overflow: hidden; min-height: 0; }
.side.s1 { background: linear-gradient(90deg, #0000002a, #00000066); }
.tk-vs2 {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 8; pointer-events: none;
  font-family: var(--title); font-size: clamp(44px, 7vh, 72px); line-height: 1; font-style: italic; letter-spacing: .06em;
  color: #fff6cf; text-shadow: 0 0 20px #ffd866aa, 3px 3px 0 #000, -1px -1px 0 #000;
}

.hero { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; --c: #888; }
.hero::before { content: ''; position: absolute; left: 50%; bottom: 0; width: 100%; height: 100%; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 72%, color-mix(in srgb, var(--c) 60%, transparent), transparent 62%); opacity: .5; }
.hero .aura { position: absolute; bottom: 4px; left: 50%; width: 62%; height: 30px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(#000c, transparent 70%); }
.hero .fig { position: relative; z-index: 1; height: 95%; max-width: 96%; display: flex; align-items: flex-end; justify-content: center; line-height: 1; filter: drop-shadow(0 12px 12px #000a); animation: idle 2.6s ease-in-out infinite alternate; }
.hero .fig .emo { font-size: clamp(120px, 30vh, 280px); align-self: center; }
.hero .fig img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: 50% 100%; }
.hero.h1 .fig .emo { display: inline-block; transform: scaleX(-1); }
.hero.waiting .fig { opacity: .2; filter: grayscale(1) blur(1px); animation: none; }
.hero.waiting .fig .emo { font-family: var(--title); }
.hero.locked .fig { animation: lockpop .4s; }
@keyframes idle { to { transform: translateY(-7px); } }
@keyframes lockpop { 40% { transform: scale(1.1); } }
.hero .ptag {
  position: absolute; top: 12px; z-index: 7; font-family: var(--title); font-size: 28px; letter-spacing: .08em; line-height: 1; padding: 3px 18px 3px 14px; color: #fff;
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%);
}
.hero.h0 .ptag { background: var(--p0); left: 0; }
.hero.h1 .ptag { background: var(--p1); right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); padding: 3px 14px 3px 18px; }
.hero .you { background: var(--gold); color: #1c1600; border-radius: 4px; padding: 0 5px; font-size: 14px; margin-left: 6px; }
.hero .lockmark { position: absolute; top: 16%; left: 50%; transform: translateX(-50%); z-index: 7; font-family: var(--title); font-size: clamp(30px, 4.5vh, 44px); letter-spacing: .1em; white-space: nowrap; color: #7dffb8; text-shadow: 0 0 16px #1fd47a, 2px 2px 0 #04331c; }
.hero .take { position: absolute; top: 42%; left: 50%; transform: translateX(-50%); z-index: 9; }
.hero .take:hover:not(:disabled) { transform: translateX(-50%) translateY(-1px); }

/* Nombre grande sobre el personaje, abajo en su esquina */
.namebar { position: absolute; bottom: 16px; z-index: 6; max-width: 94%; display: flex; flex-direction: column; justify-content: center; color: #fff; overflow: hidden; --c: #c9a0ff; }
.namebar.n0 { left: 0; align-items: flex-start; padding: 6px 40px 8px 22px; background: linear-gradient(90deg, #000e 0%, #000b 72%, transparent); border-left: 9px solid var(--p0); }
.namebar.n1 { right: 0; align-items: flex-end; text-align: right; padding: 6px 22px 8px 40px; background: linear-gradient(270deg, #000e 0%, #000b 72%, transparent); border-right: 9px solid var(--p1); }
.namebar::after { content: ''; position: absolute; top: 0; bottom: 0; width: 30%; left: -50%; background: linear-gradient(100deg, transparent, #fff4, transparent); transform: skewX(-20deg); animation: barshine 3.4s ease-in-out infinite; pointer-events: none; }
@keyframes barshine { 0%, 55% { left: -50%; } 100% { left: 130%; } }
/* Nombres llamativos: degradado blanco -> color del personaje, contorno oscuro y brillo */
.namebar .nm1 {
  font-family: var(--title); font-size: clamp(38px, 6.4vh, 72px); letter-spacing: .07em; line-height: 1.02; font-style: italic; text-transform: uppercase;
  background: linear-gradient(180deg, #fff 8%, #fff 38%, color-mix(in srgb, var(--c) 70%, #fff) 62%, var(--c) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(1.5px 0 0 #1a0833) drop-shadow(-1.5px 0 0 #1a0833) drop-shadow(0 1.5px 0 #1a0833) drop-shadow(0 -1.5px 0 #1a0833) drop-shadow(0 0 10px color-mix(in srgb, var(--c) 80%, transparent));
  animation: nmpop .42s cubic-bezier(.2, 1.6, .4, 1); padding: 0 12px 0 4px;
}
.namebar.n1 .nm1 { padding: 0 4px 0 12px; }
@keyframes nmpop { from { transform: scale(.6) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.namebar .nm2 { font-size: 15px; color: #e2c9f5; letter-spacing: .06em; }
.namebar .nm2 .ready { color: #7dffb8; font-weight: 700; }
.namebar .nm2 .rand { color: #ffe08a; font-weight: 700; }
.namebar.is-locked .nm1 { filter: drop-shadow(1.5px 0 0 #1a0833) drop-shadow(-1.5px 0 0 #1a0833) drop-shadow(0 1.5px 0 #1a0833) drop-shadow(0 -1.5px 0 #1a0833) drop-shadow(0 0 14px #7dffb8); }

/* Franja de selección: marco rojo metálico con retratos altos en dos filas */
.tk-roster { position: relative; padding: 24px clamp(8px, 2vw, 28px) 10px; background: linear-gradient(180deg, #0b0508, #1b080c); border-top: 3px solid #5a0f16; }
.tk-tab {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 1px 34px 3px; white-space: nowrap;
  font-family: var(--title); font-size: 16px; letter-spacing: .16em; color: #ffecec;
  background: linear-gradient(180deg, #d02a35, #7a0a12); clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 14px 100%);
}
.frame {
  width: fit-content; max-width: 100%; margin: 0 auto; padding: 9px 12px; border-radius: 30px;
  background: linear-gradient(180deg, #ff6a6a 0%, #c0141f 16%, #6e060d 50%, #c0141f 84%, #ff7a7a 100%);
  box-shadow: inset 0 0 0 2px #ffc4c4aa, 0 0 0 3px #2a0306, 0 10px 30px #000b;
}
.grid { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 22px; background: linear-gradient(180deg, #2a0a0f, #0b0406); box-shadow: inset 0 0 20px #000, inset 0 0 0 2px #000a; }
.grow { display: flex; justify-content: center; gap: 5px; }

.cell {
  --c: #888; position: relative; width: var(--cw); height: var(--ch); border-radius: 4px; border: 2px solid #0c0406; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--c) 70%, white), var(--c) 72%); transition: transform .1s, filter .2s;
}
.cell .face { position: absolute; inset: 0; display: grid; place-items: center; }
.cell .face .emo { font-size: calc(var(--cw) * .7); line-height: 1; filter: drop-shadow(0 2px 3px #0006); }
.cell .face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transform: scale(1.22); transform-origin: 50% 6%; }
.cell .nm { position: absolute; left: 0; right: 0; bottom: 0; font-size: clamp(8px, .75vw, 11px); font-weight: 800; letter-spacing: .02em; text-transform: uppercase; line-height: 1.05; text-align: center; padding: 12px 1px 3px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 6px #000, 0 0 3px #000; background: linear-gradient(transparent, #000e); overflow: hidden; white-space: nowrap; text-overflow: clip; }
.cell.rnd { background: linear-gradient(160deg, #eeeef4, #9a9aaa 55%, #4d4d5a); }
.cell.rnd .face .q { font-family: var(--title); font-size: calc(var(--cw) * .95); color: #d4202c; text-shadow: 1px 1px 0 #fff, 2px 3px 0 #5a0710, 0 0 12px #ff4a55; line-height: 1; }
.cell:hover { transform: scale(1.07); z-index: 2; }
.cell.c0 { border-color: var(--p0); box-shadow: 0 0 0 3px var(--p0), 0 0 22px var(--p0); z-index: 3; }
.cell.c1 { border-color: var(--p1); box-shadow: 0 0 0 3px var(--p1), 0 0 22px var(--p1); z-index: 3; }
.cell.c0.c1 { box-shadow: 0 0 0 3px var(--p0), 0 0 0 6px var(--p1), 0 0 22px #fff8; }
.cell.l0, .cell.l1 { cursor: not-allowed; }
.cell.l0::after, .cell.l1::after { content: ''; position: absolute; inset: 0; background: #000a; }
.cell.l0 { border-color: var(--p0); }
.cell.l1 { border-color: var(--p1); }
.cell .badge { position: absolute; top: 2px; font-family: var(--title); font-size: 13px; letter-spacing: .04em; padding: 0 5px; border-radius: 4px; color: #fff; z-index: 4; line-height: 1.25; }
.cell .badge.t0 { left: 2px; background: var(--p0); }
.cell .badge.t1 { right: 2px; background: var(--p1); }
.cell.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Pantallas anchas: el escenario ocupa TODO el alto y la franja de retratos queda encima (como en Tekken),
   así el personaje crece hacia abajo y el nombre ocupa la esquina libre junto al marco. */
@media (min-width: 1101px) {
  .tk2 { position: relative; min-height: 560px; --side: calc((100vw - (var(--per, 9) * var(--cw) + 110px)) / 2); }
  .tk-stage2 { position: absolute; inset: 0; min-height: 0; }
  .tk-roster { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; padding: 26px 0 14px; border-top: 0; pointer-events: none; background: linear-gradient(0deg, #000d, #0007 55%, transparent); }
  .tk-roster .frame, .tk-roster .tk-tab { pointer-events: auto; }
  .hero .fig { height: 91%; max-width: calc(var(--side) * 1.3); }
  .hero.h0 { padding-right: calc(25vw - var(--side) / 2); }
  .hero.h1 { padding-left: calc(25vw - var(--side) / 2); }
  /* el "¡LISTO!" y el botón de entrar siguen al personaje (que ya no está centrado en su mitad) */
  .hero.h0 .lockmark, .hero.h0 .take { left: calc(12.5vw + var(--side) / 4); }
  .hero.h1 .lockmark, .hero.h1 .take { left: auto; right: calc(12.5vw + var(--side) / 4); transform: translateX(50%); }
  .hero.h1 .take:hover:not(:disabled) { transform: translateX(50%) translateY(-1px); }
  .tk-vs2 { top: auto; bottom: calc(2 * var(--ch) + 96px); font-size: clamp(80px, 14vh, 140px); }
  .namebar { bottom: 18px; z-index: 12; max-width: calc(var(--side) - 6px); }
  .namebar .nm1 { font-size: clamp(34px, min(10vh, calc((var(--side) - 78px) / 4.1)), 112px); white-space: nowrap; }
  .namebar .nm2 { font-size: clamp(14px, 2vh, 20px); }
}

.controls { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; align-items: center; padding: 0 12px; }
.hint { text-align: center; color: var(--muted); margin-top: 8px; font-size: 15px; padding: 0 12px; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-family: inherit; font-size: 14px; }

/* ---------- Retrato circular (VS, paneles de juego y pantalla final) ---------- */
.portrait {
  --c: #888; width: min(190px, 60%); aspect-ratio: 1; margin: 10px auto; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, white), var(--c) 55%, color-mix(in srgb, var(--c) 40%, black));
  box-shadow: 0 10px 30px #0007, 0 0 0 4px #fff2; overflow: hidden;
}
.portrait .emo { font-size: clamp(64px, 9vw, 104px); line-height: 1; filter: drop-shadow(0 4px 6px #0006); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.empty { background: #0c1330; box-shadow: inset 0 0 0 3px #2b3968; color: #3a4a85; font-family: var(--title); font-size: 84px; }
.cname { font-family: var(--title); font-size: 34px; letter-spacing: .06em; line-height: 1; }
.ccargo { color: var(--muted); font-size: 16px; }

/* ---------- VS: presentación del duelo (fondo en diagonal, rayo central, golpe de VS) ---------- */
/* Pensado para que corra fluido en equipos modestos: sin recortes (clip-path), sin filtros pesados y sin animaciones permanentes grandes. */
#v-vs { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; background: #06081a; }
.vs-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
/* una sola capa: lado rojo a la izquierda, azul a la derecha, separados por una diagonal (115deg: la raya queda inclinada 25°) */
.vs-bg::before {
  content: ''; position: absolute; inset: 0; animation: bgFade .4s ease-out both;
  background:
    radial-gradient(ellipse 38% 60% at 22% 55%, #ff9a9a99, transparent 70%),
    radial-gradient(ellipse 38% 60% at 78% 55%, #9ad2ff99, transparent 70%),
    linear-gradient(115deg, #5a0714 0%, #b3122a 22%, #e0283c 38%, #c01530 50%, #0a2a85 50%, #1d63e0 62%, #3d8cf0 76%, #07184a 100%);
}
@keyframes bgFade { from { opacity: 0; } }
.vs-bg i { position: absolute; display: block; }
.vs-bg .rays {
  left: 50%; top: 50%; width: max(150vw, 150vh); aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, #ffffff26 0 4deg, transparent 4deg 12deg);
  -webkit-mask-image: radial-gradient(circle, transparent 0, #000 10%, #000 38%, transparent 68%); mask-image: radial-gradient(circle, transparent 0, #000 10%, #000 38%, transparent 68%);
}
.vs-bg .dots { inset: 0; background: radial-gradient(#00000038 1.5px, transparent 1.8px) 0 0 / 11px 11px; }
/* rayo central: dos rectángulos rotados 25° (la misma inclinación de la diagonal) */
.vs-bg .bolt, .vs-bg .bolt2 { left: 50%; top: 50%; height: 170vmax; transform: translate(-50%, -50%) rotate(25deg); }
.vs-bg .bolt { width: 9px; background: linear-gradient(90deg, transparent, #fff 30%, #fff 70%, transparent); animation: boltIn .45s .25s ease-out both, boltFlick .2s steps(2) .8s infinite; }
.vs-bg .bolt2 { width: 70px; background: linear-gradient(90deg, transparent, #ffd23f77 40%, #fff8 50%, #ffd23f77 60%, transparent); animation: boltIn .45s .25s ease-out both; }
@keyframes boltIn { from { opacity: 0; } }
@keyframes boltFlick { 50% { opacity: .72; } }
.vs-sparks { position: absolute; inset: 0; }
.vs-sparks i { bottom: -12px; left: var(--x); width: calc(var(--s) * 1.8); height: calc(var(--s) * 1.8); border-radius: 50%; background: radial-gradient(circle, #fff6c0 0 28%, #ffb300cc 45%, transparent 70%); opacity: 0; animation: spark var(--d) linear var(--w) infinite; }
.vs-sparks i:nth-child(n + 7) { display: none; }
@keyframes spark { 0% { transform: translate(0, 0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translate(var(--dx), -112vh); opacity: 0; } }

.vs-wrap { position: relative; z-index: 1; flex: 1; min-height: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; animation: vsShake .55s .6s both; will-change: transform; }
@keyframes vsShake { 12% { transform: translate(-12px, 7px); } 24% { transform: translate(10px, -8px); } 38% { transform: translate(-8px, -5px); } 52% { transform: translate(6px, 5px); } 70% { transform: translate(-3px, 2px); } 100% { transform: none; } }
.vs-side { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px 10px 8px; min-height: 0; }
.vs-side .tagp {
  font-family: var(--title); font-size: clamp(28px, 4.6vh, 48px); letter-spacing: .16em; color: #fff; padding: 2px 26px 0; transform: skewX(-12deg);
  background: #000a; border-bottom: 4px solid currentColor; text-shadow: 0 0 14px currentColor;
}
.vs0 .tagp { color: #ff6573; }
.vs1 .tagp { color: #6fb1ff; }
/* los personajes se acercan al borde de la pantalla para dejar sitio al VS del centro */
.vs0 .vfig { --r: 12%; }
.vs1 .vfig { --l: 12%; }
.vs-side .vfig { --c: #888; position: relative; flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vs-side .vfig::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 68%, color-mix(in srgb, var(--c) 55%, #fff 10%), transparent 62%); opacity: .7; }
.vs-side .vfig img {
  position: absolute; bottom: 0; left: var(--l, 0); right: var(--r, 0); margin: 0 auto; height: 100%; width: auto; max-width: calc(100% - var(--l, 0px) - var(--r, 0px));
  object-fit: contain; object-position: 50% 100%;
}
.vs-side .vfig::after { content: ''; position: absolute; left: 14%; right: 14%; bottom: -1%; height: 7%; border-radius: 50%; background: radial-gradient(ellipse, #000a, transparent 70%); }
.vs-side .vfig .emo { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); font-size: clamp(120px, 30vh, 280px); line-height: 1; }
.vs-side .cname {
  font-family: var(--title); font-size: clamp(44px, min(11vh, 7.6vw), 118px); line-height: 1.02; letter-spacing: .06em; font-style: italic; text-transform: uppercase; white-space: nowrap; padding: 0 12px;
  position: relative; color: #12072a; -webkit-text-stroke: .12em #12072a;
  text-shadow: 0 0 .15em color-mix(in srgb, var(--c, #c9a0ff) 85%, transparent);
}
.vs-side .cname::after {
  content: attr(data-t); position: absolute; inset: 0; padding: inherit; -webkit-text-stroke: 0; text-shadow: none;
  background: linear-gradient(180deg, #fff 10%, #fff 40%, color-mix(in srgb, var(--c, #c9a0ff) 70%, #fff) 62%, var(--c, #c9a0ff) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.vs-side .ccargo { color: #fff; opacity: .85; font-size: clamp(16px, 2.4vh, 24px); letter-spacing: .1em; text-shadow: 0 2px 6px #000a; }
.vs0 { animation: inL .6s cubic-bezier(.2, 1.25, .3, 1) both; }
.vs1 { animation: inR .6s cubic-bezier(.2, 1.25, .3, 1) both; }
@keyframes inL { from { transform: translateX(-130%) skewX(8deg); } }
@keyframes inR { from { transform: translateX(130%) skewX(-8deg); } }
.vs-mid { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none; }
.vs-mid span {
  font-family: var(--title); font-style: italic; font-size: clamp(110px, 34vh, 340px); line-height: .95; letter-spacing: .02em; display: block; padding: .04em .2em .04em .1em;
  position: relative; color: #3a2200; -webkit-text-stroke: .06em #3a2200;
  animation: vsSlam .75s .5s cubic-bezier(.2, 1.4, .3, 1) both; will-change: transform;
}
.vs-mid span::after {
  content: 'VS'; position: absolute; inset: 0; padding: inherit; -webkit-text-stroke: 0;
  background: linear-gradient(180deg, #fff6cf 5%, #ffd23f 45%, #e08a00 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.vs-mid::before { content: ''; position: absolute; left: 50%; top: 50%; width: 150%; aspect-ratio: 1; transform: translate(-50%, -50%); z-index: -1; background: radial-gradient(circle, #ffb300bb 0%, #ff6a0066 32%, transparent 64%); }
@keyframes vsSlam { 0% { transform: scale(5.5) rotate(-14deg); opacity: 0; } 55% { transform: scale(.86) rotate(2deg); opacity: 1; } 78% { transform: scale(1.1); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes vsPulse { to { transform: translate(-50%, -50%) scale(1.07); } }
.vs-flash { position: absolute; inset: 0; z-index: 6; background: #fff; opacity: 0; pointer-events: none; animation: vsFlash .45s .6s ease-out both; }
@keyframes vsFlash { 0% { opacity: .7; } 100% { opacity: 0; } }
.vs-sub {
  position: relative; z-index: 2; text-align: center; padding: 10px 12px 16px; font-family: var(--title); font-size: clamp(18px, 3vh, 32px); letter-spacing: .22em; color: #fff;
  background: linear-gradient(90deg, transparent, #000c 14%, #000c 86%, transparent); text-shadow: 0 0 14px #ffd23f, 0 2px 4px #000;
}

/* ---------- Juego ---------- */
.game { display: grid; grid-template-columns: minmax(300px, 1.3fr) minmax(300px, 380px) minmax(300px, 1.3fr); gap: 16px; align-items: start; max-width: 1500px; margin: 0 auto; }
.panel { --fs: 1; border-radius: 18px; border: 2px solid var(--line); background: linear-gradient(180deg, var(--panel2), var(--panel)); padding: clamp(8px, 1.5vh, 14px) 14px; position: relative; }
.panel.p0 { --pc: var(--p0); border-color: var(--p0); }
.panel.p1 { --pc: var(--p1); border-color: var(--p1); }
.panel.mine { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 35%, transparent), 0 0 46px color-mix(in srgb, var(--pc) 40%, transparent); }
.ph { display: flex; align-items: center; gap: 12px; }
.ph .portrait { width: clamp(42px, 6.2vh, 56px); margin: 0; box-shadow: none; flex: none; }
.ph .portrait .emo { font-size: 32px; }
.ph .pn { flex: 1; min-width: 0; }
.ph .pn b {
  display: block; font-family: var(--title); font-size: clamp(22px, 3.7vh, 32px); letter-spacing: .06em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; text-transform: uppercase;
  background: linear-gradient(180deg, #fff 15%, var(--c, #fff) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 0 0 #0b1030) drop-shadow(-1px 0 0 #0b1030) drop-shadow(0 1px 0 #0b1030) drop-shadow(0 -1px 0 #0b1030);
}
.ph .pn span { color: var(--muted); font-size: clamp(12px, 1.6vh, 14px); }
.panel.p0 .pn span em { color: var(--p0); font-style: normal; }
.panel.p1 .pn span em { color: var(--p1); font-style: normal; }
.score { text-align: right; line-height: 1; }
.score b { font-family: var(--title); font-size: clamp(30px, 5vh, 44px); color: var(--gold); display: block; }
.score small { color: var(--muted); font-size: clamp(10px, 1.5vh, 13px); letter-spacing: .1em; }
.score b.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.35); } }
.pstats { display: flex; gap: 14px; margin: clamp(4px, 1vh, 10px) 0 clamp(3px, .7vh, 6px); font-size: clamp(13px, 1.7vh, 15px); color: var(--muted); flex-wrap: wrap; }
.pstats .fl { color: var(--text); }
.pstats .ok { color: var(--ok); }
.pstats .ko { color: var(--bad); }
.pbar { height: 8px; border-radius: 999px; background: #0c1330; overflow: hidden; border: 1px solid var(--line); }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #ffe58a); transition: width .5s; }
.qbox { margin-top: clamp(6px, 1.2vh, 12px); }
.timer { position: relative; height: clamp(22px, 3.3vh, 30px); border-radius: 999px; background: #0c1330; border: 1px solid var(--line); overflow: hidden; }
.timer i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #2ee59d, #8be53e); }
.timer.warn i { background: linear-gradient(90deg, #ffb13d, #ff7a3d); }
.timer.danger i { background: linear-gradient(90deg, #ff4d6a, #ff2c44); }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(14px, 2vh, 18px); text-shadow: 0 1px 3px #000a; }
/* La pregunta y las 4 respuestas deben verse completas sin bajar la página: los tamaños dependen de la altura de la
   pantalla y de --fs (1 = normal), que el script reduce solo si el texto es muy largo y no cabe. */
.qcard {
  position: relative; margin: calc(var(--fs) * clamp(20px, 3vh, 26px)) 0 calc(var(--fs) * clamp(8px, 1.6vh, 16px)); padding: calc(var(--fs) * clamp(16px, 2.6vh, 24px)) calc(var(--fs) * 20px) calc(var(--fs) * clamp(12px, 2vh, 20px)); border-radius: 18px;
  background: linear-gradient(180deg, #2a3a7c, #18234f); border: 3px solid var(--pc, var(--gold));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--pc, var(--gold)) 20%, transparent), 0 10px 34px #000a, inset 0 0 46px color-mix(in srgb, var(--pc, var(--gold)) 16%, transparent);
}
.qcard.flash { animation: qIn .45s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes qIn { from { transform: scale(.9) translateY(10px); opacity: 0; } }
.qn {
  position: absolute; top: -16px; left: 18px; padding: 3px 18px 2px; border-radius: 999px; background: var(--pc, var(--gold)); color: #fff;
  font-family: var(--title); font-size: clamp(16px, 2.4vh, 22px); letter-spacing: .14em; box-shadow: 0 4px 14px #0008; text-shadow: 0 1px 2px #0007;
}
.qtext { font-size: calc(var(--fs) * clamp(20px, min(2.1vw, 3.7vh), 42px)); line-height: 1.16; min-height: 2.35em; font-weight: 800; color: #fff; text-shadow: 0 2px 10px #000b; display: flex; align-items: center; }
.opts { display: grid; gap: calc(var(--fs) * clamp(7px, 1.3vh, 12px)); }
.opt {
  display: flex; gap: calc(var(--fs) * 12px); align-items: center; text-align: left; padding: calc(var(--fs) * clamp(6px, 1.1vh, 12px)) calc(var(--fs) * 14px); border-radius: 16px;
  background: linear-gradient(180deg, #1f2d62, #141d44); border: 3px solid var(--line); font-size: calc(var(--fs) * clamp(16px, min(1.5vw, 2.9vh), 28px)); font-weight: 700; line-height: 1.15; transition: transform .08s, border-color .15s, background .15s, box-shadow .15s;
}
.opt .k { flex: none; width: calc(var(--fs) * clamp(30px, 4.7vh, 44px)); height: calc(var(--fs) * clamp(30px, 4.7vh, 44px)); border-radius: 12px; display: grid; place-items: center; background: var(--pc, var(--panel2)); color: #fff; font-family: var(--title); font-size: calc(var(--fs) * clamp(18px, 3vh, 28px)); text-shadow: 0 1px 2px #0007; }
.opt:hover:not(:disabled) { border-color: var(--gold); transform: translateX(4px); box-shadow: 0 0 22px #f5c54255; }
.opt:disabled { cursor: default; }
.opt.picked { border-color: var(--gold); background: #2b2a14; }
.opt.right { border-color: var(--ok); background: #0e3b2b; }
.opt.wrong { border-color: var(--bad); background: #43121f; }
.opt.dim { opacity: .45; }
.fb { margin-top: clamp(6px, 1.2vh, 12px); min-height: clamp(22px, 3.4vh, 32px); font-size: clamp(15px, min(1.4vw, 2.6vh), 24px); font-weight: 800; }
.fb.ok { color: var(--ok); }
.fb.ko { color: var(--bad); }
.fb.to { color: #ffb13d; }
.rival-status { margin-top: 14px; padding: 18px 10px; text-align: center; border-radius: 12px; background: #0c1330; border: 1px dashed var(--line); font-size: 18px; color: var(--muted); }
.rival-status.ok { color: var(--ok); }
.rival-status.ko { color: var(--bad); }
.wait { color: var(--muted); text-align: center; padding: 30px 6px; }

/* ---------- Edificio ---------- */
.building { width: 100%; max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; }
.roof {
  text-align: center; padding: 8px 6px; border-radius: 14px 14px 0 0; background: linear-gradient(180deg, #ffe58a, var(--gold));
  color: #2a1d00; font-family: var(--title); letter-spacing: .08em; line-height: 1; box-shadow: 0 0 30px #f5c54266;
}
.roof span { display: block; font-size: 26px; }
.roof small { font-size: 14px; letter-spacing: .3em; }
.bbody { position: relative; border-inline: 4px solid #3b4a82; background: #0c1330; }
.rows { display: flex; flex-direction: column-reverse; }
.rowf { height: var(--row); border-bottom: 2px solid #1d2850; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; color: #6b7bb8; font-family: var(--title); font-size: clamp(18px, calc(var(--row) * .34), 34px); background: repeating-linear-gradient(90deg, transparent 0 47px, #ffffff05 47px 48px); }
.rowf:first-child { border-bottom: 0; }
.rowf .fn { display: flex; flex-direction: column; align-items: center; line-height: 1; min-width: 38px; }
.rowf .fn small { font-family: var(--body); font-weight: 700; font-size: clamp(9px, calc(var(--row) * .15), 12px); color: #54649c; letter-spacing: .02em; margin-top: 2px; }
.rowf.top { background: linear-gradient(90deg, #4a3a0a66, #7a5a0f55, #4a3a0a66); color: var(--gold); box-shadow: inset 0 0 22px #f5c54255; }
.rowf.top .fn small { color: #c9a23a; }
.rowf .office { font-size: calc(var(--row) * .34); }

/* Cada hueco del ascensor tiene marcas cada 10 puntos (más fuertes cada piso = 20 puntos) y una estela del color del jugador */
.shaft {
  --f: 1; --c: #8f9cc8; position: absolute; top: 0; bottom: 0; width: 34%; border-inline: 2px solid #2b3968;
  background:
    repeating-linear-gradient(to top, #ffffff66 0 2px, transparent 2px var(--row)),
    repeating-linear-gradient(to top, #ffffff22 0 2px, transparent 2px calc(var(--row) / 2)),
    linear-gradient(90deg, #060a1a, #0f1736, #060a1a);
}
.shaft.s0 { left: 12%; }
.shaft.s1 { right: 12%; }
.shaft::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none;
  height: calc((var(--f) - 1) * var(--row) + var(--row) / 2); transition: height 1.1s cubic-bezier(.5, 0, .2, 1);
  background: linear-gradient(0deg, color-mix(in srgb, var(--c) 55%, transparent), color-mix(in srgb, var(--c) 10%, transparent));
}
.cab {
  position: absolute; left: 4px; right: 4px; z-index: 2; height: calc(var(--row) - 6px); bottom: calc((var(--f) - 1) * var(--row) + 3px);
  border-radius: 8px; display: grid; place-items: center; transition: bottom 1.1s cubic-bezier(.5, 0, .2, 1);
  background: linear-gradient(180deg, #cfd8f3, #8f9cc8); border: 3px solid #fff3; box-shadow: 0 4px 14px #0008;
}
.s0 .cab { border-color: var(--p0); box-shadow: 0 0 16px #ff3b4e88; }
.s1 .cab { border-color: var(--p1); box-shadow: 0 0 16px #2f8bff88; }
.cab .emo { font-size: calc(var(--row) * .6); line-height: 1; }
.cab img { width: calc(var(--row) * .72); height: calc(var(--row) * .72); border-radius: 50%; object-fit: cover; }
.cab .ctag { position: absolute; top: -9px; left: 4px; font-family: var(--title); font-size: 13px; padding: 0 6px; border-radius: 6px; color: #fff; }
.s0 .cab .ctag { background: var(--p0); }
.s1 .cab .ctag { background: var(--p1); }
.cab .cpts { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap; font-family: var(--title); font-size: 15px; letter-spacing: .04em; line-height: 1.15; padding: 0 9px; border-radius: 999px; background: #0b1030; border: 1px solid var(--gold); color: var(--gold); }
.cab .pop { position: absolute; left: 28%; top: -6px; transform: translateX(-50%); font-family: var(--title); font-size: 26px; white-space: nowrap; animation: floatUp 1.3s forwards; text-shadow: 0 2px 6px #000, 0 0 10px #000; pointer-events: none; z-index: 5; }
.cab .pop.up { color: var(--ok); }
.cab .pop.down { color: var(--bad); }
@keyframes floatUp { to { transform: translate(-50%, -52px); opacity: 0; } }
.cab.arrived { animation: glow 1s infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 30px 6px var(--gold); } }
.ground { text-align: center; padding: 6px; background: #1b2650; border-radius: 0 0 14px 14px; font-family: var(--title); letter-spacing: .2em; color: var(--muted); }

/* ---------- Burbujas de emoticones ---------- */
.ph { position: relative; }
.emote {
  --tx: -50%; --ty: 0%; --m: 1; position: absolute; z-index: 8; pointer-events: none; line-height: 1; padding: 3px 9px 5px; border-radius: 20px; background: #fff;
  font-size: calc(var(--es, 30px) * var(--m)); box-shadow: 0 4px 14px #000a, 0 0 0 2px #0002; transform-origin: 50% 100%;
  animation: emotePop 2.7s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.emote::after { content: ''; position: absolute; width: 14px; height: 14px; background: inherit; transform: rotate(45deg); border-radius: 0 0 4px 0; box-shadow: 3px 3px 5px #0004; }
.emote.at-cab { left: 70%; bottom: calc(100% + 12px); --es: clamp(26px, calc(var(--row) * .42), 48px); }
.emote.at-cab::after { left: calc(50% - 7px); bottom: -6px; }
.emote.at-panel { top: 2px; right: 100px; --tx: 0%; --ty: 0%; --es: 25px; transform-origin: 100% 50%; }
.emote.at-panel::after { right: -6px; top: calc(50% - 7px); border-radius: 0 4px 0 0; box-shadow: 3px -3px 5px #0004; }
.emote.l2 { --m: 1.1; } .emote.l3 { --m: 1.22; } .emote.l4 { --m: 1.36; } .emote.l5 { --m: 1.5; }
.emote.k-joy { background: #fff3b8; box-shadow: 0 0 0 2px #f5c542, 0 0 16px #ffd866bb, 0 4px 14px #000a; }
.emote.k-joy.l4, .emote.k-joy.l5 { background: #ffe08a; box-shadow: 0 0 0 3px #ff8a3c, 0 0 26px #ff8a3cdd, 0 4px 14px #000a; animation: emotePop 2.7s cubic-bezier(.2, 1.4, .4, 1) forwards, hot .35s ease-in-out infinite alternate; }
.emote.k-fast { background: #dcffe6; box-shadow: 0 0 0 2px #2ee59d, 0 4px 14px #000a; }
.emote.k-cry { background: #cfe6ff; box-shadow: 0 0 0 2px #5aa0ff, 0 0 16px #5aa0ff99, 0 4px 14px #000a; }
.emote.k-shame, .emote.k-down { background: #ffd9e2; box-shadow: 0 0 0 2px #ff7a9c, 0 4px 14px #000a; }
.emote.k-angry { background: #ffd2c4; box-shadow: 0 0 0 2px #ff5a3c, 0 4px 14px #000a; }
.emote.k-worry { background: #e6dcff; box-shadow: 0 0 0 2px #9b7bff, 0 4px 14px #000a; }
.emote.k-timeout, .emote.k-think { background: #eceef8; }
.emote.k-start { background: #fff; box-shadow: 0 0 0 2px var(--gold), 0 4px 14px #000a; }
@keyframes emotePop {
  0% { opacity: 0; transform: translate(var(--tx), calc(var(--ty) + 14px)) scale(.2); }
  12% { opacity: 1; transform: translate(var(--tx), var(--ty)) scale(1.28); }
  22% { transform: translate(var(--tx), var(--ty)) scale(1); }
  82% { opacity: 1; transform: translate(var(--tx), calc(var(--ty) - 6px)) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), calc(var(--ty) - 22px)) scale(.9); }
}
@keyframes hot { to { filter: brightness(1.15); } }
.pstats .st { color: #ffb13d; font-weight: 700; }
.pstats .qs { color: var(--muted); }
.endnote { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #1b2550; border: 1px solid var(--gold); color: #e8ecff; font-size: 15px; line-height: 1.3; }
.endnote b { color: var(--gold); }
.pstats .qs.last { color: #ffb13d; font-weight: 700; }
.end-card .drawrow { display: flex; justify-content: center; gap: 18px; }
.end-card .drawrow .portrait { width: 110px; margin: 12px 0; }
.pstats .st.hot { color: #ff7a3d; text-shadow: 0 0 10px #ff7a3d88; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(5, 8, 20, .7); backdrop-filter: blur(3px); }
.overlay.solid { background: rgba(5, 8, 20, .92); font-family: var(--title); font-size: 40px; letter-spacing: .1em; z-index: 50; }
#countdown { backdrop-filter: none; background: rgba(5, 8, 20, .66); }
#cd-num { font-family: var(--title); font-size: clamp(120px, 30vw, 320px); color: var(--gold); text-shadow: 0 0 28px #f5c542aa; animation: cd .9s both; will-change: transform, opacity; }
@keyframes cd { from { transform: scale(2.4); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
.end { z-index: 25; overflow: hidden; }
.end-card { text-align: center; max-width: 640px; width: calc(100% - 24px); padding: 26px 20px; border-radius: 24px; background: linear-gradient(180deg, #202c5a, #121a38); border: 2px solid var(--gold); box-shadow: 0 0 80px #f5c54255; position: relative; z-index: 2; animation: pop .6s both; }
.end-card h2 { font-family: var(--title); font-weight: 400; font-size: clamp(34px, 6vw, 56px); letter-spacing: .06em; line-height: 1; color: var(--gold); }
.end-card .portrait { width: 150px; margin: 12px auto; }
.end-card .winname { font-family: var(--title); font-size: 40px; }
.end-card .res { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.end-card .res div { background: #0c1330; border-radius: 12px; padding: 10px; border: 1px solid var(--line); font-size: 15px; }
.end-card .res b { display: block; font-family: var(--title); font-size: 24px; }
.end-card .auto { color: var(--muted); margin-top: 10px; font-size: 15px; }
.confetti { position: absolute; top: -30px; font-size: 26px; animation: fall linear forwards; z-index: 1; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 30px); background: #20305f; border: 1px solid var(--gold); padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .3s; z-index: 60; max-width: calc(100% - 24px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .game { grid-template-columns: 1fr 1fr; }
  .building { --row: clamp(44px, 8vh, 72px); grid-column: 1 / -1; grid-row: 2; max-width: 380px; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  #topbar { gap: 6px 8px; padding: 6px 10px; }
  .slots { margin-inline: 0; order: 3; width: 100%; justify-content: center; }
  .top-right { margin-left: auto; }
  .view { padding: 10px 10px 20px; }
  .brand b { font-size: 17px; }
  .brand em { display: none; }
  /* Selección en celular: los retratos pasan a filas que se ajustan solas */
  #v-select { padding-bottom: 14px; }
  .tk2 { --cw: clamp(40px, 13.4vw, 58px); --ch: calc(var(--cw) * 1.42); }
  .tk-stage2 { min-height: 300px; }
  .tk-vs2 { font-size: 34px; top: 4px; }
  .hero .ptag { font-size: 18px; top: 8px; padding: 2px 12px 2px 9px; }
  .hero .fig { height: 88%; }
  .hero .fig .emo { font-size: 110px; }
  .hero .lockmark { font-size: 22px; top: 22%; }
  .hero .take { font-size: 14px; padding: 8px 10px; white-space: normal; width: 86%; text-align: center; }
  .namebar { bottom: 8px; }
  .namebar.n0 { padding: 3px 22px 4px 10px; border-left-width: 5px; }
  .namebar.n1 { padding: 3px 10px 4px 22px; border-right-width: 5px; }
  .namebar .nm1 { font-size: 26px; }
  .namebar .nm2 { font-size: 11px; }
  .tk-roster { padding: 22px 8px 8px; }
  .frame { padding: 6px 7px; border-radius: 20px; }
  .grid { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 8px 6px; border-radius: 14px; }
  .grow { display: contents; }
  .cell .nm { font-size: 8px; padding-top: 9px; }
  .vs-mid { top: 40%; }
  .vs-mid span { font-size: 84px; }
  .vs0 .vfig { --r: 6%; }
  .vs1 .vfig { --l: 6%; }
  .vs-side { padding: 10px 4px 4px; }
  .vs-side .tagp { font-size: 18px; }
  .vs-side .cname { font-size: clamp(26px, 8.4vw, 40px); padding: 0; }
  .vs-side .ccargo { font-size: 13px; }
  .vs-sub { font-size: 13px; letter-spacing: .08em; padding: 6px 8px 12px; }
  .game { grid-template-columns: 1fr; }
  .game .building { --row: 36px; max-width: 320px; }
  .game .roof span { font-size: 20px; }
  .game .roof small { display: none; }
  .game .rowf { font-size: 16px; padding: 0 2px; }
  .game .rowf .fn { min-width: 0; }
  .game .rowf .fn small { font-size: 8px; letter-spacing: 0; }
  .game .cab .cpts { font-size: 11px; bottom: -9px; padding: 0 6px; }
  .game .cab img { width: calc(var(--row) * .62); height: calc(var(--row) * .62); }
  .game .cab .ctag { font-size: 10px; top: -8px; padding: 0 4px; }
  .emote.at-panel { right: 84px; --es: 28px; }
  .game .panel.mine { order: 1; }
  .game .building { order: 2; }
  .game .panel.other { order: 3; }
  .qtext { font-size: calc(var(--fs) * clamp(18px, 3.2vh, 24px)); min-height: 0; }
  .qcard { padding: calc(var(--fs) * 18px) calc(var(--fs) * 12px) calc(var(--fs) * 12px); }
  .opt { padding: calc(var(--fs) * 8px) calc(var(--fs) * 10px); font-size: calc(var(--fs) * clamp(15px, 2.7vh, 19px)); }
  .opt .k { width: calc(var(--fs) * 32px); height: calc(var(--fs) * 32px); font-size: calc(var(--fs) * 20px); }
  .fighter .portrait { width: 110px; }
  .fighter .cname { font-size: 26px; }
  .portrait .emo { font-size: 56px; }
}
/* ---------- Pantalla del ganador ---------- */
.end {
  background:
    radial-gradient(ellipse at 50% 58%, #4a350a99, transparent 62%),
    linear-gradient(180deg, #0b1330 0%, #070914 62%, #1c0609 100%);
  backdrop-filter: none; place-items: stretch;
}
.victory { --c: #ffd23f; position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.v-rays {
  position: absolute; left: 50%; top: 55%; width: min(125vh, 95vw); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none;
  background: repeating-conic-gradient(from 0deg, #ffd23f40 0 6deg, transparent 6deg 18deg);
  -webkit-mask-image: radial-gradient(circle closest-side, #000 0, #000 25%, transparent 100%); mask-image: radial-gradient(circle closest-side, #000 0, #000 25%, transparent 100%);
  animation: raysSpin 60s steps(300) infinite;   /* giro en pasos pequeños: se ve igual de suave y casi no cuesta */
}
@keyframes raysSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.v-title, .v-name {
  position: relative; z-index: 3; font-family: var(--title); font-style: italic; text-transform: uppercase; white-space: nowrap; line-height: 1.02; letter-spacing: .06em; padding: 0 14px;
  background: linear-gradient(180deg, #fff 8%, #fff 40%, color-mix(in srgb, var(--c) 70%, #fff) 64%, var(--c) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 0 0 #12072a) drop-shadow(-2px 0 0 #12072a) drop-shadow(0 2px 0 #12072a) drop-shadow(0 -2px 0 #12072a) drop-shadow(0 0 18px color-mix(in srgb, var(--c) 85%, transparent));
}
.v-title { margin-top: clamp(8px, 2.5vh, 28px); font-size: clamp(40px, 8.5vh, 96px); animation: titlePop .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.v-name { font-size: clamp(34px, 7vh, 80px); margin-top: 4px; animation: titlePop .7s .25s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes titlePop { from { transform: scale(.3) translateY(20px); opacity: 0; } }
.v-stage { position: relative; z-index: 2; flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; align-items: flex-end; padding: 6px 12px 0; }
.v-fig { position: relative; height: 100%; display: flex; align-items: flex-end; animation: figIn .8s .1s cubic-bezier(.2, 1.2, .3, 1) both; }
.v-fig img { height: 100%; max-width: 48vw; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 18px 22px #000b) drop-shadow(0 0 44px color-mix(in srgb, var(--c) 60%, transparent)); }
.v-fig .emo { font-size: clamp(120px, 34vh, 300px); line-height: 1; align-self: center; }
.v-fig.small { height: 82%; }
.v-fig.small img { max-width: 36vw; }
@keyframes figIn { from { transform: translateY(60px) scale(.8); opacity: 0; } }
.v-trophy {
  position: relative; align-self: flex-end; height: 56%; margin: 0 0 4% -3vw; z-index: 3; filter: drop-shadow(0 0 28px #ffd23fcc);
  animation: trophyDrop 1s .9s cubic-bezier(.3, 1.45, .5, 1) both, trophyFloat 2.4s 1.9s ease-in-out infinite alternate;
}
.v-trophy svg { height: 100%; width: auto; display: block; }
@keyframes trophyDrop { from { transform: translateY(-120vh) rotate(-25deg) scale(1.4); opacity: 0; } 70% { opacity: 1; } }
@keyframes trophyFloat { to { transform: translateY(-10px) rotate(2deg); } }
.v-sub { position: relative; z-index: 9; margin-top: 6px; padding: 8px 18px; max-width: min(900px, 94vw); text-align: center; font-size: clamp(16px, 2.5vh, 24px); font-weight: 700; color: #f1f4ff; background: #000a; border-radius: 12px; text-shadow: 0 2px 6px #000; }
.v-actions { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 16px; min-height: 40px; }
.v-actions .auto { color: var(--muted); font-size: 14px; }
.confetti-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; }
@media (max-width: 700px) {
  .v-fig img { max-width: 62vw; }
  .v-trophy { height: 40%; margin-left: -10vw; }
  .v-title { font-size: clamp(34px, 9vw, 52px); }
  .v-name { font-size: clamp(30px, 8vw, 46px); }
  .v-fig.small img { max-width: 44vw; }
}

/* ---------- Botón EMPEZAR RONDA (siempre visible arriba al centro; lo ve el espectador o el Jugador 1) ---------- */
#start-wrap { position: fixed; left: 50%; top: 62px; transform: translateX(-50%); z-index: 15; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
#start-wrap small { color: #fff; background: #000a; padding: 3px 12px; border-radius: 999px; font-size: 15px; }
.start-btn { font-family: var(--title); font-size: clamp(30px, 4.4vw, 54px); letter-spacing: .08em; padding: 12px 44px; border-radius: 16px; border-width: 3px; box-shadow: 0 0 0 0 #f5c54299, 0 10px 40px #000a; animation: startPulse 1.2s ease-in-out infinite; }
@keyframes startPulse { 50% { box-shadow: 0 0 0 16px #f5c54200, 0 10px 40px #000a, 0 0 46px #f5c542aa; transform: scale(1.04); } }
@media (max-width: 700px) {
  #start-wrap { top: 90px; }
  .start-btn { font-size: 30px; padding: 8px 26px; white-space: nowrap; border-radius: 14px; }
  #start-wrap small { font-size: 13px; }
}
#old-server { position: fixed; top: 0; left: 0; right: 0; z-index: 90; padding: 10px 16px; text-align: center; background: #ff4d6a; color: #fff; font-size: 18px; font-weight: 700; box-shadow: 0 4px 20px #0008; }

/* ---------- Título largo de la presentación (menú) ---------- */
.menu-card h1.titulo-largo { font-size: clamp(22px, 5.4vw, 32px); line-height: 1; margin-top: 4px; }
.menu-card h1.titulo-largo span { margin-top: 6px; font-size: 1.45em; line-height: .95; }

/* ---------- Ranking e historial de VS ---------- */
.modal { z-index: 40; padding: 12px; }
.stats-card {
  position: relative; width: min(760px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column;
  padding: 18px 16px 14px; border-radius: 22px; background: linear-gradient(180deg, #1d2a58, #0f1630);
  border: 2px solid var(--gold); box-shadow: 0 0 70px #f5c54238, 0 20px 60px #000a;
}
.stats-card h2 { font-family: var(--title); font-weight: 400; font-size: clamp(28px, 5vw, 38px); letter-spacing: .06em; line-height: 1; color: var(--gold); text-align: center; padding: 0 36px; }
.stats-close { position: absolute; top: 12px; right: 12px; }
.stats-tabs { display: flex; gap: 8px; justify-content: center; margin: 12px 0 10px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 16px; font-size: 16px; color: var(--muted); }
.tab:hover { border-color: var(--gold); }
.tab.on { background: var(--gold); color: #1c1600; border-color: #ffe08a; }
.stats-body { overflow-y: auto; min-height: 140px; }
.stats-empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 18px; line-height: 1.4; }
.stats-foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 10px; }

.ava { --c: var(--line); display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #0c1330; border: 2px solid var(--c); }
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava .emo { font-size: 20px; line-height: 1; }

table.rank { width: 100%; border-collapse: collapse; }
table.rank th { color: var(--muted); font-size: 14px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px 8px; text-align: center; position: sticky; top: 0; background: #131c3d; }
table.rank td { padding: 6px; text-align: center; border-top: 1px solid var(--line); font-size: 18px; }
table.rank th.nm, table.rank td.nm { text-align: left; }
table.rank td.pos { font-family: var(--title); font-size: 24px; width: 44px; }
table.rank td.v b { color: var(--gold); font-size: 20px; }
table.rank .who { display: inline-flex; align-items: center; gap: 10px; }
table.rank tr.top1 td { background: #f5c54218; }
table.rank tr.top2 td { background: #c9d4ff10; }
table.rank tr.top3 td { background: #e8934a12; }

.hist { display: grid; gap: 8px; }
.match { padding: 8px 12px 9px; border-radius: 14px; background: #0c1330; border: 1px solid var(--line); }
.mhead { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.mrow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 4px 0; }
.mside { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mside.p1 { flex-direction: row-reverse; text-align: right; }
.mside .sinfo { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.mside .sinfo b { font-family: var(--title); font-weight: 400; font-size: 22px; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mside .sinfo small { color: var(--muted); font-size: 14px; }
.mside.win .sinfo b { color: var(--gold); }
.mside.win .ava { box-shadow: 0 0 12px color-mix(in srgb, var(--c) 70%, transparent); }
.mvs { font-family: var(--title); font-size: 22px; color: var(--muted); letter-spacing: .08em; }
.mfoot { text-align: center; font-size: 15px; color: #cfd8ff; }

@media (max-width: 700px) {
  .stats-card { padding: 14px 10px 12px; }
  .ava { width: 32px; height: 32px; }
  table.rank td { font-size: 16px; padding: 5px 3px; }
  table.rank td.pos { font-size: 20px; width: 34px; }
  table.rank .who { gap: 6px; }
  .mside { gap: 6px; }
  .mside .sinfo b { font-size: 18px; }
  .mside .sinfo small { font-size: 12px; }
  .mfoot { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
