/* ─────────────────────────────────────────────────────────────────────────────
   PIEZAS COMUNES: modales, cabecera de pantalla y botón atrás
   Una hoja por zona, como js/ui/screens/. Ver "Estilos (CSS)" en AGENTS.md.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── MODAL / OVERLAY ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  animation: fade-in 150ms ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  background: var(--off-white);
  border: var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  padding: var(--sp-lg) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  animation: sheet-up 200ms ease;
}
@keyframes sheet-up { from { transform: translateY(30px); } to { transform: translateY(0); } }

.modal-title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--black);
  text-align: center;
}

/* ── BOTÓN ATRÁS — cuadrado con icono de flecha, posicionado a la izquierda ─── */
.screen-header__back {
  position: absolute;
  left: var(--sp-md);
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  background: transparent;
  border: none;
  box-shadow: none;
}
.screen-header__back:hover,
.screen-header__back:active {
  background: transparent;
  border: none;
  box-shadow: none;
  transform: none;
}
.screen-header__back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── HEADER CON TÍTULO CENTRADO ──────────────────────────────────────────────── */
.screen-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: var(--border);
  flex-shrink: 0;
  min-height: 44px;
  background: var(--red);
}
.screen-header__title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: white;
  text-align: center;
}

/* ── TEXTO SOBRE FONDOS (pantallas de información, bienvenida, victoria) ─────── */
/* Contorno negro para que el texto claro se lea sobre cualquier imagen */
.text-outline { text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
/* Párrafo de una pantalla de información (también dentro de las descripciones de ROUTE_DATA) */
.info-text {
  font-family: var(--font-pixel);
  font-size: 8px;
  line-height: 1.8;
  color: rgba(255,255,255,.85);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.info-title { text-shadow: 3px 3px 0 rgba(0,0,0,.3); }
/* Icono delante del título de un modal */
.modal-title__icon { margin-right: 4px; }

/* ── PIEZAS COMPARTIDAS POR VARIAS PANTALLAS ────────────────────────────────── */
/* Icono shiny en línea (Screens._shinyIcon; el tamaño va en línea) */
.shiny-icon { image-rendering: pixelated; vertical-align: middle; }
/* Fondo de las pantallas de ruta sin imagen (Screens._bgLayer) */
.bg-layer-fallback { background: linear-gradient(160deg, var(--green-dark) 0%, var(--green) 100%); z-index: 0; }
/* Botón de un pokémon del equipo en los modales de elegir (Screens._teamBtn) */
.btn.team-btn { display: flex; align-items: center; gap: 10px; justify-content: flex-start; padding: 8px 12px; }
.team-btn__hint { text-transform: none; }
.team-btn__note { font-family: var(--font-pixel); font-size: var(--fs-6); color: var(--grey); }
.team-btn__note--blocked { color: var(--red); }
.modal-list { margin: 12px 0; }
.modal-title__icon--wide { margin-right: 6px; }
/* Fila que se arrastra con el dedo (Screens._initTouchSort; posición y ancho en línea) */
.touch-sort-clone { position: fixed; z-index: 9999; pointer-events: none; opacity: .85; box-shadow: 0 6px 20px rgba(0,0,0,.35); }

/* Imagen centrada de una pantalla de información (description de ROUTE_DATA) */
.info-media { display: flex; justify-content: center; }
.info-media__img { height: 96px; object-fit: contain; image-rendering: pixelated; }

/* Hueco con pulso mientras carga un sprite (inicial, Pokédex, Frente Batalla); cada
   pantalla le da su tamaño con su propia clase, que va en una hoja posterior */
.loading-sprite {
  width: 64px; height: 64px;
  background: var(--grey-light);
  border-radius: var(--radius-sm);
  animation: pulse 1s ease infinite alternate;
}
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }

/* Objeto quitado con Desarme (fila del equipo y barra del equipo del combate): tachado con una X */
.held-item-lost { position: relative; }
.held-item-lost img, .held-item-lost > span { opacity: .45; }
.held-item-lost::after {
  content: '✕';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--red); font-weight: bold; font-size: 20px; line-height: 1;
  pointer-events: none;
}
