/* ============================================================
   bestiary.css — Códice de colección: teaser en la landing y
   panel modal con jefes, operadores y reliquias.
   Estética holográfica vibrante: cortes diagonales, glows por
   acento, scanlines, glitch en lo no descubierto y entrada en
   cascada de las tarjetas.
   ============================================================ */

/* ============ Teaser (landing) ============ */
.bp-teaser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  flex-wrap: wrap;
  padding: 26px 30px;
  background:
    linear-gradient(120deg, rgba(255,45,85,0.06), transparent 45%),
    linear-gradient(300deg, rgba(255,207,74,0.05), transparent 45%),
    var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--red);
  clip-path: var(--cut);
}
.bp-teaser-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.bp-teaser-stat { display: flex; flex-direction: column; gap: 3px; }
.bp-teaser-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--red);
  text-shadow: 0 0 14px rgba(255,45,85,0.3);
}
.bp-teaser-num i { font-style: normal; font-size: 0.9rem; color: var(--muted); text-shadow: none; }
.bp-teaser-stat--cyan .bp-teaser-num { color: var(--cyan); text-shadow: 0 0 14px rgba(0,229,255,0.3); }
.bp-teaser-stat--gold .bp-teaser-num { color: var(--gold); text-shadow: 0 0 14px rgba(255,207,74,0.3); }
.bp-teaser-stat--pct  .bp-teaser-num { color: var(--green); text-shadow: 0 0 14px rgba(57,255,20,0.3); }
.bp-teaser-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.bp-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--red);
  border: none;
  padding: 13px 24px;
  cursor: pointer;
  clip-path: var(--cut);
  box-shadow: 0 0 18px -4px var(--red);
  transition: transform 0.16s ease, box-shadow 0.25s ease, filter 0.2s ease;
}
.bp-cta svg { width: 16px; height: 16px; transition: transform 0.16s ease; }
.bp-cta:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 0 26px -4px var(--red); }
.bp-cta:hover svg { transform: translateX(3px); }
.bp-cta:active { transform: translateY(0); }
/* Punto "hay novedades": late en violeta sobre el CTA */
.bp-cta-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 10px var(--violet);
  animation: bpDotPulse 1.4s ease-in-out infinite;
}
@keyframes bpDotPulse { 50% { transform: scale(1.5); opacity: 0.6; } }

@media (max-width: 640px) {
  .bp-teaser { flex-direction: column; align-items: stretch; }
  .bp-teaser-stats { justify-content: space-around; gap: 18px; }
  .bp-cta { justify-content: center; }
}

/* ============ Panel modal ============ */
.bp-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8,8,16,0.78);
  backdrop-filter: blur(7px);
  animation: bpFade 0.22s ease;
}
.bp-overlay[hidden] { display: none; }
@keyframes bpFade { from { opacity: 0; } to { opacity: 1; } }

.bp-modal {
  width: min(860px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255,45,85,0.06), transparent 140px),
    rgba(15,15,26,0.98);
  border: 1px solid var(--border);
  border-left: 2px solid var(--red);
  clip-path: var(--cut);
  padding: 22px 8px 20px 26px;
  animation: bpRise 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes bpRise { from { opacity: 0; transform: translateY(16px) scale(0.985); } }

.bp-head { display: flex; align-items: center; gap: 16px; padding-right: 18px; }
.bp-titles { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.bp-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0;
  text-shadow: 0 0 22px rgba(255,45,85,0.35);
}

/* Anillo de completado (SVG): la barra se dibuja al abrir */
.bp-ring { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.bp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.bp-ring-track { fill: none; stroke: var(--border); stroke-width: 3; }
.bp-ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(57,255,20,0.6));
  transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.bp-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--green);
}

.bp-close {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 8px 14px;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  transition: color 0.18s ease, border-color 0.18s ease;
}
.bp-close:hover { color: var(--text); border-color: var(--red); }
.bp-close svg { width: 11px; height: 11px; }

.bp-scroll {
  overflow-y: auto;
  overscroll-behavior: contain; /* al llegar al final del scroll, no arrastra el scroll de la landing detrás */
  padding: 18px 18px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.bp-empty {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 30px 0;
}

/* Cabecera de sección */
.bp-sec-head { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.bp-sec-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c, var(--text));
  text-shadow: 0 0 14px color-mix(in srgb, var(--c, transparent) 40%, transparent);
}
.bp-sec-rule { flex: 1; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--border)) 45%, transparent), transparent); }
.bp-sec-count { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }

/* Subcabecera de cada pool de cartas (común / por operador) dentro de la
   sección Cartas — más discreta que .bp-sec-head, no compite con ella. */
.bp-card-group {
  margin: 18px 0 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.bp-card-group span { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0; color: var(--muted); opacity: 0.8; }
.bp-card-group:first-of-type { margin-top: 8px; }

/* Entrada en cascada de todas las tarjetas (stagger por --i) */
.bp-boss, .bp-char, .bp-relic {
  opacity: 0;
  animation: bpCardIn 0.4s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}
@keyframes bpCardIn {
  from { opacity: 0; transform: translateY(12px) rotate(0.4deg); }
  to   { opacity: 1; transform: none; }
}

/* Badge NUEVO (primera vez que se descubre; se limpia al cerrar) */
.bp-new {
  position: absolute;
  top: 8px; right: 10px;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--bg);
  background: var(--violet);
  padding: 3px 7px;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  box-shadow: 0 0 12px rgba(191,90,242,0.7);
  animation: bpNewPulse 1.3s ease-in-out infinite;
}
@keyframes bpNewPulse { 50% { box-shadow: 0 0 20px rgba(191,90,242,1); } }

/* ---- Scanline holográfica compartida (retratos) ---- */
.bp-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.03) 3px 4px);
  mix-blend-mode: screen;
}

/* ============ JEFES ============ */
.bp-boss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}
.bp-boss {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--c, var(--border));
  clip-path: var(--cut);
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.bp-boss.defeated:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--c) 65%, transparent);
}
.bp-boss-portrait {
  position: relative;
  height: 130px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(110% 90% at 50% 20%, color-mix(in srgb, var(--c, #223) 20%, transparent), transparent 72%),
    linear-gradient(180deg, #05050c, #0b0b16);
  border-bottom: 1px solid var(--border);
}
.bp-boss-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1), filter 0.35s ease;
}
.bp-boss.defeated:hover .bp-boss-portrait img { transform: scale(1.07); }
/* Avistado pero no vencido: retrato apagado, en blanco y negro */
.bp-boss.seen .bp-boss-portrait img { filter: grayscale(1) brightness(0.55); }
.bp-boss-portrait.noimg img { display: none; }
.bp-boss-fallback { display: none; font-size: 2.4rem; color: var(--c, var(--muted)); }
.bp-boss-portrait.noimg .bp-boss-fallback { display: block; }

/* Barrido de luz al pasar el ratón por un jefe derrotado */
.bp-boss.defeated .bp-boss-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, color-mix(in srgb, var(--c) 22%, transparent) 50%, transparent 62%);
  transform: translateX(-110%);
}
.bp-boss.defeated:hover .bp-boss-portrait::after { animation: bpSweep 0.7s ease; }
@keyframes bpSweep { to { transform: translateX(110%); } }

.bp-boss-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 13px; }
.bp-boss-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--text);
}
.bp-boss.defeated .bp-boss-name { text-shadow: 0 0 14px color-mix(in srgb, var(--c) 45%, transparent); }
.bp-boss-epithet { font-family: var(--font-ui); font-size: 0.72rem; color: var(--muted); line-height: 1.35; }
.bp-boss-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.bp-boss-lvl, .bp-boss-mode {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 7px;
}
/* Fijo abajo-derecha del CARD (no del flujo de .bp-boss-meta): así queda en
   el mismo sitio exacto en todas las tarjetas, tenga el jefe una o dos
   líneas de nivel/modo encima. Fondo propio para que siempre se lea, se
   solape o no con el texto de la tarjeta. */
.bp-boss-state {
  position: absolute;
  right: 12px;
  bottom: 11px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(2px);
}
.bp-boss-state.ok   { color: var(--green); border: 1px solid rgba(57,255,20,0.35); text-shadow: 0 0 8px rgba(57,255,20,0.5); }
.bp-boss-state.seen { color: var(--red);   border: 1px solid rgba(255,45,85,0.35); text-shadow: 0 0 8px rgba(255,45,85,0.5); }

/* Jefe sin descubrir: silueta con "?" que parpadea con glitch */
.bp-boss.locked { opacity: 1; filter: saturate(0.4); }
.bp-boss.locked .bp-boss-portrait { background: linear-gradient(180deg, #05050c, #0a0a14); }
.bp-boss-unknown {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 3rem;
  color: var(--muted);
  animation: bpGlitch 3.2s steps(1) infinite;
}
@keyframes bpGlitch {
  0%, 88%, 100% { opacity: 0.5; transform: none; }
  90% { opacity: 0.9; transform: translateX(-2px) skewX(-6deg); }
  92% { opacity: 0.35; transform: translateX(2px); }
  94% { opacity: 0.75; transform: none; }
}
.bp-boss.locked .bp-boss-name { color: var(--muted); letter-spacing: 0.2em; }

/* ============ OPERADORES ============ */
.bp-char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.bp-char {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--c, var(--border));
  clip-path: var(--cut);
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.bp-char.played:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--c) 60%, transparent);
}
.bp-char-portrait {
  position: relative;
  height: 120px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #05050c, #0b0b16);
  border-bottom: 1px solid var(--border);
}
.bp-char-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 18%;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1), filter 0.35s ease;
}
.bp-char.played:hover .bp-char-portrait img { transform: scale(1.06); }
.bp-char.unplayed .bp-char-portrait img { filter: grayscale(1) brightness(0.5); }
.bp-char-portrait.noimg img { display: none; }
.bp-char-fallback { display: none; font-family: var(--font-display); font-weight: 900; font-size: 2.2rem; color: var(--c, var(--muted)); }
.bp-char-portrait.noimg .bp-char-fallback { display: block; }
.bp-char-unknown { font-size: 1.8rem; opacity: 0.55; }
.bp-char-body { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px 12px; }
.bp-char-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--text);
}
.bp-char.played .bp-char-name { text-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); }
.bp-char-runs { font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); }
.bp-char-runs b { color: var(--c, var(--text)); font-size: 0.8rem; }
.bp-char.locked { filter: saturate(0.4); }

/* ============ RELIQUIAS ============ */
.bp-relic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.bp-relic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
  transition: transform 0.18s ease, box-shadow 0.25s ease;
}
.bp-relic-icon { font-size: 1.25rem; line-height: 1; }
.bp-relic-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text);
  line-height: 1.25;
}
.bp-relic-char {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.bp-relic.locked { filter: saturate(0.3); }
.bp-relic.locked .bp-relic-icon { color: var(--muted); opacity: 0.6; }
.bp-relic.locked .bp-relic-name { color: var(--muted); letter-spacing: 0.18em; }

/* Rareza: mismo código de color que el resto del juego */
.bp-relic.owned:hover { transform: translateY(-2px); }
.bp-relic.common { border-color: rgba(74,74,106,0.5); border-left: 2px solid var(--muted); }
.bp-relic.common .bp-relic-icon { color: var(--muted); }
.bp-relic.uncommon { border-color: rgba(57,255,20,0.4); border-left: 2px solid var(--green); }
.bp-relic.uncommon .bp-relic-icon { color: var(--green); text-shadow: 0 0 10px rgba(57,255,20,0.5); }
.bp-relic.uncommon.owned:hover { box-shadow: 0 6px 18px -8px rgba(57,255,20,0.55); }
.bp-relic.rare { border-color: rgba(0,229,255,0.4); border-left: 2px solid var(--cyan); }
.bp-relic.rare .bp-relic-icon { color: var(--cyan); text-shadow: 0 0 10px rgba(0,229,255,0.5); }
.bp-relic.rare.owned:hover { box-shadow: 0 6px 18px -8px rgba(0,229,255,0.55); }
.bp-relic.legendary {
  border-color: rgba(191,90,242,0.5);
  border-left: 2px solid var(--violet);
  animation: bpCardIn 0.4s cubic-bezier(0.2, 0.9, 0.2, 1) forwards, bpLegendary 2.2s ease-in-out infinite 0.5s;
  animation-delay: calc(var(--i, 0) * 30ms), 0.5s;
}
.bp-relic.legendary .bp-relic-icon { color: var(--violet); text-shadow: 0 0 12px rgba(191,90,242,0.7); }
@keyframes bpLegendary {
  0%, 100% { box-shadow: 0 0 10px -4px rgba(191,90,242,0.5); }
  50%      { box-shadow: 0 0 20px -4px rgba(191,90,242,0.9); }
}

/* Reliquia obtenida / jefe derrotado: foco de teclado visible (tabindex,
   para el popup). */
.bp-relic.owned, .bp-boss.defeated { cursor: default; }
.bp-relic.owned:focus-visible, .bp-boss.defeated:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 60%, transparent);
}

/* ---- Popup de descripción (reliquias) ----
   Mismo patrón que .slot-tip del juego: un único elemento position:fixed,
   reposicionado por JS sobre el chip que se hover/focus. --c lo fija el JS
   según la rareza de la reliquia. */
.bp-tip {
  --c: var(--gold);
  position: fixed;
  z-index: 210;
  width: 252px; max-width: 88vw;
  padding: 13px 15px 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 13%, var(--surface)), var(--surface) 62%);
  border: 1px solid var(--border);
  border-left: 2px solid var(--c);
  clip-path: var(--cut);
  pointer-events: none;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  box-shadow: 0 16px 40px -16px rgba(0,0,0,0.8), 0 0 22px -12px var(--c);
}
.bp-tip[hidden] { display: none; }
.bp-tip.show { opacity: 1; transform: translateY(0); }
.bp-tip .tip-top { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.bp-tip .tip-icon {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  font-size: 1.2rem; line-height: 1;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  clip-path: var(--cut);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 45%, transparent));
}
.bp-tip .tip-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1rem; letter-spacing: 0.02em; color: var(--text); line-height: 1.1;
}
.bp-tip .tip-rarity {
  font-family: var(--font-mono); font-size: 0.55rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--c); margin-top: 3px;
}
.bp-tip .tip-desc {
  font-family: var(--font-ui); font-size: 0.8rem;
  color: #a8a8c2; line-height: 1.45; margin: 0;
}
.bp-tip-char {
  margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}

@media (max-width: 640px) {
  .bp-modal { padding: 18px 6px 16px 18px; }
  .bp-boss-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .bp-title { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bp-overlay, .bp-modal { animation: none; }
  .bp-boss, .bp-char, .bp-relic { animation: none; opacity: 1; }
  .bp-relic.legendary { animation: none; }
  .bp-boss-unknown, .bp-new, .bp-cta-dot { animation: none; }
  .bp-ring-fill { transition: none; }
  .bp-boss.defeated:hover .bp-boss-portrait::after { animation: none; }
  .bp-tip { transition: none; }
}
