/* ========================================
   排行榜系统样式
   ======================================== */

/* 成绩提交界面 */
#score-submit-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.submit-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
}

.submit-title {
    font-size: 32px;
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.submit-time {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-bottom: 30px;
    color: white;
    font-size: 18px;
}

.time-value {
    font-size: 36px;
    font-weight: bold;
    color: #FFD700;
    display: block;
    margin-top: 10px;
}

.submit-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.submit-form label {
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.submit-form input {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.submit-form input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.error-msg {
    color: #ff6b6b;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}

.submit-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 排行榜界面 */
#leaderboard-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.leaderboard-container {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
    display: flex;
    flex-direction: column;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-header h2 {
    color: white;
    font-size: 28px;
    margin: 0;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.leaderboard-tabs {
    display: flex;
    padding: 20px 30px 0;
    gap: 10px;
}

.leaderboard-tab {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.leaderboard-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.leaderboard-tab.active {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    color: #FFD700;
}

.loading {
    padding: 60px;
    text-align: center;
    color: white;
    font-size: 18px;
}

.leaderboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px 30px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.leaderboard-table thead {
    background: rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table th {
    padding: 15px;
    color: #FFD700;
    font-weight: bold;
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.leaderboard-table td {
    padding: 15px;
    color: white;
    font-size: 15px;
}

.leaderboard-table td.rank {
    font-weight: bold;
    font-size: 18px;
    width: 80px;
    text-align: center;
}

.medal {
    font-size: 24px;
}

/* 结束界面按钮组 */
.ending-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.submit-score-button,
.view-leaderboard-button {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.submit-score-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
}

.submit-score-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.4);
}

.view-leaderboard-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.view-leaderboard-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* 关卡选择界面排行榜按钮 */
.level-header-buttons {
    display: flex;
    gap: 15px;
}

.leaderboard-button {
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.leaderboard-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

/* 无尽模式排行榜界面 */
#endless-leaderboard-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.endless-leaderboard-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.endless-leaderboard-footer .btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'KaiTi', serif;
}

.endless-leaderboard-footer .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .submit-container {
        padding: 30px 20px;
    }
    
    .submit-title {
        font-size: 24px;
    }
    
    .time-value {
        font-size: 28px;
    }
    
    .leaderboard-container {
        max-width: 100%;
        border-radius: 15px;
        max-height: 85vh;
    }
    
    .leaderboard-header {
        padding: 20px;
    }
    
    .leaderboard-header h2 {
        font-size: 22px;
    }
    
    .leaderboard-tabs {
        padding: 15px 15px 0;
        gap: 8px;
    }
    
    .leaderboard-tab {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .leaderboard-content {
        padding: 15px;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .leaderboard-table td.rank {
        width: 60px;
        font-size: 16px;
    }
    
    .medal {
        font-size: 20px;
    }
    
    .ending-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .submit-score-button,
    .view-leaderboard-button,
    .replay-button {
        width: 100%;
        min-width: auto;
    }
    
    .level-header-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .leaderboard-button,
    .back-to-intro-button {
        width: 100%;
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        display: none; /* 隐藏难度列 */
    }
    
    .leaderboard-table th:nth-child(5),
    .leaderboard-table td:nth-child(5) {
        font-size: 11px;
    }
}
