:root {
    --main-blue: #3498db;
    --box-bg: rgba(255, 255, 255, 0.95);
}

body {
    font-family: 'Pretendard', -apple-system, sans-serif;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    margin: 0; min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
}

.container {
    width: 90%; 
    max-width: 700px; 
    padding: 50px 0 300px 0; /* 아래쪽 패딩을 300px로 늘려 스크롤을 만들어줍니다 */
    flex: 1;
}

#progress {
    color: white; font-weight: bold; margin-bottom: 15px; text-align: center;
}

.question-box {
    background: var(--box-bg);
    padding: 30px; border-radius: 20px 80px 80px 20px;
    display: flex; align-items: center; gap: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin-bottom: 40px; min-height: 120px;
}

.question-icon { font-size: 2rem; color: var(--main-blue); font-weight: 900; }
.question-text { flex: 1; font-size: 1.25rem; font-weight: 600; line-height: 1.4; }

.question-img {
    width: 100%;           /* 박스 너비에 맞게 꽉 채움 */
    max-width: 400px;      /* 이미지의 최대 너비를 400px로 제한 (모바일 고려) */
    height: auto;          /* 가로 비율에 맞춰 세로 높이는 자동 조절 */
    
    /* [핵심 수정] cover -> contain: 이미지가 잘리지 않고 비율을 유지하며 영역 안에 들어감 */
    object-fit: contain;   
    
    /* 비율 고정(aspect-ratio)은 contain 사용 시 오히려 여백을 만들 수 있으므로 주석 처리하거나 제거합니다. */
    /* aspect-ratio: 16 / 9; */ 
    
    border-radius: 15px;
    background: #f9f9f9;   /* 투명 이미지가 있을 경우를 대비해 연한 배경색 지정 */
    margin: 15px 0;        /* 위아래 간격 추가 */
    display: none;         /* 기본은 숨김 (script.js에서 제어) */
}
.options-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px;
}

.option-btn {
    background: var(--box-bg); border: none; padding: 20px;
    border-radius: 15px 40px 40px 15px; cursor: pointer;
    text-align: left; transition: 0.2s; font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); display: flex; align-items: center;
}

.option-btn:hover { transform: scale(1.02); background: white; }
.option-label { color: var(--main-blue); font-weight: 900; margin-right: 15px; font-size: 1.3rem; }

#result-page { background: white; padding: 50px; border-radius: 30px; text-align: center; }
.score-display { font-size: 4rem; color: #ff4757; font-weight: 900; margin: 20px 0; }

.btn-group { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; }
.btn { padding: 15px; border: none; border-radius: 10px; font-weight: bold; cursor: pointer; }
.kakao { background: #fee500; color: #3c1e1e; }
.retry { background: #f1f2f6; }

footer { 
    padding: 50px; 
    color: white; 
    opacity: 0.8; 
    font-size: 0.8rem; 
    text-align: center;
}
footer a { color: white; text-decoration: none; border-bottom: 1px dotted white; }

@media (max-width: 500px) {
    .options-grid { grid-template-columns: 1fr; }
    .question-box { flex-direction: column; border-radius: 20px; text-align: center; }
    .question-img { width: 100%; height: 150px; }
}

/* style.css 하단에 추가 */
.btn.copy {
    background: #34495e;
    color: white;
    transition: 0.2s;
}

.btn.copy:hover {
    background: #2c3e50;
    transform: scale(1.02);
}

#start-page {
    text-align: center;
    padding: 50px 20px;
    background: var(--box-bg);
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.main-box {
    text-align: center;
    padding: 100px 20px 400px 20px; 
    background: var(--box-bg);
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-title {
    font-size: 5rem; 
    color: var(--main-blue);
    margin-bottom: 30px;
    font-weight: 900;
}

.main-desc {
    font-size: 1.3rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 60px; /* 버튼과의 간격 */
}


.btn-start {
    background: var(--main-blue);
    color: white;
    border: none;
    padding: 12px 35px; 
    font-size: 1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s;
}
.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
}

.white-footer {
    width: 100%;
    background-color: white; 
    padding: 20px 0;
    margin-top: auto;
    text-align: center;
}

.white-footer p {
    color: #000000 !important; 
    margin: 0;
    font-weight: 500;
}

.white-footer a {
    color: #000000 !important;
    text-decoration: none;
    border-bottom: 1px solid #000;
}

/* 상단 내비게이션 및 소개 버튼 */
/* style.css의 .top-nav 및 .nav-btn 부분 수정 */

.top-nav {
    width: 100%;
    max-width: 100%; /* 화면 전체 너비 활용 */
    display: flex;
    justify-content: flex-end;
    padding: 20px 20px 0 0; /* 우측 상단 여백 */
}

/* 해설창 애니메이션 */
#explanation-box {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 약관 링크 스타일 */
.policy-links a {
    color: #888 !important;
    text-decoration: none;
    border-bottom: none !important;
}

.nav-btn {
    background: #ffffff; 
    border: 2px solid #ffffff; 
    color: var(--main-blue);
    padding: 10px 25px; 
    font-size: 1rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 800; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: 0.3s;
}

.nav-btn:hover {
    transform: translateY(-2px);
    background: #f8f9fa; 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 팝업(모달) 스타일 */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 20px;
    width: 80%;
    max-width: 500px;
    position: relative;
    text-align: center;
    line-height: 1.6;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-btn {
    position: absolute;
    right: 20px; top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-btn:hover { color: black; }

.modal-content h2 { color: var(--main-blue); margin-bottom: 20px; }
.modal-content hr { border: 0.5px solid #eee; margin: 20px 0; }

/* style.css 하단에 추가 */
#explanation-box {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.option-btn:disabled {
    cursor: default;
    transform: none !important;
}

.knowledge-section {
    margin-top: 150px; /* 시작 버튼으로부터 더 아래로 배치 */
    width: 100%;
    max-width: 600px;
    text-align: left;
    padding-bottom: 50px;
}

.knowledge-section h2 {
    color: var(--main-blue);
    margin-bottom: 25px;
    font-size: 1.4rem;
    border-bottom: 2px solid var(--main-blue);
    display: inline-block;
    padding-bottom: 5px;
}

.knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.knowledge-item {
    background: #ffffff;
    padding: 18px 22px;
    border-radius: 12px;
    font-size: 0.95rem;
    color: #444;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-left: 5px solid var(--main-blue); /* 포인트 컬러 강조 */
    transition: transform 0.2s;
}

.knowledge-item:hover {
    transform: translateX(5px);
}

/* 해설 박스 스타일 강화 */
#explanation-box {
    background: #ffffff;
    border: 3px solid var(--main-blue);
    padding: 25px;
    border-radius: 20px;
    margin-top: 20px;
    text-align: left;
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.15);
    display: none;
}

#explanation-box h3 {
    margin-top: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#explanation-text {
    font-size: 1.05rem;
    color: #444;
    line-height: 1.6;
    margin-bottom: 20px;
    word-break: keep-all;
}

/* 다음 문제 버튼 스타일 */
.btn-next {
    background-color: var(--main-blue);
    color: white;
    border: none;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    box-shadow: 0 4px 0 #2980b9;
}

.btn-next:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2471a3;
}

.btn-next:active {
    transform: translateY(2px);
    box-shadow: none;
}

/* 결과 페이지 버튼 컨테이너: 세로로 배치 */
/* 결과 페이지 버튼 컨테이너: 무조건 세로 배치 */
.result-buttons {
    display: flex;
    flex-direction: column; /* 세로로 쌓기 */
    gap: 15px;             /* 버튼 사이 간격 */
    width: 100%;
    max-width: 500px;      /* 최대 너비 제한 */
    margin: 40px auto 0;   /* 중앙 정렬 및 상단 여백 */
    padding: 0 20px;       /* 좌우 여백 */
    box-sizing: border-box;
}

/* 모든 결과 버튼 공통 스타일 */
.result-buttons button {
    width: 100%;           /* 가로로 길게 */
    padding: 20px;         /* 높이감 있게(크기 키움) */
    border: none;
    border-radius: 50px;   /* 완전히 둥근 모서리 */
    font-size: 1.2rem;     /* 글자 크기 키움 */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); /* 부드러운 그림자 */
}

/* 버튼별 색상: 배경에 부드럽게 녹아드는 파스텔톤 기반 */
.btn-share.kakao {
    background-color: #FEE500; /* 카카오 노란색 */
    color: #3C1E1E;
}

.btn-copy {
    background-color: #E3F2FD; /* 매우 연한 파란색 */
    color: #1976D2;
}

.btn-restart {
    background-color: #F5F5F5; /* 아주 연한 회색 */
    color: #616161;
    border: 1px solid #E0E0E0 !important;
}

/* 클릭 효과 */
.result-buttons button:active {
    transform: scale(0.97); /* 눌리는 느낌 */
    filter: brightness(0.9);
}

.result-buttons button:hover {
    filter: brightness(0.95);
}

/* --- style.css 하단에 추가 --- */

/* 정답 버튼 스타일 (초록색 계열) */
.option-btn.correct {
    background-color: #2ecc71 !important; /* 배경을 진한 초록색으로 */
    color: white !important;               /* 글자색 흰색 */
    border: 2px solid #27ae60 !important; /* 테두리도 초록색 */
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3) !important;
}

/* 정답 버튼 내의 라벨(A, B, C, D) 색상 변경 */
.option-btn.correct .option-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* 오답 버튼 스타일 (빨간색 계열) */
.option-btn.wrong {
    background-color: #e74c3c !important; /* 배경을 진한 빨간색으로 */
    color: white !important;               /* 글자색 흰색 */
    border: 2px solid #c0392b !important; /* 테두리도 빨간색 */
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3) !important;
    
    /* 선택 사항: 오답일 때 가볍게 흔들리는 애니메이션 */
    animation: shake 0.5s linear;
}

/* 오답 버튼 내의 라벨 색상 변경 */
.option-btn.wrong .option-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* 정답/오답 확인 후 비활성화된 버튼 스타일 (마우스 오버 효과 제거) */
.option-btn:disabled:hover {
    transform: none !important;
}

/* 오답일 때 흔들리는 애니메이션 정의 */
@keyframes shake {
    0% { transform: translate(1px, 1px); }
    10% { transform: translate(-1px, -2px); }
    20% { transform: translate(-3px, 0px); }
    30% { transform: translate(3px, 2px); }
    40% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 2px); }
    60% { transform: translate(-3px, 1px); }
    70% { transform: translate(3px, 1px); }
    80% { transform: translate(-1px, -1px); }
    90% { transform: translate(1px, 2px); }
    100% { transform: translate(1px, -2px); }
}