/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

/* 容器样式 */
.container {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 90%;
    max-width: 600px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 2rem;
}

.vocab-selector {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.vocab-selector label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.vocab-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.vocab-selector select:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.vocab-selector select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.wordlist-info {
    margin: 10px 0;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    color: #495057;
    font-weight: 500;
    text-align: center;
}

header h1 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2.5em;
    font-weight: 700;
}

.progress {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    font-size: 1.1em;
    font-weight: 600;
}

#score {
    color: #4CAF50;
}

#progress {
    color: #2196F3;
}

/* 主要内容样式 */
main {
    margin-bottom: 30px;
}

#word-section {
    text-align: center;
}

#current-word {
    font-size: 2.2em;
    margin-bottom: 30px;
    color: #333;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
}

#options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

.option-btn {
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    background-color: white;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.option-btn.correct {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.option-btn.incorrect {
    background-color: #f44336;
    color: white;
    border-color: #f44336;
}

/* 反馈部分样式 */
#feedback-section {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

#feedback-message {
    font-size: 1.2em;
    margin-bottom: 20px;
    font-weight: 600;
}

#next-btn {
    padding: 12px 30px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#next-btn:hover {
    background-color: #5a67d8;
}

/* 底部样式 */
footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 600;
}

#correct-count {
    color: #4CAF50;
}

#wrong-count {
    color: #f44336;
}

#accuracy {
    color: #FF9800;
}

#restart-btn, #view-history-btn {
    padding: 10px 20px;
    margin: 0 10px;
    background-color: #9c27b0;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#restart-btn:hover, #view-history-btn:hover {
    background-color: #7b1fa2;
}

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

.modal-content {
    background-color: white;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease-in;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h3 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

#history-list {
    margin-bottom: 20px;
}

.history-item {
    background-color: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

#close-history-btn {
    padding: 10px 20px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

#close-history-btn:hover {
    background-color: #5a67d8;
}

/* 辅助类 */
.hidden {
    display: none;
}

/* 游戏模式选择器样式 */
.game-mode-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.game-mode-selector label {
    font-weight: 600;
    color: #333;
}

.game-mode-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-mode-selector select:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

#start-match-btn {
    padding: 0.5rem 1.5rem;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#start-match-btn:hover {
    background-color: #5a67d8;
}

/* 消消乐网格样式 */
#match-title {
    text-align: center;
    margin-bottom: 10px;
}

#match-game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f0f8ff;
    border-radius: 5px;
    font-size: 1.2em;
    font-weight: bold;
}

#current-round {
    color: #2196F3;
}

#current-timer {
    color: #FF9800;
}

#match-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    margin: 30px auto;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
}

.match-card {
    padding: 15px;
    background-color: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;
    min-height: 80px;
}

.match-card:hover {
    background-color: #667eea;
    color: white;
    transform: scale(1.05);
}

.match-card.flipped {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.match-card.matched {
    background-color: transparent;
    border-color: transparent;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s ease;
}

.match-card.wrong {
    background-color: #f44336;
    color: white;
    transition: all 0.3s ease;
}

/* 消消乐结果样式 */
#match-result {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background-color: #f0fff4;
    border: 2px solid #4CAF50;
    border-radius: 10px;
}

#match-result h3 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#matched-words-list {
    margin: 20px 0;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

.matched-word-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.matched-word-item:last-child {
    border-bottom: none;
}

.matched-word-english {
    font-weight: 600;
    color: #667eea;
}

.matched-word-chinese {
    color: #4CAF50;
}

#next-match-btn {
    padding: 12px 30px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 20px;
}

/* 道具系统样式 */
.powerups {
    margin: 20px auto;
    text-align: center;
    max-width: 500px;
}

.powerup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: #fff3cd;
    border: 2px solid #ffeeba;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #856404;
    width: 100%;
    margin-bottom: 10px;
}

.powerup-btn:hover {
    background-color: #ffeeba;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(133, 100, 4, 0.2);
}

.powerup-btn:disabled {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.powerup-icon {
    font-size: 1.5em;
}

.powerup-name {
    font-weight: 700;
}

.powerup-count {
    background-color: #856404;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

.powerup-description {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
    text-align: center;
}

#next-match-btn:hover {
    background-color: #5a67d8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    #current-word {
        font-size: 1.8em;
    }
    
    #options-container {
        grid-template-columns: 1fr;
    }
    
    .progress, .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-mode-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    #match-grid {
        gap: 5px;
        max-width: 350px;
    }
    
    .match-card {
        padding: 10px;
        font-size: 0.9rem;
        min-height: 60px;
    }
}