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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f8ff;
    color: #333;
    overflow-x: hidden;
}

#game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

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

header p {
    font-size: 1.2rem;
    color: white;
    opacity: 0.9;
}

/* 游戏菜单样式 */
#game-menu {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

#game-menu h2 {
    font-size: 2rem;
    color: #4CAF50;
    margin-bottom: 30px;
}

.game-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.game-buttons button {
    padding: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.game-buttons button:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

#memory-game {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
}

#math-game {
    background: linear-gradient(135deg, #4ECDC4, #45B7D1);
}

#puzzle-game {
    background: linear-gradient(135deg, #96CEB4, #FFEAA7);
}

#logic-game {
    background: linear-gradient(135deg, #DDA0DD, #9370DB);
}

#reaction-game {
    background: linear-gradient(135deg, #F7DC6F, #F8C471);
}

#language-game {
    background: linear-gradient(135deg, #85C1E9, #3498DB);
}

#science-game {
    background: linear-gradient(135deg, #F1948A, #E74C3C);
}

#art-game {
    background: linear-gradient(135deg, #BB8FCE, #8E44AD);
}

/* 游戏区域样式 */
#game-area {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

#back-button {
    padding: 10px 20px;
    font-size: 1rem;
    color: white;
    background: #666;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#back-button:hover {
    background: #555;
}

#game-title {
    font-size: 1.8rem;
    color: #4CAF50;
}

#score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #FF6B6B;
}

#game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#game-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* 游戏特定样式 */
/* 记忆力游戏 */
.memory-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.memory-card {
    width: 80px;
    height: 100px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.memory-card.flipped {
    background: white;
    border: 2px solid #4CAF50;
}

.memory-card.matched {
    background: #98FB98;
    cursor: default;
}

/* 数学游戏 */
.math-problem {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 30px 0;
    text-align: center;
}

.math-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.math-option {
    padding: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #4ECDC4, #45B7D1);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.math-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.math-option.correct {
    background: #98FB98;
    color: #333;
}

.math-option.incorrect {
    background: #FF6B6B;
    color: white;
}

/* 拼图游戏 */
.puzzle-container {
    position: relative;
    width: 300px;
    height: 300px;
    border: 2px solid #4CAF50;
    border-radius: 10px;
    overflow: hidden;
}

.puzzle-piece {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
    background-size: 300px 300px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* 逻辑游戏 */
.logic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.logic-cell {
    width: 80px;
    height: 80px;
    background: #f0f0f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logic-cell:hover {
    background: #e0e0e0;
}

.logic-cell.filled {
    background: #4CAF50;
    color: white;
}

/* 反应游戏 */
.reaction-target {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 30px 0;
}

.reaction-target:hover {
    transform: scale(1.1);
}

.reaction-target.hit {
    background: #98FB98;
    transform: scale(0.8);
}

/* 通用按钮样式 */
.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background: #4CAF50;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn:hover {
    background: #45a049;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #666;
}

.btn-secondary:hover {
    background: #555;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }
    
    .game-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .memory-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .memory-card {
        width: 60px;
        height: 80px;
    }
    
    .puzzle-container {
        width: 240px;
        height: 240px;
    }
    
    .puzzle-piece {
        width: 80px;
        height: 80px;
        background-size: 240px 240px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .game-buttons {
        grid-template-columns: 1fr;
    }
    
    .memory-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .memory-card {
        width: 50px;
        height: 70px;
    }
    
    .math-problem {
        font-size: 2rem;
    }
    
    .puzzle-container {
        width: 180px;
        height: 180px;
    }
    
    .puzzle-piece {
        width: 60px;
        height: 60px;
        background-size: 180px 180px;
    }
}