/* ==========================================================================
   수능 수학 모의고사 프로그램 전용 핵심 레이아웃 & 테마 스타일 (CSS)
   ========================================================================== */

/* 전체 감싸기 박스 (메인 컨테이너) */
.math-quiz-wrap * {
    box-sizing: border-box;
}

.math-quiz-wrap {
    max-width: 850px;
    margin: 20px auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #cbd5e1;
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    color: #333333;
}

    /* 상단 타이틀 및 가이드 카피 */
    .math-quiz-wrap h2.quiz-title {
        text-align: center;
        color: #1e293b;
        margin: 0 0 10px 0;
        font-size: 24px;
        font-weight: 700;
    }

    .math-quiz-wrap .subtitle {
        text-align: center;
        color: #64748b;
        margin-bottom: 30px;
        font-size: 14px;
    }

    /* [설정 화면] 폼 컨트롤 그룹 */
    .math-quiz-wrap .setup-box {
        display: flex;
        flex-direction: column;
        gap: 20px;
        max-width: 500px;
        margin: 0 auto;
    }

    .math-quiz-wrap .form-group label {
        display: block;
        font-weight: 600;
        margin-bottom: 8px;
        color: #1e293b;
        font-size: 15px;
    }

    .math-quiz-wrap select {
        width: 100%;
        padding: 12px;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        font-size: 15px;
        background: #ffffff;
        color: #333333;
        outline: none;
        transition: border-color 0.2s;
    }

        .math-quiz-wrap select:focus {
            border-color: #2563eb;
        }

    /* 수능 표준 제어 버튼 (블랙 & 모던 스타일) */
    .math-quiz-wrap .q-btn {
        display: inline-block;
        width: 100%;
        padding: 14px;
        background-color: #0f172a;
        color: #ffffff !important;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        text-decoration: none;
        transition: background-color 0.2s;
    }

        .math-quiz-wrap .q-btn:hover {
            background-color: #1e293b;
        }

    /* [시험 화면] 상단 고정형 헤더 및 상태 배지 */
    .math-quiz-wrap .quiz-header {
        position: sticky;
        top: 10px;
        z-index: 100;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid #cbd5e1;
        border-radius: 10px;
        padding: 12px 18px;
        margin-bottom: 25px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        backdrop-filter: blur(4px);
    }

    .math-quiz-wrap .badge {
        background: #f1f5f9;
        color: #334155;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 600;
        border: 1px solid #e2e8f0;
    }

    /* 개별 문제 카드 박스 */
    .math-quiz-wrap .question-card {
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 24px;
        margin-bottom: 24px;
        background: #fafafa;
        position: relative;
        box-shadow: 0 2px 5px rgba(0,0,0,0.01);
    }

    /* ★ 수정: 문제 지문 내 수식 정렬 최적화 */
    .math-quiz-wrap .q-text {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 20px;
        color: #0f172a;
        line-height: 1.75;
        clear: both;
    }

        .math-quiz-wrap .q-text mjx-container {
            vertical-align: middle;
            margin: 0 2px;
        }

    /* 5지선다 객관식 선지 레이아웃 (반응형 2열 구조) */
    .math-quiz-wrap .options-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* ★ 수정: 선지 내부 수식 세로 중앙 정렬 보정 */
    .math-quiz-wrap .option-label {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        background: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        margin: 0;
        transition: all 0.2s ease;
    }

        .math-quiz-wrap .option-label:hover {
            border-color: #94a3b8;
            background-color: #f8fafc;
        }

        .math-quiz-wrap .option-label input {
            margin-right: 10px;
            cursor: pointer;
            flex-shrink: 0;
        }

        /* ★ 수정: 보기 내부 수식이 한글보다 클 때 줄바꿈 및 정렬 깨짐 방지 */
        .math-quiz-wrap .option-label span {
            display: inline-flex;
            align-items: center;
            flex-wrap: wrap;
            line-height: 1.5;
        }

        .math-quiz-wrap .option-label mjx-container {
            vertical-align: middle;
            margin: 0 2px;
        }

        /* 라디오 버튼 클릭(Checked) 시 부모 label 하이라이팅 효과 */
        .math-quiz-wrap .option-label:has(input:checked) {
            border-color: #2563eb;
            background-color: #f0f5ff;
            box-shadow: 0 0 0 1px #2563eb;
            font-weight: 600;
        }

    /* ==========================================================================
   디지털 필기 연습장(Canvas Scratch Pad) 전용 컴포넌트 디자인
   ========================================================================== */
    .math-quiz-wrap .mq-memo-toggle {
        background: #4a5568;
        color: #ffffff;
        border: none;
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 4px;
        cursor: pointer;
        float: right;
        transition: background-color 0.2s;
    }

        .math-quiz-wrap .mq-memo-toggle:hover {
            background: #2d3748;
        }

    .math-quiz-wrap .mq-canvas-wrapper {
        display: none;
        margin: 15px 0;
        background: #fffdf0;
        border: 1px solid #f6e05e;
        border-radius: 6px;
        padding: 10px;
    }

    .math-quiz-wrap .mq-canvas-tools {
        margin-bottom: 8px;
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .math-quiz-wrap .mq-canvas-btn {
        background: #edf2f7;
        border: 1px solid #cbd5e1;
        padding: 4px 10px;
        font-size: 11px;
        border-radius: 4px;
        cursor: pointer;
        font-weight: bold;
        transition: background 0.15s;
    }

        .math-quiz-wrap .mq-canvas-btn:hover {
            background-color: #e2e8f0;
        }

        .math-quiz-wrap .mq-canvas-btn.clear {
            background: #fed7d7;
            color: #9b2c2c;
            border-color: #feb2b2;
        }

            .math-quiz-wrap .mq-canvas-btn.clear:hover {
                background: #feb2b2;
            }

    .math-quiz-wrap canvas.mq-pad {
        border: 1px solid #e2e8f0;
        background: #fffdf4;
        display: block;
        width: 100%;
        height: 180px;
        touch-action: none;
        cursor: crosshair;
    }

    /* ==========================================================================
   [결과 뷰 화면] 및 오답 정밀 피드백 컴포넌트 디자인
   ========================================================================== */
    .math-quiz-wrap .result-box {
        background: #f8fafc;
        border: 1px solid #cbd5e1;
        border-radius: 12px;
        padding: 25px;
        text-align: center;
        margin-bottom: 30px;
        font-size: 18px;
        font-weight: bold;
    }

    .math-quiz-wrap .ans-report {
        border-left: 4px solid #3182ce;
        padding-left: 15px;
        margin-top: 15px;
        font-size: 14px;
        background: #f7fafc;
        padding: 15px;
        border-radius: 0 6px 6px 0;
        line-height: 1.6;
    }

        .math-quiz-wrap .ans-report mjx-container {
            vertical-align: middle;
        }

/* 모바일 디바이스 가로폭 해상도 대응 반응형 브레이크포인트 */
@media (max-width: 600px) {
    .math-quiz-wrap {
        padding: 15px;
    }

        .math-quiz-wrap .options-grid {
            grid-template-columns: 1fr; /* 모바일에서는 보기를 세로로 1열 정렬 */
        }

        .math-quiz-wrap h2.quiz-title {
            font-size: 20px;
        }
}
