/* カスタムスタイル */

/* フラッシュカードアニメーション */
#flashcard-container {
    transition: all 0.3s ease-in-out;
}

/* ホバーエフェクト */
.flashcard-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 正解時のアニメーション */
.correct-animation {
    animation: correctPulse 0.6s ease-in-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background-color: #dcfce7; }
    100% { transform: scale(1); }
}

/* 不正解時のアニメーション */
.incorrect-animation {
    animation: incorrectShake 0.6s ease-in-out;
}

@keyframes incorrectShake {
    0%, 20%, 40%, 60%, 80%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
}

/* スコアアニメーション */
.score-update {
    animation: scoreHighlight 0.5s ease-in-out;
}

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

/* 読み込み中のスピナー */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* レスポンシブデザイン */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 1.875rem;
    }
    
    .text-2xl {
        font-size: 1.5rem;
    }
}

/* カードの影とグラデーション */
.card-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-shadow {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* フォーカス時のアクセシビリティ */
button:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* 日本語フォントの最適化 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans CJK JP', 'Noto Sans JP', sans-serif;
}

/* 音声認識関連のアニメーション */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

/* 音声入力ボタンのホバー効果 */
#voice-btn {
    position: relative;
    overflow: hidden;
}

#voice-btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#voice-btn:active:before {
    width: 300px;
    height: 300px;
}

/* 解説セクションのアニメーション */
#explanation-section {
    animation: slideIn 0.5s ease-out;
}

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

/* 比較セクションのスタイル */
#comparison-section {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 音声認識中の視覚的フィードバック */
.recording {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
    animation: recordingPulse 1.5s ease-in-out infinite;
}

@keyframes recordingPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ユーザー回答の表示エフェクト */
#user-answer-display {
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}