.rank-page {
    width: min(1120px, calc(100% - 48px));
    max-width: none;
    margin: 0 auto;
    padding-top: 42px;
    padding-bottom: 88px;
}

.page-shell.rank-page {
    margin-right: auto;
    margin-left: auto;
    width: min(1120px, calc(100% - 48px)) !important;
}

.rank-page-heading,
.rank-results-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.rank-page-heading {
    margin-bottom: 23px;
}

.rank-page-heading h1 {
    font-size: clamp(25px, 3vw, 34px);
}

.rank-intro {
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
}

.rank-home-link {
    flex: 0 0 auto;
}

.rank-toolbar,
.rank-results {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.rank-toolbar {
    position: relative;
    z-index: 2;
    margin-bottom: 18px;
    padding: 20px 22px 17px;
}

.rank-search-form label,
.rank-filter-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.rank-search-control {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
}

.rank-search-control input {
    min-width: 130px;
    flex: 1 1 250px;
    min-height: 42px;
    padding: 9px 13px;
    font-size: 13px;
}

.rank-search-control .button {
    min-height: 42px;
    flex: 0 0 auto;
    padding: 9px 15px;
    font-size: 12px;
}

.rank-picker {
    width: min(270px, 31%);
    min-width: 205px;
    flex: 0 0 auto;
    position: relative;
}

.rank-picker-trigger {
    display: flex;
    width: 100%;
    min-height: 41px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg);
    color: var(--text);
    text-align: left;
    font-size: 12px;
}

.rank-picker-trigger:hover:not(:disabled),
.rank-picker-trigger[aria-expanded="true"] {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.rank-picker-trigger:disabled {
    cursor: not-allowed;
    opacity: .6;
}

.rank-picker-trigger [data-rank-picker-label] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-picker-chevron {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    color: var(--muted);
    font-size: 0;
    line-height: 0;
    transform: rotate(45deg);
    transform-origin: center;
    transition: transform .16s ease;
}

.rank-picker-trigger[aria-expanded="true"] .rank-picker-chevron {
    transform: rotate(225deg);
}

.rank-picker-menu {
    position: absolute;
    z-index: 35;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: min(310px, 55vh);
    overflow: auto;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--floating-shadow);
}

.rank-picker-menu button {
    display: flex;
    width: 100%;
    min-height: 39px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 12px;
}

.rank-picker-menu button:hover:not(:disabled),
.rank-picker-menu button[aria-selected="true"],
.rank-picker-menu button[aria-checked="true"] {
    background: var(--blue-soft);
    color: var(--blue);
}

.rank-picker-menu button:focus-visible,
.rank-picker-trigger:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.rank-picker-menu button:disabled {
    color: var(--muted);
    opacity: .55;
}

.rank-picker-menu .rank-season-group + .rank-season-group {
    border-top: 1px solid var(--line);
}

.rank-picker-menu .rank-season-trigger {
    min-height: 39px;
    border-radius: 7px;
    background: transparent;
    font-weight: 650;
}

.rank-season-chevron {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    color: var(--muted);
    font-size: 0;
    line-height: 0;
    transform: rotate(45deg);
    transform-origin: center;
    transition: transform .16s ease;
}

.rank-season-trigger[aria-expanded="true"] .rank-season-chevron {
    transform: rotate(225deg);
}

.rank-chapter-options {
    display: grid;
    gap: 2px;
    padding: 0 0 5px 8px;
}

.rank-picker-menu .rank-chapter-option {
    min-height: 35px;
    padding: 7px 10px;
}

.rank-picker-menu .rank-chapter-option[aria-checked="true"] {
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 650;
}

.rank-current-label {
    margin-left: 5px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 650;
}

.rank-option-check {
    color: var(--blue);
    font-size: 13px;
}

.rank-banned-label {
    display: inline-flex;
    align-items: center;
    margin-left: 7px;
    padding: 2px 5px;
    border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
    border-radius: 5px;
    background: color-mix(in srgb, var(--red) 10%, transparent);
    color: var(--red);
    font-size: 9px;
    font-weight: 650;
    line-height: 1.2;
    vertical-align: 1px;
}

.rank-form-message {
    margin-top: 12px;
    color: var(--red);
    font-size: 11px;
}

.rank-results {
    overflow: hidden;
    padding: 0 21px;
}

.rank-results-heading {
    min-height: 76px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.rank-results-heading h2 {
    font-size: 17px;
}

.rank-results-heading p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.rank-page-size {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
}

.rank-table-heading,
.rank-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 190px 76px 68px;
    align-items: center;
    column-gap: 16px;
}

.rank-table-heading {
    min-height: 37px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
}

.rank-table-heading span:first-child,
.rank-number {
    text-align: center;
}

.rank-table-heading span:nth-last-child(-n+2) {
    text-align: right;
}

.rank-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rank-row {
    min-height: 59px;
    border-bottom: 1px solid var(--line);
    transition: background .18s ease;
}

.rank-row:hover {
    background: color-mix(in srgb, var(--blue-soft) 45%, transparent);
}

.rank-number {
    color: var(--muted);
    font: 600 13px var(--mono);
    font-variant-numeric: tabular-nums;
}

.rank-number--gold { color: var(--gold); }
.rank-number--silver { color: #8995a7; }
.rank-number--bronze { color: #ad7051; }
html[data-theme="dark"] .rank-number--silver { color: #c0cad7; }
html[data-theme="dark"] .rank-number--bronze { color: #d19a73; }

.rank-player,
.rank-tier {
    display: flex;
    min-width: 0;
    align-items: center;
}

.rank-player { gap: 11px; }

.rank-card-image {
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    border-radius: 9px;
    background: var(--subtle);
    object-fit: cover;
}

.rank-player-name {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 550;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-tier {
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
}

.rank-tier img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.rank-tier span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-rr,
.rank-wins {
    color: var(--text);
    font: 600 14px var(--mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.rank-rr small {
    margin-left: 4px;
    color: var(--muted);
    font: 500 9px var(--body-font);
}

.rank-state {
    padding: 42px 16px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.rank-pagination {
    display: flex;
    min-height: 65px;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: var(--muted);
    font-size: 11px;
}

.rank-pagination .button {
    min-height: 32px;
    padding: 7px 12px;
}

@media (max-width: 780px) {
    .rank-page {
        width: calc(100vw - 32px);
        padding-top: 26px;
        padding-bottom: 100px;
    }

    .page-shell.rank-page {
        width: calc(100vw - 32px) !important;
    }

    .rank-page-heading {
        align-items: flex-start;
        margin-bottom: 16px;
    }

    .rank-intro { max-width: 440px; font-size: 10px; }
    .rank-home-link { min-height: 34px; padding: 7px 10px; font-size: 10px; }
    .rank-toolbar { padding: 15px 13px 13px; border-radius: 10px; }
    .rank-search-control { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 6px; }
    .rank-search-control input { grid-column: 1 / -1; min-width: 0; }
    .rank-search-control .button { min-height: 39px; padding: 7px 9px; font-size: 11px; }
    .rank-search-control .button[type="submit"] { grid-column: 1; }
    .rank-search-control [data-rank-search-clear] { grid-column: 2; }
    .rank-picker { grid-column: 3; width: 100%; min-width: 0; }
    .rank-picker-trigger { min-height: 39px; padding: 7px 9px; font-size: 11px; }
    .rank-picker-menu { max-height: min(360px, 60vh); }
    .rank-picker-menu .rank-season-trigger { min-height: 37px; font-size: 11px; }
    .rank-picker-menu .rank-chapter-option { min-height: 34px; font-size: 11px; }
    .rank-current-label { font-size: 9px; }
    .rank-results { padding: 0 10px; border-radius: 10px; }
    .rank-results-heading { min-height: 64px; gap: 8px; }
    .rank-results-heading h2 { font-size: 15px; }
    .rank-results-heading p { max-width: 250px; font-size: 9px; }
    .rank-page-size { font-size: 9px; }
    .rank-table-heading { display: none; }
    .rank-row {
        min-height: 56px;
        grid-template-columns: 31px minmax(0, 1fr) 28px 46px 39px;
        column-gap: 5px;
    }
    .rank-number { font-size: 10px; }
    .rank-player { gap: 6px; }
    .rank-card-image { width: 27px; height: 27px; flex-basis: 27px; border-radius: 7px; }
    .rank-player-name { font-size: 10px; }
    .rank-tier { justify-content: center; }
    .rank-tier img { width: 23px; height: 23px; }
    .rank-tier span { display: none; }
    .rank-rr,.rank-wins { font-size: 10px; }
    .rank-rr small { margin-left: 2px; font-size: 7px; }
    .rank-wins::after { content: "胜"; margin-left: 2px; color: var(--muted); font: 7px var(--body-font); }
    .rank-pagination { min-height: 58px; gap: 13px; font-size: 10px; }
    .rank-pagination .button { min-height: 30px; padding: 6px 9px; font-size: 10px; }
}

@media (max-width: 360px) {
    .rank-page { width: calc(100% - 24px); }
    .rank-row { grid-template-columns: 28px minmax(0, 1fr) 24px 42px 34px; column-gap: 4px; }
    .rank-player-name { font-size: 9px; }
    .rank-card-image { width: 24px; height: 24px; flex-basis: 24px; }
    .rank-rr,.rank-wins { font-size: 9px; }
}
