/* ==== Pokémon Rivals — estilos ==== */
:root {
  --ui-bg: #202430;
  --ui-panel: #2b3040;
  --ui-panel-2: #363c50;
  --ui-border: #4a5268;
  --ui-text: #f0f2f8;
  --ui-dim: #9aa2b8;
  --ui-accent: #ffcb05;
  --ui-red: #e05a5a;
  --ui-green: #5ac878;
  --hp-green: #58c85a;
  --hp-yellow: #f0c040;
  --hp-red: #e05a4a;
}

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

html, body {
  height: 100%;
  background: #14161e;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ui-text);
  overflow: hidden;
}

/* El juego se renderiza a 960x640 internos y se ESCALA para llenar la
 * ventana del navegador (main.js ajusta el scale en cada resize). */
#game-root {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 960px;
  height: 640px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  overflow: hidden;
  background: #000;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#game-canvas3d {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* el arrastre gira la cámara, no hace scroll */
}

/* ---------- multijugador: chat de zona ---------- */
#net-chat {
  position: absolute;
  left: 10px;
  bottom: 44px;
  max-width: 340px;
  z-index: 14;
  pointer-events: none;
  transition: opacity 0.6s;
  font-size: 12.5px;
  line-height: 1.35;
}
.net-chat-line {
  background: rgba(10, 12, 22, 0.72);
  border-radius: 6px;
  padding: 3px 8px;
  margin-top: 3px;
  color: #e8ecf4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.net-chat-line b { color: #8ec6ee; }
#net-chat-input-wrap {
  position: absolute;
  left: 10px;
  bottom: 12px;
  z-index: 30;
  width: 360px;
}
#net-chat-input {
  width: 100%;
  box-sizing: border-box;
  font: 600 14px "Segoe UI", sans-serif;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #4a5570;
  background: rgba(12, 16, 28, 0.92);
  color: #fff;
}

/* ---------- multijugador: combate PvP ---------- */
#net-battle {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 16, 0.82);
}
.nb-panel {
  width: 720px;
  max-width: 94%;
  background: #161a26;
  border: 1px solid #3a4258;
  border-radius: 14px;
  padding: 16px 18px;
}
.nb-head { font-weight: 700; margin-bottom: 8px; }
.nb-stage {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 10px;
  margin-bottom: 8px;
}
.nb-vs { font: 900 22px "Segoe UI", sans-serif; color: #e05a5a; }
.nb-mon { text-align: center; width: 220px; }
.nb-mon img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}
.nb-name { font-weight: 700; margin: 2px 0 4px; }
.nb-hpbar {
  height: 10px;
  background: #20242f;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #0a0c14;
}
.nb-hp { height: 100%; width: 100%; background: #58c85a; transition: width 0.35s; }
.nb-log {
  height: 130px;
  overflow-y: auto;
  background: rgba(8, 10, 18, 0.6);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}
.nb-line { margin: 2px 0; }
.nb-turn { font-weight: 700; margin-bottom: 6px; }
.nb-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-move small { opacity: 0.7; }
.nb-forfeit { opacity: 0.75; }

/* ---------- controles táctiles (solo en dispositivos táctiles) ---------- */
#touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none; /* solo sus hijos capturan */
  z-index: 40;
}
.touch-joy {
  position: absolute;
  left: 4vw;
  bottom: 7vh;
  width: 132px;
  height: 132px;
  pointer-events: auto;
  touch-action: none;
}
.joy-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(18, 22, 38, 0.38);
  border: 2px solid rgba(255, 255, 255, 0.28);
}
.joy-knob {
  position: absolute;
  width: 58px;
  height: 58px;
  left: 37px;
  top: 37px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.65);
  pointer-events: none;
  transition: background 0.12s, border-color 0.12s;
}
/* correr: solo al sostener el joystick en el borde. Se avisa en el propio
   knob porque si no, no hay forma de saber por qué de pronto vas al doble */
.joy-knob.running {
  background: rgba(255, 210, 90, 0.62);
  border-color: rgba(255, 225, 130, 0.95);
}
.touch-buttons {
  position: absolute;
  right: 4vw;
  bottom: 7vh;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  pointer-events: auto;
}
/* botón táctil: icono grande + etiqueta corta debajo (se entiende solo) */
.touch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.42);
  background: rgba(18, 22, 38, 0.5);
  color: #fff;
  font: 700 24px "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn .tb-icon { font-size: 22px; line-height: 1; }
.touch-btn .tb-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2px;
  opacity: 0.85;
  line-height: 1;
  text-transform: uppercase;
}
.touch-btn.small {
  width: 46px;
  height: 46px;
  opacity: 0.85;
}
.touch-btn.small .tb-icon { font-size: 16px; }
.touch-btn.small .tb-label { font-size: 7.5px; }
/* A (hablar/avanzar): el botón principal, más grande y acentuado */
.touch-btn.primary {
  width: 74px;
  height: 74px;
  border-color: rgba(120, 170, 255, 0.75);
  background: rgba(40, 60, 110, 0.5);
}
.touch-btn.primary .tb-icon { font-size: 27px; font-weight: 900; }
/* capturar: apagado sin salvaje enganchado, encendido y latiendo con él */
.touch-btn.ball { opacity: 0.35; transition: opacity 0.25s; }
.touch-btn.ball.ready {
  opacity: 1;
  border-color: rgba(255, 210, 90, 0.9);
  animation: tb-pulse 1.1s ease-in-out infinite;
}
@keyframes tb-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 90, 0.45); }
  50% { box-shadow: 0 0 0 9px rgba(255, 210, 90, 0); }
}
/* A convertido en ⚔ Atacar: con otro jugador al alcance, el botón principal
   se pone en rojo y late, para que se vea que ese toque INICIA UN DUELO */
.touch-btn.primary.attack {
  border-color: rgba(255, 120, 110, 0.95);
  background: rgba(130, 40, 46, 0.62);
  animation: tb-pulse-atk 1s ease-in-out infinite;
}
.touch-btn.primary.attack .tb-icon { font-size: 30px; }
@keyframes tb-pulse-atk {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 80, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(255, 90, 80, 0); }
}
/* postura: agresivo cálido, pasivo apagado y frío */
.touch-btn.stance { border-color: rgba(255, 150, 90, 0.7); }
.touch-btn.stance.passive {
  border-color: rgba(150, 200, 170, 0.55);
  background: rgba(30, 48, 44, 0.45);
  opacity: 0.82;
}
/* mini Poké Ball dibujada en CSS (no hay emoji de ball) */
.tb-ball {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #20242c;
  background: linear-gradient(#d84a4a 0 42%, #20242c 42% 56%, #f2f4f8 56% 100%);
  position: relative;
}
.tb-ball::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #20242c;
  transform: translate(-50%, -50%);
}
.touch-btn:active {
  background: rgba(90, 120, 200, 0.55);
}
/* contador de jugadores online: arriba a la derecha, siempre visible */
#online-count {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 11;
  display: none; /* JS lo pone en flex al conectar */
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  background: rgba(16, 20, 31, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eaf0f8;
  font: 700 13px 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 0.2px;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
}
#online-count .oc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fd07a;
  box-shadow: 0 0 0 0 rgba(63, 208, 122, 0.6);
  animation: oc-pulse 1.8s ease-out infinite;
}
#online-count .oc-n { font-weight: 800; color: #fff; }
@keyframes oc-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 208, 122, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(63, 208, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 208, 122, 0); }
}
/* en móvil, un pelín más pequeño y sin tapar el joystick/HUD */
@media (max-width: 720px) {
  #online-count { top: 6px; right: 8px; font-size: 12px; padding: 4px 9px; }
}

/* en táctil sobran los atajos de teclado y el panel de equipo se toca */
.touch-mode #hint-bar { display: none !important; }
/* durante un diálogo solo cuenta A: el resto se apaga (menos ruido) */
.touch-buttons.in-dialog .touch-btn:not(.primary) {
  opacity: 0.22;
  pointer-events: none;
}
/* Relevo tocando la fila del panel de equipo (en móvil es la ÚNICA forma:
 * no hay teclas 1-6). El manejador vive en ui.js desde siempre, pero no se
 * disparaba nunca porque #hud es `pointer-events: none` —para no comerse los
 * clics del mundo— y eso apagaba también a sus hijos. Las filas lo recuperan
 * aquí; el resto del HUD sigue siendo transparente al dedo. */
.team-hud-row {
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;   /* sin la espera del doble toque */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.team-hud-row:active { transform: scale(0.97); }
/* en táctil, un pelín más de alto: el HUD va escalado con el mundo y la fila
 * se queda en ~22 px reales, al filo de lo que un pulgar acierta */
.touch-mode .team-hud-row { padding-top: 5px; padding-bottom: 6px; }

/* combate con escenario 3D: el canvas WebGL es el fondo */
#screen-battle.stage3d {
  background: none !important;
}
#screen-battle .stage3d-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hidden { display: none !important; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--ui-bg);
  overflow-y: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(10, 12, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
.hud-chip {
  background: rgba(20, 24, 36, 0.82);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
}
.hud-chip .zone-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
.hud-alert { color: var(--ui-accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* Panel de equipo del HUD (estilo menú de equipo de Escarlata) */
.hud-chips { display: flex; flex-direction: column; gap: 4px; }
.team-hud { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.team-hud-row {
  position: relative;   /* ancla de la barra de espera del relevo (.th-cd) */
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 224px;
  background: rgba(20, 24, 36, 0.85);
  border: 1px solid var(--ui-border);
  border-left: 4px solid var(--ui-border);
  border-radius: 9px;
  padding: 3px 9px 4px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.team-hud-row.active { border-left-color: var(--ui-accent); }
.team-hud-row.fainted { opacity: .5; }
.team-hud-row .th-num {
  flex-shrink: 0;
  width: 16px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  color: var(--ui-dim);
  background: rgba(0,0,0,.35);
  border-radius: 5px;
  line-height: 16px;
}
.team-hud-row.active .th-num { color: var(--ui-accent); background: rgba(255,203,5,.16); }
.team-hud-row .th-sprite {
  width: 40px; height: 40px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.team-hud-row .th-info { flex: 1; min-width: 0; }
.team-hud-row .th-top { display: flex; justify-content: space-between; align-items: baseline; }
.team-hud-row .th-name {
  font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.team-hud-row .th-lv { font-size: 11px; color: var(--ui-dim); font-weight: 700; flex-shrink: 0; margin-left: 6px; }
.team-hud-row .th-hpbar { background: #1c202c; height: 7px; border-radius: 4px; margin-top: 3px; padding: 1px; }
.team-hud-row .th-hpfill { height: 5px; border-radius: 3px; background: var(--hp-green); transition: width .3s, background .3s; }
.team-hud-row .th-hptext { font-size: 10px; color: var(--ui-dim); text-align: right; font-weight: 700; line-height: 1.3; }
.team-hud-row .th-xpbar { background: #1c202c; height: 4px; border-radius: 3px; margin-top: 2px; padding: 1px; }
.team-hud-row .th-xpfill { height: 2px; border-radius: 2px; background: #4aa8e8; transition: width .3s; }

/* ---------- Relevo de acompañante: animación y espera (CONFIG.SWITCH) ----------
 * Cambiar de Pokémon cuesta, y tiene que VERSE que cuesta: el que entra
 * destella al salir a pelear y una barra enseña cuánto falta para el próximo
 * relevo. La barra la anima el CSS con la duración exacta (--sw-cd, que pone
 * ui.js): el HUD solo se repinta cada 0,4 s y a mano iría a saltos. */
@keyframes th-swap-in {
  0%   { transform: translateX(-12px) scale(1.06); box-shadow: 0 0 0 2px var(--ui-accent), 0 0 16px rgba(255, 203, 5, .85); }
  55%  { transform: none; box-shadow: 0 0 0 2px var(--ui-accent), 0 0 10px rgba(255, 203, 5, .5); }
  100% { transform: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
}
.team-hud-row.th-swap { animation: th-swap-in .55s ease-out; }
.team-hud-row .th-cd {
  position: absolute;
  left: 0; bottom: 0;
  height: 3px; width: 0;
  border-radius: 0 3px 3px 0;
  background: var(--ui-accent);
  opacity: .85;
}
@keyframes th-cd-drain { from { width: 100%; } to { width: 0; } }
.team-hud.cooling .th-cd { animation: th-cd-drain var(--sw-cd, 5s) linear forwards; }
/* mientras corre la espera, las filas que no pueden salir se ven apagadas */
.team-hud.cooling .team-hud-row:not(.active) { filter: grayscale(.55) brightness(.8); }
/* relevo pedido antes de tiempo: el panel da un respingo (en móvil es la
   única forma de distinguir «no ha entrado el toque» de «hay que esperar») */
@keyframes th-deny {
  0%, 100% { transform: none; }
  25% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}
.team-hud.sw-deny { animation: th-deny .32s ease-in-out; }

/* ---------- Toasts ---------- */
#toast-container {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(24, 28, 42, 0.94);
  border: 1px solid var(--ui-accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  max-width: 340px;
  animation: toast-in .25s ease-out;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
@keyframes toast-in {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.toast.fade-out { transition: opacity .5s; opacity: 0; }

/* ---------- Caja de diálogo ---------- */
#dialog-box {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 860px;
  min-height: 96px;
  z-index: 25;
  background: rgba(18, 22, 34, 0.95);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 17px;
  line-height: 1.45;
}
/* Retrato de quien habla (episodios del anime). Solo aparece cuando el
   diálogo trae paleta: el resto de conversaciones se ven como siempre. */
#dialog-box .dialog-with-face {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
#dialog-box .dialog-body { flex: 1; min-width: 0; }
#dialog-box .dialog-face {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  image-rendering: pixelated;          /* es pixel-art: nada de suavizarlo */
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  background: rgba(10, 13, 20, 0.85);
}
/* En pantallas estrechas el retrato encoge en vez de comerse el texto */
@media (max-width: 720px) {
  #dialog-box .dialog-face { width: 48px; height: 48px; }
  #dialog-box .dialog-with-face { gap: 10px; }
}

#dialog-box .dialog-name {
  color: var(--ui-accent);
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 14px;
}
#dialog-box .dialog-next {
  position: absolute;
  right: 14px;
  bottom: 8px;
  color: var(--ui-dim);
  font-size: 12px;
  animation: pulse 1.4s infinite;
}
#dialog-box .dialog-choices {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ---------- Botones ---------- */
.btn {
  background: var(--ui-panel-2);
  border: 2px solid var(--ui-border);
  color: var(--ui-text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .12s;
}
.btn:hover, .btn.focused {
  border-color: var(--ui-accent);
  background: #414860;
  transform: translateY(-1px);
}
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.btn-primary { background: var(--ui-accent); color: #202020; border-color: #d8ae00; }
.btn.btn-primary:hover { background: #ffd83d; }
.btn.btn-danger { border-color: var(--ui-red); }
.btn.btn-small { padding: 4px 10px; font-size: 13px; }

/* ---------- Pantalla de título ---------- */
#screen-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(ellipse at 50% 30%, #3a4260 0%, #202430 65%);
}
#screen-title.hidden { display: none !important; }
.title-logo {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--ui-accent);
  text-shadow: 4px 4px 0 #2a5cb8, 8px 8px 18px rgba(0,0,0,.5);
}
.title-sub {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 8px;
  text-transform: uppercase;
  margin-top: -10px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.4);
}
.title-tag { color: var(--ui-dim); font-size: 15px; margin-bottom: 14px; }
.title-account {
  max-width: 460px;
  margin-bottom: 12px;
  padding: 8px 14px;
  border: 1px solid #3a4258;
  border-radius: 10px;
  background: rgba(16, 20, 31, .75);
  font-size: 13px;
  line-height: 1.45;
}
.title-account a { color: var(--ui-accent); }
.title-buttons .btn.locked { opacity: .45; filter: grayscale(.6); }
.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 420px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.title-buttons .btn { font-size: 18px; padding: 12px; }
.btn.save-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 15px !important;
  padding: 10px 14px !important;
}
.save-slot .ss-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,.4);
}
.save-slot .ss-body { display: flex; flex-direction: column; gap: 2px; }
.save-slot .ss-title { font-weight: 800; }
.save-slot .ss-meta { font-size: 12px; color: var(--ui-dim); font-weight: 500; }
.title-footer { position: absolute; bottom: 14px; color: var(--ui-dim); font-size: 12px; }

/* ---------- Chips de tipo ---------- */
.type-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0,0,0,.5);
  margin: 0 2px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ---------- Batalla ---------- */
#screen-battle {
  background: linear-gradient(180deg, #87c4e8 0%, #b8e0f0 46%, #7ab058 46.5%, #5c9444 100%);
  overflow: hidden;
}
#screen-battle.gym-battle {
  background: linear-gradient(180deg, #4a4460 0%, #6a6288 46%, #b09048 46.5%, #8a7038 100%);
}
.battle-sprite {
  position: absolute;
  image-rendering: pixelated;
}
.battle-sprite.enemy {
  width: 240px; height: 240px;
  right: 110px; top: 40px;
  animation: enemy-in .5s ease-out;
}
.battle-sprite.ally {
  width: 300px; height: 300px;
  left: 90px; bottom: 128px;
  animation: ally-in .5s ease-out;
}
@keyframes enemy-in { from { transform: translateX(220px); opacity:0; } to { transform:none; opacity:1; } }
@keyframes ally-in  { from { transform: translateX(-220px); opacity:0; } to { transform:none; opacity:1; } }
.battle-sprite.hit { animation: hit-flash .4s; }
@keyframes hit-flash {
  0%, 40%, 80% { opacity: 1; }
  20%, 60% { opacity: .15; }
}
.battle-sprite.faint { animation: faint-down .6s forwards; }
@keyframes faint-down { to { transform: translateY(140px); opacity: 0; } }

/* --- Animaciones de ataque --- */
.battle-sprite.lunge-ally { animation: lunge-ally .38s ease-out; }
@keyframes lunge-ally {
  0% { transform: none; }
  40% { transform: translate(90px, -55px) scale(1.04); }
  100% { transform: none; }
}
.battle-sprite.lunge-enemy { animation: lunge-enemy .38s ease-out; }
@keyframes lunge-enemy {
  0% { transform: none; }
  40% { transform: translate(-90px, 55px) scale(1.04); }
  100% { transform: none; }
}
.battle-sprite.status-pulse { animation: status-pulse .7s; }
@keyframes status-pulse {
  0%, 100% { filter: none; }
  30%, 70% { filter: brightness(1.6) saturate(2.4); }
}
.battle-sprite.heal-glow { animation: heal-glow .8s; }
@keyframes heal-glow {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.5) drop-shadow(0 0 18px #6aff8a); }
}
#screen-battle.scr-shake { animation: scr-shake .4s; }
@keyframes scr-shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-8px, 5px); }
  40% { transform: translate(7px, -4px); }
  60% { transform: translate(-5px, 3px); }
  80% { transform: translate(4px, -2px); }
}

/* partículas de impacto */
.fx-particle {
  position: absolute;
  width: 9px; height: 9px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 8;
  animation: particle-fly .55s ease-out forwards;
}
@keyframes particle-fly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

/* lanzamiento de Poké Ball */
.fx-ball {
  position: absolute;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e04a4a 0 46%, #20242c 46% 54%, #f5f5f5 54% 100%);
  border: 2px solid #20242c;
  z-index: 9;
  pointer-events: none;
}
.fx-ball::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  transform: translate(-50%, -50%);
  background: #f5f5f5;
  border: 2px solid #20242c;
  border-radius: 50%;
}
.fx-ball.throw { animation: ball-throw .65s ease-in forwards; }
@keyframes ball-throw {
  0% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(calc(var(--tx) * .5), calc(var(--ty) - 130px)) rotate(380deg); }
  100% { transform: translate(var(--tx), var(--ty)) rotate(720deg); }
}
.fx-ball.wobble { animation: ball-wobble .55s ease-in-out; }
@keyframes ball-wobble {
  0%, 100% { transform: translate(var(--tx), var(--ty)) rotate(0); }
  30% { transform: translate(var(--tx), var(--ty)) rotate(-22deg); }
  70% { transform: translate(var(--tx), var(--ty)) rotate(22deg); }
}
.battle-sprite.absorbed { animation: absorbed .35s forwards; }
@keyframes absorbed {
  to { transform: scale(0); opacity: 0; }
}
.battle-sprite.released { animation: released .3s; }
@keyframes released {
  from { transform: scale(0); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* --- Combate de gimnasio en tiempo real (pseudo-3D) --- */
#screen-battle.rt3d {
  perspective: 850px;
  background: radial-gradient(ellipse at 50% 18%, #575178 0%, #2c2840 55%, #1a1726 100%);
  overflow: hidden;
}
#screen-battle.rt3d .arena-floor {
  position: absolute;
  left: -25%; right: -25%; bottom: -8%;
  height: 78%;
  transform: rotateX(56deg);
  transform-origin: 50% 100%;
  background:
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(255,255,255,.07) 46px 48px),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(255,255,255,.07) 46px 48px),
    radial-gradient(ellipse at center, var(--arena-color, #b09048) 0%, #6a5c34 60%, #423a22 100%);
  border-radius: 40%;
  box-shadow: 0 0 80px rgba(0,0,0,.5) inset;
}
#screen-battle.rt3d .battle-sprite.enemy {
  width: 210px; height: 210px;
  right: 150px; top: 92px;
  filter: drop-shadow(0 22px 10px rgba(0,0,0,.45));
  animation: float-enemy 3.2s ease-in-out infinite;
}
@keyframes float-enemy {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -8px; }
}
#screen-battle.rt3d .battle-sprite.ally {
  width: 330px; height: 330px;
  left: 70px; bottom: 118px;
  filter: drop-shadow(0 26px 14px rgba(0,0,0,.5));
}
.rt-gauge {
  height: 12px;
  background: #1c202c;
  border-radius: 8px;
  margin-top: 6px;
  padding: 2px;
  border: 1px solid #3a3f48;
}
.rt-gauge-fill {
  height: 6px;
  border-radius: 5px;
  width: 0%;
  background: linear-gradient(90deg, #4aa8e8, #6ad8ff);
  transition: width .08s linear;
}
.rt-gauge-fill.ready { background: linear-gradient(90deg, #ffcb05, #ffe98a); box-shadow: 0 0 8px #ffcb05; }
.rt-log {
  position: absolute;
  left: 18px; top: 200px;
  z-index: 7;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  pointer-events: none;
  max-width: 400px;
}
.rt-log-entry {
  background: rgba(16, 18, 30, 0.82);
  border-left: 3px solid var(--ui-accent);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 600;
  animation: rt-log-in .25s ease-out;
}
@keyframes rt-log-in {
  from { transform: translateX(-16px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.rt-log-entry.fade { transition: opacity .6s; opacity: 0; }
.rt-hint {
  position: absolute;
  right: 18px; top: 8px;
  z-index: 7;
  color: var(--ui-dim);
  font-size: 12px;
  background: rgba(16,18,30,.7);
  padding: 4px 10px;
  border-radius: 6px;
}
.move-btn .mv-cd {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, 0.55);
  border-radius: 6px;
  transform-origin: left;
  pointer-events: none;
}

.pkmn-panel {
  position: absolute;
  background: rgba(248, 248, 240, 0.96);
  color: #24282e;
  border: 3px solid #3a3f48;
  border-radius: 10px;
  padding: 10px 14px;
  width: 300px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.25);
}
.pkmn-panel.enemy { left: 60px; top: 48px; }

/* Cara del entrenador rival, pegada a su barra de vida: durante todo el
   combate se ve contra QUIÉN peleas, no solo contra qué Pokémon. */
.pkmn-panel .pp-face {
  position: absolute;
  left: -56px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  background: rgba(10, 13, 20, 0.9);
}
/* Entrada del rival: retrato grande mientras te desafía */
.bt-trainer-in {
  position: absolute;
  right: 7%;
  top: 16%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: bt-trainer-pop 0.35s ease-out;
}
.bt-trainer-in img {
  width: 150px;
  height: 150px;
  image-rendering: pixelated;
  border: 3px solid var(--ui-border);
  border-radius: 12px;
  background: rgba(10, 13, 20, 0.92);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}
.bt-trainer-name {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: rgba(18, 22, 34, 0.95);
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  padding: 3px 10px;
}
@keyframes bt-trainer-pop {
  from { opacity: 0; transform: translateX(40px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@media (max-width: 720px) {
  .pkmn-panel .pp-face { left: -40px; width: 34px; height: 34px; }
  .bt-trainer-in img { width: 96px; height: 96px; }
  .bt-trainer-name { font-size: 13px; }
}
.pkmn-panel.ally  { right: 60px; bottom: 200px; }
.pkmn-panel .pp-name { font-weight: 800; font-size: 17px; display: flex; justify-content: space-between; }
.pkmn-panel .pp-level { color: #555; font-weight: 700; }
.hp-bar-outer {
  background: #50555e;
  border-radius: 8px;
  height: 12px;
  margin-top: 6px;
  padding: 2px;
}
.hp-bar-inner {
  height: 8px;
  border-radius: 6px;
  background: var(--hp-green);
  transition: width .55s ease, background .3s;
}
.pkmn-panel .pp-hp-text { font-size: 12px; text-align: right; margin-top: 3px; font-weight: 700; color: #444; }
.pkmn-panel .pp-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.pkmn-panel .pp-exp-outer { background: #50555e; height: 7px; border-radius: 4px; margin-top: 5px; padding: 1px; }
.pkmn-panel .pp-exp-inner { height: 5px; border-radius: 3px; background: #4aa8e8; transition: width .4s; }

.battle-msg {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 150px;
  background: rgba(18, 22, 34, 0.96);
  border-top: 3px solid var(--ui-border);
  padding: 16px 22px;
  font-size: 19px;
  line-height: 1.5;
  z-index: 5;
}
.battle-msg .bm-next {
  position: absolute; right: 18px; bottom: 10px;
  color: var(--ui-dim); font-size: 13px;
  animation: pulse 1.4s infinite;
}
.battle-actions {
  position: absolute;
  right: 14px; bottom: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  z-index: 6;
  width: 340px;
}
.battle-actions .btn { font-size: 17px; padding: 12px; }
.battle-moves {
  position: absolute;
  left: 14px; right: 370px; bottom: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  z-index: 6;
}
.move-btn {
  text-align: left;
  position: relative;
  padding: 8px 12px !important;
}
.move-btn .mv-name { font-size: 16px; font-weight: 700; }
.move-btn .mv-meta { font-size: 12px; color: var(--ui-dim); display: flex; justify-content: space-between; margin-top: 3px; }

/* ---------- Paneles genéricos (menú, tienda, PC, equipo) ---------- */
.panel {
  background: var(--ui-panel);
  border: 2px solid var(--ui-border);
  border-radius: 14px;
  padding: 20px 24px;
  min-width: 420px;
  max-width: 880px;
  max-height: 580px;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.panel h2 { color: var(--ui-accent); margin-bottom: 12px; font-size: 21px; }
.panel-list { display: flex; flex-direction: column; gap: 8px; }
.panel-footer { margin-top: 14px; display: flex; gap: 8px; justify-content: flex-end; }

.team-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ui-panel-2);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color .12s;
}
.team-row:hover, .team-row.focused { border-color: var(--ui-accent); }
.team-row.fainted { opacity: .55; }
/* número de atajo (1-6) al elegir relevo: la tecla y el toque hacen lo mismo,
   así que la fila enseña cuál es la suya */
.team-row .tr-key {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--ui-border);
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  color: var(--ui-dim);
}
.team-row:not(.fainted) .tr-key { color: var(--ui-accent); border-color: var(--ui-accent); }
.team-row.dragging { opacity: .35; }
.team-row.drag-over {
  border-color: var(--ui-accent);
  border-style: dashed;
  transform: translateY(2px);
}
.team-row img, .team-row canvas { width: 52px; height: 52px; image-rendering: pixelated; }
.team-row .tr-info { flex: 1; }
.team-row .tr-name { font-weight: 700; font-size: 15px; }
.team-row .tr-hp-outer { background: #1c202c; border-radius: 6px; height: 8px; margin-top: 4px; width: 100%; }
.team-row .tr-hp-inner { height: 8px; border-radius: 6px; background: var(--hp-green); }
.team-row .tr-meta { font-size: 12px; color: var(--ui-dim); margin-top: 3px; }

.shop-row, .bag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ui-panel-2);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.shop-row:hover, .bag-row:hover, .shop-row.focused, .bag-row.focused { border-color: var(--ui-accent); }
.shop-row .sr-name, .bag-row .sr-name { font-weight: 700; }
.shop-row .sr-desc, .bag-row .sr-desc { font-size: 12px; color: var(--ui-dim); margin-top: 2px; }
.shop-row .sr-price { color: var(--ui-accent); font-weight: 800; white-space: nowrap; margin-left: 14px; }

/* ---------- Detalle de Pokémon ---------- */
.pkmn-detail { display: flex; gap: 20px; }
.pkmn-detail img, .pkmn-detail canvas { width: 160px; height: 160px; image-rendering: pixelated; }
.pkmn-detail .pd-stats { flex: 1; font-size: 14px; line-height: 1.7; }
.pd-stat-row { display: flex; align-items: center; gap: 8px; }
.pd-stat-row .pd-label { width: 78px; color: var(--ui-dim); font-size: 12px; font-weight: 700; }
.pd-stat-row .pd-bar-outer { flex: 1; background: #1c202c; height: 9px; border-radius: 5px; }
.pd-stat-row .pd-bar-inner { height: 9px; border-radius: 5px; background: var(--ui-accent); }
.pd-moves { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pd-move {
  background: var(--ui-panel-2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

/* ---------- Evolución ---------- */
#screen-evolution {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #4a5580 0%, #181c2a 75%);
  z-index: 50;
}
#screen-evolution img, #screen-evolution canvas {
  width: 260px; height: 260px;
  image-rendering: pixelated;
}
#screen-evolution .evo-text { font-size: 22px; font-weight: 700; margin-top: 20px; }
.evo-glow { animation: evo-glow 1s infinite alternate; filter: brightness(0) invert(1); }
@keyframes evo-glow { from { transform: scale(.94); } to { transform: scale(1.06); } }

/* ---------- Combate de arena en tiempo real (gimnasio) ---------- */
#arena-ui {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
.arena-panels {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
}
.arena-panel {
  background: rgba(18, 22, 34, 0.9);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 230px;
}
.arena-panel .ap-name { font-size: 14px; font-weight: 600; }
.arena-panel .ap-hp {
  background: #1c202c;
  height: 10px;
  border-radius: 6px;
  margin-top: 5px;
  padding: 1px;
}
.arena-panel .ap-hp-fill {
  height: 8px;
  border-radius: 5px;
  transition: width .25s;
}
.arena-panel .ap-hp-text { font-size: 11px; color: var(--ui-dim); text-align: right; margin-top: 2px; font-weight: 700; }
.arena-vs {
  font-size: 20px;
  font-weight: 900;
  color: var(--ui-accent);
  text-shadow: 2px 2px 4px rgba(0,0,0,.6);
}
.arena-moves {
  position: absolute;
  left: 50%;
  bottom: 38px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 205px);
  gap: 8px;
  pointer-events: auto;
}
.arena-move { position: relative; }
.arena-move .am-key {
  display: inline-block;
  background: var(--ui-accent);
  color: #202020;
  font-weight: 900;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
  margin-right: 2px;
}
.arena-move.ready {
  border-color: var(--ui-accent);
  box-shadow: 0 0 12px rgba(255, 203, 5, .45);
}
.arena-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ui-dim);
  font-size: 12px;
  background: rgba(16, 18, 30, .7);
  padding: 3px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- Captura estilo Pokémon GO ---------- */
.catchgo-canvas {
  position: absolute;
  inset: 0;
  z-index: 28;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none; /* el gesto de lanzamiento no debe hacer scroll/zoom en táctil */
}

/* ---------- Pantalla de Controles ---------- */
.ctrl-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.ctrl-key {
  flex: 0 0 210px;
  font-weight: 700;
  color: var(--ui-text);
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  text-align: center;
}
.ctrl-desc { color: var(--ui-dim); font-size: 14px; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ui-bg); }
::-webkit-scrollbar-thumb { background: var(--ui-border); border-radius: 5px; }

/* ---------- Modo Stadium (N64): defensa de gimnasio ---------- */
.stadium-screen {
  background: radial-gradient(ellipse at 50% 30%, #2a3550 0%, #1a2030 55%, #12141e 100%);
  overflow: hidden;
}

/* línea del anunciador */
.st-announcer {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  max-width: 82%;
  background: rgba(16, 18, 28, .88);
  border: 2px solid var(--ui-accent);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ui-accent);
  z-index: 8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .6s;
}
.st-announcer.st-fade { opacity: 0; }

.st-turn {
  position: absolute;
  top: 14px; right: 14px;
  color: var(--ui-dim);
  font-size: 13px;
  font-weight: 700;
  z-index: 8;
}

/* arena y combatientes */
.st-arena { position: absolute; inset: 0; }
.st-sprite { position: absolute; z-index: 4; transition: opacity .5s, transform .5s; }
.st-sprite.ally { left: 18%; bottom: 120px; }
.st-sprite.enemy { right: 16%; top: 110px; }
.st-sprite img, .st-sprite canvas { image-rendering: pixelated; filter: drop-shadow(0 14px 10px rgba(0,0,0,.45)); }
.st-sprite.st-faint { opacity: 0; transform: translateY(60px); }
.st-sprite.st-hit { animation: stHit .34s; }
@keyframes stHit {
  0%, 100% { filter: none; transform: translateX(0); }
  25% { filter: brightness(2.4); transform: translateX(-7px); }
  60% { filter: brightness(1.6); transform: translateX(5px); }
}

/* paneles de PS */
.st-panel {
  position: absolute;
  z-index: 6;
  background: rgba(24, 28, 42, .92);
  border: 2px solid var(--ui-border);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 250px;
}
.st-panel.enemy { top: 16px; left: 16px; }
.st-panel.ally { bottom: 130px; right: 16px; }
.st-p-top { display: flex; align-items: center; gap: 8px; }
.st-p-name { font-weight: 800; font-size: 16px; }
.st-p-lv { color: var(--ui-dim); font-weight: 700; font-size: 13px; }
.st-status {
  color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 4px; padding: 1px 6px;
}
.st-hp-outer { background: #10121c; border-radius: 6px; height: 10px; margin-top: 7px; padding: 1px; }
.st-hp-inner { height: 8px; border-radius: 5px; background: var(--hp-green); }
.st-hp-text { font-size: 12px; color: var(--ui-dim); font-weight: 700; text-align: right; margin-top: 3px; }

/* mensajes */
.st-msg {
  position: absolute;
  left: 14px; right: 14px; bottom: 14px;
  min-height: 62px;
  background: rgba(18, 22, 34, .95);
  border: 2px solid var(--ui-border);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 600;
  z-index: 7;
  cursor: pointer;
}

/* menú de acciones */
.st-actions {
  position: absolute;
  left: 14px; right: 14px; bottom: 14px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-moves { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.st-actions-bottom { display: flex; gap: 8px; justify-content: flex-end; }

/* selección 3-de-6 */
.st-pick-panel { min-width: 760px; }
.st-pick-sub { color: var(--ui-dim); font-size: 13px; margin-bottom: 12px; }
.st-pick-cols { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.st-pick-list { display: flex; flex-direction: column; gap: 8px; }
.st-pick-rival h3 { color: var(--ui-dim); font-size: 15px; margin-bottom: 8px; }
.st-pick-rival { border-left: 2px solid var(--ui-border); padding-left: 14px; }
.st-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ui-panel-2);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  padding: 6px 10px;
  transition: border-color .12s;
}
.st-pick-row:not(.rival):not(.fainted) { cursor: pointer; }
.st-pick-row:not(.rival):not(.fainted):hover { border-color: var(--ui-accent); }
.st-pick-row.st-picked { border-color: var(--ui-accent); background: #3a4160; }
.st-pick-row.fainted { opacity: .5; }
.st-pick-row.rival { margin-bottom: 6px; }
.st-pick-row img, .st-pick-row canvas { image-rendering: pixelated; }
.st-pick-row .tr-info { flex: 1; }
.st-pick-row .tr-name { font-weight: 700; font-size: 14px; }
.st-pick-row .tr-hp-outer { background: #1c202c; border-radius: 6px; height: 7px; margin-top: 4px; width: 100%; }
.st-pick-row .tr-hp-inner { height: 7px; border-radius: 6px; background: var(--hp-green); }
.st-pick-row .tr-meta { font-size: 11px; color: var(--ui-dim); margin-top: 2px; }
.st-pick-badge {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ui-accent);
  color: #202020;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
}
.st-pick-row:not(.st-picked) .st-pick-badge { background: #1c202c; color: transparent; }
.st-pick-num { color: var(--ui-dim); font-weight: 800; font-size: 13px; width: 14px; }

/* recap final */
.st-recap-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 10px 0; }
.st-recap-cols h3 { color: var(--ui-dim); font-size: 15px; margin-bottom: 8px; }
.st-recap-cols .st-pick-row { margin-bottom: 6px; }

/* estadio 3D como fondo del modo Stadium */
.stadium-screen.st-3d { background: none; }
.stadium-screen .stage3d-canvas { position: absolute; inset: 0; z-index: 0; }
.stadium-screen.st-3d .st-sprite { display: none; }

/* temporizador de decisión (torneos Stadium) */
.st-timer {
  position: absolute;
  top: -34px; right: 0;
  background: rgba(18, 22, 34, .95);
  border: 2px solid var(--ui-border);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 800;
  font-size: 14px;
}
.st-timer-low { border-color: var(--ui-red); color: var(--ui-red); }

/* ---------- Barra de pistas contextual (hotkeys por modo) ---------- */
#hint-bar {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  z-index: 26;
  background: rgba(16, 18, 28, 0.72);
  border: 1px solid rgba(74, 82, 104, 0.7);
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #cfd4e4;
  white-space: nowrap;
  pointer-events: none;
}
#hint-bar b { color: var(--ui-accent); font-weight: 800; }

/* Velo del desmayo: cubre TODO el juego (canvas, HUD, toasts y menús)
 * mientras el jugador cae y despierta en el Centro Pokémon. Vive dentro de
 * #game-root, así que escala con él. La duración de la transición la pone
 * ui.js desde CONFIG.BLACKOUT; aquí solo se define el estado apagado. */
#blackout-veil {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 70;
}

/* pista de teclas dentro del combate clásico y del Stadium */
.battle-hint, .st-keys {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ui-dim);
}
.battle-hint {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 18, 28, 0.6);
  border-radius: 999px;
  padding: 3px 14px;
  z-index: 5;
}
.st-keys { margin-top: 2px; }

/* ---------- Reto de captura (minijuego infinito del menú) ---------- */
#screen-arcade {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #2f4a3e 0%, #202430 65%);
}
#screen-arcade.hidden { display: none !important; }
.arcade-title {
  font-size: 42px;
  font-weight: 900;
  color: var(--ui-accent);
  text-shadow: 3px 3px 0 #2a5cb8, 6px 6px 14px rgba(0,0,0,.5);
}
.arcade-sub { color: var(--ui-dim); font-size: 15px; }
.arcade-rules {
  max-width: 560px;
  background: rgba(16, 18, 28, 0.55);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 14px 18px;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
}
.arcade-rules p { margin: 0 0 7px; }
.arcade-rules p:last-child { margin-bottom: 0; }
.arcade-rules b { color: var(--ui-accent); }
.arcade-best { font-size: 16px; }
.arcade-best b { color: var(--ui-accent); font-size: 20px; }
.arcade-score {
  font-size: 64px;
  font-weight: 900;
  color: var(--ui-accent);
  line-height: 1;
}
.arcade-score span { font-size: 20px; color: var(--ui-dim); margin-left: 8px; }
.arcade-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.arcade-stats div {
  background: var(--ui-panel);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  padding: 10px 18px;
  min-width: 92px;
}
.arcade-stats b { display: block; font-size: 24px; font-weight: 900; }
.arcade-stats span { font-size: 11px; color: var(--ui-dim); text-transform: uppercase; }
.arcade-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 84vw);
}
.arcade-buttons .btn { font-size: 17px; padding: 11px; }

/* ---------- Minimapa (arriba a la derecha) + mapa de la región ----------
 * El recuadro vive dentro de #game-root, así que escala con el juego. El
 * contador de jugadores online se aparta a su izquierda para no pisarlo. */
#minimap {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 12;
  width: 152px;
  height: 152px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--ui-border);
  background: rgba(16, 20, 31, 0.72);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: border-color .16s, transform .16s;
}
#minimap:hover { border-color: var(--ui-accent); transform: scale(1.02); }
#minimap:active { transform: scale(0.98); }
#minimap canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
#minimap .mm-hint {
  position: absolute;
  right: 4px;
  bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  font: 700 10px 'Segoe UI', system-ui, sans-serif;
  color: rgba(240, 242, 248, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}
#minimap .mm-n {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 3px;
  padding: 0 3px;
  background: rgba(10, 12, 20, 0.6);
}
/* en táctil no hay teclas: se toca el recuadro */
.touch-mode #minimap .mm-n { display: none; }
/* el contador de online y los avisos se apartan del recuadro: los toasts
 * salían justo encima y lo tapaban unos segundos cada vez */
#online-count { right: 172px; }
#toast-container { top: 170px; }
@media (max-width: 720px) {
  #online-count { right: 172px; }
}
/* mientras no se pueda abrir (diálogo, menú…) el recuadro no invita al clic */
#minimap.mm-idle { cursor: default; pointer-events: none; opacity: 0.72; }
#minimap.mm-idle .mm-hint { opacity: 0.35; }

/* El panel tiene que caber en los 640 px internos: título + mapa + leyenda +
 * pie. Nada de vh aquí (medirían la ventana, no el área de juego escalada). */
.mm-panel {
  text-align: center;
  padding: 12px 16px;
  max-height: 624px;
  overflow: hidden;
}
.mm-panel h2 { margin-bottom: 6px; font-size: 19px; }
.mm-big {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
}
.mm-big canvas {
  width: 468px;
  height: 468px;
  border-radius: 10px;
  border: 2px solid var(--ui-border);
  background: #10131c;
  image-rendering: pixelated;
}
.mm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  font-size: 11.5px;
  color: var(--ui-dim);
  font-weight: 600;
}
.mm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mm-legend i {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.5);
}
.mm-foot { margin-top: 8px; font-size: 12px; color: var(--ui-dim); }

/* ---------- "Llévatelo al móvil": botón del título + panel de la oferta ----------
 * El botón solo lo pinta UI.showTitle en móvil/tablet (PwaInstall.offerable). */
.btn-app {
  border-color: #3fd07a !important;
  box-shadow: 0 0 0 1px rgba(63, 208, 122, 0.25) inset;
}
.app-offer-panel {
  max-width: 420px;
  text-align: center;
  padding: 18px 20px;
}
.app-offer-why {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ui-text);
  opacity: 0.9;
}
.app-offer-steps {
  margin: 12px 0 4px;
  text-align: left;
  background: rgba(12, 15, 24, 0.45);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.app-offer-steps p { font-size: 13px; line-height: 1.5; margin: 3px 0; }
.app-offer-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.app-offer-actions .btn { text-decoration: none; }
.app-offer-foot { margin-top: 10px; font-size: 11.5px; color: var(--ui-dim); }
