* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    padding: 20px;
}

.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

.leaderboard {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    min-width: 250px;
}

.leaderboard h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.total-users {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: bold;
}

#totalUsers {
    color: #2196F3;
    margin-left: 5px;
}

#leaderboardList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: #f8f8f8;
    border-radius: 5px;
    font-size: 0.9em;
    margin-bottom: 5px;
    transition: opacity 0.3s;
}

.leaderboard-item.current-player {
    background-color: #e8f5e9;
    border: 1px solid #4CAF50;
}

.player-rank {
    font-weight: bold;
    color: #666;
    width: 30px;
}

.player-name {
    flex: 1;
    margin: 0 10px;
}

/* 离线玩家样式 */
.player-name:has(+ .player-score:not(:has(+ .current-score))) {
    color: #666;
}

.player-name:contains("(离线)") {
    font-style: italic;
    opacity: 0.8;
}

.player-score {
    color: #2196F3;
    font-weight: bold;
}

.current-score {
    color: #4CAF50;
    font-weight: bold;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid #ddd;
}

.game-container {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    min-width: 500px;
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    position: relative;
}

h1 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: bold;
}

#score {
    font-size: 1.2em;
    color: #333;
    padding: 8px 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
    font-weight: bold;
}

.username-container {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

#usernameInput {
    padding: 8px 12px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s;
    width: 200px;
    text-align: center;
}

#usernameInput:focus {
    border-color: #4CAF50;
}

#usernameInput:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

#gameCanvas {
    border: 3px solid #2c3e50;
    background-color: #fff;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.controls {
    text-align: center;
    margin-top: 20px;
}

#startBtn {
    padding: 10px 20px;
    font-size: 1.1em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 120px;
}

#startBtn:hover {
    background-color: #45a049;
}

.instructions {
    margin-top: 10px;
    color: #666;
    font-size: 0.9em;
}

/* 游戏说明样式 */
.game-instructions {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-left: 20px;
    min-width: 250px;
    max-width: 300px;
}

.game-instructions h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
}

.game-instructions h3 {
    color: #666;
    margin: 15px 0 10px;
    font-size: 1.2em;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

.instruction-content {
    font-size: 0.9em;
    color: #555;
}

.instruction-content ul,
.instruction-content ol {
    padding-left: 20px;
    margin: 10px 0;
}

.instruction-content li {
    margin: 8px 0;
    line-height: 1.4;
}

/* 响应式布局 */
@media (max-width: 1200px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .game-instructions {
        margin-left: 0;
        margin-top: 20px;
        max-width: 400px;
        width: 100%;
    }
    
    .leaderboard {
        margin-bottom: 20px;
        max-width: 400px;
        width: 100%;
    }
}

.user-stats {
    margin-top: 20px;
    padding: 15px;
    border-top: 2px solid #f0f0f0;
    background-color: #f8f8f8;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-weight: bold;
    color: #2c3e50;
}

.stat-value {
    color: #2196F3;
    font-weight: bold;
    background-color: #e3f2fd;
    padding: 5px 10px;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
    font-size: 1.1em;
}

/* 聊天框样式 */
.chat-box {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-box h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.chat-messages {
    height: 200px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 5px;
    margin-bottom: 10px;
}

.chat-message {
    margin-bottom: 8px;
    padding: 8px 10px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
}

.chat-message .username {
    font-weight: bold;
    color: #2196F3;
    margin-right: 5px;
}

.chat-message .message {
    color: #333;
    margin-right: 5px;
}

.chat-message .timestamp {
    font-size: 0.8em;
    color: #999;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

#chatInput {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
}

#chatInput:focus {
    border-color: #2196F3;
}

#sendMessage {
    padding: 8px 15px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#sendMessage:hover {
    background-color: #1976D2;
}

/* 移动端适配聊天框 */
@media (max-width: 768px) {
    .chat-box {
        margin-top: 15px;
        padding: 10px;
    }

    .chat-messages {
        height: 150px;
    }

    #chatInput {
        font-size: 16px;
    }

    #sendMessage {
        padding: 8px 12px;
    }
}

/* 移动端样式 */
@media (max-width: 768px) {
    .game-wrapper {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }
    
    .game-container {
        min-width: unset;
        width: 100%;
        padding: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .leaderboard,
    .game-instructions {
        width: 100%;
        max-width: none;
        margin: 10px 0;
    }
    
    .instruction-content {
        font-size: 0.85em;
    }
    
    .mobile-only {
        display: block;
        color: #4CAF50;
        font-weight: bold;
    }
    
    #usernameInput {
        width: 100%;
        max-width: 200px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
    
    #startBtn {
        width: 100%;
        max-width: 200px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .stat-item {
        padding: 8px;
    }
}

/* 在桌面端隐藏移动端提示 */
@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }
}

/* 禁用页面滚动时的橡皮筋效果 */
html, body {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

/* 输入组样式 */
.input-group {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 300px;
    justify-content: center;
}

#versionNumber {
    position: absolute;
    left: 0;
    top: 0;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-radius: 15px;
    font-size: 0.9em;
    color: #666;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

#versionNumber:hover {
    background-color: #e0e0e0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .input-group {
        max-width: 250px;
    }
    
    #versionNumber {
        font-size: 0.8em;
        padding: 4px 8px;
    }
    
    #usernameInput {
        width: 100%;
        max-width: 200px;
    }
}

/* 删除旧的版本号样式 */
.version-info {
    display: none;
}

/* 更新日志弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-10%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #666;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.version-entry {
    margin-bottom: 20px;
}

.version-entry h3 {
    color: #2196F3;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.version-entry ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 0;
}

.version-entry li {
    margin: 8px 0;
    color: #666;
    line-height: 1.4;
} 