/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.5), rgba(30, 41, 59, 0.5)), 
                url('https://xdx.obs.cn-east-3.myhuaweicloud.com/img/quiz-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.dashboard {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
}

/* Header styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.leaderboard-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #f8fafc;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-left: 1rem;
}

/* 倒计时样式 */
.countdown-container {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    /* backdrop-filter: blur(15px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 140px;
}

.countdown-label {
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.25rem;
}

.countdown-time {
    font-size: 3rem;
    font-weight: 700;
    color: #f8fafc;
}

/* 当倒计时小于1分钟时的警告颜色 */
.countdown-warning {
    color: #fbbf24;
}

/* 当倒计时小于30秒时的危险颜色 */
.countdown-danger {
    color: #ef4444;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.status-container {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem 2rem;
    /* backdrop-filter: blur(15px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.progress-count {
    font-size: 2.2rem;
    font-weight: 700;
    color: #f8fafc;
}

.progress-bar-container {
    width: 150px;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    border-radius: 6px;
    transition: width 0.8s ease;
}

/* Leaderboard styles */
.leaderboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    width: 100%;
    padding-bottom: 2rem; /* 添加底部padding，确保动画有足够空间 */
}

.leaderboard {
    width: 98%;
    max-width: 1400px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    overflow: visible;
    padding: 1rem 0 1.5rem; /* 添加上下padding，确保动画有足够空间 */
}

/* 创建左右两列分组 */
.leaderboard-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: visible;
    padding-bottom: 1.5rem; /* 添加底部padding，确保动画有足够空间 */
}

.leaderboard-column-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-column:first-child .leaderboard-column-title {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-column:last-child .leaderboard-column-title {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(160, 160, 160, 0.1));
    border: 1px solid rgba(192, 192, 192, 0.3);
}

.leaderboard-item {
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.5s ease,
                background-color 0.5s ease;
    overflow: hidden;
    height: 85px;
    min-height: 85px;
    z-index: 1;
}

.leaderboard-item.move-up {
    z-index: 5;
}

.leaderboard-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* 晋级组（1-8名）使用金色配色 */
.qualification .leaderboard-item {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(255, 165, 0, 0.08));
    border: 1px solid rgba(255, 215, 0, 0.25);
}

.qualification .user-icon {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* 淘汰组（9-16名）使用银色配色 */
.elimination .leaderboard-item {
    background: rgba(192, 192, 192, 0.08);
    border: 1px solid rgba(192, 192, 192, 0.15);
}

.elimination .user-icon {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}

.user-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0; /* 确保文本可以正确截断 */
    width: 100%;
}

.user-name-container {
    display: flex;
    flex-direction: column;
    /* gap: 0.25rem; */
    flex-shrink: 1;
    min-width: 0; /* 确保文本可以正确截断 */
    max-width: 70%; /* 增加最大宽度，为复活图标腾出空间 */
}

/* 用户ID样式 - 放在用户名之前 */
.user-id {
    font-size: 0.85rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    order: -1; /* 使其显示在用户名之前 */
    margin-bottom: -0.25rem;
}

.user-name {
    font-size: 2rem;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.revival-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.7rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 5px rgba(249, 115, 22, 0.4);
    animation: pulse 2s infinite;
    z-index: 5;
    /* margin-right: 0.5rem; */
    margin-left: 0;
    line-height: 1;
    align-self: center;
    order: -1;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(249, 115, 22, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.problems-count {
    font-size: 1.5rem;
    color: #cbd5e1;
    padding: 0.25rem 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    white-space: nowrap;
}

.score {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 0.8rem;
    color: white;
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
    min-width: 3.5rem;
    text-align: center;
    margin-left: auto; /* 使score右对齐 */
}

/* Animation for score updates */
@keyframes scoreUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.score-update {
    animation: scoreUpdate 0.8s ease;
}

/* Animation for position changes */
@keyframes moveUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.move-up {
    animation: moveUp 0.5s ease-out;
    z-index: 5;
}

/* Loading and error messages */
.loading-message,
.error-message {
    font-size: 1.2rem;
    padding: 2rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    grid-column: 1 / -1;
    text-align: center;
}

/* Responsive design */
@media (max-width: 1100px) {
    .dashboard {
        padding: 1rem;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .leaderboard-title {
        margin-left: 0;
        font-size: 2rem;
    }
    
    .countdown-container {
        margin: 0.5rem 0;
        width: 100%;
    }
    
    .status-container {
        width: 100%;
        padding: 0.75rem 1.5rem;
    }
    
    .leaderboard {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
    }
    
    .leaderboard-column {
        margin-bottom: 1rem;
    }
    
    .user-info {
        gap: 0.5rem;
    }
    
    .user-stats {
        gap: 0.75rem;
    }
    
    .leaderboard-item {
        height: 75px;
        min-height: 75px;
        padding: 0.85rem 1rem;
    }
}

@media (max-width: 768px) {
    .status-container {
        padding: 0.75rem 1.5rem;
    }
    
    .progress-count {
        font-size: 1.8rem;
    }
    
    .progress-bar-container {
        width: 200px;
    }
    
    .user-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .user-name {
        font-size: 1rem;
    }
    
    .user-id {
        font-size: 0.75rem;
    }
    
    .user-name-container {
        max-width: 45%;
    }
    
    .score {
        font-size: 1.3rem;
    }
    
    .problems-count {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    
    .leaderboard-item {
        gap: 0.75rem;
        height: 70px;
        min-height: 70px;
    }
    
    .revival-indicator {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
        margin-right: 0.4rem;
    }
    
    .countdown-time {
        font-size: 1.8rem;
    }
    
    .countdown-label {
        font-size: 0.9rem;
    }
} 
h1 {
    color: #fff;
}