/* leaderboard.css - 积分榜单样式（与 index.html 统一配色） */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #fff4e0 0%, #ffeef5 45%, #e8f4ff 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
    color: #3a2e2a;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ========== 顶部 Banner ========== */
.banner {
    width: 100%;
    display: block;
    background: linear-gradient(90deg, #ff8a3d 0%, #ffb380 50%, #66b3ff 100%);
    box-shadow: 0 4px 20px rgba(255, 138, 61, 0.25);
    position: relative;
    z-index: 2;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.banner-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.22);
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 1px;
    transition: background 0.2s;
    /* 移动端/云启动兼容 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.banner-back:hover {
    background: rgba(255, 255, 255, 0.38);
}
.banner-back:active {
    background: rgba(255, 255, 255, 0.48);
    transform: scale(0.95);
}

.banner-title {
    color: white;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(255, 138, 61, 0.3);
}

.banner-placeholder {
    width: 40px;
}

/* ========== 主舞台 ========== */
.stage {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* ========== Tab切换 ========== */
.tab-container {
    display: flex;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 16px;
    border: 2px solid rgba(255, 200, 150, 0.35);
    box-shadow: 0 4px 12px rgba(255, 170, 120, 0.15);
}

.tab-btn {
    flex: 1;
    padding: 10px 6px;
    border: none;
    background: transparent;
    color: #8a6a4a;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.tab-btn.active {
    background: linear-gradient(135deg, #ff8a3d 0%, #ffb380 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 138, 61, 0.35);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 200, 150, 0.3);
}
.tab-btn:active {
    transform: scale(0.95);
}

/* ========== 榜单内容区 ========== */
.rank-content {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(255, 170, 120, 0.15);
    border: 1px solid rgba(255, 200, 150, 0.3);
    overflow: hidden;
}

/* ========== 个人排名卡 ========== */
.my-rank-card {
    background: linear-gradient(135deg, #ff8a3d 0%, #ffb380 100%);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.my-rank-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.my-rank-info {
    flex: 1;
    color: white;
}

.my-rank-name {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 4px;
    text-shadow: 0 1px 4px rgba(255, 138, 61, 0.3);
}

.my-rank-score {
    font-size: 14px;
    opacity: 0.9;
}

.my-rank-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ========== 榜单列表 ========== */
.rank-list {
    padding: 8px 0;
    max-height: 55vh;
    overflow-y: auto;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 200, 150, 0.2);
    transition: background 0.2s;
}

.rank-item:hover {
    background: rgba(255, 245, 230, 0.5);
}
.rank-item:active {
    transform: scale(0.98);
}

.rank-item.top1 { background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 255, 255, 0) 100%); }
.rank-item.top2 { background: linear-gradient(90deg, rgba(192, 192, 192, 0.12) 0%, rgba(255, 255, 255, 0) 100%); }
.rank-item.top3 { background: linear-gradient(90deg, rgba(205, 127, 50, 0.12) 0%, rgba(255, 255, 255, 0) 100%); }

.rank-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    margin-right: 12px;
    flex-shrink: 0;
}

.rank-num.top1 { background: linear-gradient(135deg, #ffd700, #ffb380); color: #8b6914; }
.rank-num.top2 { background: linear-gradient(135deg, #e0e0e0, #c0c0c0); color: #5a5a5a; }
.rank-num.top3 { background: linear-gradient(135deg, #deb887, #cd7f32); color: #5a3a1a; }
.rank-num.normal { background: rgba(255, 200, 150, 0.3); color: #8a6a4a; }

.rank-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8a3d 0%, #ffb380 100%);
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(255, 138, 61, 0.2);
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-name {
    font-size: 14px;
    font-weight: 600;
    color: #3a2e2a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-detail {
    font-size: 12px;
    color: #a08770;
    margin-top: 2px;
}

.rank-score {
    font-size: 16px;
    font-weight: 800;
    color: #ff6b00;
    margin-left: 8px;
}

.rank-camp {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.rank-camp.cat { background: rgba(255, 138, 61, 0.15); color: #ff6b00; }
.rank-camp.dog { background: rgba(102, 179, 255, 0.15); color: #2196f3; }

/* 奖励说明 */
.reward-section {
    padding: 14px 16px;
    background: rgba(255, 245, 230, 0.5);
    border-top: 1px solid rgba(255, 200, 150, 0.3);
}

.reward-title {
    font-size: 14px;
    font-weight: 700;
    color: #5d3a1a;
    margin-bottom: 10px;
}

.reward-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reward-item {
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    color: #5d3a1a;
    border: 1px solid rgba(255, 200, 150, 0.3);
    box-shadow: 0 2px 6px rgba(255, 170, 120, 0.1);
}

.reward-item .icon {
    margin-right: 4px;
}

/* 段位显示 */
.rank-level {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rank-level-icon {
    font-size: 18px;
}

.rank-level-name {
    font-size: 13px;
    font-weight: 600;
    color: #5d3a1a;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 16px;
    gap: 8px;
    border-top: 1px solid rgba(255, 200, 150, 0.2);
}

.page-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 200, 150, 0.4);
    background: white;
    color: #5d3a1a;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: rgba(255, 200, 150, 0.2);
}
.page-btn:active:not(:disabled) {
    transform: scale(0.9);
}

.page-btn.active {
    background: linear-gradient(135deg, #ff8a3d 0%, #ffb380 100%);
    color: white;
    border-color: #ffb380;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: #8a6a4a;
    padding: 0 12px;
    font-weight: 500;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #a08770;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 200, 150, 0.3);
    border-top-color: #ff8a3d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #a08770;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ========== 底部 ========== */
.foot {
    text-align: center;
    padding: 20px 0 24px;
    color: #a08770;
    font-size: 12px;
    letter-spacing: 1px;
}

/* 响应式 */
@media (max-width: 640px) {
    .stage {
        padding: 12px;
    }
    
    .tab-btn {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .rank-item {
        padding: 10px 12px;
    }
    
    .rank-avatar {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
    
    .rank-score {
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .banner-title {
        font-size: 18px;
    }
    
    .tab-btn {
        font-size: 11px;
        padding: 8px 2px;
    }
    
    .rank-num {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .rank-avatar {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
    
    .rank-name {
        font-size: 13px;
    }
    
    .rank-score {
        font-size: 13px;
    }
}

/* 滚动条美化 */
.rank-list::-webkit-scrollbar {
    width: 6px;
}

.rank-list::-webkit-scrollbar-track {
    background: rgba(255, 200, 150, 0.1);
    border-radius: 3px;
}

.rank-list::-webkit-scrollbar-thumb {
    background: rgba(255, 179, 128, 0.4);
    border-radius: 3px;
}

.rank-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 138, 61, 0.5);
}
