* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #121212;
    color: #f5f5f5;
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.game-container {
    position: relative;
    width: 800px;
    height: 300px;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.game-stats {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 18px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #f5f5f5;
}

#game-area {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #121212;
}

#dino {
    position: absolute;
    width: 44px;
    height: 44px;
    bottom: 0;
    left: 50px;
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 10;
}

#ground {
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    background-color: #444;
}

.obstacle {
    position: absolute;
    bottom: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom;
    z-index: 5;
}

.cactus {
    width: 15px;
}

.rock {
    border-radius: 50% 50% 0 0;
}

.tall-cactus {
    width: 20px;
}

.cloud {
    position: absolute;
    width: 60px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    z-index: 5;
}

.star {
    position: absolute;
    background-color: #ffffff;
    border-radius: 50%;
    z-index: 1;
    animation: twinkle 4s infinite alternate;
}

.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #f5f5f5;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 15px 30px;
    border-radius: 8px;
    z-index: 20;
    width: 80%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-message small {
    font-size: 16px;
    display: block;
    margin: 10px 0;
    color: #FFD700; /* 金色显示古诗 */
    font-style: italic;
}

/* 失败图片样式 */
#failure-image {
    max-width: 60px;
    max-height: 60px;
    margin: 10px 0;
}

/* 用户输入表单样式 */
.user-input-form {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    z-index: 30;
    width: 80%;
    max-width: 400px;
    display: none;
    max-height: 90vh; /* 限制最大高度 */
    overflow-y: auto; /* 添加滚动条 */
}

.user-input-form h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #FFD700;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #f5f5f5;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #222;
    color: #f5f5f5;
    font-size: 14px;
}

.form-group textarea {
    height: 80px;
    resize: none;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.user-input-form button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: #444;
    color: #f5f5f5;
    cursor: pointer;
    transition: background-color 0.3s;
    flex: 1;
    margin: 0 5px;
}

.user-input-form button:first-child {
    margin-left: 0;
}

.user-input-form button:last-child {
    margin-right: 0;
}

.user-input-form button:hover {
    background-color: #555;
}

#submit-message {
    background-color: #007BFF;
}

#submit-message:hover {
    background-color: #0069D9;
}

/* 统计信息按钮样式 */
.stats-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 8px 15px;
    background-color: rgba(0, 123, 255, 0.7);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 100;
}

/* 统计信息面板样式 */
.stats-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 200;
    overflow-y: auto;
    padding: 20px;
    display: none;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.stats-header h3 {
    color: #FFD700;
    font-size: 24px;
}

#close-stats {
    padding: 5px 10px;
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.stats-content {
    max-width: 800px;
    margin: 0 auto;
}

.message-item {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.message-name {
    font-weight: bold;
    color: #FFD700;
}

.message-score {
    color: #f5f5f5;
}

.message-content {
    margin-bottom: 10px;
    color: #f5f5f5;
    line-height: 1.4;
}

.message-date {
    font-size: 12px;
    color: #999;
    text-align: right;
}

.no-messages {
    text-align: center;
    color: #999;
    padding: 20px;
}

@keyframes jump {
    0% { bottom: 0; }
    50% { bottom: 100px; }
    100% { bottom: 0; }
}

@keyframes twinkle {
    0% { opacity: 0.2; }
    50% { opacity: 0.8; }
    100% { opacity: 0.2; }
}

/* Responsive design */
@media (max-width: 820px) {
    .game-container {
        width: 95vw;
        height: 250px;
    }
    
    .game-message {
        width: 90%;
        padding: 12px 20px;
    }
    
    .stats-panel {
        padding: 10px;
    }
    
    .stats-header h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .game-container {
        height: 180px;
        margin-top: -30px; /* 向上偏移一点，给统计按钮留出空间 */
    }
    
    .game-stats {
        font-size: 14px;
    }
    
    .game-message {
        width: 90%;
        padding: 12px;
        font-size: 14px;
    }
    
    .game-message small {
        font-size: 12px;
        margin: 8px 0;
    }
    
    #failure-image {
        max-width: 50px;
        max-height: 50px;
        margin: 8px 0;
    }
    
    #dino {
        width: 36px;
        height: 36px;
    }
    
    .obstacle {
        transform: scale(0.8);
    }
    
    .user-input-form {
        transform: translate(-50%, -45%);
        width: 85%;
        padding: 15px;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 10px;
        font-size: 16px; /* 16px是移动设备上不会被缩放的最小字体大小 */
    }
    
    .form-group textarea {
        height: 60px; /* 减小文本区域高度 */
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .user-input-form button {
        padding: 12px;
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .user-input-form h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .stats-button {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 14px;
        background-color: rgba(0, 123, 255, 0.9);
    }
    
    .message-item {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .pinned-tag {
        padding: 1px 3px;
        font-size: 8px;
    }
    
    .message-rank {
        padding: 1px 3px;
        font-size: 8px;
    }
    
    .current-device {
        padding: 1px 3px;
        font-size: 8px;
    }
    
    .refresh-button {
        padding: 8px;
        font-size: 14px;
    }
}

/* 置顶消息样式 */
.pinned-message {
    background-color: rgba(255, 215, 0, 0.1) !important;
    border-left: 3px solid #FFD700;
}

.pinned-tag {
    background-color: #FFD700;
    color: #000;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 5px;
    font-weight: bold;
}

.message-rank {
    background-color: #444;
    color: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 5px;
}

/* 确保视口高度正确设置 */
html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* 加载提示样式 */
.loading-messages {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* 刷新按钮样式 */
.refresh-button {
    display: block;
    margin: 15px auto;
    padding: 8px 15px;
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.refresh-button:hover {
    background-color: #555;
}

/* 当前设备指示器 */
.current-device {
    background-color: #007BFF;
    color: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 5px;
    font-weight: normal;
} 