/* ========== Ranking Page ========== */
.ranking-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 8px 0 24px;
}

.ranking-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) auto;
    gap: 18px 16px;
    margin-bottom: 18px;
    padding: 18px 22px;
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 55%, #f1f6ff 100%);
    border: none;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.ranking-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at left top, rgba(255,255,255,0.92), transparent 34%),
        radial-gradient(circle at right bottom, rgba(59,130,246,0.08), transparent 28%);
    pointer-events: none;
}

.ranking-hero::after {
    display: none;
}

.ranking-hero > * {
    position: relative;
    z-index: 1;
}

.ranking-hero-main {
    flex: 1;
    min-width: 0;
}

.ranking-hero-topline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.ranking-hero-badge,
.ranking-hero-update {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.ranking-hero-badge {
    color: #334155;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.ranking-hero-update {
    color: #2563eb;
    background: rgba(59, 130, 246, 0.08);
}

.ranking-hero-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ranking-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #2563eb;
    font-size: 26px;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.08);
    flex-shrink: 0;
}

.ranking-hero-heading {
    min-width: 0;
}

.ranking-hero-heading h1 {
    margin: 0 0 6px;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 800;
    color: #0f172a;
}

.ranking-hero-heading p {
    margin: 0;
    max-width: 720px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.75;
}

.ranking-hero-side {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ranking-hero-preview {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px dashed rgba(148, 163, 184, 0.22);
}

.ranking-preview-head {
    flex-shrink: 0;
}

.ranking-preview-head span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.ranking-preview-head span i {
    color: #f59e0b;
}

.ranking-preview-head small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.ranking-preview-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    flex: 1;
}

.ranking-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.ranking-preview-rank {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
}

.ranking-preview-rank i {
    font-size: 11px;
    line-height: 1;
}

.ranking-preview-rank em {
    font-style: normal;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.ranking-preview-item.rank-1 .ranking-preview-rank { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ranking-preview-item.rank-2 .ranking-preview-rank { background: linear-gradient(135deg, #94a3b8, #64748b); }
.ranking-preview-item.rank-3 .ranking-preview-rank { background: linear-gradient(135deg, #fb923c, #ea580c); }

.ranking-preview-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ranking-preview-avatar .user-avatar-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.ranking-preview-avatar .user-avatar-wrapper .user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ranking-preview-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ranking-preview-info strong {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-preview-info small {
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-stat-chip {
    min-width: 150px;
    padding: 12px 14px;
    border-radius: 18px;
    background: #fff;
    border: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.ranking-stat-chip-label,
.ranking-stat-chip strong,
.ranking-stat-chip small {
    display: block;
}

.ranking-stat-chip-label {
    margin-bottom: 4px;
    font-size: 11px;
    color: #94a3b8;
}

.ranking-stat-chip strong {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
    color: #0f172a;
}

.ranking-stat-chip small {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.ranking-stat-chip.accent-points strong,
.ranking-hero.accent-points .ranking-hero-icon { color: #f59e0b; }
.ranking-stat-chip.accent-level strong,
.ranking-hero.accent-level .ranking-hero-icon { color: #8b5cf6; }
.ranking-stat-chip.accent-post strong,
.ranking-hero.accent-post .ranking-hero-icon { color: #3b82f6; }
.ranking-stat-chip.accent-checkin strong,
.ranking-hero.accent-checkin .ranking-hero-icon { color: #22c55e; }
.ranking-stat-chip.accent-follower strong,
.ranking-hero.accent-follower .ranking-hero-icon { color: #ec4899; }
.ranking-stat-chip.accent-like strong,
.ranking-hero.accent-like .ranking-hero-icon { color: #ef4444; }

.accent-points { box-shadow: 0 12px 30px rgba(245, 158, 11, 0.08); }
.accent-level { box-shadow: 0 12px 30px rgba(139, 92, 246, 0.08); }
.accent-post { box-shadow: 0 12px 30px rgba(59, 130, 246, 0.08); }
.accent-checkin { box-shadow: 0 12px 30px rgba(34, 197, 94, 0.08); }
.accent-follower { box-shadow: 0 12px 30px rgba(236, 72, 153, 0.08); }
.accent-like { box-shadow: 0 12px 30px rgba(239, 68, 68, 0.08); }

.ranking-tabs-wrap {
    margin-bottom: 22px;
}

.ranking-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.ranking-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    color: var(--text-primary);
}

.ranking-tab:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 14px 30px rgba(59, 130, 246, 0.12);
}

.ranking-tab.active {
    border-color: transparent;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    box-shadow: 0 16px 32px rgba(59, 130, 246, 0.14);
}

.ranking-tab-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--rank-tab-color) 14%, white);
    color: var(--rank-tab-color);
    font-size: 18px;
}

.ranking-tab-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ranking-tab-text strong {
    font-size: 14px;
    font-weight: 700;
    color: inherit;
}

.ranking-tab-text small {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.ranking-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ranking-list-wrap,
.ranking-empty {
    background: #fff;
    border-radius: 24px;
    border: 1px solid var(--border-light);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.ranking-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), #fff);
}

.ranking-section-title span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.ranking-section-title span i {
    color: #f59e0b;
}

.ranking-section-title small {
    font-size: 12px;
    color: var(--text-muted);
}

.ranking-empty {
    padding: 88px 20px;
    text-align: center;
    color: var(--text-muted);
}

.ranking-empty i {
    display: block;
    margin-bottom: 16px;
    font-size: 58px;
    color: #cbd5e1;
}

.ranking-list {
    padding: 8px 0;
}

.ranking-item {
    display: grid;
    grid-template-columns: 58px 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease, transform 0.2s ease;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: #f8fbff;
}

.ranking-item.is-me {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.02));
}

.ranking-item-rank {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 800;
}

.ranking-item-rank.top-rank {
    color: #fff;
}

.ranking-item-rank.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ranking-item-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.ranking-item-rank.rank-3 { background: linear-gradient(135deg, #fb923c, #ea580c); }

.ranking-item-rank.top-rank i {
    font-size: 20px;
}

.ranking-item-avatar {
    display: block;
}

.ranking-item-avatar .user-avatar-wrapper,
.ranking-item-avatar img {
    border-radius: 50%;
}

.ranking-item-info {
    min-width: 0;
}

.ranking-item-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.me-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ranking-item-level {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.ranking-item-value {
    text-align: right;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.ranking-item-value .value-unit {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

@media (max-width: 1100px) {
    .ranking-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .ranking-hero {
        grid-template-columns: 1fr;
    }

    .ranking-hero-side {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .ranking-stat-chip {
        flex: 1 1 160px;
        min-width: 0;
    }

    .ranking-hero-preview {
        flex-direction: column;
        align-items: stretch;
    }

    .ranking-preview-list {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 768px) {
    .ranking-page {
        padding-top: 0;
    }

    .ranking-hero {
        padding: 18px 16px;
        border-radius: 18px;
    }

    .ranking-hero-title-row {
        align-items: flex-start;
    }

    .ranking-hero-icon {
        width: 48px;
        height: 48px;
        border-radius: 16px;
        font-size: 22px;
    }

    .ranking-hero-heading h1 {
        font-size: 24px;
    }

    .ranking-hero-heading p {
        font-size: 13px;
    }

    .ranking-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .ranking-tab {
        padding: 12px;
        border-radius: 16px;
    }

    .ranking-tab-text strong {
        font-size: 13px;
    }

    .ranking-item {
        grid-template-columns: 44px 48px minmax(0, 1fr);
        gap: 10px;
        padding: 14px 16px;
    }

    .ranking-item-value {
        grid-column: 2 / 4;
        text-align: left;
        padding-left: 58px;
        font-size: 20px;
    }

    .ranking-item-value .value-unit {
        display: inline;
        margin-top: 0;
        margin-left: 4px;
    }
}

@media (max-width: 520px) {
    .ranking-tabs {
        grid-template-columns: 1fr;
    }

    .ranking-tab {
        justify-content: flex-start;
    }

    .ranking-section-title {
        padding: 16px;
    }

    .ranking-top3 {
        padding: 18px 16px 16px;
    }

    .top3-item {
        padding: 18px 12px 16px;
    }

    .ranking-item {
        grid-template-columns: 40px 44px minmax(0, 1fr);
        padding: 12px 14px;
    }

    .ranking-item-rank {
        width: 40px;
        height: 40px;
        border-radius: 14px;
        font-size: 14px;
    }

    .ranking-item-value {
        padding-left: 54px;
        font-size: 18px;
    }
}
