/* 기본 설정 및 폰트 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    /* 배경색은 이미지가 로드되기 전이나 투명도 뒤에 비치는 색상 */
    background-color: #f4f4f4; 
    margin: 0;
    padding: 0;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    position: relative; /* 가상 요소를 위한 기준점 */
    min-height: 100vh;
}

/* [추가] 배경 이미지 설정 (커피 테마) */
body::before {
    content: "";
    position: fixed; /* 스크롤 해도 배경 고정 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 커피 관련 무료 이미지 URL (Unsplash) */
    background-image: url('https://images.unsplash.com/photo-1497935586351-b67a49e012bf?ixlib=rb-1.2.1&auto=format&fit=crop&w=1951&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* 투명도 조절 (0.0 ~ 1.0) - 숫자가 작을수록 흐려짐 */
    opacity: 0.15; 
    
    z-index: -1; /* 콘텐츠(글자, 박스) 뒤로 보내기 */
    pointer-events: none; /* 마우스 클릭 방해 금지 */
}

/* 반응형 컨테이너 */
.container {
    max-width: 800px;
    width: 95%;
    margin: 40px auto; /* 상하 여백 조정 */
    background: rgba(255, 255, 255, 0.95); /* 컨테이너 배경을 살짝 불투명한 흰색으로 */
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); /* 그림자 강화 */
    backdrop-filter: blur(5px); /* 최신 브라우저용 블러 효과 */
}

h1 {
    font-size: 1.8rem;
    text-align: center;
    color: #4b3621; /* 커피색 텍스트 */
    margin-bottom: 15px;
    font-weight: 700;
}

h2 {
    font-size: 1.3rem;
    color: #5d4037;
}

/* 폼 요소 스타일 */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
    border-color: #8d6e63; /* 커피 톤 포커스 색상 */
    outline: none;
    box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.2);
}

/* 버튼 스타일 (커피색 테마 적용) */
button {
    width: 100%;
    padding: 16px;
    background-color: #6d4c41; /* 진한 갈색 */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(109, 76, 65, 0.3);
    transition: background 0.2s, transform 0.1s;
}

button:active {
    transform: scale(0.98);
    background-color: #5d4037;
}

button:hover {
    background-color: #5d4037;
}

/* 문제 카드 스타일 */
.question-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 25px 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.sector-badge {
    display: inline-block;
    background: #efebe9;
    color: #795548;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.question-title {
    font-size: 1.15rem;
    line-height: 1.6;
    font-weight: 600;
    margin-bottom: 20px;
    word-break: keep-all;
    color: #3e2723;
}

/* 보기(Options) 스타일 */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #f5f5f5;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.option-label input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2);
    accent-color: #795548; /* 라디오 버튼 색상 */
}

.option-label:hover {
    background-color: #fafafa;
    border-color: #d7ccc8;
}

.option-label.selected {
    border-color: #8d6e63;
    background-color: #efebe9;
    color: #4e342e;
    font-weight: 600;
}

/* 결과 페이지 스타일 */
.score-circle {
    width: 130px;
    height: 130px;
    background: #2ecc71; /* 점수는 눈에 띄게 초록색 유지 */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: bold;
    margin: 30px auto;
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.result-detail {
    font-size: 0.95rem;
    margin-top: 10px;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
    line-height: 1.5;
}

.correct-text { color: #27ae60; font-weight: bold; }
.wrong-text { color: #c0392b; font-weight: bold; }

.result-message-box { 
    padding: 20px; 
    margin: 20px 0; 
    border-radius: 10px; 
    text-align: center; 
    font-weight: bold; 
    font-size: 1.4rem; 
    animation: popIn 0.5s ease; 
}
.pass-box { background-color: #d4edda; color: #155724; border: 2px solid #c3e6cb; }
.fail-box { background-color: #f8d7da; color: #721c24; border: 2px solid #f5c6cb; }

@keyframes popIn { 
    0% { transform: scale(0.8); opacity: 0; } 
    100% { transform: scale(1); opacity: 1; } 
}

/* 모바일 전용 스타일 */
@media (max-width: 600px) {
    .container {
        margin: 15px auto;
        padding: 20px;
        width: 95%;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    
    h1 { font-size: 1.4rem; }
    
    .question-title { font-size: 1.05rem; }
    
    button {
        position: sticky;
        bottom: 20px;
        z-index: 100;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
}

/* ... (기존 스타일 코드는 그대로 유지) ... */

/* [추가] 인쇄 모드 전용 스타일 */
@media print {
    /* 배경 이미지 및 색상 제거 */
    body { 
        background: white !important; 
        -webkit-print-color-adjust: exact;
    }
    body::before { display: none !important; } /* 배경 이미지 숨김 */

    /* 웹 전용 요소 숨기기 (헤더, 버튼 등) */
    .header-bar, .no-print, button { 
        display: none !important; 
    }

    /* 컨테이너 너비 및 여백 초기화 */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
    }

    /* 문제 카드 디자인 단순화 (잉크 절약) */
    .question-card {
        border: none !important;
        border-bottom: 1px solid #ccc !important; /* 구분선만 남김 */
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
        padding: 10px 0 !important;
        page-break-inside: avoid; /* 문제 중간에 페이지가 잘리지 않게 설정 */
    }

    /* 정답 보기 스타일 */
    .option-label {
        border: none !important;
        padding: 5px 0 !important;
    }
    
    /* 제목 폰트 색상 강제 검정 */
    h1, h2, .question-title {
        color: black !important;
    }

    /* 인쇄용 수험 정보 헤더 표시 */
    .print-header {
        display: block !important;
        text-align: center;
        border-bottom: 2px solid #333;
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    .print-info {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
        font-size: 1.1rem;
    }
}

/* 화면에서는 인쇄용 헤더 숨김 */
.print-header { display: none; }