/* ===== Exam page header (spi_top と統一) ===== */
.spi-exam-page {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: #fff;
    font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
}
.spi-exam-page * { box-sizing: border-box; }
.spi-exam-page-header {
    background: #26A69A;
    padding: 16px 36px;
    display: flex; align-items: center; gap: 18px;
}
.spi-exam-page-brand { display: inline-flex; align-items: center; text-decoration: none; }
.spi-exam-page-logo-img { display: block; height: 44px; width: auto; transition: transform .22s ease; }
.spi-exam-page-brand:hover .spi-exam-page-logo-img { transform: translateY(-2px); }
.spi-exam-page-divider { width: 1px; height: 28px; background: rgba(255,255,255,.5); }
.spi-exam-page-sub { font-size: 18px; font-weight: 500; color: #fff; letter-spacing: .06em; }
@media (max-width: 720px) {
    .spi-exam-page-header { padding: 12px 16px; gap: 12px; }
    .spi-exam-page-logo-img { height: 36px; }
    .spi-exam-page-sub { font-size: 14px; }
}

#spi-exam-app.spi-quiz {
    --spi-green: #26A69A;
    --spi-green-dark: #1f8a80;
    --spi-green-light: #E4F8F6;
    --spi-yellow: #f1c40f;
    --spi-red: #e04e4e;
    --spi-text: #1f2328;
    --spi-muted: #6a737d;
    --spi-border: #e1e4e8;
    --spi-surface: #f6f8fa;
    max-width: 980px;
    margin: 2em auto;
    background: #fff;
    color: var(--spi-text);
    line-height: 1.7;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
    padding: 1.8em 2em;
}
#spi-exam-app.spi-quiz * { box-sizing: border-box; }

/* ===== 共通ボタン ===== */
.spi-quiz-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .7em 1.5em; border-radius: 6px; font-weight: 700; border: 1px solid transparent; background: var(--spi-surface); color: var(--spi-text); cursor: pointer; font-size: 1em; text-decoration: none; transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s; }
.spi-quiz-btn-primary { background: var(--spi-green); color: #fff; border-color: var(--spi-green); }
.spi-quiz-btn-primary:hover { background: var(--spi-green-dark); border-color: var(--spi-green-dark); }
.spi-quiz-btn-next { background: #4a7fd0; color: #fff; border-color: #4a7fd0; padding: .75em 1.8em; border-radius: 4px; }
.spi-quiz-btn-next:hover:not(:disabled) { background: #3a6cbb; border-color: #3a6cbb; }
.spi-quiz-btn-next:disabled { background: #b0bec5; border-color: #b0bec5; cursor: not-allowed; opacity: .7; }
.spi-quiz-btn-ghost { background: #fff; color: var(--spi-green-dark); border-color: var(--spi-border); }
.spi-quiz-btn-ghost:hover { border-color: var(--spi-green); }

/* ===== スタート ===== */
.spi-quiz-start { padding: 2em 1em; text-align: center; }
.spi-quiz-start-title { margin: 0 0 .8em; font-size: 1.5em; color: var(--spi-text); }
.spi-quiz-start-lead { margin: 0 0 1.6em; color: var(--spi-muted); }

/* ===== ヘッダー ===== */
.spi-quiz-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5em; margin-bottom: 1.4em; }
.spi-quiz-head-left { flex: 1; min-width: 0; }
.spi-exam-page .spi-quiz-title { padding: 0; border: 0; background: none; font-size: 1.3em; font-weight: 700; margin: 0 0 .7em; color: var(--spi-text); }
.spi-exam-page .spi-quiz-title::before,
.spi-exam-page .spi-quiz-title::after { content: none; display: none; }
.spi-quiz-instruction { display: none; }

/* ===== 右上：2重リングメーター ===== */
.spi-quiz-meter { display: flex; align-items: center; gap: .8em; flex: none; }
.spi-quiz-meter-chart { width: 86px; height: 86px; position: relative; flex: none; }
.spi-quiz-meter-chart svg { width: 100%; height: 100%; }
.spi-quiz-pie-bg        { fill: #eef1f3; }
.spi-quiz-wedge-time    { fill: #a5d6a7; transition: fill .3s; }
.spi-quiz-wedge-progress{ fill: #fdf3a0; }
.spi-quiz-meter.is-warn   .spi-quiz-wedge-time { fill: #f3c66c; }
.spi-quiz-meter.is-danger .spi-quiz-wedge-time { fill: #e88c8c; }

.spi-exam-page .spi-quiz-meter-legend { list-style: none; padding: 0; margin: 0; font-size: .82em; color: var(--spi-muted); line-height: 1.6; }
.spi-quiz-meter-legend li { display: flex; align-items: center; gap: .4em; }
.spi-quiz-meter-legend em { font-style: normal; font-weight: 700; color: var(--spi-text); font-variant-numeric: tabular-nums; margin-left: .2em; }
.spi-quiz-meter-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.spi-quiz-meter-legend .dot-time     { background: var(--spi-green); }
.spi-quiz-meter-legend .dot-progress { background: var(--spi-yellow); }

/* ===== 本体（左：問題 / 右：選択肢） ===== */
.spi-quiz-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5em; padding-top: 1em; border-top: 1px solid var(--spi-border); }
.spi-quiz-question { background: #f6fffe; border: 1.5px solid var(--spi-green); border-left: 5px solid var(--spi-green); border-radius: 8px; padding: 1.2em 1.4em; }
.spi-quiz-question-text { font-size: 1.08em; font-weight: 700; line-height: 1.9; margin: 0; white-space: pre-wrap; color: var(--spi-text); }
.spi-quiz-qnum { font-weight: 800; color: var(--spi-green-dark); margin-right: .2em; font-size: 1.05em; }
.spi-quiz-question-figure { margin: 1em auto 0; display: flex; justify-content: center; }
.spi-quiz-question-figure svg { max-width: 100%; height: auto; display: block; }
.spi-quiz-question-figure[hidden] { display: none; }
.spi-quiz-review-figure { margin: .8em 0 0; display: flex; justify-content: center; }
.spi-quiz-review-figure svg { max-width: 360px; width: 100%; height: auto; display: block; }

.spi-quiz-choices { display: flex; flex-direction: column; gap: .5em; }
.spi-quiz-choice { display: flex; align-items: center; gap: .8em; padding: .9em 1.2em; border: 1px solid var(--spi-border); border-radius: 6px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.spi-quiz-choice:hover { border-color: var(--spi-green); }
.spi-quiz-choice.is-selected { border-color: var(--spi-green); background: var(--spi-green-light); }
.spi-quiz-choice input { margin: 0; accent-color: var(--spi-green); width: 18px; height: 18px; flex: none; }
.spi-quiz-choice-text { flex: 1; color: var(--spi-text); }

/* ===== フッター ===== */
.spi-quiz-footer { padding-top: 1.4em; display: flex; align-items: center; gap: 1.2em; }
.spi-quiz-timebar { display: flex; align-items: center; gap: .8em; flex: 1; min-width: 0; }
.spi-quiz-timebar-label { font-size: .85em; color: var(--spi-text); font-weight: 700; flex: none; }
.spi-quiz-timebar-track { position: relative; flex: 1; display: flex; gap: 3px; height: 22px; min-width: 0; }
.spi-quiz-timebar-seg { flex: 1; min-width: 0; border-radius: 2px; transition: filter .2s; }
.spi-quiz-timebar-marker { position: absolute; top: -10px; transform: translateX(-50%); width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid #1f2328; pointer-events: none; will-change: left; }
.spi-quiz-next { min-width: 110px; flex: none; }

/* ===== スコア帯カード ===== */
.spi-quiz-tier-card { display: flex; align-items: center; gap: 1.2em; padding: 1.4em 1.6em; border-radius: 12px; margin: 1.4em 0; border: 2px solid transparent; }
.spi-quiz-tier-card.is-low  { background: #fff7f0; border-color: #f59e6a; }
.spi-quiz-tier-card.is-mid  { background: #fffbeb; border-color: #f1c40f; }
.spi-quiz-tier-card.is-high { background: #f0fdf8; border-color: #26A69A; }
.spi-quiz-tier-emoji { font-size: 2.8em; line-height: 1; flex: none; }
.spi-quiz-tier-body { flex: 1; min-width: 0; }
.spi-quiz-tier-label { font-size: 1.1em; font-weight: 800; margin: 0 0 .3em; }
.spi-quiz-tier-card.is-low  .spi-quiz-tier-label { color: #c2520a; }
.spi-quiz-tier-card.is-mid  .spi-quiz-tier-label { color: #92620a; }
.spi-quiz-tier-card.is-high .spi-quiz-tier-label { color: #1f8a80; }
.spi-quiz-tier-msg { font-size: .88em; color: var(--spi-muted); margin: 0 0 .8em; line-height: 1.6; }
.spi-quiz-tier-cta { display: inline-block; padding: .65em 1.6em; border-radius: 8px; font-size: .95em; font-weight: 700; text-decoration: none; color: #fff; }
.spi-quiz-tier-card.is-low  .spi-quiz-tier-cta,
.spi-quiz-tier-card.is-mid  .spi-quiz-tier-cta { background: #f59e0b; }
.spi-quiz-tier-card.is-high .spi-quiz-tier-cta { background: var(--spi-green); }

/* ===== フィードバック ===== */
.spi-quiz-feedback { margin: 2em 0 0; padding: 0; background: none; border: 0; }
.spi-quiz-feedback-iframe-wrap {
    width: 100%;
    overflow: hidden;
}
.spi-quiz-feedback-iframe {
    display: block;
    width: 100%;
    height: 453px;
    border: 0;
}
@media (max-width: 720px) {
    .spi-quiz-feedback-iframe { height: 600px; }
}

/* ===== 結果 ===== */
.spi-quiz-result { padding: 1em 0; }
.spi-exam-page .spi-quiz-result-title { padding: 0; border: 0; background: none; margin: 0 0 1em; color: var(--spi-green-dark); text-align: center; font-size: 1.4em; }
.spi-exam-page .spi-quiz-result-title::before,
.spi-exam-page .spi-quiz-result-title::after { content: none; display: none; }

/* ===== Lognavi 誘導（spi-topの白カード基調に合わせて） ===== */
.spi-quiz-lognavi { margin: 36px auto 16px; max-width: 520px; }
.spi-quiz-lognavi-card {
    position: relative;
    padding: 28px 28px 26px;
    background: #fff;
    border: 1px solid #EAF2F1;
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(38,166,154,.06);
}
.spi-quiz-lognavi-eyebrow {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 14px;
}
.spi-quiz-lognavi-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #E4F8F6;
    color: #1f8a80;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    border-radius: 999px;
}
.spi-quiz-lognavi-brandname {
    font-size: 13px;
    font-weight: 600;
    color: #1f8a80;
    letter-spacing: .04em;
}
.spi-exam-page .spi-quiz-lognavi-headline {
    margin: 0 0 12px;
    padding: 0; border: 0; background: none;
    font-size: 22px; font-weight: 500;
    line-height: 1.55;
    color: #1a1a1a;
    letter-spacing: .02em;
}
.spi-exam-page .spi-quiz-lognavi-headline::before,
.spi-exam-page .spi-quiz-lognavi-headline::after { content: none; display: none; }
.spi-quiz-lognavi-headline .is-accent { color: #26A69A; font-weight: 600; }
.spi-quiz-lognavi-lead {
    margin: 0 0 22px;
    font-size: 13.5px;
    line-height: 1.7;
    color: #5d6f6c;
}
.spi-quiz-lognavi-lead strong { color: #1f8a80; font-weight: 600; }
.spi-exam-page .spi-quiz-lognavi-feats {
    list-style: none;
    margin: 0 0 24px;
    padding: 16px 18px;
    background: #F8FCFB;
    border-radius: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 10px;
}
.spi-exam-page .spi-quiz-lognavi-feats li {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 0; margin: 0;
    font-size: 12px;
    color: #5d6f6c;
    letter-spacing: .02em;
    text-align: center;
    flex: 1;
}
.spi-quiz-lognavi-feat-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: #E4F8F6;
    border-radius: 50%;
}
.spi-quiz-lognavi-feat-text { font-weight: 500; }
.spi-quiz-lognavi-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 15px 22px;
    background: #26A69A; color: #fff;
    border-radius: 12px;
    font-weight: 500; font-size: 15px;
    letter-spacing: .04em;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(38,166,154,.22);
    transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s cubic-bezier(.2,.8,.2,1), background .18s ease;
}
.spi-quiz-lognavi-cta:hover {
    transform: translateY(-2px);
    background: #1f8a80;
    box-shadow: 0 12px 24px rgba(38,166,154,.32);
    color: #fff;
}
.spi-quiz-lognavi-cta-arrow {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    background: rgba(255,255,255,.18);
    border-radius: 50%;
}
@media (max-width: 720px) {
    .spi-quiz-lognavi { margin: 28px 0 12px; }
    .spi-quiz-lognavi-card { padding: 22px 20px 20px; }
    .spi-exam-page .spi-quiz-lognavi-headline { font-size: 18px; margin-bottom: 10px; }
    .spi-quiz-lognavi-lead { font-size: 12.5px; margin-bottom: 18px; }
    .spi-exam-page .spi-quiz-lognavi-feats { padding: 14px 12px; gap: 6px; margin-bottom: 20px; }
    .spi-exam-page .spi-quiz-lognavi-feats li { font-size: 11px; }
    .spi-quiz-lognavi-feat-icon { width: 32px; height: 32px; }
    .spi-quiz-lognavi-cta { padding: 14px 18px; font-size: 14px; }
}
.spi-quiz-result-summary { display: flex; gap: 2em; justify-content: center; align-items: center; padding: 1.5em; background: var(--spi-green-light); border-radius: 10px; margin-bottom: 1.5em; flex-wrap: wrap; }
.spi-quiz-result-summary div { text-align: center; }
.spi-quiz-result-summary .label { font-size: .85em; color: var(--spi-muted); display: block; margin-bottom: .3em; }
.spi-quiz-result-summary .value { font-size: 1.7em; font-weight: 700; color: var(--spi-green-dark); font-variant-numeric: tabular-nums; }
.spi-quiz-result-list { display: flex; flex-direction: column; gap: .8em; }
.spi-quiz-review { padding: 1em 1.2em; border: 1px solid var(--spi-border); border-left-width: 4px; background: #fff; border-radius: 6px; }
.spi-quiz-review.is-correct { border-left-color: var(--spi-green); }
.spi-quiz-review.is-wrong   { border-left-color: var(--spi-red); }
.spi-quiz-review-head { display: flex; gap: .6em; align-items: center; margin-bottom: .3em; font-weight: 700; flex-wrap: wrap; }
.spi-quiz-review.is-correct .spi-quiz-review-verdict { color: var(--spi-green-dark); }
.spi-quiz-review.is-wrong   .spi-quiz-review-verdict { color: var(--spi-red); }
.spi-quiz-tag { display: inline-block; font-size: .75em; padding: .15em .7em; border-radius: 999px; background: var(--spi-green-light); color: var(--spi-green-dark); font-weight: 700; }
.spi-quiz-review dl { margin: .4em 0 0; font-size: .95em; }
.spi-quiz-review dt { font-weight: 700; color: var(--spi-muted); margin-top: .4em; }
.spi-quiz-review dd { margin: 0 0 0 1em; white-space: pre-wrap; }
.spi-quiz-result-actions { margin-top: 1.5em; text-align: center; }

/* ===== Result gate (LINE → PW) ===== */
.spi-quiz-gate { display: flex; justify-content: center; padding: 1em 0 .5em; }
.spi-quiz-gate[hidden] { display: none; }
.spi-quiz-gate-card {
    width: 100%; max-width: 460px;
    background: linear-gradient(180deg, #FBFFFE 0%, #F2FBFA 100%);
    border: 1.4px solid #B6E9E4;
    border-radius: 18px;
    padding: 32px 28px 28px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(38,166,154,.10);
}
.spi-quiz-gate-icon { display: flex; justify-content: center; margin-bottom: 14px; }
.spi-exam-page .spi-quiz-gate-title {
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 1.25em;
    font-weight: 600;
    color: #1f8a80;
    line-height: 1.5;
    letter-spacing: .02em;
    text-align: center;
}
.spi-exam-page .spi-quiz-gate-title::before,
.spi-exam-page .spi-quiz-gate-title::after { content: none; display: none; }
.spi-quiz-gate-lead  { margin: 0 0 22px; font-size: .92em; color: var(--spi-muted); line-height: 1.7; }
.spi-quiz-gate-lead strong { color: #1f8a80; font-weight: 700; }
.spi-quiz-gate-note { display: block; margin-top: .5em; font-size: .88em; color: #e07b3a; font-weight: 600; }
.spi-quiz-gate-line {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 10px;
    width: 100%; max-width: 320px;
    padding: 14px 24px;
    background: #06C755; color: #fff;
    border-radius: 10px;
    font-weight: 600; font-size: 1em; letter-spacing: .02em;
    text-decoration: none;
    box-shadow: 0 6px 14px rgba(6,199,85,.28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.spi-quiz-gate-line:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(6,199,85,.34); color: #fff; }
.spi-quiz-gate-line img.spi-line-mark { display: block; width: 56px; height: 56px; margin: 0; padding: 0; border: 0; box-shadow: none; flex: none; }
.spi-quiz-gate-line span { text-align: center; word-break: keep-all; }
.spi-quiz-gate-divider {
    display: flex; align-items: center;
    margin: 22px 0 16px;
    color: var(--spi-muted); font-size: .8em;
}
.spi-quiz-gate-divider::before,
.spi-quiz-gate-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--spi-border);
}
.spi-quiz-gate-divider span { padding: 0 12px; }
.spi-quiz-gate-form { display: flex; flex-direction: column; gap: 10px; }
.spi-quiz-gate-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.4px solid #D6E5E2;
    border-radius: 8px;
    font-size: 1em;
    background: #fff;
    color: var(--spi-text);
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.spi-quiz-gate-input:focus { outline: none; border-color: #26A69A; box-shadow: 0 0 0 3px rgba(38,166,154,.18); }
.spi-quiz-gate-input.is-error { border-color: #E66B6B; }
.spi-quiz-gate-submit {
    width: 100%;
    padding: 12px 22px;
    background: #26A69A; color: #fff;
    border: 0; border-radius: 8px;
    font-weight: 600; font-size: 1em;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.spi-quiz-gate-submit:hover { background: #1f8a80; transform: translateY(-1px); }
.spi-quiz-gate-error { margin: 4px 0 0; color: #E66B6B; font-size: .85em; }
.spi-quiz-gate-error[hidden] { display: none; }

/* ===== レスポンシブ ===== */
@media (max-width: 720px) {
    #spi-exam-app.spi-quiz { margin: 1em; padding: 1.2em 1em; }
    .spi-quiz-header { display: none; }
    .spi-quiz-question { position: relative; }
    .spi-quiz-meter.is-inline { position: absolute; top: .8em; right: .8em; flex-direction: column; align-items: center; gap: .2em; z-index: 1; }
    .spi-quiz-meter-chart { width: 52px; height: 52px; }
    .spi-quiz-question-text { padding-right: 72px; }
    /* モバイルでは凡例ラベル（時間/解答状況）を隠して、進捗数字のみコンパクト表示 */
    .spi-quiz-meter-legend { font-size: 0; line-height: 1.2; }
    .spi-quiz-meter-legend li:first-child { display: none; }
    .spi-quiz-meter-legend li:last-child { font-size: 0; gap: 0; }
    .spi-quiz-meter-legend li:last-child .dot { display: none; }
    .spi-quiz-meter-legend li:last-child em { font-size: 13px; margin: 0; }
    .spi-quiz-body { display: block; gap: 0; padding-top: 0; border-top: none; }
    .spi-quiz-question { margin-bottom: 1.2em; }
    .spi-quiz-question-text {
        font-size: .95em;
        line-height: 1.7;
    }
    .spi-quiz-question-figure { padding-right: 0; }
    .spi-quiz-footer { flex-wrap: wrap; gap: .8em; }
    .spi-quiz-timebar { flex: 1 1 100%; }
    .spi-quiz-next { width: 100%; }
    .spi-quiz-result-summary { gap: 1em; padding: 1.2em; }
}
