:root {
  --header-footer-height: 54px;
  --header-bg: #181a1e; /* стало темнее! */
  --header-shadow: 0 4px 14px 0 #0006;
  --header-border: #222328;
  --graphite: #23262b;
  --avatar-w: 210px;
  --avatar-h: 280px;
  --avatar-gap: 8px;
  --nick-bg: rgba(30, 32, 36, 0.65);
  --nick-bg-hover: rgba(30, 32, 36, 0.95);
  --nick-color: #b3b3b3;
}

@media (max-width: 500px) {
  :root {
    --avatar-w: 180px;
    --avatar-h: 240px;
  }
  .filter-input {
    width: 140px;
    font-size: 0.98rem;
  }
}
@media (min-width: 900px) {
  .avatar-grid {
    max-width: 80vw;
  }
}

header {
  height: var(--header-footer-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1.5px solid var(--header-border);
  box-shadow: var(--header-shadow);
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 22px;
  font-weight: bold;
  flex-wrap: wrap; /* важно! позволяет переносить строки на мобиле */
}
.header-left {
  display: flex;
  align-items: center;
  white-space: nowrap;
  min-width: 0;
}
.legends-label {
  color: #FFD600;
  font-size: 0.7em;
  font-weight: 700;
  margin-left: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  vertical-align: middle;
}
.filter-bar {
  min-width: 140px;
  text-align: center;
  display: flex;
  justify-content: center;
}
.filter-input {
  background: #23262b;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: #ececec;
  font-size: 1rem;
  outline: none;
  width: 420px;
  max-width: 80%;
}

body {
  margin: 0;
  background: #1c1e22;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #ececec;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
footer {
  height: var(--header-footer-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}
.legends-label {
  color: #FFD600;
  font-size: 0.6em;
  font-weight: 700;
  margin-left: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  vertical-align: middle;
  /* можно добавить glow/тень если нужно: */
  /* text-shadow: 0 0 8px #FFD60099; */
}
footer {
  background: var(--graphite);
  margin-top: auto;
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 14px;
  font-weight: normal;
  color: #888;
}
main {
  padding: 24px 0 32px 0;
  background: #23262b;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--avatar-w), 1fr));
  gap: var(--avatar-gap);
  max-width: 98vw;
  width: 100%;
  justify-items: center;
  align-items: stretch;
  min-height: 200px;
}
.avatar-card {
  position: relative;
  width: var(--avatar-w);
  height: var(--avatar-h);
  background: #18191b;
  overflow: hidden;
  box-shadow: 0 1px 7px 0 #000a;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.25s, filter 0.25s;
  opacity: 1;
  filter: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  will-change: transform, opacity;
  animation: card-in 0.22s cubic-bezier(.4,1.3,.6,1) backwards;
}
@keyframes card-in {
  0% { opacity: 0; transform: scale(0.85) translateY(20px);}
  100% { opacity: 1; transform: scale(1) translateY(0);}
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-nick {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 32px;
  background: var(--nick-bg);
  color: var(--nick-color);
  font-size: 1.12rem;
  line-height: 32px;
  text-align: center;
  transition: background 0.25s, height 0.25s;
  z-index: 2;
  overflow: hidden;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.avatar-card:hover .avatar-nick,
.avatar-nick.active {
  height: 100%;
  background: var(--nick-bg-hover);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.avatar-desc {
  opacity: 0;
  max-height: 0;
  font-size: 1rem;
  margin: 0 10px;
  padding-top: 13px;
  padding-bottom: 25px;
  color: #b0b7c3;
  line-height: 1.3;
  word-break: break-word;
  transition: opacity 0.25s, max-height 0.25s;
  pointer-events: none;
  overflow-y: auto;
  scrollbar-width: none;             /* Firefox */
}
.avatar-card:hover .avatar-desc,
.avatar-nick.active .avatar-desc {
  opacity: 1;
  max-height: 160px;
  pointer-events: auto;
}
/* Chrome, Safari */
.avatar-desc::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

@media (max-width: 600px) {
  header {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    font-size: 18px;
    padding: 1vw 4vw;
    height: auto;
  }
  .header-left {
    justify-content: flex-start;
    font-size: 18px;
    margin-bottom: 4px;
  }
  .filter-bar {
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 0;
  }
  .filter-input {
    width: 100%;
    max-width: 100%;
    font-size: 1rem;
  }
}

.rating-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 5px;
  background: #26282c;
  z-index: 4;
  overflow: hidden;
  pointer-events: auto;      /* Чтобы бар ловил ховер */
  opacity: 0;
  transition: opacity 0.22s, height 0.22s;
}

.avatar-card:hover .rating-bar,
.avatar-nick.active ~ .rating-bar {
  opacity: 1;
  /* height убираем здесь! */
}

.rating-bar:hover {
  height: 25px;
}


.rating-fill {
  height: 100%;
  background: #b0b7c3;
  transition: width 0.3s, background 0.3s;
  position: relative;
  z-index: 1;
}

.rating-percent {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  line-height: normal;
  opacity: 0; /* Скрыто всегда */
  transition: opacity 0.22s, font-size 0.22s;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Показываем только при ховере на сам бар */
.rating-bar:hover .rating-percent {
  opacity: 0.7;
  font-size: 1em;
}

