/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* 游戏标题 */
.game-header {
    margin-bottom: 20px;
}

.game-header h1 {
    color: #ff6b6b;
    font-size: 2.2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.score-board {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 15px;
    margin-bottom: 10px;
}

.score, .level {
    font-size: 1.1em;
    font-weight: bold;
    color: #495057;
}

/* 游戏控制区域 */
.game-controls {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.game-type-selector, .difficulty-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-type-selector label, .difficulty-selector label {
    font-size: 1em;
    color: #495057;
    font-weight: bold;
}

#game-type-select, #difficulty-select {
    padding: 8px 12px;
    border: 2px solid #4ecdc4;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    color: #495057;
    cursor: pointer;
    min-width: 120px;
}

#game-type-select:focus, #difficulty-select:focus {
    outline: none;
    border-color: #45b7b8;
    box-shadow: 0 0 5px rgba(78, 205, 196, 0.3);
}

.new-game-button {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.new-game-button:hover {
    background: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 图片显示区域 */
.image-container {
    position: relative;
    margin: 20px 0;
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.feedback-button {
    position: absolute;
    bottom: 5px;
    right: 10px;
    background: rgba(128, 128, 128, 0.7);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(128, 128, 128, 0.3);
    z-index: 10;
    white-space: nowrap;
}

.feedback-button:hover {
    background: rgba(96, 96, 96, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(128, 128, 128, 0.4);
}

.feedback-button.feedback-submitted {
    background: #4caf50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.game-image {
    max-width: 300px;
    max-height: 300px;
    width: 100%;
    height: auto;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* 字母信息显示区域 */
.letter-info {
    margin: 8px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.pronunciation-display {
    font-size: 1.4em;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
}

.phonetic-display {
    font-size: 1.2em;
    color: #6c757d;
    font-style: italic;
}

/* 语音提示区域 */
.voice-prompt {
    margin: 20px 0;
}

#voice-text {
    margin-top: 10px;
    font-size: 1.2em;
    color: #495057;
    font-weight: bold;
}

/* 字母选项区域 */
.options-container {
    margin: 20px 0;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 20px;
}

.option-button {
    background: linear-gradient(145deg, #f0f0f0, #e0e0e0);
    border: 3px solid #ddd;
    border-radius: 15px;
    padding: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #4ecdc4;
}

.option-button:active {
    transform: translateY(-1px);
}

.option-button.correct {
    background: linear-gradient(145deg, #4ecdc4, #45b7b8);
    color: white;
    border-color: #4ecdc4;
    transform: scale(1.1);
    animation: correctPulse 0.6s ease-in-out;
}

.option-button.wrong {
    background: linear-gradient(145deg, #ff6b6b, #ff8e8e);
    color: white;
    border-color: #ff6b6b;
    animation: wrongShake 0.5s ease-in-out;
}

.option-button.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* 反馈区域 */
.feedback-container {
    margin: 20px 0;
    min-height: 50px;
}

.feedback-message {
    font-size: 1.5em;
    font-weight: bold;
    padding: 15px;
    border-radius: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.feedback-message.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-message.correct {
    color: #4ecdc4;
    background: #e8f8f5;
    animation: correctBounce 0.6s ease-in-out;
}

.feedback-message.wrong {
    color: #ff6b6b;
    background: #ffe8e8;
    animation: wrongBounce 0.6s ease-in-out;
}

/* 控制按钮 */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.restart-button, .abc-song-button, .settings-button, .back-home-button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.restart-button {
    background: #ff6b6b;
    color: white;
}

.restart-button:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

.abc-song-button {
    background: #ffd700;
    color: #333;
}

.abc-song-button:hover {
    background: #ffed4e;
    transform: translateY(-2px);
}

.settings-button {
    background: #6c757d;
    color: white;
}

.settings-button:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.back-home-button {
    background: #17a2b8;
    color: white;
}

.back-home-button:hover {
    background: #138496;
    transform: translateY(-2px);
}

/* 弹窗样式 */
.game-over-modal, .settings-modal, .abc-song-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-modal.show, .settings-modal.show, .abc-song-modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.5s ease-out;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    color: #4ecdc4;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 1.3em;
    color: #495057;
    margin-bottom: 30px;
}

.play-again-button {
    background: #4ecdc4;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.play-again-button:hover {
    background: #45b7b8;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 设置弹窗内容样式 */
.settings-content {
    margin: 20px 0;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.setting-item label {
    font-size: 1.1em;
    font-weight: bold;
    color: #495057;
    flex: 1;
    text-align: left;
}

.setting-item input[type="range"] {
    flex: 2;
    margin: 0 15px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4ecdc4;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #4ecdc4;
    cursor: pointer;
}

.test-voice-button {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.test-voice-button:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#rate-value {
    font-weight: bold;
    color: #4ecdc4;
    min-width: 30px;
    text-align: center;
}

.settings-buttons, .song-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.save-settings-button, .close-settings-button, .play-song-button, .close-song-button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.save-settings-button, .play-song-button {
    background: #4ecdc4;
    color: white;
}

.save-settings-button:hover, .play-song-button:hover {
    background: #45b7b8;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.close-settings-button, .close-song-button {
    background: #6c757d;
    color: white;
}

.close-settings-button:hover, .close-song-button:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 字母歌弹窗样式 */
.song-content {
    margin: 20px 0;
}

.song-lyrics {
    font-size: 1.3em;
    color: #495057;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.alphabet-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.alphabet-letter {
    background: linear-gradient(145deg, #4ecdc4, #45b7b8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alphabet-letter:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.alphabet-letter.playing {
    background: linear-gradient(145deg, #ff6b6b, #ff8e8e);
    animation: letterPulse 0.6s ease-in-out;
}

/* 单词显示样式 */
.words-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.words-display h3 {
    color: #ff6b6b;
    font-size: 1.5em;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 100%;
}

.word-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 1.3em;
    font-weight: bold;
    color: #495057;
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.word-item.current {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border-color: #ff6b6b;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    animation: pulse 0.6s ease-in-out;
}

.word-item.completed {
    background: linear-gradient(135deg, #51cf66, #69db7c);
    color: white;
    border-color: #51cf66;
    opacity: 0.8;
}

/* 动画效果 */
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes correctBounce {
    0% { transform: translateY(20px); opacity: 0; }
    50% { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes wrongBounce {
    0% { transform: translateY(20px); opacity: 0; }
    50% { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes modalSlideIn {
    0% { transform: scale(0.8) translateY(-50px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes letterPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.1); }
}

/* 响应式设计 */
@media (max-width: 600px) {
    .game-container {
        margin: 10px;
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 1.8em;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-image {
        max-width: 200px;
        max-height: 200px;
    }
    
    .option-button {
        font-size: 1.5em;
        padding: 15px;
        min-height: 60px;
    }
    
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 15px;
    }
    
    .controls {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    .restart-button, .abc-song-button, .settings-button, .back-home-button {
        width: 120px;
        padding: 10px 16px;
        font-size: 1em;
    }
    
    .alphabet-display {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .alphabet-letter {
        font-size: 1em;
        padding: 8px;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .words-display {
        padding: 15px;
    }
    
    .words-display h3 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .words-list {
        gap: 10px;
    }
    
    .word-item {
        font-size: 1.1em;
        padding: 10px 16px;
        min-width: 70px;
    }
}
