/**
 * クイズゲーム用スタイル
 * ライトモード（デフォルト）とダークモード対応
 * シンプルで洗練されたフラットデザイン
 */

/* ============================================
   共通スタイル
   ============================================ */

/* クイズコンテナ全体 */
.quiz-container {
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    max-width: 800px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 問題文 */
.quiz-question {
    font-size: 1.5rem;
    font-weight: 500;
    color: #333333;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: left; /* 左寄せに変更 */
    line-height: 1.6;
}

/* 選択肢エリア */
.quiz-choices {
    margin: 2rem 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* 選択肢ボタン */
.quiz-choice {
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    background: #ffffff;
    color: #333333;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    min-height: 3rem;
    display: flex;
    align-items: center;
}

.quiz-choice:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #666666;
}

.quiz-choice:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* 選択された状態 */
.quiz-choice.selected {
    border-color: #333333;
    background: #f0f0f0;
    font-weight: 500;
}

/* 正解 */
.quiz-choice.correct {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
    font-weight: 500;
}

.quiz-choice.correct::after {
    content: '◯';
    position: absolute;
    right: 1rem;
    font-size: 1.5rem;
    color: #4caf50;
}

/* 不正解 */
.quiz-choice.incorrect {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.quiz-choice.incorrect::after {
    content: '✕';
    position: absolute;
    right: 1rem;
    font-size: 1.5rem;
    color: #f44336;
}

/* ヒント・解説セクション - 縦配置でコンパクト化 */
.quiz-info-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

/* ヒントコンテナ */
.quiz-hint-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 120px; /* フォントサイズ1.5remに合わせて高さ調整 */
    height: auto; /* 内容に応じて伸縮 */
}

/* 解説コンテナ */
.quiz-explanation-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 120px; /* フォントサイズ1.5remに合わせて高さ調整 */
    height: auto; /* 内容に応じて伸縮 */
}

/* 共通ボタンスタイル - モバイル対応大きめサイズ */
.quiz-hint-toggle,
.quiz-answer-btn {
    /* サイズ統一: 幅180px、高さ48px */
    min-width: 180px;
    height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 1.5rem; /* ★フォントサイズ: ここを変更 */
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 3;
    /* タッチターゲット最小44px推奨を満たす */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 統一ボタンスタイル - ライトモード */
.quiz-hint-toggle,
.quiz-answer-btn {
    border: none;
    background: #ffffff;
    color: #333333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 薄い影で押せる雰囲気 */
}

.quiz-hint-toggle:hover,
.quiz-answer-btn:hover:not(:disabled) {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* ホバー時に影を強調 */
    transform: translateY(-2px); /* 単純にY軸で浮かせる */
}

.quiz-hint-toggle:active,
.quiz-answer-btn:active:not(:disabled) {
    transform: translateY(0); /* 押し込み効果 */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.quiz-hint-toggle.active,
.quiz-answer-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

/* ヒントコンテンツ - フォントサイズ調整箇所 */
.quiz-hint-content {
    padding: 1rem;
    color: #666666;
    font-size: 1.5rem; /* ★フォントサイズ: ここを変更 */
    line-height: 1.6;
    text-align: left; /* 左寄せに変更 */
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 左寄せ配置 */
    min-height: 100%;
}

/* 解説コンテンツ - フォントサイズ調整箇所 */
.quiz-explanation-content {
    padding: 1rem;
    color: #666666;
    font-size: 1.5rem; /* ★フォントサイズ: ここを変更 */
    line-height: 1.6;
    text-align: left; /* 左寄せに変更 */
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 左寄せ配置 */
    min-height: 100%;
}

/* 操作ボタンエリア（下部中央） */
.quiz-controls {
    display: flex;
    justify-content: center;
    margin: 2rem 0 0 0;
    min-height: 50px;
}

/* リセットボタン - 統一スタイル */
.quiz-reset-btn {
    /* サイズ統一: 幅180px、高さ48px */
    min-width: 180px;
    height: 48px;
    padding: 0.75rem 2rem;
    font-size: 1.5rem; /* ★フォントサイズ: ここを変更 */
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #ffffff;
    color: #333333;
    transition: all 0.2s ease;
    opacity: 0.3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 非活性時は薄い影 */
    /* タッチターゲット最小44px推奨を満たす */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quiz-reset-btn.active {
    opacity: 1;
    color: #333333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quiz-reset-btn.active:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.quiz-reset-btn.active:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.quiz-reset-btn:disabled {
    cursor: not-allowed;
}

/* ポップアップメッセージ関連のスタイルは削除 */

/* ボタンが非表示の時のスタイル */
.quiz-hint-toggle.hidden,
.quiz-answer-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* すりガラスオーバーレイ */
.quiz-glass-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* より透明にして、文字が見えそうで見えない効果 */
    background: rgba(255, 255, 255, 0.5);
    /* 微妙なぼかしで、読めそうで読めない感じに */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, backdrop-filter 0.6s ease;
    border-radius: 8px;
}

.quiz-glass-overlay.active {
    opacity: 1;
    visibility: visible;
}

.quiz-glass-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

/* ============================================
   レスポンシブ対応
   ============================================ */
@media (max-width: 768px) {
    .quiz-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .quiz-question {
        padding: 1rem;
    }
    
    .quiz-choice {
        padding: 0.875rem 1rem;
    }
    
    /* モバイルでは既に縦配置なので変更不要 */
    
    .quiz-hint-container,
    .quiz-explanation-container {
        min-height: 100px;
        height: auto; /* モバイルでも内容に応じて伸縮 */
    }
}

/* ============================================
   ダークモード - 漆黒のナイトモード
   ============================================ */
@media (prefers-color-scheme: dark) {
    .quiz-container {
        background: #0a0a0a; /* より深い黒 */
        border: none; /* ボーダーを削除 */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    }
    
    .quiz-question {
        background: #0f0f0f; /* ほぼ黒 */
        color: #e8eaed; /* 読みやすいオフホワイト */
        border: none;
    }
    
    .quiz-choice {
        background: transparent; /* 背景透明 */
        color: #e8eaed;
        border: 1px solid #2a2a2a; /* 最小限のボーダー */
    }
    
    .quiz-choice:hover:not(:disabled) {
        background: rgba(255, 255, 255, 0.05); /* わずかな明るさ */
        border-color: #3a3a3a;
    }
    
    .quiz-choice.selected {
        border-color: #4a4a4a;
        background: rgba(255, 255, 255, 0.08);
    }
    
    /* 正解 - 暗めの緑背景 */
    .quiz-choice.correct {
        background: rgba(76, 175, 80, 0.15);
        border-color: #4caf50;
        color: #81c784;
    }
    
    /* 不正解 - 暗めの赤背景 */
    .quiz-choice.incorrect {
        background: rgba(244, 67, 54, 0.15);
        border-color: #f44336;
        color: #e57373;
    }
    
    .quiz-hint-container,
    .quiz-explanation-container {
        background: #0f0f0f; /* ほぼ黒 */
        border: 1px solid #1a1a1a; /* 最小限のボーダー */
    }
    
    /* すりガラスオーバーレイ - ダークモード */
    .quiz-glass-overlay {
        /* より透明な黒で、文字がもっと見えるように */
        background: rgba(10, 10, 15, 0.5);
        /* 軽いぼかしで見えそうで見えない効果 */
        backdrop-filter: blur(5px) brightness(0.7);
        -webkit-backdrop-filter: blur(5px) brightness(0.7);
    }
    
    /* ボタンのダークモード - 宇宙の藍色の輝き */
    .quiz-hint-toggle,
    .quiz-answer-btn {
        background: rgba(15, 15, 15, 0.8);
        color: #e8eaed;
        border: 1px solid rgba(70, 130, 255, 0.2); /* 藍色の境界線 */
        box-shadow: 0 0 15px rgba(70, 130, 255, 0.15), /* 藍色の輝き */
                    inset 0 0 10px rgba(70, 130, 255, 0.05); /* 内側の輝き */
    }
    
    .quiz-hint-toggle:hover,
    .quiz-answer-btn:hover:not(:disabled) {
        background: rgba(25, 25, 35, 0.9);
        border-color: rgba(70, 130, 255, 0.4);
        box-shadow: 0 0 25px rgba(70, 130, 255, 0.3), /* より強い輝き */
                    inset 0 0 15px rgba(70, 130, 255, 0.1);
        transform: translateY(-2px); /* 単純にY軸で浮かせる */
    }
    
    .quiz-hint-toggle:active,
    .quiz-answer-btn:active:not(:disabled) {
        transform: translateY(0);
        box-shadow: 0 0 10px rgba(70, 130, 255, 0.2),
                    inset 0 0 8px rgba(70, 130, 255, 0.08);
    }
    
    .quiz-hint-content,
    .quiz-explanation-content {
        color: #b8bbbe; /* 読みやすいグレー */
    }
    
    .quiz-reset-btn {
        background: rgba(15, 15, 15, 0.5);
        color: #6a6a6a;
        border: 1px solid rgba(70, 130, 255, 0.1);
        box-shadow: 0 0 8px rgba(70, 130, 255, 0.05);
    }
    
    .quiz-reset-btn.active {
        background: rgba(15, 15, 15, 0.8);
        color: #e8eaed;
        border: 1px solid rgba(70, 130, 255, 0.2);
        box-shadow: 0 0 15px rgba(70, 130, 255, 0.15),
                    inset 0 0 10px rgba(70, 130, 255, 0.05);
    }
    
    .quiz-reset-btn.active:hover {
        background: rgba(25, 25, 35, 0.9);
        border-color: rgba(70, 130, 255, 0.4);
        box-shadow: 0 0 25px rgba(70, 130, 255, 0.3),
                    inset 0 0 15px rgba(70, 130, 255, 0.1);
        transform: translateY(-1px);
    }
    
    .quiz-reset-btn.active:active {
        transform: translateY(0);
        box-shadow: 0 0 10px rgba(70, 130, 255, 0.2),
                    inset 0 0 8px rgba(70, 130, 255, 0.08);
    }
    
    .quiz-message {
        background: #0f0f0f;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    }
    
    .quiz-message.success {
        background: rgba(76, 175, 80, 0.1);
        color: #81c784;
        border: 1px solid rgba(76, 175, 80, 0.3);
    }
    
    .quiz-message.error {
        background: rgba(244, 67, 54, 0.1);
        color: #e57373;
        border: 1px solid rgba(244, 67, 54, 0.3);
    }
    
    .quiz-message.warning {
        background: rgba(255, 152, 0, 0.1);
        color: #ffb74d;
        border: 1px solid rgba(255, 152, 0, 0.3);
    }
}

/* ============================================
   アクセシビリティ
   ============================================ */
.quiz-choice:focus,
.quiz-hint-toggle:focus,
.quiz-answer-btn:focus,
.quiz-reset-btn:focus {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* ダークモードでのフォーカス */
@media (prefers-color-scheme: dark) {
    .quiz-choice:focus,
    .quiz-hint-toggle:focus,
    .quiz-answer-btn:focus,
    .quiz-reset-btn:focus {
        outline-color: #64b5f6;
    }
}