/* =================================================================
 * Page Specific Styles for Driver's License Quiz
 * Standard Size & Dark Mode Visibility Fix & Mobile Feedback Fix
 * ================================================================= */

/* --- 新規追加: Typography & Layout Utility Classes --- */
.hero-title-clamp {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.feature-alert {
    max-width: 800px;
    font-size: 0.95rem;
}

.mode-desc {
    font-size: 0.85rem;
}

.quiz-progress {
    height: 6px;
    background-color: var(--bs-secondary-bg);
}

.question-text-wrap {
    min-height: 120px;
}

.question-text-clamp {
    font-size: clamp(1.1rem, 3vw, 1.25rem);
}

.score-display {
    line-height: 1;
}

.th-term {
    width: 20%;
}

.th-meaning {
    width: 40%;
}

.spinner-large {
    width: 3rem;
    height: 3rem;
}

/* --- ローディングオーバーレイ --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1090;
    backdrop-filter: blur(3px);
}

/* --- クイズカード本体 --- */
#quiz-card {
    min-height: 550px;
    position: relative;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
    border-radius: 1rem;
    transition: background-color 0.3s;
}

/* スマホサイズでクイズカードの最小高さを少し抑える */
@media (max-width: 575.98px) {
    #quiz-card {
        min-height: 480px; 
    }
}

/* --- 選択肢ボタン --- */
.option-btn {
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-width: 2px;
    border-radius: 12px;
}

.option-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.option-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- モード選択ボタン --- */
.mode-btn {
    transition: all 0.2s ease;
    border-width: 2px;
    background-color: transparent;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* 1. 一般モード (青) */
.mode-btn[data-mode="general"]:hover {
    background-color: #cfe2ff !important;
    color: #084298 !important;
    border-color: #084298 !important;
}

/* 2. 標識モード (緑) */
.mode-btn[data-mode="sign"]:hover {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
    border-color: #0f5132 !important;
}

/* 3. 危険予測モード (黄) - 視認性修正 */
.mode-btn[data-mode="danger"] {
    color: #856404;
    border-color: #ffc107;
}

.mode-btn[data-mode="danger"]:hover {
    background-color: #fff3cd !important;
    color: #533f03 !important;
    border-color: #ffc107 !important;
}

[data-bs-theme="dark"] .mode-btn[data-mode="danger"] {
    color: #ffc107;
    border-color: #ffc107;
}

[data-bs-theme="dark"] .mode-btn[data-mode="danger"]:hover {
    background-color: #ffc107 !important;
    color: #000000 !important;
}

/* 4. 苦手克服モード (赤) */
.mode-btn[data-mode="weakness"]:hover {
    background-color: #f8d7da !important;
    color: #842029 !important;
    border-color: #842029 !important;
}

/* --- 標識・イラスト画像スタイル --- */
img.sign-image {
    height: auto;
    max-height: 280px;
    width: auto;
    max-width: 100%;
    object-fit: contain;

    background-color: #ffffff !important;
    border-radius: 12px;
    padding: 10px;

    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #dee2e6 !important;

    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

[data-bs-theme="dark"] img.sign-image {
    background-color: #ffffff !important;
    border-color: #495057 !important;
}

img.sign-image:hover {
    transform: scale(1.02);
}

/* --- ダークモード時の視認性修正 --- */

/* ダークモード時の bg-white（用語比較表）はコントラストを落としてなじませる */
[data-bs-theme="dark"] .bg-white {
    background-color: #2c3035 !important;
    color: #c8ced4 !important; /* #e9ecef → 少しトーン落とし。約7:1 のWCAG AAA水準 */
    border: 1px solid rgba(255, 255, 255, 0.08); /* #495057 → 半透明で控えめに */
}

[data-bs-theme="dark"] .bg-white .fw-bold,
[data-bs-theme="dark"] .bg-white .small,
[data-bs-theme="dark"] .bg-white i {
    color: #d6dade !important; /* fw-bold は本文より少しだけ強く */
}

/* 用語比較表のセル罫線も控えめに */
[data-bs-theme="dark"] .bg-white > :not(caption) > * > * {
    border-color: rgba(255, 255, 255, 0.06) !important;
}

[data-bs-theme="dark"] .bg-white thead th {
    background-color: #34393f !important; /* ヘッダーはセルより少し主張 */
    color: #e3e6e9 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ライトモードでも軽くコントラストを抑える */
.bg-white.table {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}
.bg-white.table > :not(caption) > * > * {
    border-color: var(--bs-border-color-translucent) !important;
}

.badge.bg-warning {
    color: #000000 !important;
}

[data-bs-theme="dark"] #question-text {
    color: #ffc107;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* --- フィードバックオーバーレイ --- */
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    display: none;
    z-index: 10;
    animation: fadeIn 0.2s ease-out;
}

[data-bs-theme="dark"] .feedback-overlay {
    background-color: rgba(33, 37, 41, 0.98) !important;
}

.scrollable-feedback {
    max-height: 40vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.text-correct {
    color: #198754 !important;
}

.text-incorrect {
    color: #dc3545 !important;
}

/* --- スタンプ --- */
.pass-stamp,
.fail-stamp {
    display: inline-block;
    padding: 10px 40px;
    font-size: 2.5rem;
    font-family: "Impact", sans-serif;
    font-weight: 800;
    border-radius: 8px;
    transform: rotate(-8deg);
    opacity: 0.9;
    letter-spacing: 0.1em;
}

.pass-stamp {
    color: #198754;
    border: 4px solid #198754;
    background-color: rgba(25, 135, 84, 0.1);
}

.fail-stamp {
    color: #dc3545;
    border: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* --- 記事エリア --- */
.prose {
    line-height: 1.8;
}

.prose h3 {
    border-left: 4px solid var(--bs-primary);
    padding-left: 1rem;
}

/* --- ダークモード基本文字色 --- */
[data-bs-theme="dark"] #quiz-card {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-muted {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .card.bg-light {
    background-color: #343a40 !important;
}

[data-bs-theme="dark"] #feedback-text {
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .list-group-item {
    color: #e9ecef;
    border-color: #495057;
    background-color: transparent;
}