/* 排行榜样式 */
/* 游戏和排行榜包装容器 */
.game-wrapper {
    display: flex;
    flex-direction: row;
    gap: 30px;
    margin-bottom: 10px;
    align-items: flex-start;
    justify-content: space-between;
}

/* 游戏区域响应式调整 */
.game-container {
    flex: 0 0 auto;
    min-width: 300px;
    max-width: 460px;
    width: 460px;
}

/* 侧边排行榜样式 */
.side-leaderboard {
    width: 320px;
    background-color: #bbada0;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    flex-shrink: 0;
    margin-top: 0;
    height: 460px; /* 增加高度以匹配game-container */
    margin-right: 20px;
}

.leaderboard-title {
    color: #776e65;
    font-size: 20px;
    margin-bottom: 8px;
    text-align: center;
}

.leaderboard-update-tip {
    color: #776e65;
    font-size: 12px;
    text-align: center;
    margin-bottom: 15px;
    font-style: italic;
    opacity: 0.9;
}

.leaderboard-list {
    overflow-y: auto;
    max-height: calc(80% - 40px); /* 调整为总高度的80%减去标题高度 */
    background-color: #ede0c8;
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    flex: 8; /* 设置flex比例为8 */
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #eee4da;
    transition: background-color 0.2s ease;
    border-radius: 3px;
    align-items: center;
}

.leaderboard-item:hover {
    background-color: #eee4da;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 24px;
    height: 24px;
    font-weight: bold;
    color: #776e65;
    background-color: #eee4da;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 13px;
    position: relative;
}

.leaderboard-player {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
    color: #776e65;
    font-weight: 500;
    font-size: 14px;
}

.leaderboard-score {
    color: #f67c5f;
    font-weight: bold;
    text-align: right;
    font-size: 15px;
}

.leaderboard-date {
    font-size: 11px;
    color: #a09a91;
    margin-left: 8px;
    min-width: 60px;
    text-align: right;
}

/* 提交分数表单 */
.score-submit-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.score-submit-container.active,
.score-submit-container[style*="display: flex"] {
    display: flex;
    animation: fade-in 0.3s ease;
}

.score-submit-form {
    background-color: #faf8ef;
    border-radius: 6px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #8f7a66;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-button:hover {
    background: #9f8b77;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.score-submit-title {
    text-align: center;
    color: #776e65;
    font-size: 22px;
    margin-bottom: 15px;
}

.score-display {
    text-align: center;
    background-color: #edc22e;
    color: #f9f6f2;
    font-size: 28px;
    font-weight: bold;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.potential-rank {
    text-align: center;
    color: #776e65;
    margin-bottom: 20px;
}

.potential-rank strong {
    color: #f65e3b;
    font-size: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #776e65;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #bbada0;
    border-radius: 4px;
    font-size: 16px;
    color: #776e65;
}

.form-group input:focus {
    border-color: #8f7a66;
    outline: none;
}

.submit-button {
    width: 100%;
    padding: 12px;
    background-color: #8f7a66;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.submit-button:hover {
    background-color: #9f8b77;
}

/* 响应式调整 */
@media screen and (max-width: 880px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .game-container {
        max-width: 460px;
        width: 100%;
    }
    
    .side-leaderboard {
        width: 100%;
        max-width: 460px;
        margin-top: 15px;
        margin-right: 0; /* 在小屏幕上不需要右边距 */
        height: 400px; /* 响应式模式下调整高度 */
    }
    
    .leaderboard-list {
        flex: 8;
        max-height: calc(80% - 40px);
    }
    
    .online-players-container {
        flex: 2;
        min-height: 40px;
    }
}

@media screen and (max-width: 520px) {
    .leaderboard-item {
        padding: 6px 8px;
    }
    
    .leaderboard-date {
        display: none;
    }
    
    .leaderboard-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .leaderboard-rank {
        height: 20px;
        width: 20px;
        font-size: 12px;
        margin-right: 5px;
    }
    
    .leaderboard-rank-1::after, 
    .leaderboard-rank-2::after, 
    .leaderboard-rank-3::after {
        width: 10px;
        height: 10px;
        top: -5px;
        right: -3px;
    }
    
    .leaderboard-player {
        font-size: 13px;
    }
    
    .leaderboard-score {
        font-size: 14px;
    }
    
    .score-submit-form {
        padding: 15px;
    }
    
    .score-submit-title {
        font-size: 18px;
    }
    
    .score-display {
        font-size: 24px;
    }
    
    .side-leaderboard {
        height: 350px; /* 小屏幕下更紧凑的高度 */
    }
    
    .leaderboard-list {
        flex: 8;
        max-height: calc(80% - 30px);
    }
    
    .online-players-container {
        min-height: 45px; /* 小屏幕下稍微减小高度，但仍然保持适当空间 */
        flex: 2;
        padding: 4px 5px;
    }
    
    .online-players-title::before,
    .online-players-title::after {
        width: 5px;
        height: 5px;
        margin: 0 4px;
    }
}

/* 前三名突出显示 */
.leaderboard-rank-1, .leaderboard-rank-2, .leaderboard-rank-3 {
    color: #fff;
    font-weight: bold;
}

/* 为前三名添加奖牌图标 */
.leaderboard-rank-1::after, 
.leaderboard-rank-2::after, 
.leaderboard-rank-3::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    top: -6px;
    right: -4px;
}

.leaderboard-rank-1 {
    background-color: #edc22e !important; /* 金色 */
}

.leaderboard-rank-1::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23edc22e'%3E%3Cpath d='M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z'/%3E%3Cpath d='M12 2L8 6h8l-4-4zm0 20l4-4H8l4 4z'/%3E%3C/svg%3E");
}

.leaderboard-rank-2 {
    background-color: #cdc1b4 !important; /* 银色 */
}

.leaderboard-rank-2::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cdc1b4'%3E%3Cpath d='M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z'/%3E%3Cpath d='M12 2L8 6h8l-4-4zm0 20l4-4H8l4 4z'/%3E%3C/svg%3E");
}

.leaderboard-rank-3 {
    background-color: #cd8e65 !important; /* 铜色 */
}

.leaderboard-rank-3::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cd8e65'%3E%3Cpath d='M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z'/%3E%3Cpath d='M12 2L8 6h8l-4-4zm0 20l4-4H8l4 4z'/%3E%3C/svg%3E");
}

/* 前三名玩家名和分数突出显示 */
.leaderboard-item:nth-child(1) .leaderboard-player,
.leaderboard-item:nth-child(1) .leaderboard-score {
    font-weight: bold;
    color: #edc22e;
}

.leaderboard-item:nth-child(2) .leaderboard-player,
.leaderboard-item:nth-child(2) .leaderboard-score {
    font-weight: bold;
    color: #9f9f9f;
}

.leaderboard-item:nth-child(3) .leaderboard-player,
.leaderboard-item:nth-child(3) .leaderboard-score {
    font-weight: bold;
    color: #cd8e65;
}

/* 滚动条样式 */
.leaderboard-list::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 2px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: #8f7a66;
    border-radius: 2px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: #776e65;
}

/* 鼠标悬停在排行榜上时才显示滚动条 */
.leaderboard-list:hover {
    scrollbar-color: #8f7a66 transparent;
}

/* 在线玩家走马灯样式 */
.online-players-container {
    width: 100%;
    margin-top: 8px; /* 进一步减少上边距 */
    background-color: #ede0c8;
    border-radius: 4px;
    padding: 5px 6px; /* 增加内边距 */
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 2; /* 设置flex比例为2 */
    display: flex;
    flex-direction: column;
    min-height: 50px; /* 增加最小高度以适应较大字体 */
    justify-content: flex-start; /* 调整为顶部对齐 */
}

.online-players-title {
    display: block; /* 显示标题 */
    font-size: 15px; /* 增加字体大小 */
    text-align: center;
    margin: 0 0 5px 0; /* 增加下边距 */
    color: #776e65;
    font-weight: 600;
    line-height: 1.3;
    height: 20px; /* 增加高度 */
}

.online-players-title::before,
.online-players-title::after {
    content: '';
    display: inline-block;
    width: 6px; /* 减小指示点大小 */
    height: 6px; /* 减小指示点大小 */
    background-color: #4CAF50;
    border-radius: 50%;
    margin: 0 6px; /* 减小边距 */
    animation: blink 2s infinite;
    vertical-align: middle; /* 保持垂直居中 */
}

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

.online-players-marquee {
    overflow: hidden;
    position: relative;
    height: 20px; /* 增加高度与title匹配 */
    margin: 0 auto;
    width: 100%;
    padding: 0 10px; /* 增加左右内边距 */
}

.online-players-list {
    display: flex;
    position: absolute;
    white-space: nowrap;
    width: max-content;
    height: 20px; /* 增加高度与marquee匹配 */
    left: 0; /* 从容器左侧开始 */
    top: 0; /* 调整顶部位置 */
    will-change: transform; /* 提高性能 */
    animation-name: marquee;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-duration: 6s; /* 设置为4秒一个人名 */
}

.online-players-list:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% { transform: translateX(0); } /* 从左侧开始 */
    100% { transform: translateX(-100px); } /* 移动一个人名的距离 */
}

.online-player-item {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-right: 25px; /* 增加间距 */
    color: #776e65;
    font-size: 14px; /* 增加字体大小 */
    padding-right: 10px; /* 增加右内边距 */
    min-width: 150px; /* 设置最小宽度 */
}

.online-player-name {
    font-weight: 500;
    margin-right: 5px;
}

.online-player-score {
    color: #f67c5f;
    font-weight: bold;
}

/* 响应式调整 */
@media screen and (max-width: 520px) {
    .online-players-title {
        font-size: 14px; /* 小屏幕下稍微减小字体，但仍然保持较大 */
    }
    
    .online-player-item {
        font-size: 13px; /* 小屏幕下稍微减小字体，但仍然保持较大 */
        margin-right: 20px;
    }
    
    .online-players-container {
        min-height: 45px; /* 小屏幕下稍微减小高度，但仍然保持适当空间 */
        padding: 4px 5px;
    }
    
    .online-players-title::before,
    .online-players-title::after {
        width: 5px;
        height: 5px;
        margin: 0 4px;
    }
} 