.statistics-total,
.statistics-modalities,
.statistics-modality {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
}

.statistics-group-icon {
    width: 1.2em;
    height: 1.2em;
    flex-shrink: 0;
    color: #777;
}

.statistics-modalities {
    margin: 0;
    gap: clamp(1rem, 4vw, 2rem);
    font-size: 1rem;
}

.statistics-modality {
    white-space: nowrap;
}

.statistics-modality--mcr .statistics-group-icon {
    color: var(--mcr-green);
}

.statistics-modality--riichi .statistics-group-icon {
    color: var(--riichi-red);
}

.statistics-activity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 0 auto clamp(2rem, 5vw, 3rem);
}

.statistics-activity-card {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.statistics-activity-card h2,
.statistics-players-card h2,
.statistics-evolution h2,
.statistics-grades h2,
.statistics-communities-heading h2 {
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
    font-weight: 700;
}

.statistics-caption {
    margin: 0;
    color: #555;
    font-size: 0.85rem;
}

.statistics-activity-number {
    margin: 1rem 0;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.statistics-explanation {
    margin-top: 1rem;
}

.statistics-match-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.statistics-match-breakdown h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}

.statistics-match-breakdown p {
    margin: 0;
    font-size: 0.85rem;
    color: #555;
}

.statistics-rule--mcr {
    color: var(--mcr-green);
}

.statistics-rule--riichi {
    color: var(--riichi-red);
}

.statistics-participation {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 1.25rem 0 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e5e5;
}

.statistics-participation dt {
    font-size: 0.8rem;
    line-height: 1.4;
}

.statistics-participation dd {
    margin: 0.4rem 0 0;
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.statistics-participation > div {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.statistics-rule--ambas {
    color: #666;
}

.statistics-communities-heading {
    margin: 0 auto 1.5rem;
    text-align: center;
}

.statistics-table-wrapper {
    margin-bottom: 2rem;
}

.statistics-evolution {
    max-width: none;
}

.statistics-grades {
    max-width: none;
}

.statistics-grades-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.statistics-grades-grid h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.statistics-grade-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
}

.statistics-grade-row {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.85rem;
    font-size: 0.85rem;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.statistics-grade-name {
    font-weight: 700;
}

.statistics-grade-track {
    height: 0.65rem;
    background: #ededed;
    border-radius: 999px;
    overflow: hidden;
}

.statistics-grade-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--mcr-green);
}

.statistics-grade-fill--riichi {
    background: var(--riichi-red);
}

.statistics-grade-count {
    text-align: right;
    white-space: nowrap;
}

.statistics-grade-percent {
    color: #555;
    font-size: 0.75rem;
}

.statistics-chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.statistics-chart-controls label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: left;
    font-size: 0.85rem;
    min-width: 0;
}

.statistics-chart-controls select,
.statistics-chart-controls button {
    min-height: 44px;
    max-width: 100%;
    border: 1px solid #aaa;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    background: #fff;
    color: var(--page-text);
    font: inherit;
}

.statistics-chart-controls button {
    background: #f4f4f4;
    font-size: 0.85rem;
    font-weight: 700;
}

.statistics-chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.statistics-chart-scroll {
    overflow-x: auto;
    padding: 2rem 0 0.5rem;
}

.statistics-chart-scroll-hint {
    margin-top: 1rem;
    text-align: right;
}

.statistics-chart {
    display: grid;
    grid-template-columns: repeat(var(--months), minmax(78px, 1fr));
    min-width: calc(var(--months) * 78px);
}

.statistics-chart-bars {
    display: flex;
    justify-content: center;
    gap: 6px;
    height: 200px;
    border-bottom: 1px solid #aaa;
}

.statistics-chart-series {
    display: flex;
    align-items: flex-end;
    width: 24px;
    height: 100%;
}

.statistics-chart-bar {
    position: relative;
    width: 100%;
    border-radius: 3px 3px 0 0;
    background: var(--mcr-green);
}

.statistics-chart-series--riichi .statistics-chart-bar {
    background: var(--riichi-red);
}

.statistics-chart-value {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: 3px;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.statistics-chart-month-label {
    display: block;
    padding-top: 0.6rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.statistics-table {
    font-size: 1rem;
}

.statistics-community {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 14rem;
}

.statistics-community .autonomy-flag {
    flex-shrink: 0;
}

.statistics-clubs {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.statistics-club {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 76px;
    flex-shrink: 0;
    color: inherit;
    text-align: center;
    text-decoration: none;
    font-size: 0.65rem;
    line-height: 1.25;
}

.statistics-club img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.statistics-club:hover {
    color: inherit;
    text-decoration: underline;
}

.statistics-table .statistics-count {
    width: 1%;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
    .statistics-grades-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .statistics-activity {
        grid-template-columns: minmax(0, 1fr);
    }

    .statistics-page .ranking-heading h1 {
        font-size: clamp(1.4rem, 6vw, 2.25rem);
    }

    .statistics-table-wrapper {
        overflow: visible;
        border: 0;
        box-shadow: none;
    }

    .statistics-table,
    .statistics-table tbody {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .statistics-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        grid-template-areas:
            "community community total"
            "mcr riichi riichi"
            "clubs clubs clubs";
        gap: 0.9rem 0.75rem;
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid #d9d9d9;
        border-radius: 4px;
        background: #fff;
        box-shadow: 0 5px 20px rgb(0 0 0 / 8%);
    }

    .statistics-table > tbody > tr > *,
    .statistics-table tbody tr:nth-child(even) > * {
        min-width: 0;
        width: auto;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .statistics-community-cell {
        grid-area: community;
    }

    .statistics-community {
        min-width: 0;
        gap: 0.6rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .statistics-count--total {
        grid-area: total;
        align-self: center;
        font-weight: 700;
    }

    .statistics-count--mcr {
        grid-area: mcr;
    }

    .statistics-count--riichi {
        grid-area: riichi;
    }

    .statistics-table .statistics-modality {
        justify-content: flex-start;
    }

    .statistics-clubs-cell {
        grid-area: clubs;
    }

    .statistics-clubs-cell--empty {
        display: none;
    }

    .statistics-clubs {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .statistics-table .ranking-message {
        grid-column: 1 / -1;
    }
}
