.ranking-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

.ranking-header {
    min-height: 104px;
    display: grid;
    grid-template-columns: 45.5% 54.5%;
    flex: 0 0 auto;
}

.ranking-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: #fff;
}

.ranking-brand img {
    width: auto;
    max-width: 94%;
    height: auto;
    max-height: 98px;
    object-fit: contain;
}

.ranking-brand:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: -3px;
}

.ranking-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--page-text);
    background: var(--footer-yellow);
}

.ranking-heading h1 {
    margin: 0;
    font-size: clamp(2.2rem, 11vw, 3.3rem);
    font-weight: 300;
    line-height: 1;
    text-align: center;
}

.ranking-title-long {
    display: none;
}

.ranking-title-short {
    display: inline;
}

.ranking-main {
    width: min(92%, 1100px);
    margin: 0 auto;
    padding: clamp(28px, 6vw, 64px) 0 72px;
    flex: 1 0 auto;
}






[data-ranking-panel][hidden] {
    display: none;
}

.ranking-table-wrapper {
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    box-shadow: 0 5px 20px rgb(0 0 0 / 8%);
}

.ranking-table {
    min-width: 300px;
    font-size: clamp(0.95rem, 3.9vw, 1.1rem);
}

.ranking-table > :not(caption) > * > * {
    padding: 0.8em 0.9em;
}

.ranking-table thead th {
    color: #fff;
    background: var(--modality-accent);
    border-bottom: 0;
    font-weight: 700;
    white-space: nowrap;
}

.ranking-info-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: 1.05em;
    line-height: 1;
    text-decoration: none;
    vertical-align: -0.05em;
}

.ranking-info-link:hover {
    color: inherit;
    opacity: 0.78;
}

.ranking-info-link:focus-visible {
    border-radius: 2px;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.ranking-table tbody tr:nth-child(even) > * {
    background: #fff8dd;
}

.ranking-table tbody tr:last-child > * {
    border-bottom: 0;
}

.player-name {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
}

.online-alias { font-size: .8em; overflow-wrap: anywhere; min-width: 0; }
.online-alias--riichi { color: var(--riichi-red); }
.online-alias--mcr { color: var(--mcr-green); }

@media (max-width: 575.98px) {
    .ranking-online-alias { display: none; }
}

.community-name {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
}

.community-rating-column {
    width: 9.5rem;
}

.community-players-column {
    width: 8rem;
}

.community-player-count {
    font-variant-numeric: tabular-nums;
}

.ranking-player-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.ranking-player-link:hover {
    color: var(--modality-accent);
    text-decoration: none;
}

.ranking-player-link:focus-visible {
    border-radius: 2px;
    outline: 3px solid #0d6efd;
    outline-offset: 3px;
}

.medal-slot,
.ranking-medal {
    width: 1em;
    height: 1em;
}

.medal-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1em;
}

.ranking-medal {
    display: block;
    object-fit: contain;
}

.ranking-position {
    width: 2em;
    display: inline-block;
    flex: 0 0 2em;
    color: #555;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.autonomy-flag {
    width: 1.5em;
    height: 1em;
    display: inline-block;
    flex: 0 0 auto;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 18%);
    cursor: help;
}

.autonomy-flag.community-flag {
    width: 2.25em;
    height: 1.5em;
    cursor: default;
}

.rating-column {
    width: 9em;
}

.ranking-ema-column {
    display: none;
}

.ranking-ema {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
}

.ranking-ema .autonomy-flag {
    cursor: default;
}

.ranking-ema a {
    color: #0052a4;
    text-underline-offset: 0.15em;
}

.ranking-ema a:hover {
    color: #00366d;
}

.ranking-ema a:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: 3px;
}

@media (min-width: 768px) {
    col.ranking-ema-column {
        display: table-column;
        width: 10em;
    }

    th.ranking-ema-column,
    td.ranking-ema-column {
        display: table-cell;
    }
}

.rating-value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rating-provisional {
    display: inline-block;
    margin-left: .4rem;
    padding: .15em .45em;
    border-radius: .3rem;
    background: #edf0f3;
    color: #49515a;
    font-size: .7rem;
    font-weight: 500;
    vertical-align: middle;
}

.rating-trigger {
    white-space: nowrap;
    margin: -0.25em;
    padding: 0.25em;
    border: 0;
    border-radius: 3px;
    color: inherit;
    background: transparent;
    font: inherit;
    font-variant-numeric: tabular-nums;
    line-height: inherit;
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    cursor: help;
}

.rating-trigger:hover,
.rating-trigger:focus-visible {
    color: var(--modality-accent);
    background: #fff1b9;
}

.ranking-grade--dan {
    font-weight: 700;
}

.ranking-grade--bronce {
    color: #99602e;
}

.ranking-grade--plata {
    color: #707780;
}

.ranking-grade--oro {
    color: #947000;
}

.rating-trigger:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

.rating-detail-tooltip {
    --bs-tooltip-max-width: 310px;
    --bs-tooltip-bg: #242424;
    --bs-tooltip-opacity: 0.97;
}

.rating-detail-tooltip .tooltip-inner {
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    line-height: 1.55;
    text-align: left;
    white-space: pre-line;
}

.ranking-message {
    padding: 2rem 1rem !important;
    color: #555;
    text-align: center;
}

.ranking-updated {
    margin: 1.25rem 0 0;
    color: #555;
    font-size: 0.95rem;
    text-align: center;
}

.ranking-average-note {
    margin: 0 0 12px;
    color: #5f6368;
    font-size: .9rem;
}

.ranking-updated > * + * {
    margin-left: 0.25em;
}

.ranking-matches-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.ranking-matches-link:hover {
    color: var(--modality-accent);
    text-decoration: none;
}

.ranking-matches-link:focus-visible {
    border-radius: 2px;
    outline: 3px solid #0d6efd;
    outline-offset: 3px;
}

/* Tablet: 576 px - 991 px */
@media (min-width: 576px) {
    .ranking-header {
        min-height: 126px;
        grid-template-columns: 26% 74%;
    }

    .ranking-brand {
        padding: 7px 16px;
    }

    .ranking-brand img {
        max-height: 112px;
    }

    .ranking-heading {
        padding: 16px 24px;
    }

    .ranking-heading h1 {
        font-size: clamp(1.25rem, 3.5vw, 3.25rem);
        white-space: nowrap;
    }

    .ranking-title-long {
        display: inline;
    }

    .ranking-title-short {
        display: none;
    }

    .ranking-main {
        width: min(86%, 1100px);
        padding-top: 54px;
    }

    .ranking-table {
        font-size: 1.05rem;
    }
}

/* Desktop: 992 px and above */
@media (min-width: 992px) {
    .ranking-header {
        min-height: 150px;
        grid-template-columns: 18% 82%;
    }

    .ranking-brand {
        padding: 5px 28px;
    }

    .ranking-brand img {
        max-height: 140px;
    }

    .ranking-heading {
        padding: 20px 36px;
    }

    .ranking-heading h1 {
        font-size: clamp(2.35rem, 3.5vw, 4.25rem);
    }

    .ranking-main {
        padding-top: 64px;
    }

    .ranking-table {
        font-size: 1.15rem;
    }
}

.club-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    object-fit: contain;
}

/* Keep all ranking columns visible on phones, with metadata stacked beside names. */
@media (max-width: 575.98px) {
    .ranking-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        font-size: .875rem;
    }
    .ranking-table > :not(caption) > * > * { padding: 10px 6px; }
    .ranking-table thead th { white-space: normal; vertical-align: middle; font-size: .8125rem; }
    .rating-column { width: 76px; }
    .community-rating-column { width: 64px; }
    .community-players-column { width: 76px; }
    .player-name, .community-name {
        display: grid;
        grid-template-columns: 24px minmax(0, 1fr);
        column-gap: 6px;
        row-gap: 2px;
        align-items: center;
    }
    .player-name > .ranking-position, .community-name > .ranking-position {
        grid-column: 1;
        grid-row: 1;
        width: auto;
        text-align: center;
        font-size: .8rem;
    }
    .player-name > .medal-slot, .community-name > .medal-slot {
        grid-column: 1;
        grid-row: 2;
        justify-self: center;
    }
    .medal-slot:not(:has(img)) { display: none; }
    .player-name > .autonomy-flag, .community-name > .autonomy-flag,
    .community-name > .club-logo {
        grid-column: 1;
        grid-row: 3;
        width: 22px;
        height: 15px;
        justify-self: center;
    }
    .community-name > .club-logo { height: 22px; }
    .player-name > .ranking-player-link,
    .community-name > .ranking-player-link,
    .community-name > span:last-child {
        grid-column: 2;
        grid-row: 1 / 4;
        min-width: 0;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }
    .ranking-player-link { display: flex; align-items: center; min-height: 44px; }
    .players-ranking-table .ranking-grade { display: block; font-size: .8rem; line-height: 1.2; }
    .ranking-grade-separator { display: none; }
    .players-ranking-table .rating-trigger { min-height: 44px; min-width: 44px; margin: 0; padding: 4px; font-weight: 700; }
}

@media (max-width: 767.98px) {
    .players-ranking-table .rating-provisional { display: block; width: fit-content; margin: .15rem 0 0 auto; }
}

.ranking-provisional-filter { margin-bottom: 1rem; }
.ranking-provisional-filter button { min-height: 44px; }
.ranking-provisional-filter .ranking-average-note { margin: .5rem 0 0; }
.players-ranking-table tr[hidden], .ranking-provisional-filter[hidden] { display: none !important; }
