/* 元日古詩學習遊戲 - 樣式表 */

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

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
}

/* 畫面切換 */
.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

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

/* 首頁樣式 */
#home-screen {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.title-decoration {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.poem-preview {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
}

.poem-preview p {
    font-size: 1.5rem;
    color: #333;
    margin: 10px 0;
    font-weight: bold;
}

/* 按鈕樣式 */
.btn-primary, .btn-secondary, .btn-back, .btn-next, .btn-speak {
    display: inline-block;
    padding: 15px 40px;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-back {
    background: #f0f0f0;
    color: #666;
    padding: 10px 25px;
    font-size: 1rem;
}

.btn-back:hover {
    background: #e0e0e0;
}

.btn-next {
    background: #4CAF50;
    color: white;
}

.btn-next:hover {
    background: #45a049;
}

.btn-speak {
    padding: 8px 15px;
    font-size: 1rem;
    background: #FF6B6B;
    color: white;
}

.btn-speak:hover {
    background: #ff5252;
}

/* 模式選擇 */
#mode-screen {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#mode-screen h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mode-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: #333;
    margin-bottom: 10px;
}

.mode-card p {
    color: #666;
    font-size: 0.9rem;
}

/* 朗讀學習模式 */
#read-mode {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#read-mode h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.poem-display {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.poem-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255,255,255,0.8);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.poem-line:hover {
    background: white;
    transform: scale(1.02);
}

.line-text {
    font-size: 1.8rem;
    color: #333;
    font-weight: bold;
}

.notes-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.notes-section h3 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.note-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.note-term {
    font-weight: bold;
    color: #667eea;
    min-width: 80px;
}

.note-meaning {
    color: #666;
    text-align: right;
}

/* 音頻控制區域 */
.audio-controls {
    text-align: center;
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-radius: 15px;
    border: 2px dashed #667eea;
}

.audio-controls .btn-primary {
    font-size: 1.2rem;
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.audio-controls .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.audio-note {
    margin-top: 15px;
    color: #666;
    font-size: 0.95rem;
}

/* 填充練習模式 */
#fill-mode, #quiz-mode {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#fill-mode h2, #quiz-mode h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s ease;
    width: 25%;
}

.question-counter {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.fill-question, .quiz-question {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

.poem-blank {
    font-size: 1.8rem;
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin-bottom: 25px;
    letter-spacing: 5px;
}

.blank {
    display: inline-block;
    min-width: 60px;
    padding: 5px 15px;
    margin: 0 5px;
    border-bottom: 3px solid #667eea;
    color: #667eea;
    font-weight: bold;
}

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

.option-btn {
    padding: 15px 25px;
    font-size: 1.3rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.option-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

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

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

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* 測驗選項 */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: inherit;
}

.quiz-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

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

.quiz-option.wrong {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

/* 配對遊戲 */
#match-mode {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#match-mode h2 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}

.match-instruction {
    text-align: center;
    color: #666;
    margin-bottom: 15px;
}

.match-score {
    text-align: center;
    font-size: 1.2rem;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 20px;
}

.match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.match-column h3 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f4ff;
    border-radius: 10px;
}

.match-item {
    padding: 15px;
    margin: 10px 0;
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.match-item:hover {
    border-color: #667eea;
    transform: scale(1.02);
}

.match-item.selected {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.match-item.matched {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
    cursor: default;
}

/* 反饋訊息 */
.feedback {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    display: none;
}

.feedback.show {
    display: block;
    animation: popIn 0.3s ease;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
}

.feedback.wrong {
    background: #f8d7da;
    color: #721c24;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* 完成畫面 */
#complete-screen {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.celebration {
    font-size: 5rem;
    animation: bounce 1s infinite;
}

#complete-screen h2 {
    color: #333;
    font-size: 2rem;
    margin: 20px 0;
}

.score-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
}

.score-display p {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.score-number {
    font-size: 4rem;
    font-weight: bold;
    margin: 10px 0;
}

.reward-section {
    margin: 30px 0;
}

.reward-section p {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
}

.reward-badge {
    font-size: 4rem;
}

/* 響應式設計 */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .line-text {
        font-size: 1.3rem;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
    }
    
    .match-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .poem-blank {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }
}

/* Confetti 動畫 */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease-out forwards;
    z-index: 1000;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}
