@font-face {
    font-family: 'Press Start 2P';
    src: url('/vendor/font/press-start-2p-latin-400-normal.woff2') format('woff2');
    font-display: swap;
}
:root {
    --red: #ff3344;
    --blue: #3a6bff;
    --bg: #05050d;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
    margin: 0; width: 100%; height: 100%; overflow: hidden;
    background: var(--bg); color: #fff;
    font-family: 'Press Start 2P', monospace;
    -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
    touch-action: none;
}
#canvas-container { position: fixed; inset: 0; z-index: 0; }
#canvas-container canvas { display: block; }
.outline { text-shadow: 3px 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000; }

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

/* ---------- parte superior (estilo juego de pelea) ---------- */
#top-ui { position: absolute; top: calc(8px + var(--safe-top)); left: 0; right: 0; padding: 0 8px; }
#center-info { text-align: center; }
#round-label { font-size: clamp(9px, 2.6vw, 14px); color: #ffd23f; letter-spacing: 2px; text-shadow: 2px 2px 0 #000; }
#scoreboard { font-size: clamp(22px, 7vw, 40px); margin: 4px 0 6px; text-shadow: 4px 4px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000; }
#score-red { color: var(--red); } #score-blue { color: var(--blue); }
.dash { color: #fff; margin: 0 0.3em; }
#scoreboard span.bump { display: inline-block; animation: bump 0.6s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.8); } 100% { transform: scale(1); } }

#fighters { display: flex; justify-content: space-between; gap: 8px; }
.fighter { display: flex; gap: 6px; align-items: flex-start; width: 50%; min-width: 0; }
.fighter.right { flex-direction: row-reverse; }
.portrait { width: clamp(50px, 15vw, 92px); height: clamp(50px, 15vw, 92px); flex: none; image-rendering: pixelated; border: 3px solid #fff; box-shadow: 0 0 0 3px #000, 0 6px 14px rgba(0,0,0,.6); background: #000; }
.fighter.left .portrait { border-color: #ffb3bb; } .fighter.right .portrait { border-color: #b3c6ff; }
.portrait.hit { animation: phit 0.3s steps(2); }
@keyframes phit { 50% { transform: translateX(3px); filter: brightness(1.8); } }
.bars { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fighter.right .bars { align-items: stretch; }
.fname { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: clamp(7px, 2.1vw, 12px); text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; }
.fighter.right .fname { flex-direction: row-reverse; }
.fighter.left .tn { color: #ff8a93; } .fighter.right .tn { color: #9db4ff; }
.tn { overflow: hidden; text-overflow: ellipsis; }
.members { font-size: 0.85em; opacity: 0.9; flex: none; }
.health-bg { position: relative; height: clamp(14px, 4.2vw, 24px); background: #1a1020; border: 2px solid #fff; box-shadow: 0 0 0 2px #000, 0 6px 14px rgba(0,0,0,.6); overflow: hidden; }
.fighter.right .health-bg, .fighter.right .taps { transform: scaleX(-1); }
.health-bg .fill, .health-bg .ghost { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; transform-origin: left; }
.health-bg .ghost { background: #e0142a; transition: transform 0.7s ease-in 0.4s; }
.health-bg .fill { background: linear-gradient(180deg, #fff5a8 0 22%, #ffd21f 22% 70%, #e8a200 70% 100%); transition: transform 0.12s ease-out; }
.health-bg.low .fill { background: linear-gradient(180deg, #ffc38a 0 22%, #ff8a1f 22% 70%, #d85a00 70% 100%); animation: lowhp 0.5s steps(2) infinite; }
@keyframes lowhp { 50% { filter: brightness(1.6); } }
.sub { display: flex; align-items: center; gap: 6px; }
.fighter.right .sub { flex-direction: row-reverse; }
.taps { flex: 1; height: clamp(5px, 1.5vw, 8px); background: #0b1030; border: 1px solid #000; position: relative; overflow: hidden; }
.taps-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #1ea0ff, #7fe3ff); transition: transform 0.2s linear; }
.taps::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), #000 calc(25% - 1px) 25%); }
.taps.full .taps-fill { background: #fff; }
.hp-num { font-size: clamp(6px, 1.8vw, 10px); text-shadow: 1px 1px 0 #000; flex: none; }

/* ---------- avisos laterales ---------- */
.toasts { position: absolute; top: 30%; display: flex; flex-direction: column; gap: 6px; max-width: 46%; }
.toasts.left { left: 8px; align-items: flex-start; } .toasts.right { right: 8px; align-items: flex-end; }
.toast { font-size: clamp(7px, 2vw, 10px); padding: 6px 8px; background: rgba(0,0,0,.72); border-left: 4px solid; line-height: 1.5; animation: toastIn 0.3s ease-out, toastOut 0.5s ease-in 3.2s forwards; word-break: break-word; }
.toasts.left .toast { border-color: var(--red); } .toasts.right .toast { border-color: var(--blue); border-left: 0; border-right: 4px solid var(--blue); text-align: right; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- nombres flotantes y daño ---------- */
.floater { position: absolute; left: 0; top: 0; font-size: clamp(8px, 2.4vw, 13px); white-space: nowrap; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000; will-change: transform, opacity; animation: floatUp 1.5s ease-out forwards; }
.floater.dmg { color: #ffd23f; font-size: clamp(12px, 4vw, 22px); }
.floater.dmg.big { color: #ff5a1f; font-size: clamp(16px, 6vw, 32px); }
.floater.heal { color: #5cff9a; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.5); } 12% { opacity: 1; transform: translate(var(--x), calc(var(--y) - 10px)) scale(1.15); } 100% { opacity: 0; transform: translate(calc(var(--x) + var(--dx)), calc(var(--y) - 110px)) scale(1); } }

/* ---------- mensajes grandes ---------- */
#big-message { position: absolute; top: 40%; left: 0; right: 0; text-align: center; transform: translateY(-50%); font-size: clamp(28px, 10vw, 72px); line-height: 1.25; display: none; text-shadow: 5px 5px 0 #000, -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000; }
#big-message.show { display: block; animation: slam 0.45s cubic-bezier(.2,1.6,.4,1); }
#big-message small { display: block; font-size: 0.35em; color: #fff; margin-top: 0.5em; }
#big-message.fatality { color: #ff0000; font-size: clamp(34px, 12vw, 96px); animation: slam 0.45s cubic-bezier(.2,1.6,.4,1), shake 0.12s 0.45s 10; }
@keyframes slam { from { transform: translateY(-50%) scale(3); opacity: 0; } }
@keyframes shake { 50% { transform: translateY(-50%) translateX(6px) rotate(1deg); } }
#mvp { position: absolute; top: 56%; left: 0; right: 0; text-align: center; font-size: clamp(9px, 2.8vw, 15px); color: #ffd23f; display: none; text-shadow: 2px 2px 0 #000; }
#mvp.show { display: block; animation: toastIn 0.4s ease-out; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity 0.35s ease-out; }

/* ---------- parte inferior ---------- */
#bottom-ui { position: absolute; left: 0; right: 0; bottom: calc(8px + var(--safe-bottom)); padding: 0 10px; display: flex; flex-direction: column; gap: 8px; }
#narrator { display: flex; gap: 10px; align-items: flex-start; background: linear-gradient(90deg, rgba(10,10,30,.9), rgba(30,10,40,.85)); border: 2px solid #ffd23f; box-shadow: 0 0 0 2px #000, 0 0 18px rgba(255,210,63,.25); padding: 10px 12px; min-height: 3.6em; font-size: clamp(8px, 2.5vw, 13px); line-height: 1.6; }
#narrator .mic { flex: none; }
#narrator.pulse { animation: npulse 0.4s ease-out; }
#narrator.hot { border-color: #ff3344; box-shadow: 0 0 0 2px #000, 0 0 24px rgba(255,50,70,.55); }
@keyframes npulse { 0% { transform: scale(1.04); } }
#footer { font-size: clamp(6px, 1.8vw, 9px); line-height: 1.8; color: #cfd3ff; background: rgba(0,0,0,.6); padding: 6px 8px; text-align: center; }
#footer b { color: #ffd23f; font-weight: normal; }
#conn-pill { position: absolute; top: calc(4px + var(--safe-top)); right: 6px; font-size: 8px; background: #b3121b; padding: 4px 6px; }

/* ---------- pantalla de inicio ---------- */
#start-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5,5,13,.86); display: flex; align-items: center; justify-content: center; }
#start-overlay[hidden] { display: none; }
.start-card { width: min(92vw, 420px); background: #0e0e1f; border: 3px solid #fff; box-shadow: 0 0 0 3px #000, 0 20px 40px rgba(0,0,0,.6); padding: 22px; display: flex; flex-direction: column; gap: 14px; font-size: 11px; line-height: 1.6; }
.start-card h1 { font-size: 22px; margin: 0 0 6px; text-align: center; color: #ffd23f; text-shadow: 3px 3px 0 #b3121b; }
.start-card label { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.start-card input { width: 20px; height: 20px; accent-color: #ffd23f; }
.start-card button { font: inherit; font-size: 13px; padding: 16px; background: #ff3344; color: #fff; border: 3px solid #fff; box-shadow: 0 0 0 3px #000; cursor: pointer; margin-top: 6px; }
.start-card button:active { transform: translateY(2px); }
.start-card .hint { font-size: 8px; color: #9aa0c8; margin: 0; }
