/* ==========================================================================
   CHOQUE DE COLEGIOS — juego de peleas pixel art de estudiantina.online
   Noche de Costanera: fondo violeta casi negro, letras pixel, botones con
   canto duro y el naranja de la marca como acento.
   ========================================================================== */

/* Fuentes locales (subconjunto latino, licencia OFL): el juego anda igual sin conexión y en la app */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/pelea/fonts/press-start-2p-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/pelea/fonts/instrument-sans-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/pelea/fonts/pixelify-sans-latin.woff2') format('woff2');
}

:root {
  --pl-bg: #0b0a12;
  --pl-bg-2: #15131f;
  --pl-bg-3: #1f1c2e;
  --pl-line: #322d47;
  --pl-ink: #f2ede4;
  --pl-ink-2: #b9b2c9;
  --pl-ink-3: #7f7894;
  --pl-accent: #ff8a1f;
  --pl-accent-2: #ffd23f;
  --pl-p1: #ff4d5e;
  --pl-p2: #3fa9ff;
  --pl-hp: #46e07a;
  --pl-hp-low: #ff4d5e;
  --pl-ki: #ffd23f;
  --pl-pixel: 'Press Start 2P', ui-monospace, monospace;
  --pl-sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --pl-top-h: 48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body.pl {
  background: var(--pl-bg);
  color: var(--pl-ink);
  font-family: var(--pl-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 3px solid var(--pl-accent-2); outline-offset: 2px; }

/* ---------- barra de arriba ---------- */
.pl-top {
  height: var(--pl-top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 2px solid var(--pl-line);
  background: var(--pl-bg);
}
.pl-back { color: var(--pl-ink-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.pl-back span { color: var(--pl-ink-3); }
.pl-back:hover { color: var(--pl-ink); }
.pl-top-actions { display: flex; gap: 8px; }
.pl-icon {
  width: 32px; height: 32px;
  font-family: var(--pl-pixel); font-size: 12px;
  background: var(--pl-bg-3); border: 2px solid var(--pl-line);
  box-shadow: 0 3px 0 #000;
}
.pl-icon:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }

.pl-app { min-height: calc(100dvh - var(--pl-top-h)); }

.pl-screen { display: none; }
.pl-screen.is-on { display: block; }

/* ---------- botones ---------- */
.pl-btn {
  font-family: var(--pl-pixel);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 14px 18px 13px;
  background: var(--pl-bg-3);
  border: 2px solid #4a4366;
  box-shadow: 0 4px 0 #000, inset 0 -3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 60ms, box-shadow 60ms, background 120ms;
}
.pl-btn:hover:not(:disabled) { background: #2a2640; }
.pl-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #000, inset 0 -1px 0 rgba(0, 0, 0, 0.35); }
.pl-btn--main { background: var(--pl-accent); border-color: #ffb066; color: #1a0d00; }
.pl-btn--main:hover:not(:disabled) { background: #ff9c3d; }

.pl-link {
  font-family: var(--pl-pixel); font-size: 10px; color: var(--pl-ink-2);
  padding: 10px 4px; text-decoration: underline; text-underline-offset: 4px;
}
.pl-link:hover { color: var(--pl-ink); }

.pl-seg { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pl-seg-label { font-family: var(--pl-pixel); font-size: 9px; color: var(--pl-ink-3); margin-right: 6px; }
.pl-seg button {
  font-family: var(--pl-pixel); font-size: 9px; padding: 9px 10px;
  border: 2px solid var(--pl-line); background: var(--pl-bg-2); color: var(--pl-ink-2);
}
.pl-seg button[aria-checked="true"] { background: var(--pl-ink); color: var(--pl-bg); border-color: var(--pl-ink); }

.pl-h2 { font-family: var(--pl-pixel); font-size: 16px; line-height: 1.4; font-weight: 400; }
.pl-copy { color: var(--pl-ink-2); max-width: 60ch; }
.pl-status { min-height: 1.5em; color: var(--pl-accent-2); font-weight: 600; }

/* ---------- menú ---------- */
.pl-menu {
  max-width: 640px; margin: 0 auto; padding: 24px 16px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
}
.pl-menu-art {
  width: 100%; max-width: 640px; aspect-ratio: 320 / 120;
  image-rendering: pixelated; border: 2px solid var(--pl-line);
}
.pl-logo {
  font-family: var(--pl-pixel); font-weight: 400;
  font-size: clamp(22px, 6.4vw, 40px); line-height: 1.15;
  color: var(--pl-accent-2);
  text-shadow: 3px 3px 0 #c2410c, 6px 6px 0 #000;
  text-transform: uppercase;
}
.pl-logo span { display: block; font-size: 0.5em; color: var(--pl-ink); text-shadow: 2px 2px 0 #000; margin-bottom: 6px; }
.pl-tag { color: var(--pl-ink-2); max-width: 40ch; }
.pl-menu-btns { display: grid; gap: 12px; width: min(100%, 320px); }

/* ---------- online ---------- */
.pl-panel { max-width: 900px; margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 16px; }
.pl-online-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pl-card {
  background: var(--pl-bg-2); border: 2px solid var(--pl-line); padding: 16px;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
}
.pl-card h3 { font-family: var(--pl-pixel); font-size: 11px; font-weight: 400; color: var(--pl-ink-2); }
.pl-code { display: grid; gap: 4px; }
.pl-code span { font-size: 12px; color: var(--pl-ink-3); }
.pl-code strong { font-family: var(--pl-pixel); font-size: 28px; letter-spacing: 0.1em; color: var(--pl-accent-2); font-weight: 400; }
.pl-join { display: flex; gap: 8px; width: 100%; }
.pl-join input {
  flex: 1; min-width: 0; font-family: var(--pl-pixel); font-size: 16px; letter-spacing: 0.15em;
  text-transform: uppercase; padding: 10px; background: var(--pl-bg); color: var(--pl-ink);
  border: 2px solid var(--pl-line);
}

/* ---------- selección ---------- */
.pl-select { max-width: 1200px; margin: 0 auto; padding: 16px 16px 24px; display: grid; gap: 14px; }
.pl-select-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pl-turn { font-family: var(--pl-pixel); font-size: 10px; color: var(--pl-p1); }
.pl-turn[data-player="1"] { color: var(--pl-p2); }
.pl-select-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.pl-grid { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 6px; }
.pl-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px 5px;
  background: linear-gradient(180deg, var(--c1) 0 62%, var(--pl-bg-2) 62%);
  border: 2px solid #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.pl-cell canvas { width: 100%; max-width: 66px; height: auto; image-rendering: pixelated; display: block; }
.pl-cell span {
  font-size: 10px; font-weight: 600; line-height: 1.1; color: var(--pl-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.pl-cell:hover { filter: brightness(1.15); }
.pl-cell.is-cursor { outline: 3px solid var(--pl-accent-2); outline-offset: 0; z-index: 1; }
.pl-cell.is-cursor span { color: var(--pl-ink); }
.pl-cell.is-p1::after, .pl-cell.is-p2::after {
  position: absolute; top: 2px; left: 2px; font-family: var(--pl-pixel); font-size: 8px; padding: 3px;
  color: #fff;
}
.pl-cell.is-p1::after { content: "J1"; background: var(--pl-p1); }
.pl-cell.is-p2::after { content: "J2"; background: var(--pl-p2); left: auto; right: 2px; }

.pl-detail {
  background: var(--pl-bg-2); border: 2px solid var(--pl-line);
  border-top: 6px solid var(--c1, var(--pl-accent));
  padding: 14px; display: grid; gap: 12px; position: sticky; top: 12px;
}
.pl-detail-top { display: flex; gap: 12px; align-items: center; }
.pl-detail-top canvas {
  width: 120px; height: 144px; image-rendering: pixelated; flex: none;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--c1, #333) 45%, transparent), transparent 70%);
}
.pl-detail-name { font-family: var(--pl-pixel); font-size: 13px; line-height: 1.4; font-weight: 400; }
.pl-detail-lema { color: var(--pl-ink-2); font-size: 13px; margin-top: 6px; }
.pl-stats { display: grid; gap: 5px; }
.pl-stats div { display: grid; grid-template-columns: 82px 1fr; align-items: center; }
.pl-stats dt { font-size: 12px; color: var(--pl-ink-2); font-weight: 600; }
.pl-stats dd { display: flex; gap: 3px; }
.pl-stats i { width: 100%; max-width: 30px; height: 10px; background: var(--pl-bg-3); border: 1px solid #000; }
.pl-stats i.on { background: var(--pl-accent-2); }
.pl-moves { display: grid; gap: 8px; }
.pl-moves div { display: grid; grid-template-columns: 82px 1fr; gap: 4px; }
.pl-moves dt { font-size: 12px; color: var(--pl-ink-3); font-weight: 600; }
.pl-moves dd b { display: block; font-size: 13px; }
.pl-moves dd span { display: block; font-size: 12px; color: var(--pl-ink-2); line-height: 1.35; }
.pl-detail-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pl-select-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- pelea ---------- */
#scr-fight.is-on { display: flex; flex-direction: column; align-items: center; padding: 8px 0 16px; gap: 10px; }
.pl-arena {
  position: relative;
  width: min(100vw, calc((100dvh - var(--pl-top-h) - 24px) * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  user-select: none; -webkit-user-select: none;
}
.pl-canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; background: #000; }

.pl-hud {
  position: absolute; inset: 0 0 auto 0;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 2cqw; align-items: start;
  padding: 1.6cqw 2cqw 0; pointer-events: none;
  font-family: var(--pl-pixel);
}
.pl-side { display: grid; gap: 0.6cqw; }
.pl-side[data-side="1"] { justify-items: end; }
.pl-name { display: flex; gap: 1cqw; align-items: center; font-size: clamp(7px, 1.5cqw, 13px); text-shadow: 2px 2px 0 #000; }
.pl-side[data-side="1"] .pl-name { flex-direction: row-reverse; }
.pl-name b { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30cqw; }
.pl-wins { display: flex; gap: 3px; }
.pl-wins i { width: clamp(6px, 1.2cqw, 11px); aspect-ratio: 1; background: #000; border: 1px solid var(--pl-ink-3); transform: rotate(45deg); }
.pl-wins i.on { background: var(--pl-accent-2); border-color: #fff; }
.pl-hp {
  position: relative; width: 100%; height: clamp(8px, 2.4cqw, 22px);
  background: #1a0c10; border: 2px solid #000; box-shadow: 0 0 0 1px var(--c2, #fff);
}
.pl-hp i { position: absolute; top: 0; bottom: 0; left: 0; }
.pl-side[data-side="1"] .pl-hp i { left: auto; right: 0; }
.pl-hp-lag { background: #e43c3c; }
.pl-hp-fill { background: linear-gradient(180deg, #8dffb0 0 30%, var(--pl-hp) 30% 75%, #23a656 75%); }
.pl-side.is-low .pl-hp-fill { background: linear-gradient(180deg, #ffb0b8 0 30%, var(--pl-hp-low) 30% 75%, #b3202f 75%); }
.pl-ki {
  position: relative; width: 70%; height: clamp(5px, 1.2cqw, 11px);
  background: #000; border: 1px solid #000; box-shadow: 0 0 0 1px #3a3456;
}
.pl-ki::before { content: ""; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 2px; background: #fff; opacity: 0.6; z-index: 1; }
.pl-ki-fill { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(180deg, #fff6b8, var(--pl-ki)); }
.pl-side[data-side="1"] .pl-ki-fill { left: auto; right: 0; }
.pl-ki-tag {
  position: absolute; top: 50%; transform: translateY(-50%); font-size: clamp(6px, 1.1cqw, 10px);
  color: var(--pl-accent-2); text-shadow: 1px 1px 0 #000; left: calc(100% + 1cqw); white-space: nowrap;
}
.pl-side[data-side="1"] .pl-ki-tag { left: auto; right: calc(100% + 1cqw); }
.pl-callout {
  font-size: clamp(7px, 1.4cqw, 12px); color: var(--c2, #fff); text-shadow: 2px 2px 0 #000;
  opacity: 0; min-height: 1em;
}
.pl-callout.is-on { animation: pl-callout 1.4s steps(8) forwards; }
@keyframes pl-callout {
  0% { opacity: 0; transform: translateY(-4px); }
  10%, 75% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
.pl-timer {
  font-size: clamp(12px, 3.6cqw, 32px); min-width: 3ch; text-align: center;
  padding: 0.6cqw 1cqw; background: #000; border: 2px solid #3a3456; text-shadow: 2px 2px 0 #444;
}
.pl-timer.is-low { color: var(--pl-hp-low); }

.pl-announce, .pl-ultra {
  position: absolute; left: 0; right: 0; text-align: center; pointer-events: none;
  font-family: var(--pl-pixel); text-transform: uppercase;
}
.pl-announce {
  top: 38%; font-size: clamp(14px, 5.2cqw, 48px); color: var(--pl-accent-2);
  text-shadow: 3px 3px 0 #c2410c, 6px 6px 0 #000;
}
.pl-announce.is-ko { color: #fff; font-size: clamp(22px, 9cqw, 84px); text-shadow: 4px 4px 0 #e11d48, 8px 8px 0 #000; }
.pl-ultra {
  bottom: 14%; font-size: clamp(10px, 3cqw, 26px); color: #fff;
  text-shadow: 3px 3px 0 var(--c1, #c2410c), 5px 5px 0 #000;
}
.pl-ultra:empty, .pl-announce:empty { display: none; }
.pl-netinfo {
  position: absolute; right: 1.5cqw; bottom: 1.2cqw; font-family: var(--pl-pixel);
  font-size: clamp(6px, 1cqw, 9px); color: var(--pl-ink-3); pointer-events: none;
}
.pl-pause-btn {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(1.6cqw + clamp(12px, 3.6cqw, 32px) + 2.4cqw);
  font-family: var(--pl-pixel); font-size: clamp(7px, 1.2cqw, 10px); padding: 0.6cqw 1cqw;
  background: rgba(0, 0, 0, 0.5); border: 1px solid #3a3456; color: var(--pl-ink-2);
}

.pl-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(8, 6, 16, 0.78);
}
.pl-overlay[hidden] { display: none; }
.pl-overlay-box {
  display: grid; gap: 12px; justify-items: center; text-align: center; padding: 20px;
  background: var(--pl-bg-2); border: 2px solid var(--pl-line); box-shadow: 0 6px 0 #000;
  max-width: min(92%, 520px);
}
.pl-overlay-box canvas { width: 80px; height: 96px; image-rendering: pixelated; }
.pl-res-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- control táctil ---------- */
.pl-touch { display: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.pl-stick {
  position: relative; aspect-ratio: 1; touch-action: none; display: grid; place-items: center;
}
.pl-stick-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 56, 98, 0.55) 0 55%, rgba(31, 28, 46, 0.85) 56%);
  border: 3px solid #4a4366; box-shadow: 0 5px 0 #000, inset 0 0 0 2px rgba(255, 255, 255, 0.05);
}
.pl-stick-ring i { position: absolute; width: 0; height: 0; border: 7px solid transparent; opacity: 0.55; }
.pl-stick-ring .up { top: 7%; left: 50%; margin-left: -7px; border-bottom-color: var(--pl-ink); border-top: 0; }
.pl-stick-ring .down { bottom: 7%; left: 50%; margin-left: -7px; border-top-color: var(--pl-ink); border-bottom: 0; }
.pl-stick-ring .left { left: 7%; top: 50%; margin-top: -7px; border-right-color: var(--pl-ink); border-left: 0; }
.pl-stick-ring .right { right: 7%; top: 50%; margin-top: -7px; border-left-color: var(--pl-ink); border-right: 0; }
.pl-stick-knob {
  position: relative; width: 40%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6b63a0, #3a3456 70%);
  border: 3px solid #000; box-shadow: 0 4px 0 #000; pointer-events: none;
}
.pl-stick.is-down .pl-stick-knob { background: radial-gradient(circle at 35% 30%, #ffd23f, #ff8a1f 70%); }
.pl-stick-hint {
  position: absolute; bottom: -20px; left: 0; right: 0; text-align: center;
  font-size: 10px; color: var(--pl-ink-3); white-space: nowrap; pointer-events: none;
}
.pl-pads { display: grid; gap: 10px; align-content: center; grid-template-columns: 1fr 1fr; }
.pl-pads.pl-pads { grid-template-areas: "def esp" "ki ki" "gol pat"; }
.pl-touch.has-extra .pl-pads { grid-template-areas: "def esp" "extra ki" "gol pat"; }
.pad {
  position: relative; display: grid; place-content: center; justify-items: center; gap: 2px;
  color: #fff; border: 3px solid #000; box-shadow: 0 5px 0 #000, inset 0 -5px 0 rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.18);
  touch-action: none; user-select: none; -webkit-user-select: none; transition: transform 50ms, opacity 150ms, filter 150ms;
}
.pad b { font-family: var(--pl-pixel); font-weight: 400; font-size: 13px; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5); }
.pad span { font-size: 10px; font-weight: 600; opacity: 0.85; line-height: 1.1; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad.is-down { transform: translateY(4px); box-shadow: 0 1px 0 #000, inset 0 -2px 0 rgba(0, 0, 0, 0.3); filter: brightness(1.2); }
.pad--gol, .pad--pat { aspect-ratio: 1; border-radius: 50%; }
.pad--gol { grid-area: gol; background: #c22a3a; }
.pad--pat { grid-area: pat; background: #2453c9; }
.pad--ki { grid-area: ki; background: #a8680a; border-radius: 999px; padding: 10px 6px; }
.pad--esp { grid-area: esp; background: #6d28d9; border-radius: 14px; padding: 10px 6px; }
.pad--def { grid-area: def; background: #c2410c; border-radius: 14px; padding: 10px 6px; }
.pad--extra { grid-area: extra; background: #0f766e; border-radius: 999px; padding: 10px 6px; }
.pad--extra[hidden] { display: none; }
/* los que gastan ki se apagan hasta que alcanza, y brillan cuando se pueden usar */
.pad[data-need]:not(.is-ready) { opacity: 0.42; filter: grayscale(0.6); }
.pad--esp.is-ready, .pad--def.is-ready, .pad--extra.is-ready { animation: pl-pad-ready 1.2s steps(4) infinite; }
@keyframes pl-pad-ready {
  0%, 100% { box-shadow: 0 5px 0 #000, inset 0 -5px 0 rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255, 210, 63, 0); }
  50% { box-shadow: 0 5px 0 #000, inset 0 -5px 0 rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(255, 210, 63, 0.75); }
}

@media (pointer: coarse) {
  body[data-screen="fight"] { overflow: hidden; touch-action: none; overscroll-behavior: none; }
  .pl-overlay { position: fixed; z-index: 30; }
}

/* Celular parado: marcador arriba, la pelea a todo el ancho y el control abajo con el resto de la pantalla */
@media (pointer: coarse) and (orientation: portrait) {
  body[data-screen="fight"] .pl-top { display: none; }
  body[data-screen="fight"] .pl-app { min-height: 100dvh; }
  #scr-fight.is-on {
    height: 100dvh; padding: env(safe-area-inset-top, 0px) 0 0; gap: 0; justify-content: flex-start;
  }
  .pl-arena { width: 100vw; aspect-ratio: 240 / 210; margin-top: 74px; flex: none; }
  .pl-hud { inset: auto 0 100% 0; padding: 8px 10px 8px; gap: 8px; align-items: end; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .pl-side { min-width: 0; justify-items: stretch !important; }
  .pl-side > * { width: 100%; min-width: 0; }
  .pl-side > .pl-ki { width: 80%; }
  .pl-side[data-side="1"] > .pl-ki { margin-left: auto; }
  .pl-side[data-side="1"] .pl-name { justify-content: flex-start; }
  .pl-name b { overflow: hidden; text-overflow: ellipsis; }
  .pl-name { font-size: 9px; gap: 5px; max-width: 100%; }
  .pl-name b { max-width: 100%; min-width: 0; }
  .pl-wins i { width: 8px; }
  .pl-hp { height: 16px; }
  .pl-ki { height: 8px; width: 80%; }
  .pl-ki-tag { font-size: 7px; }
  .pl-side > .pl-callout { font-size: 9px; position: absolute; top: calc(100% + 6px); left: 10px; width: auto; max-width: 60%; }
  .pl-side[data-side="1"] .pl-callout { left: auto; right: 10px; }
  .pl-timer { font-size: 20px; padding: 6px 8px; }
  .pl-pause-btn { top: auto; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-size: 8px; padding: 3px 6px; }
  .pl-netinfo { font-size: 8px; }
  .pl-touch {
    display: grid; grid-template-columns: 46% 1fr; align-items: center; gap: 16px;
    width: 100%; flex: 1; min-height: 0;
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, #120f1d, #0b0a12);
    border-top: 2px solid var(--pl-line);
  }
  .pl-stick { width: min(100%, 230px, 34dvh); justify-self: center; }
  .pl-pads { width: min(100%, 230px); justify-self: center; }
  .pad--gol, .pad--pat { width: 100%; max-width: 100px; justify-self: center; }
}

/* Celular acostado (así se juega): la pelea ocupa todo el alto y el control flota en las esquinas de abajo */
@media (pointer: coarse) and (orientation: landscape) {
  .pl-top { display: none; }
  .pl-app { min-height: 100dvh; }
  #scr-fight.is-on { padding: 0; height: 100dvh; justify-content: center; }
  .pl-arena { width: min(100vw, calc(100dvh * 16 / 9)); }
  .pl-hud { padding: 1.4cqw 2cqw 0; }
  .pl-touch {
    display: flex; justify-content: space-between; align-items: flex-end;
    position: fixed; inset: auto 0 0 0; z-index: 10; pointer-events: none;
    padding: 0 max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
  .pl-touch > * { pointer-events: auto; }
  .pl-stick { width: min(150px, 40dvh); }
  .pl-stick-ring { background: radial-gradient(circle, rgba(63, 56, 98, 0.28) 0 55%, rgba(31, 28, 46, 0.5) 56%); border-color: rgba(74, 67, 102, 0.8); }
  .pl-stick-knob { opacity: 0.9; }
  .pl-stick-hint { display: none; }
  .pl-pads { width: min(200px, 54dvh); gap: 6px; grid-template-columns: 1fr 1fr; }
  .pad { opacity: 0.8; }
  .pad[data-need]:not(.is-ready) { opacity: 0.35; }
  .pad.is-down { opacity: 1; }
  .pad span { display: none; }
  .pad b { font-size: 11px; }
  .pad--ki, .pad--esp, .pad--def, .pad--extra { padding: 7px 4px; }
  .pad--gol, .pad--pat { width: min(100%, 84px, 22dvh); justify-self: center; }
  .pl-pause-btn { font-size: 8px; padding: 3px 6px; }

  /* menú: sin el dibujo de arriba para que entre todo */
  .pl-menu { padding: 14px 16px 20px; gap: 12px; }
  .pl-menu-art { display: none; }
  .pl-menu-btns { grid-template-columns: repeat(3, 1fr); width: min(100%, 620px); }
  .pl-tag { display: none; }

  /* elegir colegio: grilla a la izquierda y la ficha a la derecha */
  body .pl-select { padding: 10px 14px 14px; gap: 8px; }
  body .pl-select-head .pl-h2 { font-size: 12px; }
  body .pl-turn { font-size: 9px; }
  body .pl-select-body { grid-template-columns: minmax(0, 1fr) 270px; gap: 10px; }
  body .pl-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  body .pl-cell { padding: 2px 1px 3px; }
  body .pl-cell span { font-size: 7px; }
  body .pl-detail { position: sticky; top: 8px; order: 0; gap: 7px; padding: 10px; max-height: calc(100dvh - 20px); overflow: auto; }
  body .pl-detail-top canvas { width: 48px; height: 58px; }
  body .pl-detail-name { font-size: 10px; }
  body .pl-detail-lema { display: none; }
  body .pl-stats { gap: 2px; }
  body .pl-stats div { grid-template-columns: 62px 1fr; }
  body .pl-stats dt { font-size: 10px; }
  body .pl-stats i { height: 7px; }
  body .pl-moves { grid-template-columns: 1fr 1fr; gap: 4px 10px; }
  body .pl-moves div { grid-template-columns: 1fr; gap: 0; }
  body .pl-moves dt { font-size: 9px; }
  body .pl-moves dd b { font-size: 11px; }
  body .pl-moves dd span { display: none; }
  body .pl-detail-actions .pl-btn { padding: 10px 8px 9px; font-size: 10px; }
  body .pl-select-foot { gap: 6px; }
}

/* ---------- celular parado durante la pelea: pedir que lo giren ---------- */
.pl-girar {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-content: center; justify-items: center; gap: 16px;
  padding: 24px; text-align: center;
  background: rgba(5, 5, 6, 0.94);
}
.pl-girar[hidden] { display: none; }
.pl-girar-phone {
  width: 54px; height: 92px; border: 4px solid var(--pl-ink); border-radius: 10px;
  position: relative; animation: pl-girar 2.4s ease-in-out infinite;
}
.pl-girar-phone i { position: absolute; inset: 8px 6px; background: linear-gradient(180deg, #2a2063, #5a2a72); }
@keyframes pl-girar {
  0%, 25% { transform: rotate(0deg); }
  55%, 85% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
.pl-girar-title { font-family: var(--pl-pixel); font-size: 16px; color: var(--pl-accent-2); line-height: 1.4; }
.pl-girar-copy { color: var(--pl-ink-2); max-width: 30ch; }
@media (prefers-reduced-motion: reduce) {
  .pl-girar-phone { animation: none; transform: rotate(-90deg); }
}

/* ---------- ayuda ---------- */
.pl-dialog {
  margin: auto; max-width: min(640px, calc(100% - 32px)); padding: 20px;
  background: var(--pl-bg-2); color: var(--pl-ink); border: 2px solid var(--pl-line); box-shadow: 0 6px 0 #000;
}
.pl-dialog[open] { display: grid; gap: 14px; }
.pl-dialog::backdrop { background: rgba(8, 6, 16, 0.8); }
.pl-keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.pl-keys th, .pl-keys td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--pl-line); }
.pl-keys th { font-size: 11px; color: var(--pl-ink-3); font-weight: 600; }
.pl-keys td:not(:first-child) { font-family: var(--pl-pixel); font-size: 9px; color: var(--pl-accent-2); }
.pl-tips { padding-left: 18px; color: var(--pl-ink-2); display: grid; gap: 4px; font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .pl-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .pl-select-body { grid-template-columns: 1fr; }
  .pl-detail { position: static; order: -1; }
  .pl-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pl-online-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .pl-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .pl-cell span { font-size: 9px; }
  .pl-detail-top canvas { width: 80px; height: 96px; }
  .pl-keys th:nth-child(3), .pl-keys td:nth-child(3), .pl-keys th:nth-child(4), .pl-keys td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pl-callout.is-on { animation-duration: 0.01s; opacity: 1; }
}

/* ---------- presentación ---------- */
.pl-splash {
  position: fixed; inset: 0; z-index: 50; background: #050506;
  display: grid; place-items: center; cursor: pointer;
  transition: opacity 400ms ease;
}
.pl-splash.is-out { opacity: 0; pointer-events: none; }
.pl-splash[hidden] { display: none; }
.pl-splash-card {
  grid-area: 1 / 1; display: grid; justify-items: center; gap: 14px; text-align: center;
  opacity: 0; transform: scale(0.96); transition: opacity 500ms ease, transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.pl-splash-card.is-on { opacity: 1; transform: none; }
.pl-splash-card img { width: clamp(96px, 22vmin, 160px); height: auto; }
.pl-splash-brand {
  font-family: var(--pl-sans); font-weight: 700; font-size: clamp(20px, 5vmin, 34px);
  letter-spacing: 0.32em; text-transform: uppercase; color: #f2e6e9; padding-left: 0.32em;
}
.pl-splash-brand span { color: #d42a52; }
.pl-splash-card .pl-splash-site-logo { width: clamp(140px, 34vmin, 220px); }
.pl-splash-sub { font-family: var(--pl-pixel); font-size: 10px; color: var(--pl-ink-3); text-transform: uppercase; }
.pl-splash-card[data-card="1"] .pl-splash-sub { order: -1; }
.pl-splash-skip {
  position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center;
  font-family: var(--pl-pixel); font-size: 8px; color: #4a4458;
}
.pl-btn--ghost { background: transparent; border-color: var(--pl-line); font-size: 10px; padding: 10px 14px; }
.pl-ios-hint { font-size: 13px; color: var(--pl-ink-2); max-width: 36ch; }
.pl-credits { font-size: 12px; color: var(--pl-ink-3); }
.pl-credits b { color: var(--pl-ink-2); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .pl-splash-card { transition: none; }
}


/* ---------- intro de Moonriver Games (igual que en Chacrero) ---------- */
.pl-studio {
  position: fixed; inset: 0; z-index: 60; background: #050506; cursor: pointer; overflow: hidden;
  transition: opacity 0.7s; font-family: 'Pixelify Sans', ui-monospace, monospace;
}
.pl-studio.out { opacity: 0; }
.pl-studio[hidden] { display: none; }
#stCv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#stWord {
  position: absolute; left: 0; right: 0; display: grid; justify-items: center; gap: 0.55em;
  opacity: 0; transform: translateY(8px); transition: opacity 1.1s, transform 1.1s;
}
#stWord.on { opacity: 1; transform: none; }
#stWord b {
  font-weight: 700; font-size: clamp(26px, 5.6vmin, 58px); letter-spacing: 0.32em; margin-right: -0.32em;
  color: #f3dfe4; text-shadow: 0 0 22px rgba(212, 42, 82, 0.4);
}
#stWord i { font-style: normal; font-weight: 600; font-size: clamp(12px, 2.2vmin, 21px); color: #d42a52; display: flex; align-items: center; gap: 1.1em; }
#stWord i span { letter-spacing: 0.7em; margin-right: -0.7em; }
#stWord i::before, #stWord i::after { content: ""; width: 2.6em; height: 2px; background: #5e0b1c; }
#stSkip { position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); font-size: 12px; letter-spacing: 0.08em; color: #6b3a46; }
@media (prefers-reduced-motion: reduce) { .pl-studio, #stWord { transition: none; } }

/* ---------- selección en el celular parado: grilla arriba y ficha fija abajo con los botones ---------- */
@media (pointer: coarse) and (orientation: portrait) {
  .pl-select { padding: 12px 10px calc(310px + env(safe-area-inset-bottom, 0px)); gap: 10px; }
  .pl-select-head { gap: 6px; }
  .pl-select-head .pl-h2 { font-size: 12px; }
  .pl-turn { font-size: 9px; }
  .pl-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .pl-cell { padding: 2px 1px 3px; }
  .pl-cell span { font-size: 8px; }
  .pl-detail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 5; order: 0;
    border-width: 2px 0 0; border-top-width: 5px; gap: 8px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.6);
  }
  .pl-detail-top { gap: 10px; }
  .pl-detail-top canvas { width: 56px; height: 67px; }
  .pl-detail-name { font-size: 11px; }
  .pl-detail-lema { display: none; }
  .pl-stats { grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 3px; }
  .pl-stats div { grid-template-columns: 62px 1fr; }
  .pl-stats dt { font-size: 10px; }
  .pl-stats i { height: 7px; }
  .pl-moves { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .pl-moves div { grid-template-columns: 1fr; gap: 0; }
  .pl-moves dt { font-size: 9px; }
  .pl-moves dd b { font-size: 11px; }
  .pl-moves dd span { display: none; }
  .pl-detail-actions .pl-btn { padding: 12px 10px 11px; font-size: 11px; }
  .pl-select-foot { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pl-seg button { padding: 8px 8px; }
}
