/* Reserve the scrollbar gutter so filtering (which changes page height) doesn't
   shift the layout width when the viewport scrollbar appears/disappears.
   Unscoped is fine: this stylesheet only loads on the tier list page. */
html {
    scrollbar-gutter: stable;
}

.page-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 20px 0;
    width: 100%;
    color: #fff;
    display: block;
}

.tier-list-container {
    /* width:100% is load-bearing: the parent .main-container is a column flexbox
       and the auto side-margins would otherwise shrink-to-fit this box to its
       content, so its width would change as filters hide cards. */
    width: 100%;
    max-width: 1140px;
    margin: 0 auto 40px auto;
    padding: 0 12px;
    box-sizing: border-box;
}

/* Role filter bar */

.tier-role-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.tier-role-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background-color: #1c1c22;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.tier-role-filter:hover {
    background-color: #2a2a33;
}

.tier-role-filter.active {
    border-color: #a78bfa;
    background-color: #2a2a33;
}

.tier-role-filter-icon,
.tier-role-filter picture,
.tier-role-filter img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

/* Tier rows: one shared background, rows divided by a line only */

.tier-rows {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background-color: #17171c;
    overflow: hidden;
}

.tier-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #2a2a33;
}

.tier-row:last-child {
    border-bottom: none;
}

.tier-row.tier-row-empty {
    display: none;
}

/* URL-selected tier (e.g. /tier-list/s-tier/) */
.tier-row.tier-row-highlighted {
    background-color: #1f1f27;
    box-shadow: inset 0 0 0 1px #a78bfa66;
}

.tier-label {
    flex: 0 0 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 800;
    color: #18181b;
    text-decoration: none;
    transition: filter 0.2s;
}

.tier-label:hover {
    color: #18181b;
    filter: brightness(1.08);
}

/* Tier colors are duplicated in css/tier-list-admin.css — keep in sync. */
.tier-s { background-color: #ff8080; }
.tier-a { background-color: #ffc080; }
.tier-b { background-color: #ffdf80; }
.tier-c { background-color: #ffff80; }
.tier-d { background-color: #dfff80; }
.tier-e { background-color: #bfff80; }
.tier-f { background-color: #80ff80; }

.tier-heroes {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    padding: 12px;
    min-height: 118px;
    flex: 1;
}

/* Hero cards */

.tier-hero-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 76px;
    text-decoration: none;
    transition: transform 0.2s;
}

.tier-hero-card:hover {
    transform: translateY(-3px);
}

.tier-hero-card.tier-hero-hidden {
    display: none;
}

.tier-hero-img-wrapper {
    width: 76px;
    height: 76px;
    border-radius: 6px;
    overflow: hidden;
    background-color: #26262e;
}

.tier-hero-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Role icon(s) inline, left of the hero name */
.tier-hero-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    /* width constraint is load-bearing: as a centered flex item this box would
       otherwise shrink-wrap to its content and overflow the card, so the name
       text would never truncate. */
    width: 100%;
    margin-top: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    text-align: center;
    text-transform: none;
    word-break: break-word;
}

.tier-hero-role-icon {
    width: 12px;
    height: 12px;
    display: block;
    flex-shrink: 0;
}

/* Truncate names that don't fit on one line (full name in the card's title attr) */
.tier-hero-name-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tier-hero-name picture {
    display: flex;
}

@media (max-width: 600px) {
    .tier-label {
        flex-basis: 44px;
        font-size: 1.4rem;
    }

    .tier-heroes {
        padding: 8px;
        gap: 6px;
        min-height: 0;
    }

    .tier-hero-card,
    .tier-hero-img-wrapper {
        width: 60px;
    }

    .tier-hero-img-wrapper {
        height: 60px;
    }
}
