/**
 * Vitrina de insignias — diseño cósmico (referencia INSIGNIAS).
 * Tarjetas con borde luminoso por rareza, glassmorphism y tipografía legible.
 */

/* Paleta unificada de rareza (tarjetas, pills y popover) */
:root {
  /* Común — Bronce */
  --badge-rarity-common-color: #cd7f32;
  --badge-rarity-common-soft: rgba(205, 127, 50, 0.42);
  --badge-rarity-common-tint: rgba(42, 28, 18, 0.9);

  /* Poco común — Plata */
  --badge-rarity-uncommon-color: #c0c0c0;
  --badge-rarity-uncommon-soft: rgba(192, 192, 192, 0.45);
  --badge-rarity-uncommon-tint: rgba(28, 32, 38, 0.92);

  /* Raro — Oro */
  --badge-rarity-rare-color: #ffd700;
  --badge-rarity-rare-soft: rgba(255, 215, 0, 0.42);
  --badge-rarity-rare-tint: rgba(48, 38, 8, 0.92);

  /* Épico — Azul */
  --badge-rarity-epic-color: #42a5f5;
  --badge-rarity-epic-soft: rgba(66, 165, 245, 0.45);
  --badge-rarity-epic-tint: rgba(12, 28, 58, 0.92);

  /* Legendario — Morado */
  --badge-rarity-legendary-color: #ab47bc;
  --badge-rarity-legendary-soft: rgba(171, 71, 188, 0.45);
  --badge-rarity-legendary-tint: rgba(36, 18, 48, 0.92);

  /* Único — Rojo */
  --badge-rarity-unique-color: #e53935;
  --badge-rarity-unique-soft: rgba(229, 57, 53, 0.45);
  --badge-rarity-unique-tint: rgba(48, 12, 12, 0.92);
}

.badge-rarity--common {
  --badge-accent: var(--badge-rarity-common-color);
  --badge-accent-soft: var(--badge-rarity-common-soft);
  --badge-card-tint: var(--badge-rarity-common-tint);
  --badge-glow: var(--badge-rarity-common-color);
}

.badge-rarity--uncommon {
  --badge-accent: var(--badge-rarity-uncommon-color);
  --badge-accent-soft: var(--badge-rarity-uncommon-soft);
  --badge-card-tint: var(--badge-rarity-uncommon-tint);
  --badge-glow: var(--badge-rarity-uncommon-color);
}

.badge-rarity--rare {
  --badge-accent: var(--badge-rarity-rare-color);
  --badge-accent-soft: var(--badge-rarity-rare-soft);
  --badge-card-tint: var(--badge-rarity-rare-tint);
  --badge-glow: var(--badge-rarity-rare-color);
}

.badge-rarity--epic {
  --badge-accent: var(--badge-rarity-epic-color);
  --badge-accent-soft: var(--badge-rarity-epic-soft);
  --badge-card-tint: var(--badge-rarity-epic-tint);
  --badge-glow: var(--badge-rarity-epic-color);
}

.badge-rarity--legendary {
  --badge-accent: var(--badge-rarity-legendary-color);
  --badge-accent-soft: var(--badge-rarity-legendary-soft);
  --badge-card-tint: var(--badge-rarity-legendary-tint);
  --badge-glow: var(--badge-rarity-legendary-color);
}

.badge-rarity--unique {
  --badge-accent: var(--badge-rarity-unique-color);
  --badge-accent-soft: var(--badge-rarity-unique-soft);
  --badge-card-tint: var(--badge-rarity-unique-tint);
  --badge-glow: var(--badge-rarity-unique-color);
}

/* --- Contenedor vitrina (sin caja de fondo) --- */
.badge-showcase-panel,
.badge-showcase-cosmos,
.badge-showcase-cosmos--inset {
  position: relative;
  margin-top: 0;
  padding: 0;
  background: transparent !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none !important;
  overflow: visible;
}

.badge-showcase-cosmos::before {
  content: none;
  display: none;
}

.badge-showcase-panel__grid,
.badge-showcase-cosmos__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 1.25rem;
}

.badge-showcase-panel__section-title,
.badge-showcase-cosmos__section-title {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.badge-showcase-panel__empty {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

/* --- Cabecera INSIGNIAS --- */
.badge-showcase-cosmos__hero {
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}

.badge-showcase-cosmos__ornament {
  display: block;
  width: min(220px, 70%);
  height: 2px;
  margin: 0 auto 1rem;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 152, 0, 0.2) 15%,
    rgba(255, 193, 7, 0.9) 50%,
    rgba(255, 152, 0, 0.2) 85%,
    transparent
  );
  position: relative;
}

.badge-showcase-cosmos__ornament::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #ffb74d, #ff9800);
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.8);
}

.badge-showcase-cosmos__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.25);
}

.badge-showcase-cosmos__more-toggle {
  position: relative;
  z-index: 1;
}

.badge-showcase-cosmos__empty {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
}

.badge-showcase-cosmos__subtitle {
  margin: 0;
  font-size: clamp(0.8125rem, 1.8vw, 0.9375rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

/* --- Grid: reglas compartidas arriba (.badge-showcase-panel__grid) --- */

/* --- Tarjeta insignia --- */
.profile-badge-tile {
  position: relative;
  display: block;
  border: none;
  border-radius: 14px;
  padding: 0;
  text-align: left;
  cursor: default;
  background: transparent;
}

.profile-badge-tile:not([class*="badge-rarity--"]) {
  --badge-accent: #9e9e9e;
  --badge-accent-soft: rgba(158, 158, 158, 0.35);
  --badge-card-tint: rgba(18, 22, 38, 0.88);
}

.profile-badge-tile__glow {
  position: absolute;
  inset: -1px;
  border-radius: 15px;
  background: linear-gradient(
    145deg,
    var(--badge-accent-soft),
    transparent 45%,
    var(--badge-accent-soft)
  );
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
}

.profile-badge-tile__inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 13px;
  border: 1px solid color-mix(in srgb, var(--badge-accent) 55%, transparent);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--badge-card-tint) 92%, var(--badge-accent) 8%) 0%,
    var(--badge-card-tint) 55%,
    rgba(6, 8, 16, 0.95) 100%
  );
  box-shadow:
    0 0 28px var(--badge-accent-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.profile-badge-tile--compact .profile-badge-tile__inner {
  padding: 0.85rem 1rem;
}

.profile-badge-tile--compact .profile-badge-tile__foot {
  display: none;
}

.profile-badge-tile--compact .profile-badge-tile__icon-wrap .material-icons {
  font-size: 1.65rem;
}

.profile-badge-tile--compact .profile-badge-tile__title {
  font-size: 0.95rem;
}

.profile-badge-tile:not(.profile-badge-tile--compact) .profile-badge-tile__inner {
  padding: 1rem 1.1rem 0.85rem;
}

/* Cabecera tarjeta */
.profile-badge-tile__head {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.profile-badge-tile__icon-wrap {
  flex-shrink: 0;
  width: 3.25rem;
  height: 3.25rem;
  min-width: 3.25rem;
  max-width: 3.25rem;
  min-height: 3.25rem;
  max-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--badge-accent) 35%, #1a1f35),
    rgba(8, 10, 20, 0.9)
  );
  border: 1px solid color-mix(in srgb, var(--badge-accent) 40%, transparent);
  box-shadow: 0 0 18px var(--badge-accent-soft);
  overflow: hidden;
  line-height: 0;
}

.profile-badge-tile__icon-wrap .material-icons {
  font-size: 2rem;
  color: var(--badge-accent);
  filter: drop-shadow(0 0 8px var(--badge-accent-soft));
  line-height: 1;
}

.profile-badge-tile__icon-wrap .profile-badge-tile__img {
  display: block;
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 0 !important;
  max-width: 2.5rem !important;
  max-height: 2.5rem !important;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
  background: transparent;
}

.profile-badge-tile--compact .profile-badge-tile__icon-wrap {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  max-width: 2.75rem;
  min-height: 2.75rem;
  max-height: 2.75rem;
}

.profile-badge-tile--compact .profile-badge-tile__icon-wrap .profile-badge-tile__img {
  width: 2rem !important;
  height: 2rem !important;
  max-width: 2rem !important;
  max-height: 2rem !important;
}

.profile-badges-picker-thumb-wrap {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  min-height: 28px;
  max-height: 28px;
  flex-shrink: 0;
  margin-right: 0.35rem;
  overflow: hidden;
  line-height: 0;
}

.profile-badges-picker-thumb-wrap.profile-badge-tile__icon-wrap {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  min-height: 28px;
  max-height: 28px;
  border-radius: 6px;
  box-shadow: none;
}

.profile-badges-featured-form img.profile-badges-picker-thumb,
.profile-badges-picker-thumb-wrap img.profile-badges-picker-thumb {
  display: block;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  object-fit: contain;
  flex-shrink: 0;
}

.profile-badges-picker-thumb-icon {
  font-size: 1.25rem;
  line-height: 1;
  color: #666;
}

.profile-badges-picker-text {
  min-width: 0;
}

.badge-admin-thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  vertical-align: middle;
  margin-right: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
}

.profile-badge-tile__head-text {
  flex: 1;
  min-width: 0;
}

.profile-badge-tile__head-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.35rem;
}

.badge-rarity-pill {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  line-height: 1.2;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge-rarity-pill.badge-rarity--common {
  background: linear-gradient(135deg, #d4956a, #8b5a2b);
  color: #fff;
}
.badge-rarity-pill.badge-rarity--uncommon {
  background: linear-gradient(135deg, #f0f0f0, #9e9e9e);
  color: #1a1a1a;
}
.badge-rarity-pill.badge-rarity--rare {
  background: linear-gradient(135deg, #ffe566, #daa520);
  color: #3e2723;
}
.badge-rarity-pill.badge-rarity--epic {
  background: linear-gradient(135deg, #64b5f6, #1565c0);
  color: #fff;
}
.badge-rarity-pill.badge-rarity--legendary {
  background: linear-gradient(135deg, #ce93d8, #7b1fa2);
  color: #fff;
}
.badge-rarity-pill.badge-rarity--unique {
  background: linear-gradient(135deg, #ef5350, #b71c1c);
  color: #fff;
}

.profile-badge-tile__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.profile-badge-tile__refrain {
  margin: 0;
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.72);
}

/* Bloques de estadística */
.profile-badge-tile__stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
}

.profile-badge-tile__stat {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-badge-tile__stat:last-child {
  border-bottom: none;
}

.profile-badge-tile__stat > .material-icons {
  font-size: 1.15rem;
  color: var(--badge-accent);
  opacity: 0.9;
  margin-top: 0.1rem;
}

.profile-badge-tile__stat-body {
  flex: 1;
  min-width: 0;
}

.profile-badge-tile__stat-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0.2rem;
}

.profile-badge-tile__stat-value {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.profile-badge-tile__stat-value strong,
.profile-badge-tile__stat-value .profile-badge-tile__pct-num {
  color: var(--badge-accent);
  font-weight: 700;
}

/* Pie fecha */
.profile-badge-tile__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.profile-badge-tile__foot .material-icons {
  font-size: 0.95rem;
  opacity: 0.7;
}

/* Rareza: acento y brillo por nivel (hereda variables de .badge-rarity--*) */
.profile-badge-tile.badge-rarity--common,
.badge-preview-popover.badge-rarity--common .badge-preview-popover__inner,
.badge-preview-popover__inner.badge-rarity--common {
  --badge-accent: var(--badge-rarity-common-color);
  --badge-accent-soft: var(--badge-rarity-common-soft);
  --badge-card-tint: var(--badge-rarity-common-tint);
}

.profile-badge-tile.badge-rarity--uncommon,
.badge-preview-popover.badge-rarity--uncommon .badge-preview-popover__inner,
.badge-preview-popover__inner.badge-rarity--uncommon {
  --badge-accent: var(--badge-rarity-uncommon-color);
  --badge-accent-soft: var(--badge-rarity-uncommon-soft);
  --badge-card-tint: var(--badge-rarity-uncommon-tint);
}

.profile-badge-tile.badge-rarity--rare,
.badge-preview-popover.badge-rarity--rare .badge-preview-popover__inner,
.badge-preview-popover__inner.badge-rarity--rare {
  --badge-accent: var(--badge-rarity-rare-color);
  --badge-accent-soft: var(--badge-rarity-rare-soft);
  --badge-card-tint: var(--badge-rarity-rare-tint);
}

.profile-badge-tile.badge-rarity--epic,
.badge-preview-popover.badge-rarity--epic .badge-preview-popover__inner,
.badge-preview-popover__inner.badge-rarity--epic {
  --badge-accent: var(--badge-rarity-epic-color);
  --badge-accent-soft: var(--badge-rarity-epic-soft);
  --badge-card-tint: var(--badge-rarity-epic-tint);
}

.profile-badge-tile.badge-rarity--legendary,
.badge-preview-popover.badge-rarity--legendary .badge-preview-popover__inner,
.badge-preview-popover__inner.badge-rarity--legendary {
  --badge-accent: var(--badge-rarity-legendary-color);
  --badge-accent-soft: var(--badge-rarity-legendary-soft);
  --badge-card-tint: var(--badge-rarity-legendary-tint);
}

.profile-badge-tile.badge-rarity--unique,
.badge-preview-popover.badge-rarity--unique .badge-preview-popover__inner,
.badge-preview-popover__inner.badge-rarity--unique {
  --badge-accent: var(--badge-rarity-unique-color);
  --badge-accent-soft: var(--badge-rarity-unique-soft);
  --badge-card-tint: var(--badge-rarity-unique-tint);
}

/* Hover / destacada */
.profile-badge-tile--hover {
  transition: transform 0.25s ease, filter 0.25s ease;
}

.profile-badge-tile--hover:hover,
.profile-badge-tile--hover:focus {
  transform: translateY(-4px) scale(1.01);
  filter: brightness(1.06);
  outline: none;
}

.profile-badge-tile--hover:hover .profile-badge-tile__inner,
.profile-badge-tile--hover:focus .profile-badge-tile__inner {
  box-shadow:
    0 0 36px var(--badge-accent-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.profile-badge-tile--highlight {
  animation: badge-highlight-pulse 1.2s ease-in-out 3;
}

.profile-badge-tile--highlight .profile-badge-tile__inner {
  box-shadow:
    0 0 0 2px rgba(255, 193, 7, 0.7),
    0 0 32px var(--badge-accent-soft);
}

@keyframes badge-highlight-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

/* Dashboard (Mi perfil): sin caja oscura; tarjetas sobre card-body blanco */
.profile-badges-showcase--dashboard .profile-badges-toolbar {
  margin-bottom: 1rem;
}

.profile-badges-showcase--dashboard .profile-badges-toolbar .form-control {
  background: #fff;
}

.profile-badges-showcase--dashboard .profile-badges-featured-form {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

.profile-badges-showcase--dashboard .badge-showcase-panel,
.profile-badges-showcase--dashboard .badge-showcase-cosmos,
.profile-badges-showcase--dashboard .badge-showcase-cosmos--inset {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.profile-badges-showcase--dashboard .badge-showcase-panel__section-title {
  color: #757575;
}

.profile-badges-showcase--dashboard .profile-badge-tile {
  background: transparent;
  border: none;
  box-shadow: none;
}

.profile-badges-showcase--empty-cosmos,
.profile-badges-showcase--dashboard .badge-showcase-panel__empty {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

/* Público: filtros sobre cosmos */
.profile-badges-showcase--public .profile-badges-toolbar .form-control {
  background: rgba(15, 20, 35, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.profile-badges-showcase--public .profile-badges-toolbar label {
  color: rgba(255, 255, 255, 0.7);
}

.profile-badges-showcase--public .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.35);
}

/* Perfil público: prioridad sobre Material Kit */
.profile-page .profile-badges-showcase--public .profile-badge-tile {
  background: transparent;
  border: none;
  box-shadow: none;
}

.profile-page .profile-badges-showcase--public .profile-badge-tile__title,
.profile-page .profile-badges-showcase--public .badge-showcase-cosmos__title {
  color: #ffffff !important;
}

.profile-page .profile-badges-showcase--public .profile-badge-tile__refrain {
  color: rgba(255, 255, 255, 0.72) !important;
}

.profile-page .profile-badges-showcase--public .badge-showcase-cosmos {
  width: 100%;
}

.profile-page .profile-badges-showcase--public .badge-showcase-cosmos__grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

@media (min-width: 992px) {
  .profile-page .profile-badges-showcase--public .badge-showcase-cosmos__grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.badge-unlock-toast {
  animation: badge-toast-in 0.45s ease-out;
}

@keyframes badge-toast-in {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.profile-page .profile-badges-showcase--public .profile-badge-tile__icon-wrap {
  width: 3.75rem;
  height: 3.75rem;
  min-width: 3.75rem;
  max-width: 3.75rem;
  min-height: 3.75rem;
  max-height: 3.75rem;
}

.profile-page .profile-badges-showcase--public .profile-badge-tile__icon-wrap .profile-badge-tile__img {
  width: 2.85rem !important;
  height: 2.85rem !important;
  max-width: 2.85rem !important;
  max-height: 2.85rem !important;
}

/* Vista previa ampliada (hover): ficha completa de insignia */
.badge-hover-preview {
  cursor: pointer;
}

.profile-badges-picker-row.badge-hover-preview {
  border-radius: 8px;
  padding: 0.15rem 0.35rem 0.15rem 0;
  transition: background 0.15s ease;
}

.profile-badges-picker-row.badge-hover-preview:hover,
.profile-badges-picker-row.badge-hover-preview:focus {
  background: rgba(233, 30, 99, 0.06);
  outline: none;
}

.badge-preview-popover {
  position: fixed;
  z-index: 10050;
  pointer-events: auto;
  width: min(320px, calc(100vw - 20px));
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  background: transparent;
  border: none;
  box-shadow: none;
}

.badge-preview-popover.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.badge-preview-popover .profile-badge-tile__inner {
  padding: 1rem 1.1rem 0.85rem;
}

.badge-preview-popover .profile-badge-tile__icon-wrap.badge-preview-popover__icon-wrap {
  width: 4.25rem !important;
  height: 4.25rem !important;
  min-width: 4.25rem !important;
  max-width: 4.25rem !important;
  min-height: 4.25rem !important;
  max-height: 4.25rem !important;
}

.badge-preview-popover .profile-badge-tile__icon-wrap .profile-badge-tile__img,
.badge-preview-popover .profile-badge-tile__icon-wrap .badge-preview-popover__img {
  width: 3.35rem !important;
  height: 3.35rem !important;
  max-width: 3.35rem !important;
  max-height: 3.35rem !important;
}

.badge-preview-popover .profile-badge-tile__icon-wrap .badge-preview-popover__mi {
  font-size: 2.35rem;
}

.badge-preview-popover .profile-badge-tile__title {
  font-size: 1.05rem;
}

.badge-preview-popover .profile-badge-tile__refrain {
  font-size: 0.82rem;
}

.profile-badge-tile__icon-wrap.badge-hover-preview:focus {
  outline: 2px solid var(--badge-accent);
  outline-offset: 2px;
}

/* Franja de insignias destacadas (perfil público, debajo de Ver QR) */
.profile-featured-badges {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.profile-featured-badges__title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 0 1.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

.profile-featured-badges__title-icon {
  font-size: 1.05rem !important;
  color: #ffc107;
  opacity: 0.9;
}

.profile-featured-badges__grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.15rem 0.1rem 0.45rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.profile-featured-badges__grid::-webkit-scrollbar {
  height: 5px;
}

.profile-featured-badges__grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.profile-featured-badges__grid > li {
  display: flex;
  flex: 0 0 6.5rem;
  width: 6.5rem;
  min-width: 6.5rem;
  min-height: 0;
}

@media (min-width: 992px) {
  .profile-featured-badges__grid {
    justify-content: center;
    overflow-x: visible;
  }

  .profile-featured-badges__grid > li {
    flex: 1 1 0;
    width: auto;
    min-width: 5.75rem;
    max-width: 7.25rem;
  }
}

.profile-featured-badges__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  flex: 1 1 auto;
  min-height: 100%;
  padding: 0.65rem 0.45rem 0.75rem;
  border-radius: 12px;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  cursor: pointer;
  outline: none;
  overflow: visible;
  position: relative;
}

.profile-featured-badges__item:hover,
.profile-featured-badges__item:focus {
  transform: translateY(-8px) scale(1.03);
  border-color: color-mix(in srgb, var(--badge-accent) 55%, transparent);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.32),
    0 0 28px var(--badge-accent-soft);
  z-index: 5;
}

.profile-featured-badges__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  width: 100%;
  flex: 1 1 auto;
  text-align: center;
}

/* Slot: altura fija para alinear iconos en todas las filas */
.profile-featured-badges__icon-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 0 0 4.1rem;
  height: 4.1rem;
  margin-bottom: 0.35rem;
  overflow: visible;
}

.profile-featured-badges__icon-wrap.profile-badge-tile__icon-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  max-width: 2.25rem;
  min-height: 2.25rem;
  max-height: 2.25rem;
  border-radius: 10px;
  overflow: visible;
  box-sizing: border-box;
  transition: box-shadow 0.22s ease;
}

.profile-featured-badges__icon-wrap .profile-featured-badges__img,
.profile-featured-badges__icon-wrap .profile-badge-tile__img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: block;
  width: 4rem !important;
  height: 4rem !important;
  min-width: 0 !important;
  max-width: 4rem !important;
  max-height: 4rem !important;
  object-fit: contain !important;
  object-position: center center;
  border-radius: 6px;
  background: transparent;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), filter 0.28s ease;
}

.profile-featured-badges__icon-wrap .profile-featured-badges__mi {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-size: 2.85rem;
  line-height: 1;
  color: var(--badge-accent);
  filter: drop-shadow(0 0 8px var(--badge-accent-soft));
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), filter 0.28s ease;
}

.profile-featured-badges__item:hover .profile-featured-badges__img,
.profile-featured-badges__item:focus .profile-featured-badges__img,
.profile-featured-badges__item:hover .profile-badge-tile__img,
.profile-featured-badges__item:focus .profile-badge-tile__img,
.profile-featured-badges__item:hover .profile-featured-badges__mi,
.profile-featured-badges__item:focus .profile-featured-badges__mi {
  transform: translate(-50%, -58%) scale(1.5);
  filter:
    drop-shadow(0 14px 32px var(--badge-accent-soft))
    drop-shadow(0 0 20px color-mix(in srgb, var(--badge-accent) 70%, transparent))
    brightness(1.12)
    saturate(1.1);
}

.profile-featured-badges__item:hover .profile-featured-badges__icon-wrap,
.profile-featured-badges__item:focus .profile-featured-badges__icon-wrap {
  transform: scale(1.08);
  box-shadow: 0 0 28px var(--badge-accent-soft);
}

@media (min-width: 768px) {
  .profile-featured-badges__icon-slot {
    flex-basis: 4.35rem;
    height: 4.35rem;
  }

  .profile-featured-badges__icon-wrap.profile-badge-tile__icon-wrap {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    max-width: 2.5rem;
    min-height: 2.5rem;
    max-height: 2.5rem;
  }

  .profile-featured-badges__icon-wrap .profile-featured-badges__img,
  .profile-featured-badges__icon-wrap .profile-badge-tile__img {
    width: 4.35rem !important;
    height: 4.35rem !important;
    max-width: 4.35rem !important;
    max-height: 4.35rem !important;
  }
}

.profile-featured-badges__rarity {
  font-size: 0.55rem;
  padding: 0.15rem 0.4rem;
  flex-shrink: 0;
}

.profile-featured-badges__name {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  width: 100%;
  min-height: 2.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.profile-featured-badges__refrain {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.35;
  font-style: italic;
  color: rgba(255, 255, 255, 0.62);
  width: 100%;
  min-height: 4.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.profile-featured-badges__refrain--empty {
  visibility: hidden;
  pointer-events: none;
}

.profile-featured-badges__item.badge-rarity--common,
.profile-panel--badges .profile-featured-badges__item.badge-rarity--common {
  --badge-accent: var(--badge-rarity-common-color);
  --badge-accent-soft: var(--badge-rarity-common-soft);
  border-color: color-mix(in srgb, var(--badge-accent) 50%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 14px var(--badge-accent-soft);
}

.profile-featured-badges__item.badge-rarity--uncommon,
.profile-panel--badges .profile-featured-badges__item.badge-rarity--uncommon {
  --badge-accent: var(--badge-rarity-uncommon-color);
  --badge-accent-soft: var(--badge-rarity-uncommon-soft);
  border-color: color-mix(in srgb, var(--badge-accent) 50%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 14px var(--badge-accent-soft);
}

.profile-featured-badges__item.badge-rarity--rare,
.profile-panel--badges .profile-featured-badges__item.badge-rarity--rare {
  --badge-accent: var(--badge-rarity-rare-color);
  --badge-accent-soft: var(--badge-rarity-rare-soft);
  border-color: color-mix(in srgb, var(--badge-accent) 50%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 14px var(--badge-accent-soft);
}

.profile-featured-badges__item.badge-rarity--epic,
.profile-panel--badges .profile-featured-badges__item.badge-rarity--epic {
  --badge-accent: var(--badge-rarity-epic-color);
  --badge-accent-soft: var(--badge-rarity-epic-soft);
  border-color: color-mix(in srgb, var(--badge-accent) 50%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 14px var(--badge-accent-soft);
}

.profile-featured-badges__item.badge-rarity--legendary,
.profile-panel--badges .profile-featured-badges__item.badge-rarity--legendary {
  --badge-accent: var(--badge-rarity-legendary-color);
  --badge-accent-soft: var(--badge-rarity-legendary-soft);
  border-color: color-mix(in srgb, var(--badge-accent) 50%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 14px var(--badge-accent-soft);
}

.profile-featured-badges__item.badge-rarity--unique,
.profile-panel--badges .profile-featured-badges__item.badge-rarity--unique {
  --badge-accent: var(--badge-rarity-unique-color);
  --badge-accent-soft: var(--badge-rarity-unique-soft);
  border-color: color-mix(in srgb, var(--badge-accent) 50%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 14px var(--badge-accent-soft);
}

/* Popover en <body>: prioridad por #id */
#badge-preview-popover.badge-rarity--common,
#badge-preview-popover.badge-rarity--common .badge-preview-popover__inner {
  --badge-accent: var(--badge-rarity-common-color);
  --badge-accent-soft: var(--badge-rarity-common-soft);
  --badge-card-tint: var(--badge-rarity-common-tint);
}

#badge-preview-popover.badge-rarity--uncommon,
#badge-preview-popover.badge-rarity--uncommon .badge-preview-popover__inner {
  --badge-accent: var(--badge-rarity-uncommon-color);
  --badge-accent-soft: var(--badge-rarity-uncommon-soft);
  --badge-card-tint: var(--badge-rarity-uncommon-tint);
}

#badge-preview-popover.badge-rarity--rare,
#badge-preview-popover.badge-rarity--rare .badge-preview-popover__inner {
  --badge-accent: var(--badge-rarity-rare-color);
  --badge-accent-soft: var(--badge-rarity-rare-soft);
  --badge-card-tint: var(--badge-rarity-rare-tint);
}

#badge-preview-popover.badge-rarity--epic,
#badge-preview-popover.badge-rarity--epic .badge-preview-popover__inner {
  --badge-accent: var(--badge-rarity-epic-color);
  --badge-accent-soft: var(--badge-rarity-epic-soft);
  --badge-card-tint: var(--badge-rarity-epic-tint);
}

#badge-preview-popover.badge-rarity--legendary,
#badge-preview-popover.badge-rarity--legendary .badge-preview-popover__inner {
  --badge-accent: var(--badge-rarity-legendary-color);
  --badge-accent-soft: var(--badge-rarity-legendary-soft);
  --badge-card-tint: var(--badge-rarity-legendary-tint);
}

#badge-preview-popover.badge-rarity--unique,
#badge-preview-popover.badge-rarity--unique .badge-preview-popover__inner {
  --badge-accent: var(--badge-rarity-unique-color);
  --badge-accent-soft: var(--badge-rarity-unique-soft);
  --badge-card-tint: var(--badge-rarity-unique-tint);
}
