/* Quiz4 CSS - 確実動作版（中央寄せ対応）*/
/* 配置場所: assets/quiz4.css */

/* 外ラッパー - 確実に中央配置 */
.quiz4-outer {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 60vh;
    padding: 20px;
    margin: 0 auto !important;
}

/* ルート要素 */
.quiz4-root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.quiz4-root * {
    box-sizing: border-box;
}

/* 読み込み中 */
.quiz4-loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
}

/* メインコンテナ */
.quiz4-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 20px;
    margin: 0 auto;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* セットアップ画面 */
.quiz4-setup {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
}

.quiz4-setup h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz4-setup p {
    margin: 10px 0;
    color: #6b7280;
    font-size: 1.1rem;
}

/* クイズ画面 */
.quiz4-wrap {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* ヘッダー */
.quiz4-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
    flex-wrap: wrap;
    gap: 15px;
}

.quiz4-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
    min-width: 200px;
}

.quiz4-progress {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quiz4-progress-bar {
    width: 150px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

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

.quiz4-timer {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.quiz4-timer.warning {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: pulse 1s infinite;
}

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

/* 質問エリア */
.quiz4-question-container {
    margin-bottom: 30px;
}

.quiz4-question {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: #1f2937;
    text-align: center;
    line-height: 1.5;
}

/* 選択肢 */
.quiz4-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.quiz4-choice {
    padding: 20px;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 選択肢の色分け */
.quiz4-choice:nth-child(1) {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.quiz4-choice:nth-child(2) {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.quiz4-choice:nth-child(3) {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.quiz4-choice:nth-child(4) {
    background: linear-gradient(135deg, #10b981, #059669);
}

.quiz4-choice:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 回答状態 */
.quiz4-choice.correct {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    animation: correctPulse 0.6s ease;
}

.quiz4-choice.incorrect {
    background: linear-gradient(135deg, #7f1d1d, #991b1b) !important;
    animation: incorrectShake 0.6s ease;
}

.quiz4-choice.dimmed {
    opacity: 0.4;
    transform: none;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

/* 解説 */
.quiz4-explanation {
    background: #f8faff;
    border-left: 4px solid #667eea;
    padding: 20px;
    border-radius: 0 10px 10px 0;
    margin: 20px 0;
    display: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.quiz4-explanation.show {
    display: block;
    animation: slideIn 0.3s ease;
}

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

/* フッター */
.quiz4-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.quiz4-counter {
    color: #6b7280;
    font-weight: 600;
}

/* ボタン */
.quiz4-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    margin: 5px;
}

.quiz4-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.quiz4-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.quiz4-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quiz4-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* 結果画面 */
.quiz4-results {
    text-align: center;
}

.quiz4-results-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #1f2937;
}

.quiz4-score {
    font-size: 3rem;
    font-weight: 800;
    margin: 20px 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz4-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.quiz4-stat-card {
    background: linear-gradient(135deg, #f8faff, #f0f6fc);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.quiz4-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: #667eea;
    margin-bottom: 5px;
}

.quiz4-stat-label {
    color: #6b7280;
    font-weight: 600;
    font-size: 0.9rem;
}

/* エラー表示 */
.quiz4-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 2px solid #fecaca;
    border-radius: 15px;
    padding: 25px;
    color: #991b1b;
    text-align: center;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
}

.quiz4-error h3 {
    margin: 0 0 10px 0;
    color: #dc2626;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .quiz4-outer {
        padding: 10px;
        min-height: 50vh;
    }
    
    .quiz4-container {
        padding: 15px;
    }
    
    .quiz4-setup, .quiz4-wrap {
        padding: 20px;
    }
    
    .quiz4-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .quiz4-title {
        font-size: 1.3rem;
    }
    
    .quiz4-question {
        font-size: 1.1rem;
    }
    
    .quiz4-choices {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .quiz4-choice {
        padding: 15px;
        min-height: 60px;
        font-size: 0.9rem;
    }
    
    .quiz4-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .quiz4-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .quiz4-score {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .quiz4-setup h1 {
        font-size: 1.5rem;
    }
    
    .quiz4-choice {
        padding: 12px;
        min-height: 50px;
    }
    
    .quiz4-btn {
        width: 100%;
        margin: 5px 0;
    }
}