:root {
    --bg-primary: #e8e8e8;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #4facfe, #00f2fe);
    --gradient-tertiary: linear-gradient(135deg, #f093fb, #f5576c);
}

[data-theme="dark"] {
    --bg-primary: #212121;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #424242 0%, #212121 100%);
    --gradient-secondary: linear-gradient(135deg, #2c3e50, #34495e);
    --gradient-tertiary: linear-gradient(135deg, #8e44ad, #9b59b6);
}

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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    gap: 40px;
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#theme-toggle-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-color);
}

.game-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 80vh;
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 20px 40px var(--shadow-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 游戏主界面 */
.game-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    border-right: 2px solid var(--border-color);
    background: var(--bg-primary);
    transition: all 0.3s ease;
}

.game-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-align: center;
}

.game-header h2 {
    font-size: 1.8rem;
    font-weight: bold;
}

/* 游戏说明 */
.game-instructions {
    padding: 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.game-instructions h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.game-instructions p {
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

/* AI手势显示区域 */
.ai-gesture-area {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 40px;
    background: var(--bg-secondary);
    min-height: 200px;
    transition: all 0.3s ease;
}

.ai-avatar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #667eea;
}

.ai-gesture-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.ai-gesture-display img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.ai-gesture-display p {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

/* 游戏控制按钮 */
.game-controls {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    flex: 0 0 auto;
    transition: all 0.3s ease;
}

.start-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* 结果按钮 */
.result-controls {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    min-height: 120px;
    align-items: center;
    position: relative;
    z-index: 100;
    flex: 0 0 auto;
    transition: all 0.3s ease;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible;
}

.result-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1.1rem;
    min-width: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-btn.win {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.result-btn.lose {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
    color: white;
}

.result-btn.draw {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
}

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

.result-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: #cccccc !important;
    color: #666666 !important;
    border: 2px solid #dddddd;
}

.result-btn:disabled:hover {
    transform: none;
    box-shadow: none;
    background: #cccccc !important;
    color: #666666 !important;
}

/* 确保按钮始终可见 */
#result-controls {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#win-btn,
#lose-btn,
#draw-btn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 聊天记录区域 */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    transition: all 0.3s ease;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    text-align: center;
}

.chat-header h2 {
    font-size: 1.5rem;
    font-weight: bold;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message.ai {
    flex-direction: row;
}

.message.player {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.avatar.ai {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.avatar.player {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    background: var(--bg-primary);
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-line;
    transition: all 0.3s ease;
}

.message.ai .message-content {
    background: var(--bg-primary);
    border-bottom-left-radius: 5px;
}

.message.player .message-content {
    background: var(--bg-primary);
    border-bottom-right-radius: 5px;
}

.gesture-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-top: 5px;
}

/* 内容板块 */
.content-section {
    width: 100%;
    max-width: 1200px;
}

.content-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.content-header {
    background: var(--gradient-primary);
    padding: 25px 30px;
    text-align: center;
}

.content-header h2 {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.content-body {
    padding: 30px;
}

.content-body p {
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 0;
    text-align: justify;
    transition: color 0.3s ease;
}

/* 怎么玩列表样式 */
.how-to-play-list {
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 0;
    padding-left: 20px;
    transition: color 0.3s ease;
}

.how-to-play-list li {
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.how-to-play-list li:last-child {
    margin-bottom: 0;
}

.how-to-play-list ul {
    margin: 10px 0 0 20px;
    padding-left: 0;
}

.how-to-play-list ul li {
    margin-bottom: 8px;
    list-style-type: disc;
}

.how-to-play-list ul li:last-child {
    margin-bottom: 0;
}

.how-to-play-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
    }

    .game-panel,
    .chat-panel {
        border-right: none;
        border-bottom: 2px solid #e0e0e0;
    }

    .ai-gesture-area {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    .result-controls {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }

    .result-btn {
        min-width: 100px;
        font-size: 1rem;
        padding: 12px 20px;
        flex: 1;
        max-width: 120px;
    }

    .start-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .page-wrapper {
        gap: 20px;
    }

    .content-section {
        padding: 0 10px;
    }

    .content-header {
        padding: 20px 15px;
    }

    .content-header h2 {
        font-size: 1.4rem;
    }

    .content-body {
        padding: 20px 15px;
    }

    .content-body p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .how-to-play-list {
        font-size: 1rem;
        line-height: 1.6;
        padding-left: 15px;
    }

    .how-to-play-list ul {
        margin: 8px 0 0 15px;
    }
}