/*
 * Maná Kids — Seleção de Avatar (selecionar-avatar.css)
 *
 * Tela estilo "character select" de jogo de luta: palco escuro com brilho,
 * grade densa (4 colunas no mobile), bordas com glow no hover/seleção,
 * silhueta escura para bloqueados (cadeado + barra de XP fina) e efeito
 * dourado/coroa para os exclusivos de assinatura. Animações CSS puras,
 * respeitando prefers-reduced-motion (padrão do projeto — sem libs).
 */

/* ---------- Avatar ilustrado reutilizável (dashboard/perfil/ranking) ---------- */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
/* Faces que antes eram emoji e agora podem receber <img> */
.avatar-face .avatar-img,
.avatar-atual .avatar-img { width: 100%; height: 100%; }
.mini-row .av .avatar-img,
.rank-row .avatar .avatar-img { width: 1.6em; height: 1.6em; display: inline-block; vertical-align: middle; }
.perf-chip .cara .avatar-img { width: 1.5em; height: 1.5em; display: inline-block; vertical-align: middle; }
.cp-face .avatar-img { width: 2.6rem; height: 2.6rem; display: inline-block; }

/* Imagem em destaque no modal de celebração "novo avatar" */
.celebra-avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-inline: auto;
  display: block;
  box-shadow: 0 0 0 5px #ffd76a, 0 0 28px rgba(255, 199, 66, 0.65);
  animation: selavBrilho 1.6s ease-in-out infinite alternate;
}

/* ---------- Topo ---------- */
.sel-av .selav-topo { text-align: center; margin-bottom: 1rem; }
.sel-av .selav-contador {
  color: var(--cor-texto-suave);
  font-weight: 800;
  margin-top: 0.3rem;
}

/* Banner sutil do Kids Plus (não intrusivo) */
.selav-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  background: linear-gradient(90deg, #fff7e0, #fff1c9);
  border: 2px solid #ffd76a;
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  font-weight: 700;
}
.selav-banner-btn { padding: 0.45rem 0.9rem; font-size: 0.85rem; white-space: nowrap; }

/* ---------- Palco escuro estilo character-select ---------- */
.selav-palco {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(167, 122, 255, 0.35), transparent 55%),
    radial-gradient(ellipse at 15% 110%, rgba(108, 63, 200, 0.3), transparent 50%),
    linear-gradient(180deg, #241640, #1a0f30);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
}

.selav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 colunas no mobile */
  gap: 0.55rem;
}
@media (min-width: 640px) { .selav-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 960px) { .selav-grid { grid-template-columns: repeat(7, 1fr); gap: 0.7rem; } }

/* ---------- Card de personagem ---------- */
.selav-card {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(167, 122, 255, 0.35);
  border-radius: 14px;
  background: #2d1d4e;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.selav-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.selav-card:hover,
.selav-card:focus-visible {
  transform: scale(1.05);
  border-color: #c9a5ff;
  box-shadow: 0 0 14px rgba(186, 143, 255, 0.55);
  z-index: 1;
}

.selav-nome {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.14rem 0.2rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(20, 8, 40, 0.85) 40%);
  pointer-events: none;
}

/* Selecionado: borda dourada + brilho */
.selav-card.selecionado {
  border-color: #ffd76a;
  box-shadow: 0 0 0 2px #ffd76a, 0 0 18px rgba(255, 199, 66, 0.6);
}
.selav-atual {
  position: absolute;
  top: 4px; right: 4px;
  width: 1.15rem; height: 1.15rem;
  border-radius: 50%;
  background: #ffd76a;
  color: #4a2d00;
  font-size: 0.72rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* Bloqueado por XP: silhueta escura/dessaturada + cadeado + barra fina */
.selav-card.travado img {
  filter: grayscale(1) brightness(0.42);
}
.selav-card.travado { border-color: rgba(255, 255, 255, 0.12); }
.selav-cadeado {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  font-size: 1.3rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

/* Barra de XP fina estilo "barra de vida" */
.selav-xp-bar {
  position: absolute;
  left: 8%; right: 8%; bottom: 1.35rem;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  pointer-events: none;
}
.selav-xp-bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #7ee08a, #3dbb55);
}
.selav-xp-falta {
  position: absolute;
  left: 0; right: 0; bottom: 0.28rem;
  font-size: 0.56rem;
  font-weight: 800;
  text-align: center;
  color: #cfeed5;
  pointer-events: none;
}
.selav-card.travado .selav-nome { display: none; }

/* Exclusivo por assinatura: silhueta com brilho dourado + coroa */
.selav-card.so-plus img { filter: grayscale(0.85) brightness(0.5) sepia(0.35); }
.selav-card.so-plus {
  border-color: rgba(255, 199, 66, 0.55);
  box-shadow: 0 0 10px rgba(255, 199, 66, 0.25);
}
.selav-plus-tag {
  position: absolute;
  left: 0; right: 0; bottom: 0.28rem;
  font-size: 0.56rem;
  font-weight: 900;
  text-align: center;
  color: #ffd76a;
  pointer-events: none;
}
.selav-plus-mini {
  position: absolute;
  top: 3px; left: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* "Power select": zoom + glow ao confirmar a escolha */
.selav-card.power-select { animation: selavPower 0.65s ease; }
@keyframes selavPower {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.18); box-shadow: 0 0 0 3px #ffd76a, 0 0 34px rgba(255, 214, 106, 0.95); }
  100% { transform: scale(1); }
}
@keyframes selavBrilho {
  from { box-shadow: 0 0 0 5px #ffd76a, 0 0 16px rgba(255, 199, 66, 0.45); }
  to   { box-shadow: 0 0 0 5px #ffd76a, 0 0 34px rgba(255, 199, 66, 0.85); }
}

.selav-dica {
  text-align: center;
  color: var(--cor-texto-suave);
  font-size: 0.88rem;
  margin-top: 0.9rem;
}

/* ---------- Modais (bloqueado por XP / exclusivo Plus) ---------- */
.selav-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(20, 8, 40, 0.72);
}
.selav-modal-card {
  background: var(--cor-fundo, #fff);
  border-radius: 20px;
  padding: 1.4rem;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  animation: selavModalIn 0.22s ease;
}
@keyframes selavModalIn {
  from { transform: translateY(14px) scale(0.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.selav-modal-img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin: 0 auto 0.7rem;
  display: block;
}
.selav-modal-img.bloqueado { filter: grayscale(1) brightness(0.55); }
.selav-modal-img.dourado {
  box-shadow: 0 0 0 4px #ffd76a, 0 0 24px rgba(255, 199, 66, 0.6);
}
.selav-modal-card h2 { margin-bottom: 0.35rem; }
.selav-modal-card p { color: var(--cor-texto-suave); margin-bottom: 0.8rem; }
.selav-sugestoes {
  list-style: none;
  text-align: left;
  font-size: 0.88rem;
  display: grid;
  gap: 0.4rem;
  background: rgba(108, 63, 200, 0.07);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  margin-bottom: 1rem;
}

/* ---------- Acessibilidade: movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .selav-card, .selav-card:hover { transition: none; transform: none; }
  .selav-card.power-select { animation: none; }
  .celebra-avatar-img { animation: none; }
  .selav-modal-card { animation: none; }
}
