.heroes-filters {
  padding-top: 32px;
  padding-bottom: 8px;
}

.filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.heroes-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(212, 176, 64, .12);
}

.heroes-filters-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.heroes-filters-title::after {
  content: '';
  flex: 1;
  min-width: 40px;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 176, 64, .25), transparent);
}

.heroes-filters-count {
  font-size: 12px;
  color: var(--text-muted);
}
.heroes-filters-count strong {
  color: var(--gold-bright);
  font-size: 15px;
  font-weight: 800;
}

.heroes-filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.heroes-filter-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.heroes-filter-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 176, 64, .25), transparent);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 6px 14px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(212, 176, 64, .15);
  border-radius: 999px;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
  line-height: 1.4;
}
.filter-chip:hover {
  color: var(--text);
  border-color: var(--border-hover);
}
.filter-chip:focus-visible {
  outline: 2px solid var(--border-gold);
  outline-offset: 2px;
}
.filter-chip.is-active {
  background: rgba(212, 176, 64, .18);
  border-color: var(--border-gold);
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 176, 64, .15);
}

.heroes-filters-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 176, 64, .12);
}

.heroes-reset {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  color: var(--gold-light);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.heroes-reset:hover {
  background: rgba(212, 176, 64, .08);
}
.heroes-reset:focus-visible {
  outline: 2px solid var(--border-gold);
  outline-offset: 2px;
}

/* ---------- Сетка ---------- */
.heroes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

/* ---------- Карточка ---------- */
.hero-card {
  position: relative;
  min-width: 0;
}

/* Скрытие для фильтра */
.hero-card.is-hidden {
  display: none !important;
}

.hero-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}
.hero-card-link:focus-visible {
  outline: 2px solid var(--border-gold);
  outline-offset: 3px;
}

.hero-card-media {
  position: relative;
  aspect-ratio: 80 / 118;
  border-radius: 8px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  
  /* Базовый цветной фон (если нет редкости) */
  background: radial-gradient(circle at 50% 60%, #3a3a20 0%, #1e1e10 80%);
  border: 1px solid rgba(0, 0, 0, .5);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .6);
}

.hero-card:hover .hero-card-media,
.hero-card-link:focus-visible .hero-card-media {
  transform: translateY(-3px);
}

/* Цветные фоны и свечение по редкости (как в тир-листе) */
.hero-card[data-rarity="common"] .hero-card-media {
  background: radial-gradient(circle at 50% 65%, #4a4a4a 0%, #1a1a1a 80%);
  box-shadow: inset 0 0 14px rgba(156, 163, 175, .25);
  border-color: #9ca3af;
}
.hero-card[data-rarity="uncommon"] .hero-card-media {
  background: radial-gradient(circle at 50% 65%, #1e4a2a 0%, #0e1a12 80%);
  box-shadow: inset 0 0 14px rgba(34, 197, 94, .3);
  border-color: #22c55e;
}
.hero-card[data-rarity="rare"] .hero-card-media {
  background: radial-gradient(circle at 50% 65%, #1a3a4a 0%, #0a1a24 80%);
  box-shadow: inset 0 0 14px rgba(80, 224, 249, .3);
  border-color: #50e0f9;
}
.hero-card[data-rarity="epic"] .hero-card-media {
  background: radial-gradient(circle at 50% 65%, #3a1a4a 0%, #1a0a24 80%);
  box-shadow: inset 0 0 14px rgba(249, 171, 255, .3);
  border-color: #f9abff;
}
.hero-card[data-rarity="legendary"] .hero-card-media {
  background: radial-gradient(circle at 50% 65%, #4a3a10 0%, #1a1408 80%);
  box-shadow: inset 0 0 14px rgba(212, 176, 64, .4);
  border-color: #d4b040;
}

/* 1. Портрет героя */
.hero-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  z-index: 1;
  transition: transform .3s ease;
  pointer-events: none;
}
.hero-card:hover .hero-card-img,
.hero-card-link:focus-visible .hero-card-img {
  transform: scale(1.06);
}

/* 2. Градиент под именем */
.hero-card-media::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 45%;
  background: linear-gradient(to top, rgba(0, 0, 0, .9), transparent);
  z-index: 2;
  pointer-events: none;
}

/* 3. Иконки фракций (слева) */
.hero-card-factions {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}
.hero-card-faction {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .9));
}

/* 3. Плашка класс + рейтинг (справа) */
.hero-card-role {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 10px;
  background: rgba(20, 18, 12, .85);
  border-left: 1px solid rgba(212, 176, 64, .3);
  border-bottom: 1px solid rgba(212, 176, 64, .3);
  border-radius: 0 0 0 16px; /* Скругление только снизу слева */
  pointer-events: none;
  min-width: 36px;
}
.hero-card-role-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .9));
}
.hero-card-rating {
  height: 14px;
  width: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .9));
}

/* 4. Имя снизу */
.hero-card-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4%;
  z-index: 3;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  padding: 4px 6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 1), 0 0 8px rgba(0, 0, 0, .8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Адаптив */
@media (max-width: 720px) {
  .hero-card-factions {
    top: 4px;
    left: 4px;
  }
  .hero-card-faction {
    width: 32px;
    height: 32px;
  }
  .hero-card-role {
    padding: 4px 5px 6px;
    border-radius: 0 0 0 12px;
  }
  .hero-card-role-icon {
    width: 16px;
    height: 16px;
  }
  .hero-card-rating {
    height: 12px;
  }
  .hero-card-name {
    font-size: 12px;
  }
}

/* ---------- Показать ещё / пусто ---------- */
.heroes-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.heroes-more-wrap[hidden] {
  display: none !important;
}

.heroes-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 15px;
  background: var(--bg-card);
  border: 1px dashed var(--border-gold);
  border-radius: 12px;
  margin-top: 24px;
}
.heroes-empty[hidden] {
  display: none !important;
}
.heroes-empty strong {
  display: block;
  color: var(--gold-light);
  font-size: 18px;
  margin-bottom: 6px;
}

/* ---------- Адаптив ---------- */

/* Планшет */
@media (max-width: 1000px) and (min-width: 721px) {
  .heroes-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* Мобильные */
@media (max-width: 720px) {
  .heroes-filters {
    padding-top: 20px;
  }
  .filter-panel {
    padding: 14px;
    gap: 12px;
    border-radius: 12px;
  }
  .heroes-filter-label,
  .heroes-filters-title {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .filter-chip {
    padding: 5px 11px;
    font-size: 11px;
  }
  .heroes-filters-actions {
    padding-top: 10px;
  }
  .heroes-reset {
    padding: 7px 14px;
    font-size: 11px;
  }
  .heroes-filters-count {
    font-size: 11px;
  }
  .heroes-filters-count strong {
    font-size: 14px;
  }

  .heroes-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
  .hero-card-media {
    border-radius: 6px;
  }
  .hero-card-name {
    font-size: 11px;
  }
  .hero-card-faction {
    width: 30px;
    height: 30px;
  }
  .hero-card-role-icon {
    width: 18px;
    height: 18px;
  }
  .hero-card-rating {
    height: 13px;
  }
}

/* Узкие экраны */
@media (max-width: 400px) {
  .heroes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .hero-card-name {
    font-size: 10px;
    padding: 3px 4px;
  }
}