/* =========================
   RANKING
   VISUAL COMPACTO
========================= */

body.page-ranking {
    visibility: hidden;
    background: #09090b;
    margin: 0;
    padding: 0;
}

body.page-ranking.ready {
    visibility: visible;
}

.ranking-page {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 15px 100px;
    box-sizing: border-box;
}

/* =========================
   CABEÇALHO
========================= */

.ranking-header {
    text-align: center;
    margin: 8px 0 12px;
}

.ranking-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.ranking-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: #71717a;
}

/* =========================
   ABAS
========================= */

.ranking-tabs {
    display: flex;
    gap: 6px;
    margin: 10px 0;
}

.ranking-tab {
    flex: 1;
    min-height: 38px;
    padding: 7px 10px;

    border: 1px solid #27272a;
    border-radius: 10px;

    background: #111113;
    color: #f4f4f5;

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;
}

.ranking-tab.active {
    border-color: #3f3f46;
    background: #18181b;
}

/* =========================
   STATUS
========================= */

#status {
    min-height: 16px;
    margin: 8px 0;

    text-align: center;

    color: #71717a;
    font-size: 10px;
}

#status.error {
    color: #f87171;
}

/* =========================
   TOP 3
========================= */

#top-three {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 6px;

    width: 100%;
}

/* =========================
   CARD DO JOGADOR
========================= */

.top-player {
    position: relative;

    display: flex;
    flex-direction: column;

    width: 100%;
    min-width: 0;

    padding: 0;

    border: 1px solid #27272a;
    border-radius: 10px;

    background: #111113;
    color: #f4f4f5;

    overflow: hidden;

    text-align: center;
    cursor: pointer;

    transition:
        transform .15s ease,
        border-color .15s ease;
}

.top-player:active {
    transform: scale(.98);
}

.top-player:hover {
    border-color: #3f3f46;
}

/* =========================
   COLOCAÇÃO
========================= */

.rank-position {
    position: absolute;

    top: 5px;
    left: 5px;

    z-index: 5;
}

.rank-medal {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 25px;
    height: 22px;

    padding: 0 4px;

    border-radius: 6px;

    background: rgba(9, 9, 11, .85);

    font-size: 12px;
    font-weight: 800;
}

/* =========================
   DESTAQUE DAS POSIÇÕES
========================= */

.rank-first {
    border-color:
        rgba(250, 204, 21, .35);
}

.rank-second {
    border-color:
        rgba(161, 161, 170, .35);
}

.rank-third {
    border-color:
        rgba(180, 83, 9, .35);
}

/* =========================
   PERSONAGEM
========================= */

.top-character {
    position: relative;

    width: 100%;
    height: 145px;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    overflow: hidden;

    background: #09090b;
}

.top-character img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;
}

.top-character img.render-loading {
    opacity: .85;
}

.character-error-icon {
    display: none;

    position: absolute;
    inset: 0;

    align-items: center;
    justify-content: center;

    font-size: 28px;
    opacity: .35;
}

.top-character.character-error
.character-error-icon {
    display: flex;
}

/* =========================
   INFORMAÇÕES
========================= */

.top-player-info {
    padding: 7px 5px 8px;
}

.rank-username {
    width: 100%;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 12px;
    font-weight: 800;
}

.rank-level {
    margin-top: 2px;

    font-size: 9px;
    color: #a1a1aa;
}

.rank-clan {
    margin-top: 3px;

    width: 100%;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 9px;
    font-weight: 700;

    color: #a1a1aa;
}

.rank-no-clan {
    opacity: .5;
}

/* =========================
   ATRIBUTOS
========================= */

.top-stats {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 2px;

    margin-top: 6px;
}

.top-stats div {
    min-width: 0;

    padding: 3px 1px;

    border-radius: 5px;

    background: #09090b;
}

.top-stats span {
    display: block;

    font-size: 7px;

    color: #71717a;

    text-transform: uppercase;
}

.top-stats strong {
    display: block;

    margin-top: 1px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 8px;
}

/* =========================
   PODER
========================= */

.total-power {
    margin-top: 5px;

    padding: 5px 3px;

    border-radius: 6px;

    background: #18181b;
}

.total-power small {
    display: block;

    font-size: 7px;

    color: #71717a;
}

.total-power strong {
    display: block;

    margin-top: 1px;

    font-size: 12px;
    font-weight: 800;
}

/* =========================
   LISTA
========================= */

#rank-list {
    display: flex;
    flex-direction: column;

    gap: 5px;

    margin-top: 8px;
}

.rank-row {
    display: grid;

    grid-template-columns:
        32px 34px minmax(0, 1fr) auto 12px;

    align-items: center;

    gap: 7px;

    width: 100%;

    min-height: 46px;

    padding: 5px 8px;

    box-sizing: border-box;

    border: 1px solid #27272a;
    border-radius: 10px;

    background: #111113;
    color: #f4f4f5;

    text-align: left;

    cursor: pointer;
}

.rank-row:active {
    transform: scale(.99);
}

.rank-row-position {
    text-align: center;

    color: #71717a;

    font-size: 10px;
    font-weight: 800;
}

.rank-row-avatar {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 7px;

    background: #09090b;

    font-size: 16px;
}

.rank-row-avatar img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;
}

.rank-row-player {
    min-width: 0;
}

.rank-row-player strong {
    display: block;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 12px;
}

.rank-row-player span {
    display: block;

    margin-top: 2px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #71717a;

    font-size: 9px;
}

.rank-row-stats {
    text-align: right;
}

.rank-row-stats span {
    display: block;

    color: #71717a;

    font-size: 7px;

    text-transform: uppercase;
}

.rank-row-stats strong {
    display: block;

    margin-top: 1px;

    font-size: 10px;
}

.rank-row-arrow {
    color: #3f3f46;

    font-size: 18px;
}

/* =========================
   VAZIO
========================= */

.ranking-empty,
.ranking-no-more {
    padding: 18px 10px;

    border: 1px solid #27272a;
    border-radius: 10px;

    background: #111113;

    text-align: center;

    color: #71717a;

    font-size: 11px;
}

/* =========================
   CELULAR
========================= */

@media (max-width: 600px) {

    .ranking-page {
        padding:
            8px 10px 100px;
    }

    .ranking-header {
        margin:
            5px 0 8px;
    }

    .ranking-header h1 {
        font-size: 19px;
    }

    .ranking-header p {
        font-size: 10px;
    }

    .ranking-tabs {
        margin: 7px 0;
    }

    .ranking-tab {
        min-height: 34px;

        padding:
            5px 7px;

        font-size: 10px;
    }

    #status {
        margin: 5px 0;
        font-size: 9px;
    }

    #top-three {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 4px;
    }

    .top-character {
        height: 125px;
    }

    .top-player-info {
        padding:
            6px 3px 7px;
    }

    .rank-username {
        font-size: 10px;
    }

    .rank-level {
        font-size: 8px;
    }

    .rank-clan {
        font-size: 8px;
    }

    .top-stats {
        gap: 1px;
        margin-top: 4px;
    }

    .top-stats div {
        padding: 3px 0;
    }

    .top-stats span {
        font-size: 6px;
    }

    .top-stats strong {
        font-size: 7px;
    }

    .total-power {
        margin-top: 4px;
        padding: 4px 2px;
    }

    .total-power small {
        font-size: 6px;
    }

    .total-power strong {
        font-size: 10px;
    }

    .rank-medal {
        min-width: 21px;
        height: 19px;

        font-size: 10px;
    }

    .rank-position {
        top: 3px;
        left: 3px;
    }

    .rank-row {
        grid-template-columns:
            28px 32px minmax(0, 1fr) auto 10px;

        gap: 5px;

        min-height: 43px;

        padding:
            4px 6px;
    }

    .rank-row-avatar {
        width: 32px;
        height: 32px;
    }

    .rank-row-player strong {
        font-size: 11px;
    }

    .rank-row-player span {
        font-size: 8px;
    }

    .rank-row-stats strong {
        font-size: 9px;
    }

}

/* =========================
   TELAS MUITO PEQUENAS
========================= */

@media (max-width: 360px) {

    .ranking-page {
        padding-left: 7px;
        padding-right: 7px;
    }

    #top-three {
        gap: 3px;
    }

    .top-character {
        height: 112px;
    }

    .rank-username {
        font-size: 9px;
    }

    .rank-level,
    .rank-clan {
        font-size: 7px;
    }

    .top-stats span {
        font-size: 5px;
    }

    .top-stats strong {
        font-size: 6px;
    }

    .total-power strong {
        font-size: 9px;
    }

}

/* =========================
   CORES DOS ATRIBUTOS
========================= */

.top-stats div:nth-child(1) span,
.top-stats div:nth-child(1) strong {
    color: #f87171;
}

.top-stats div:nth-child(2) span,
.top-stats div:nth-child(2) strong {
    color: #60a5fa;
}

.top-stats div:nth-child(3) span,
.top-stats div:nth-child(3) strong {
    color: #cbd5e1;
}

.top-stats .total-power small,
.top-stats .total-power strong {
    color: #facc15;
}

/* =========================
   CORES DOS ATRIBUTOS
========================= */

.top-stats .rank-stat:nth-child(1) span,
.top-stats .rank-stat:nth-child(1) strong {
    color: #ef4444 !important;
}

.top-stats .rank-stat:nth-child(2) span,
.top-stats .rank-stat:nth-child(2) strong {
    color: #60a5fa !important;
}

.top-stats .rank-stat:nth-child(3) span,
.top-stats .rank-stat:nth-child(3) strong {
    color: #cbd5e1 !important;
}

.top-stats .total-power span,
.top-stats .total-power strong {
    color: #facc15 !important;
}

/* =========================
   CORES DOS ATRIBUTOS
========================= */

.top-stats > div:nth-child(1) span,
.top-stats > div:nth-child(1) strong {
    color: #ef4444 !important;
}

.top-stats > div:nth-child(2) span,
.top-stats > div:nth-child(2) strong {
    color: #60a5fa !important;
}

.top-stats > div:nth-child(3) span,
.top-stats > div:nth-child(3) strong {
    color: #cbd5e1 !important;
}

.top-stats > .total-power small,
.top-stats > .total-power strong {
    color: #facc15 !important;
}

/* Ajustes de legibilidade e alinhamento dos atributos */
.top-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.top-stats .total-power {
    grid-column: 1 / -1;
    margin-top: 2px;
    background: linear-gradient(100deg, rgba(234,179,8,.14), rgba(24,24,27,.95));
    border: 1px solid rgba(234,179,8,.18);
}
.rank-row-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(42px, auto));
    gap: 2px 7px;
    align-items: center;
}
.rank-row-stats .total-power {
    grid-column: 1 / -1;
    margin-top: 1px;
    padding: 3px 5px;
    background: rgba(234,179,8,.10);
}
.rank-row-stats .total-power strong { color: #facc15; }
.rank-username, .rank-row-player strong { color: #fafafa; }
.rank-level { color: #a1a1aa; }
.rank-clan:not(.rank-no-clan) { color: #7dd3fc; }
.rank-first { border-color: rgba(250,204,21,.65); box-shadow: 0 0 14px rgba(250,204,21,.08); }
.rank-second { border-color: rgba(203,213,225,.55); }
.rank-third { border-color: rgba(251,146,60,.55); }

@media (max-width: 390px) {
    .top-character { height: 118px; }
    .rank-row { grid-template-columns: 25px 30px minmax(0,1fr) auto 8px; gap: 5px; padding: 5px; }
    .rank-row-avatar { width: 30px; height: 30px; }
    .rank-row-stats { grid-template-columns: repeat(2, minmax(34px, auto)); gap: 1px 4px; }
    .rank-row-stats strong { font-size: 8px; }
}
