/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 介绍区域 */
.intro-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-rules {
    margin-bottom: 30px;
}

.game-rules h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.game-rules ul {
    list-style: none;
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.game-rules li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

/* 按钮样式 */
.start-btn, .hint-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.start-btn:hover, .hint-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.start-btn:disabled, .hint-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 游戏区域 */
.game-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.game-stats {
    display: flex;
    gap: 20px;
    font-weight: bold;
    color: #667eea;
}

.hint-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
}

.welcome-message {
    margin-bottom: 15px;
}

/* 消息样式 */
.message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 5px;
}

.agent-message {
    justify-content: flex-start;
}

.agent-message .message-content {
    background: #e3f2fd;
    color: #333;
    border-bottom-left-radius: 5px;
}

/* 输入区域 */
.input-container, .guess-section {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.input-container input, .guess-section input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.input-container input:focus, .guess-section input:focus {
    border-color: #667eea;
}

.input-container button, .guess-section button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
}

.input-container button:hover, .guess-section button:hover {
    background: #5a6fd8;
}

.input-container button:disabled, .guess-section button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.guess-section {
    background: #fff3cd;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ffeaa7;
}

.guess-section input {
    background: #fff;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.modal-content p {
    margin-bottom: 20px;
    line-height: 1.6;
}

#figure-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
}

#figure-info h3 {
    color: #667eea;
    margin-bottom: 10px;
}

/* Portrait gallery */
.portrait-gallery {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.portrait-item {
    flex: 0 0 auto;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    border: 2px solid #e0e0e0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portrait-item:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(102,126,234,0.4);
    border-color: #667eea;
}

.portrait-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 工具类 */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.loading-box {
    background: white;
    border-radius: 20px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 20px;
}

.loading-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.loading-step {
    font-size: 0.95rem;
    color: #667eea;
    min-height: 1.4em;
    transition: opacity 0.4s ease;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-section {
        height: 500px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .input-container, .guess-section {
        flex-direction: column;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 5px;
    }
}