/* ═══════════════════════════════════════════════════════════════════════════
   PIXEL AVATAR — container com layers absolutas e animações leves
   ═══════════════════════════════════════════════════════════════════════════ */

.px-avatar {
  position: relative;
  display: inline-block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  background: transparent;
  flex-shrink: 0;
}

.px-avatar.px-no-asset {
  background: linear-gradient(135deg, rgba(108,63,197,0.15), rgba(245,200,66,0.12));
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 8px;
  position: relative;
}
.px-avatar.px-no-asset::after {
  content: '🎨';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60%;
  opacity: 0.6;
  pointer-events: none;
}

/* Tamanhos */
.px-sz-xs { width: 28px;  height: 28px;  }
.px-sz-sm { width: 40px;  height: 40px;  }
.px-sz-md { width: 64px;  height: 64px;  }
.px-sz-lg { width: 96px;  height: 96px;  }
.px-sz-xl { width: 160px; height: 160px; }

/* Cada layer ocupa o container inteiro — render layered */
.px-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  image-rendering: pixelated;
}

/* z-index por slot */
.px-slot-aura   { z-index: 0; }
.px-base        { z-index: 1; }
.px-slot-back   { z-index: 2; }
.px-slot-body   { z-index: 3; }
.px-slot-head   { z-index: 4; }
.px-slot-weapon { z-index: 5; }

/* Aura recebe pulso */
.px-slot-aura { animation: px-aura-pulse 2.4s ease-in-out infinite; }
@keyframes px-aura-pulse {
  0%,100% { opacity: 0.85; transform: scale(1); }
  50%     { opacity: 1;    transform: scale(1.04); }
}

/* Animações de base sprite */
.px-anim-idle .px-base { animation: px-idle 2.6s ease-in-out infinite; }
@keyframes px-idle {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-2%); }
}
.px-anim-attack .px-base { animation: px-attack 0.5s ease-out forwards; }
@keyframes px-attack {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(-8%) rotate(-4deg); }
  60%  { transform: translateX(12%) rotate(4deg); }
  100% { transform: translateX(0); }
}
.px-anim-walk .px-base { animation: px-walk 0.6s linear infinite; }
@keyframes px-walk {
  0%,100% { transform: translateX(-1%); }
  50%     { transform: translateX(1%); }
}

/* ═══ HEAD (crop superior do sprite) ═══ */
.px-head {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(34,211,238,0.08), rgba(108,63,197,0.10));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.px-head-inner {
  position: relative;
  width: 200%;          /* mostra só a metade superior do sprite */
  height: 200%;
  margin-top: -50%;
  image-rendering: pixelated;
}
.px-head-inner .px-layer {
  width: 100%;
  height: 100%;
}

/* ═══ PROFILE (face dedicada — pixel art "rosto") ═══ */
.px-profile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(34,211,238,0.08), rgba(108,63,197,0.10));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.px-profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ═══ PORTAL DO ALUNO — aba "🎨 Avatar" ═══ */
.px-avatar-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 14px;
}
.px-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg3, rgba(255,255,255,0.03));
  border: 1px solid var(--border2, rgba(255,255,255,0.08));
  border-radius: 10px;
}
.px-mode-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted2, rgba(255,255,255,0.6));
  margin-right: 6px;
}
.px-mode-btn {
  padding: 6px 14px;
  background: var(--bg2, rgba(255,255,255,0.04));
  color: var(--text, #fff);
  border: 1px solid var(--border2, rgba(255,255,255,0.08));
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.px-mode-btn:hover { border-color: var(--gold, #f5c842); }
.px-mode-btn.active {
  background: linear-gradient(135deg, var(--gold, #f5c842), #e6a420);
  color: #1a1a1a;
  border-color: transparent;
}

.px-section {
  background: var(--bg2, rgba(255,255,255,0.03));
  border: 1px solid var(--border2, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 16px;
}
.px-section-head { margin-bottom: 14px; }
.px-section-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text, #fff);
}
.px-section-title small {
  font-weight: 400;
  color: var(--muted2, rgba(255,255,255,0.55));
  font-size: 0.7rem;
  margin-left: 6px;
}
.px-section-emoji {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted2, rgba(255,255,255,0.6));
  display: flex;
  align-items: center;
  gap: 10px;
}

.px-preview-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--bg3, rgba(255,255,255,0.03));
  border-radius: 10px;
  margin-bottom: 14px;
}
.px-preview-box {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.px-preview-box.character {
  width: 160px;
  height: 160px;
}
.px-emoji-preview {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, rgba(34,211,238,0.08), rgba(108,63,197,0.10));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 50%;
}
.px-emoji-preview.lg {
  width: 140px;
  height: 140px;
  font-size: 5rem;
  border-radius: 16px;
}
.px-preview-meta {
  font-size: 0.82rem;
  color: var(--muted2, rgba(255,255,255,0.65));
  line-height: 1.5;
}

.px-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.px-skin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--bg3, rgba(255,255,255,0.03));
  border: 2px solid var(--border2, rgba(255,255,255,0.08));
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.px-skin-card:hover {
  border-color: var(--teal, #22d3ee);
  transform: translateY(-2px);
}
.px-skin-card.selected {
  border-color: var(--gold, #f5c842);
  background: linear-gradient(135deg, rgba(245,200,66,0.12), rgba(108,63,197,0.08));
}
.px-skin-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.px-skin-card.character .px-skin-img {
  width: 80px;
  height: 96px;
}
.px-skin-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text, #fff);
  text-align: center;
  line-height: 1.2;
}

/* Avatares emoji compactos (fallback) */
.s-avatar-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}
.s-avatar-emoji-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  line-height: 1;
}
