/* Mobile-only refinements for Token Rank. Desktop layout stays in token-rank.css. */

.token-rank-mobile-filter-bar,
.token-rank-mobile-filter-backdrop,
.token-rank-mobile-filter-head,
.token-rank-mobile-filter-actions,
.token-rank-mobile-sheet-actions {
    display: none;
}

@media (max-width: 760px) {
    .token-rank-mobile-filter-bar button,
    .token-rank-filter-panel button,
    .token-rank-filter-panel a {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .token-rank-page {
        gap: 14px;
    }

    .token-rank-page[data-token-rank-page="board"] .token-rank-hero {
        padding: 16px;
        border-radius: 14px;
    }

    .token-rank-page[data-token-rank-page="board"] .token-rank-hero h1 {
        font-size: 27px;
    }

    .token-rank-page[data-token-rank-page="board"] .token-rank-title img {
        width: 30px;
        height: 30px;
    }

    .token-rank-page[data-token-rank-page="board"] .token-rank-hero .sub {
        font-size: 12.5px;
        line-height: 1.55;
    }

    .token-rank-page[data-token-rank-page="board"] .token-rank-actions {
        display: none;
    }

    .token-rank-mobile-filter-bar {
        display: block;
    }

    .token-rank-mobile-filter-bar button {
        width: 100%;
        min-height: 40px;
        justify-content: space-between;
        gap: 7px;
        padding: 0 9px 0 13px;
        border-color: #e8edf4;
        border-radius: 999px;
        background: #fff;
        color: #111827;
        box-shadow: 0 3px 10px rgba(15, 23, 42, .045);
        transform: none;
    }

    .token-rank-mobile-filter-bar span {
        min-width: 0;
        overflow: hidden;
        color: #374151;
        font-size: 12.5px;
        font-weight: 800;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .token-rank-mobile-filter-bar strong {
        flex: 0 0 auto;
        min-height: 32px;
        display: inline-grid;
        place-items: center;
        padding: 0 11px;
        border-radius: 999px;
        background: #111827;
        color: #fff;
        font-size: 12px;
    }

    .token-rank-mobile-filter-backdrop {
        position: fixed;
        inset: 0;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        z-index: 82;
        display: block;
        background: rgba(15, 23, 42, .34);
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s ease;
    }

    body.token-rank-mobile-filter-open .token-rank-mobile-filter-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .token-rank-filter-panel {
        position: fixed;
        left: 50%;
        right: auto;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        z-index: 94;
        width: min(430px, calc(100% - 24px));
        max-height: min(68vh, 520px);
        display: grid;
        grid-template-columns: 1fr;
        justify-items: center;
        align-content: start;
        gap: 7px;
        overflow: auto;
        padding: 8px 14px 14px;
        border: 1px solid #ececee;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 22px 64px rgba(15, 23, 42, .22);
        opacity: 0;
        pointer-events: none;
        transform: translate(-50%, 10px) scale(.98);
        transform-origin: 50% 100%;
        visibility: hidden;
        transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    }

    body.token-rank-mobile-filter-open .token-rank-filter-panel {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, 0) scale(1);
        visibility: visible;
    }

    .token-rank-mobile-filter-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        justify-self: stretch;
        gap: 12px;
        position: sticky;
        top: -8px;
        z-index: 1;
        margin: -8px -14px 2px;
        padding: 9px 14px 8px;
        border-bottom: 1px solid #f0f1f3;
        background: #fff;
    }

    .token-rank-mobile-filter-head strong {
        font-size: 15px;
        font-weight: 400;
        line-height: 1.2;
    }

    .token-rank-mobile-filter-head button {
        display: none;
    }

    .token-rank-filter-group {
        width: fit-content;
        max-width: 100%;
        justify-self: center;
        gap: 6px;
    }

    .token-rank-filter-group > span,
    .token-rank-filter-label {
        font-size: 11.5px;
    }

    .token-rank-chips {
        justify-content: center;
        gap: 6px;
    }

    .token-rank-chip {
        min-height: 31px;
        padding: 0 10px;
        font-size: 11.5px;
    }

    .token-rank-tool-more-toggle {
        width: 42px;
    }

    .token-rank-mobile-sheet-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 7px;
        padding-top: 2px;
    }

    .token-rank-mobile-sheet-actions > * {
        width: 100%;
        min-height: 38px;
        font-size: 12px;
    }

    .token-rank-mobile-filter-actions {
        display: none !important;
    }

    @media (hover: none) {
        .token-rank-mobile-filter-bar button:hover,
        .token-rank-mobile-filter-bar button:active,
        .token-rank-filter-panel button:hover,
        .token-rank-filter-panel button:active,
        .token-rank-filter-panel a:hover,
        .token-rank-filter-panel a:active {
            box-shadow: none;
            transform: none;
        }

        .token-rank-chip:hover,
        .token-rank-chip:active {
            color: #111827;
            background: #fff;
        }

        .token-rank-chip.active:hover,
        .token-rank-chip.active:active {
            color: #fff;
            background: #111827;
        }
    }

    .token-rank-board {
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .token-rank-summary {
        display: flex;
        flex-wrap: nowrap;
        align-items: baseline;
        gap: 6px;
        min-height: 0;
        padding: 12px 14px;
        border-radius: 16px;
    }

    #tokenRankSummaryLabel {
        min-width: 0;
        overflow: hidden;
        font-size: 12.5px;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .token-rank-summary strong {
        flex: 0 0 auto;
        font-size: clamp(19px, 6.2vw, 24px);
    }

    .token-rank-summary .sub {
        flex: 0 0 auto;
        margin-top: 0;
        font-size: 11px;
        line-height: 1.2;
    }

    .token-rank-summary-users {
        display: none;
    }

    .token-rank-list {
        gap: 8px;
    }

    .token-rank-row {
        grid-template-columns: 22px 32px minmax(0, 1fr) minmax(58px, max-content);
        gap: 6px;
        min-height: 64px;
        padding: 9px 10px;
        border-radius: 12px;
    }

    .token-rank-row-current {
        box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
    }

    .token-rank-rank {
        font-size: 15px;
    }

    .token-rank-medal {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .token-rank-avatar {
        width: 32px;
        height: 32px;
        min-height: 32px;
        font-size: 13px;
    }

    .token-rank-avatar-member-badge {
        right: -2px;
        bottom: -2px;
        width: 13px;
        height: 13px;
        border-width: 1.5px;
    }

    .token-rank-avatar-member-badge svg {
        width: 8px;
        height: 8px;
    }

    .token-rank-user {
        min-width: 0;
        gap: 3px;
        overflow: hidden;
    }

    .token-rank-user strong {
        font-size: 15px;
        line-height: 1.15;
    }

    .token-rank-user-meta,
    .token-rank-breakdown-badges {
        max-width: 100%;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .token-rank-user-meta {
        min-height: 20px;
        gap: 4px;
    }

    .token-rank-breakdown-badges {
        gap: 4px;
    }

    .token-rank-breakdown-badge {
        flex: 0 0 auto;
        min-height: 20px;
        max-width: none;
        gap: 4px;
        padding: 0 6px 0 5px;
        font-size: 10.5px;
    }

    .token-rank-breakdown-badge[hidden] {
        display: none;
    }

    .token-rank-breakdown-dot {
        width: 5px;
        height: 5px;
        box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--token-rank-client-color, #64748b) 18%, transparent);
    }

    .token-rank-breakdown-name {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
    }

    .token-rank-breakdown-badge strong {
        font-size: 10.5px;
    }

    .token-rank-breakdown-text {
        display: block;
        overflow: hidden;
        font-size: 11px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .token-rank-score {
        grid-column: auto;
        min-width: 0;
        text-align: right;
    }

    .token-rank-score strong {
        overflow: hidden;
        font-size: 18px;
        line-height: 1.05;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .token-rank-score span {
        font-size: 10.5px;
        line-height: 1.2;
    }
}
