/* ================================================================
   英検クイズ フロントエンド CSS
   eiken-quiz/assets/eiken-quiz.css
   ================================================================ */

/* ── ラッパー ── */
.eiken-quiz-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

/* ── 管理画面（問題入力フォーム） ── */
.eiken-admin-wrap {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 0;
}

/* ── スタート画面 ── */
.eq-start-screen {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.eq-start-inner {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 48px 48px 40px;
    text-align: center;
    max-width: 480px;
    width: 100%;
}
.eq-start-badge {
    display: inline-block;
    background: #D75A30;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 18px;
    border-radius: 20px;
    margin-bottom: 16px;
}
.eq-start-section {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 28px;
}
.eq-start-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 36px;
    padding: 20px;
    background: #f5f5f0;
    border-radius: 12px;
}
.eq-start-stat { text-align: center; }
.eq-start-stat-num   { display: block; font-size: 22px; font-weight: 700; color: #D75A30; }
.eq-start-stat-label { display: block; font-size: 11px; color: #999; margin-top: 2px; }
.eq-start-btn {
    background: #D75A30;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 16px 48px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}
.eq-start-btn:active { opacity: 0.85; }

@media (max-width: 768px) {
    .eq-start-inner { padding: 32px 20px; }
    .eq-start-stats { gap: 16px; }
    .eq-start-stat-num { font-size: 18px; }
}

/* ── トップバー ── */
.eq-topbar {
    background: #D75A30;
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    color: #fff;
}
.eq-topbar-info { display: flex; flex-direction: column; gap: 3px; }
.eq-topbar-title { font-size: 15px; font-weight: 500; }
.eq-topbar-sub   { font-size: 12px; opacity: 0.8; }

/* タイマーリング */
.eq-timer-ring-wrap { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.eq-timer-ring-wrap svg {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
    display: block;
}
.eq-timer-track { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 5; }
.eq-timer-arc   { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round;
    transition: stroke-dashoffset 0.9s linear, stroke 0.3s; }
.eq-timer-num {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; color: #fff;
    line-height: 1;
}
.eq-timer-num.overtime { color: #FFB3A0; }

/* プログレス */
.eq-progress-area { flex: 1; }
.eq-progress-bar-wrap { background: rgba(255,255,255,0.3); border-radius: 99px; height: 6px; }
.eq-progress-bar-fill { background: #fff; height: 6px; border-radius: 99px; transition: width 0.4s ease; }
.eq-progress-labels { display: flex; justify-content: space-between; margin-top: 5px; font-size: 12px; color: rgba(255,255,255,0.85); }
.eq-qnum-badge { background: rgba(255,255,255,0.2); font-size: 13px; padding: 6px 14px; border-radius: 20px; white-space: nowrap; }
.eq-set-badge  { background: rgba(255,255,255,0.35); font-size: 14px; font-weight: 600; padding: 6px 16px; border-radius: 20px; white-space: nowrap; letter-spacing: 0.04em; }

/* ── セットブレイク画面 ── */
.eq-set-break { display: none; }
.eq-set-break.show { display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.eq-set-break-inner { background: #fff; border: 1px solid #e8e8e8; border-radius: 16px; padding: 40px 48px; text-align: center; }
.eq-set-break-num   { font-size: 28px; font-weight: 600; color: #D75A30; margin-bottom: 12px; }
.eq-set-break-score { font-size: 18px; color: #333; margin-bottom: 28px; }
.eq-sb-score        { font-size: 36px; font-weight: 600; color: #1D9E75; }
.eq-set-next-btn {
    background: #D75A30; color: #fff; border: none;
    border-radius: 12px; padding: 14px 32px;
    font-size: 16px; font-weight: 500; font-family: inherit;
    cursor: pointer;
}
.eq-set-next-btn:active { opacity: 0.85; }

/* ── 問題文カード（1段全幅） ── */
.eq-question-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 10px 32px;
    margin-bottom: 16px;
}
.eq-q-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.eq-q-label {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.eq-font-btn {
    background: #D75A30;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.eq-font-btn:active { opacity: 0.8; }
.eq-q-text {
    font-size: 18px;
    color: #1a1a1a;
    line-height: 1.85;
}
.eq-q-speaker { font-size: 14px; font-weight: 500; color: #777; }
.eq-q-blank {
    display: inline-block;
    border-bottom: 2.5px solid #D75A30;
    min-width: 80px;
    text-align: center;
    color: #D75A30;
    font-weight: 500;
    padding: 0 6px;
    vertical-align: bottom;
}

/* ── 選択肢：1列（デフォルト・短い選択肢） ── */
.eq-choices-1col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── 選択肢：2列（長い選択肢・準1級など） ── */
.eq-choices-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ── 選択肢ボタン ── */
.eq-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    text-align: left;
    color: #1a1a1a;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.eq-choice-btn:hover:not(.disabled) {
    border-color: #bbb;
    background: #fafafa;
}
.eq-choice-btn:active:not(.disabled) { transform: scale(0.99); }

.eq-choice-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500; color: #666;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

/* 正解 */
.eq-choice-btn.correct { border-color: #1D9E75; background: #E1F5EE; }
.eq-choice-btn.correct .eq-choice-num { background: #1D9E75; color: #fff; }

/* 不正解 */
.eq-choice-btn.wrong { border-color: #E24B4A; background: #FCEBEB; }
.eq-choice-btn.wrong .eq-choice-num { background: #E24B4A; color: #fff; }

.eq-choice-btn.disabled { cursor: default; }

/* ── フィードバック ── */
.eq-feedback {
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.7;
    display: none;
    margin-top: 12px;
}
.eq-feedback.show { display: block; }
.eq-feedback.correct { background: #E1F5EE; color: #0F6E56; border: 1px solid #5DCAA5; }
.eq-feedback.wrong   { background: #FCEBEB; color: #A32D2D; border: 1px solid #F09595; }

/* 解説・日本語訳 */
.eq-extra-info      { margin-top: 10px; border-top: 1px solid rgba(0,0,0,0.08); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.eq-translation,
.eq-explanation     { font-size: 13px; color: #444; line-height: 1.6; }
.eq-extra-label     { display: inline-block; font-size: 10px; font-weight: 600; background: rgba(0,0,0,0.08); border-radius: 3px; padding: 1px 6px; margin-right: 6px; color: #555; vertical-align: middle; }
.eq-highlight       { color: #E24B4A; font-weight: 600; }

/* ── 次へボタン ── */
.eq-next-btn {
    background: #D75A30;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    width: 100%;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: none;
    margin-top: 12px;
    transition: opacity 0.15s;
}
.eq-next-btn.show { display: block; }
.eq-next-btn:active { opacity: 0.85; }

/* ── 結果画面 ── */
/* ── 結果グリッド（番号＋⭕/❌） ── */
.eq-result-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 10px 8px 4px;
    margin-bottom: 4px;
}
.eq-result-grid-item {
    position: relative;
    width: 40px;
    height: 40px;
}
.eq-result-grid-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5e6e0;
    font-size: 14px;
    font-weight: 700;
    color: #D75A30;
}
.eq-result-grid-num.ok { background: #e8f5e9; color: #2e7d32; }
.eq-result-grid-num.ng { background: #fff3f3; color: #c62828; }
.eq-result-grid-mark {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 13px;
    line-height: 1;
    pointer-events: none;
}

.eq-result { display: none; }
.eq-result.show { display: block; }

.eq-result-header {
    background: #D75A30;
    border-radius: 12px;
    padding: 36px 32px;
    text-align: center;
    color: #fff;
    margin-bottom: 16px;
}
.eq-result-score-big   { font-size: 56px; font-weight: 500; line-height: 1; }
.eq-result-score-label { font-size: 14px; opacity: 0.85; margin-top: 6px; }
.eq-result-title       { font-size: 22px; font-weight: 500; margin-top: 14px; }
.eq-result-sub         { font-size: 14px; opacity: 0.85; margin-top: 6px; }

.eq-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.eq-stat-card { background: #f5f5f0; border-radius: 8px; padding: 18px; text-align: center; }
.eq-stat-num   { font-size: 28px; font-weight: 500; }
.eq-stat-label { font-size: 12px; color: #888; margin-top: 4px; }

.eq-result-btn-row { display: flex; gap: 12px; margin-top: 4px; }
.eq-result-restart {
    background: #D75A30; color: #fff; border: none;
    border-radius: 12px; padding: 14px;
    font-size: 15px; font-weight: 500; font-family: inherit;
    cursor: pointer; flex: 1;
}
.eq-result-back {
    background: #f0f0f0; color: #666;
    border: 1px solid #ddd;
    border-radius: 12px; padding: 14px;
    font-size: 14px; font-family: inherit;
    cursor: pointer; flex: 1;
}
.eq-result-other-set {
    background: #1D9E75; color: #fff; border: none;
    border-radius: 12px; padding: 14px;
    font-size: 15px; font-weight: 500; font-family: inherit;
    cursor: pointer; flex: 1;
}

/* ── PC用 数字ボタンバー ── */
.eq-mob-num-bar {
    margin-top: 12px;
}

/* ── テキストリスト＋数字ボタン ── */
.eq-choice-text-list {
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}
.eq-choice-text-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #1a1a1a;
    line-height: 1.5;
}
.eq-choice-text-row:last-child { border-bottom: none; }
.eq-choice-text-num {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    min-width: 14px;
    flex-shrink: 0;
    padding-top: 1px;
}
.eq-choice-text-row.correct .eq-choice-text-num,
.eq-choice-text-row.correct .eq-choice-text-content { color: #1D9E75; font-weight: 500; }
.eq-choice-text-row.wrong   { opacity: 0.5; }
.eq-choice-text-row.wrong .eq-choice-text-content   { text-decoration: line-through; }

.eq-num-btn-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 4px;
}
.eq-num-btn {
    height: 60px;
    font-size: 24px;
    font-weight: 700;
    color: #555;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.eq-num-btn:active:not(.disabled)  { background: #f5f5f0; }
.eq-num-btn.correct  { background: #E1F5EE; color: #1D9E75; border-color: #1D9E75; }
.eq-num-btn.wrong    { background: #FCEBEB; color: #E24B4A; border-color: #E24B4A; }
.eq-num-btn.disabled { cursor: default; }

/* ── スクロールヒント ── */
@keyframes eq-hint-bounce {
    0%, 100% { transform: translateY(0);   opacity: 0.7; }
    50%       { transform: translateY(6px); opacity: 1;   }
}
.eq-scroll-hint { display: none; }
.eq-scroll-hint.show {
    display: block;
    position: sticky;
    bottom: 6px;
    text-align: center;
    padding: 4px 0 2px;
    animation: eq-hint-bounce 0.85s ease-in-out infinite;
    pointer-events: none;
}
.eq-scroll-hint.show::before {
    content: '解説をcheck!';
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #e8b800;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.eq-scroll-hint.show::after {
    content: '↓';
    display: block;
    font-size: 25px;
    font-weight: 900;
    color: #e8b800;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* ── PC用（769px以上）固定高さレイアウト ── */
@media (min-width: 769px) {
    .eq-quiz-area {
        display: flex;
        flex-direction: column;
        height: 620px;
    }
    .eq-topbar        { flex-shrink: 0; }
    .eq-question-card { flex-shrink: 0; }
    .eq-scroll-body {
        flex: 1;
        overflow-y: auto;
        padding: 4px 0 4px;
    }
    .eq-next-btn  { flex-shrink: 0; }
    .eq-mob-num-bar {
        flex-shrink: 0;
        background: #fafaf8;
        border-top: 1px solid #e8e8e8;
        padding: 12px 0 4px;
        margin-top: 0;
    }
    .eq-mob-num-bar .eq-num-btn-row { margin-bottom: 0; }
}

/* ── スマホ用（768px以下） ── */
@media (max-width: 768px) {
    /* クイズ中: header/ナビを非表示 */
    body.eq-quiz-active header.header,
    body.eq-quiz-active .header,
    body.eq-quiz-active #g_nav,
    body.eq-quiz-active .g_nav-sp,
    body.eq-quiz-active #wpadminbar { display: none !important; }
    body.eq-quiz-active { overflow: hidden; }

    /* クイズUI: 全画面固定フレックス */
    .eq-quiz-area {
        position: fixed !important;
        inset: 0;
        flex-direction: column;
        background: #fafaf8;
        z-index: 9999;
        overflow: hidden;
        display: none;
    }

    /* 上部スクロールエリア（topbar + 問題 + 選択肢テキスト + フィードバック） */
    .eq-topbar {
        flex-shrink: 0;
        flex-wrap: wrap;
        padding: 10px 14px;
        gap: 10px;
        border-radius: 0;
    }
    .eq-topbar-info { order: 1; flex: 1; }
    .eq-qnum-badge  { order: 2; }
    .eq-timer-ring-wrap { order: 3; width: 46px; height: 46px; }
    .eq-timer-num   { font-size: 17px; }
    .eq-progress-area { order: 4; width: 100%; flex: unset; }

    .eq-question-card {
        flex-shrink: 0;
        padding: 7px 14px 5px;
        margin-bottom: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
    }
    .eq-q-label-row { margin-bottom: 6px; }
    .eq-q-text { font-size: 15px; }

    .eq-choices-wrap {
        padding: 0;
    }

    /* スマホでは常に1列 */
    .eq-choices-2col { grid-template-columns: 1fr; }
    .eq-choice-btn { font-size: 14px; padding: 12px 14px; }
    .eq-choice-num { width: 28px; height: 28px; font-size: 12px; }

    .eq-feedback {
        margin: 8px 0 4px;
        border-radius: 8px;
    }
    .eq-next-btn { flex-shrink: 0; margin: 4px 12px 4px; border-radius: 8px; width: auto; box-sizing: border-box; }

    /* スクロール可能ボディ（選択肢テキスト＋フィードバック） */
    .eq-scroll-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 12px 4px;
    }

    /* 数字ボタン固定下バー */
    .eq-mob-num-bar {
        flex-shrink: 0;
        background: #fff;
        border-top: 1px solid #e8e8e8;
        padding: 10px 12px 14px;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
    }
    .eq-mob-num-bar .eq-num-btn-row { margin-bottom: 0; }

    .eq-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .eq-result-score-big { font-size: 40px; }
    .eq-result-header { padding: 24px 16px; }

}

/* ── スマホ結果画面: フルスクリーン固定 + ボタン sticky ── */
body.eq-result-active { overflow: hidden; }
body.eq-result-active .eq-result.show {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 0;
    background: #fff;
    z-index: 100;
    display: flex;
    flex-direction: column;
}
body.eq-result-active .eq-result-btn-row {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px 0 16px;
    margin-top: auto;
    border-top: 1px solid #f0f0f0;
}
