/* =========================================================
   C. 質問画面のCSS
   ========================================================= */


/* ---------------------------------------------------------
   質問画面 全体
   --------------------------------------------------------- */

#diagnosis-screen {
    width: 100%;
    animation: diagnosisFadeIn 0.5s ease;
}

@keyframes diagnosisFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ---------------------------------------------------------
   質問ヘッダー
   --------------------------------------------------------- */

.question-header {
    position: relative;
    width: 100%;
    text-align: center;
    margin-bottom: 18px;
}

.question-progress {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;

    font-family: "Yusei Magic", sans-serif;
    color: #302f29;
}

.question-progress .label {
    font-size: 13px;
    letter-spacing: 2px;
    opacity: 0.65;
}

#question-number {
    font-size: 28px;
    line-height: 1;
}


/* ---------------------------------------------------------
   キャラクター＋吹き出し
   --------------------------------------------------------- */

.question-guide {
    position: relative;

    display: flex;
    justify-content: center;
    align-items: flex-end;

    width: 100%;
    min-height: 155px;

    margin-bottom: 5px;
}


/* キャラクター */

.character-question {
    position: relative;
    z-index: 2;

    width: 145px;
    height: 145px;

    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.character-question img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    animation: characterFloat 2.5s ease-in-out infinite;
}

@keyframes characterFloat {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}


/* 吹き出し */

.speech-bubble {
    position: relative;
    z-index: 3;

    isolation: isolate;
    width: 280px;
    min-height: 78px;

    margin-left: -12px;
    margin-bottom: 48px;
    padding: 20px 25px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;

    border: 3px solid #302f29;
    border-radius: 24px;

    box-shadow: 0 6px 0 rgba(48, 47, 41, 0.18);
}


/* 右側の黒い外枠 */
.speech-bubble::after {
    content: "";

    position: absolute;

    right: -22px;
    top: 50%;
    transform: translateY(-50%);

    width: 0;
    height: 0;

    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 22px solid #302f29;

    z-index: -1;
}


/* 右側の白い内側 */
.speech-bubble::before {
    content: "";

    position: absolute;

    right: -20px;
    top: 50%;
    transform: translateY(-50%);

    width: 0;
    height: 0;

    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 22px solid #ffffff;

    z-index: 0;
}

.speech-bubble p {
    margin: 0;

    font-family: "Yusei Magic", sans-serif;
    font-size: 21px;
    line-height: 1.5;

    color: #302f29;
}


/* ---------------------------------------------------------
   質問文
   --------------------------------------------------------- */

.question-area {
    width: 100%;
    margin: 5px auto 42px;

    text-align: center;
}

#question-text {
    margin: 0;

    font-family: "Yusei Magic", sans-serif;
    font-size: clamp(23px, 3vw, 30px);
    line-height: 1.65;
    letter-spacing: 0.03em;

    color: #302f29;
    padding-bottom: 24px;
}


/* ---------------------------------------------------------
   回答ボタン
   --------------------------------------------------------- */

#answer-buttons {
    width: 100%;

    display: flex;
    flex-direction: column;
    gap: 32px;

    margin: 0 auto;
}


/* 2択・3択共通 */

.answer-button {
    position: relative;

    width: 100%;
    min-height: 72px;

    padding: 15px 28px;

    border: none;
    border-radius: 24px;

    background: #45a8cf;

    color: #ffffff;

    font-family: "Yusei Magic", sans-serif;
    font-size: 21px;
    line-height: 1.4;

    cursor: pointer;

    box-shadow:
        0 7px 0 #187ba4,
        0 10px 15px rgba(48, 47, 41, 0.15);

    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease,
        background 0.15s ease;
}


/* ホバー */

.answer-button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 9px 0 #187ba4,
        0 13px 18px rgba(48, 47, 41, 0.18);
}


/* 押した瞬間 */

.answer-button:active {
    transform: translateY(5px);

    box-shadow:
        0 2px 0 #187ba4,
        0 5px 8px rgba(48, 47, 41, 0.12);
}


/* キーボード操作 */

.answer-button:focus-visible {
    outline: 4px solid rgba(69, 168, 207, 0.35);
    outline-offset: 4px;
}


/* ---------------------------------------------------------
   回答ボタンの選択アニメーション
   JSから .selected を付けた場合
   --------------------------------------------------------- */

.answer-button.selected {
    transform: translateY(5px);

    box-shadow:
        0 2px 0 #187ba4,
        0 5px 8px rgba(48, 47, 41, 0.12);

    animation: answerSelected 0.25s ease;
}

@keyframes answerSelected {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.97);
    }

    100% {
        transform: scale(1);
    }
}


/* ---------------------------------------------------------
   回答後の画面切り替え用
   --------------------------------------------------------- */

#diagnosis-screen.question-changing {
    animation: questionChange 0.35s ease;
}

@keyframes questionChange {
    0% {
        opacity: 0;
        transform: translateX(15px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}


/* ---------------------------------------------------------
   プログレスバー
   --------------------------------------------------------- */

.progress-bar {
    width: 100%;
    height: 9px;

    margin-top: 28px;

    overflow: hidden;

    background: #deddd4;
    border-radius: 999px;
}

#progress-bar-fill {
    width: 0%;
    height: 100%;

    background: #45a8cf;

    border-radius: inherit;

    transition: width 0.45s ease;
}


/* ---------------------------------------------------------
   QUESTION / TOTAL 表示
   --------------------------------------------------------- */

.question-counter {
    display: flex;
    justify-content: space-between;

    margin-top: 7px;

    font-family: "Yusei Magic", sans-serif;
    font-size: 12px;

    color: #777568;
}


/* ---------------------------------------------------------
   スコア表示
   ※ゲーム中に見せない場合は display:none でOK
   --------------------------------------------------------- */

.score-area {
    display: none;
}


/* =========================================================
   3択専用
   ========================================================= */

#answer-buttons.three-choice {
    gap: 12px;
}

#answer-buttons.three-choice .answer-button {
    min-height: 64px;
    font-size: 19px;
}


/* =========================================================
   タブレット
   ========================================================= */

@media (max-width: 768px) {

    .question-guide {
        min-height: 135px;
    }

    .character-question {
        width: 125px;
        height: 125px;
    }

    .speech-bubble {
        width: 240px;
        min-height: 70px;

        margin-bottom: 38px;
        padding: 16px 20px;
    }

    .speech-bubble p {
        font-size: 18px;
    }

    #question-text {
        font-size: 24px;
    }

    .answer-button {
        min-height: 68px;
        font-size: 19px;
    }
}


/* =========================================================
   スマートフォン
   ========================================================= */

@media (max-width: 520px) {

    #diagnosis-screen {
        padding-top: 5px;
    }

    .question-header {
        margin-bottom: 5px;
    }

    #question-number {
        font-size: 24px;
    }

    .question-guide {
        min-height: 115px;
    }

    .character-question {
        width: 105px;
        height: 105px;
    }

.speech-bubble {
    width: 175px;
    min-height: 58px;

    margin-left: -8px;
    margin-bottom: 27px;

    padding: 10px 12px;

    border-width: 2px;
    border-radius: 18px;

    box-shadow: 0 4px 0 rgba(48, 47, 41, 0.18);
}

.speech-bubble::after {
    right: -12px;
    top: 50%;
    bottom: auto;

    transform: translateY(-50%);

    width: 0;
    height: 0;

    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 12px solid #302f29;

    z-index: -1;
}
.speech-bubble::before {
    right: -10px;
    top: 50%;

    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 10px solid #ffffff;
}

    .speech-bubble p {
        font-size: 16px;
    }

    .question-area {
        margin: 4px auto 30px;
    }

    #question-text {
        font-size: 20px;
        line-height: 1.55;
    }

    #answer-buttons {
        gap: 12px;
    }

    .answer-button {
        min-height: 62px;

        padding: 12px 18px;

        border-radius: 20px;

        font-size: 17px;

        box-shadow:
            0 6px 0 #187ba4,
            0 8px 12px rgba(48, 47, 41, 0.13);
    }

    .answer-button:hover {
        transform: none;

        box-shadow:
            0 6px 0 #187ba4,
            0 8px 12px rgba(48, 47, 41, 0.13);
    }

    .answer-button:active {
        transform: translateY(4px);

        box-shadow:
            0 2px 0 #187ba4,
            0 4px 7px rgba(48, 47, 41, 0.1);
    }

    #answer-buttons.three-choice {
        gap: 9px;
    }

    #answer-buttons.three-choice .answer-button {
        min-height: 56px;
        font-size: 16px;
    }

    .progress-bar {
        height: 7px;
        margin-top: 22px;
    }

    .question-counter {
        font-size: 10px;
    }
}


/* =========================================================
   動きを減らす設定
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .character-question img,
    #diagnosis-screen,
    .answer-button {
        animation: none;
        transition: none;
    }
}