@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&display=swap');

body {
    background-color: #f0f0f0;
    font-family: 'Gowun Batang', serif;
    color: #000;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

*, *::before, *::after { box-sizing: border-box; }

.exam-paper {
    background-color: #fff;
    width: 100%;
    max-width: 800px;
    min-height: 900px;
    padding: 40px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

header { text-align: center; margin-bottom: 30px; }
header[hidden] { display: none; }
.brand-link { display: inline-flex; align-items: center; justify-content: center; gap: 20px; max-width: 100%; color: #111; text-decoration: none; }
.brand-logo { width: 104px; height: 104px; flex: 0 0 auto; object-fit: contain; }
.brand-copy { display: flex; width: 196px; min-width: 0; flex-direction: column; align-items: stretch; text-align: center; line-height: 1.1; }
.brand-acronym { display: block; width: 100%; font-family: 'Gowun Batang', serif; font-size: 68px; font-weight: bold; line-height: 0.95; letter-spacing: 0; text-align: center; white-space: nowrap; }
.brand-acronym span { display: inline; }
.brand-english { display: block; width: 100%; margin-top: 7px; font-family: Arial, sans-serif; font-size: 7.36px; line-height: 1; letter-spacing: 0; text-align: center; white-space: nowrap; }
.brand-korean { display: block; width: 100%; margin-top: 8px; font-family: 'Gowun Batang', serif; font-size: 19px; font-weight: bold; line-height: 1.1; letter-spacing: 0; text-align: center; white-space: nowrap; }
.brand-link:hover .brand-copy { color: #7b5d20; }
.thick-line { border: 0; border-top: 3px solid #000; border-bottom: 1px solid #000; height: 3px; }

.menu-screen { padding: 46px 0 80px; text-align: center; }
.menu-screen h1 { margin: 8px 0 30px; font-size: 28px; }
.menu-list { display: grid; width: min(420px, 100%); margin: 0 auto; padding: 0; gap: 14px; justify-items: stretch; list-style: none; }
.menu-list li { width: 100%; margin: 0; padding: 0; }
.menu-button { display: block; box-sizing: border-box; width: 100%; min-height: 58px; margin: 0; border: 1px solid #111; padding: 17px 22px; background: #fff; color: #111; font-family: inherit; font-size: 18px; font-weight: bold; line-height: 22px; text-align: center; text-decoration: none; cursor: pointer; transition: 0.2s; }
.menu-button:hover { background: #111; color: #fff; }
.menu-button:disabled { border-color: #bbb; background: #e5e5e5; color: #888; cursor: not-allowed; }

.site-home-button { position: fixed; z-index: 900; top: 18px; left: 18px; display: grid; width: 42px; height: 42px; padding: 5px; border: 1px solid #c9c9c9; border-radius: 6px; background: rgba(255,255,255,0.95); place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.site-home-button img { display: block; width: 26px; height: 26px; object-fit: contain; }
.site-home-button:hover { border-color: #111; background: #fff; }
.site-home-screen { padding: 50px 0 80px; text-align: center; }
.site-home-logo { display: block; width: min(320px, 75%); height: auto; margin: 0 auto 34px; object-fit: contain; }
.unavailable-menu-button:disabled { opacity: 0.72; }
.home-confirmation { position: fixed; z-index: 3000; inset: 0; display: grid; padding: 20px; background: rgba(0,0,0,0.55); place-items: center; }
.home-confirmation[hidden] { display: none; }
.home-confirmation-box { width: min(360px, 100%); padding: 28px; border: 1px solid #333; background: #fff; text-align: center; box-shadow: 0 12px 36px rgba(0,0,0,0.3); }
.home-confirmation-box p { margin: 0 0 24px; font-size: 18px; font-weight: 700; white-space: pre-line; }
.home-confirmation-actions { display: flex; justify-content: center; gap: 12px; }
.home-confirmation-actions .btn { min-width: 100px; }

.welcome-title { text-align: center; margin: 40px 0; line-height: 1.8; }
.welcome-title h3 { font-size: 20px; font-weight: normal; }
.welcome-title strong { font-size: 24px; }
.guide-section { margin-bottom: 40px; }
.guide-section h4 { font-size: 16px; margin-bottom: 10px; text-align: center; }
.guide-table { width: 100%; border-collapse: collapse; border-top: 2px solid #000; border-bottom: 2px solid #000; }
.guide-table th, .guide-table td { padding: 12px; border-bottom: 1px solid #ddd; font-size: 14px; line-height: 1.6; }
.guide-table th { background-color: #f7f7f7; width: 25%; text-align: left; }
.guide-table ul { margin: 0; padding-left: 20px; list-style-type: none; }
.guide-table li { margin-bottom: 5px; }

.warning-text { color: #d32f2f; font-weight: bold; }
.exam-notice { white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.center-btn { text-align: center; margin-top: 20px; }
.primary-btn { background: #000 !important; color: #fff !important; padding: 15px 40px !important; font-size: 18px !important; }
.primary-btn:hover { background: #333 !important; }

.badge { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: bold; color: #fff; border-radius: 3px; margin-right: 5px; text-align: center; min-width: 45px;}
.lvl3 { background-color: #2e7d32; } /* 초록 */
.lvl2 { background-color: #1565c0; } /* 파랑 */
.lvl1 { background-color: #ef6c00; } /* 주황 */
.fail { background-color: #c62828; } /* 빨강 */
.grade1 { background-color: #6a1b9a; }
.grade2 { background-color: #4527a0; }
.grade3 { background-color: #1565c0; }
.grade4 { background-color: #00838f; }
.grade5 { background-color: #2e7d32; }
.grade6 { background-color: #558b2f; }
.grade7 { background-color: #ef6c00; }
.grade8 { background-color: #d84315; }
.grade9 { background-color: #c62828; }

.info-box { border: 1px solid #000; padding: 15px; margin-bottom: 20px; font-size: 14px; line-height: 1.6; }
.warning { color: #d32f2f; font-weight: bold; }
.student-info table { width: 250px; margin: 0 0 0 auto; border-collapse: collapse; }
.student-info th, .student-info td { border: 1px solid #000; padding: 5px; text-align: center; font-size: 14px; }
.student-info th { background-color: #f5f5f5; width: 30%; }
.student-info input { width: 90%; border: none; font-family: inherit; outline: none; text-align: center; }
.section-title { font-size: 18px; font-weight: bold; border-top: 2px solid #000; border-bottom: 1px solid #000; padding: 10px 0; margin-bottom: 20px; }
.exam-status { margin-bottom: 24px; }
.timer { color: #d32f2f; font-size: 20px; font-weight: bold; text-align: right; font-variant-numeric: tabular-nums; }
.timer.urgent { animation: timerPulse 1s infinite; }
.progress-summary { display: flex; justify-content: space-between; margin: 8px 0; font-size: 14px; font-weight: bold; }
.progress-track { width: 100%; height: 8px; overflow: hidden; background: #e0e0e0; border-radius: 4px; }
.progress-fill { width: 0; height: 100%; background: #1565c0; transition: width 0.2s ease; }
.question-container { display: grid; grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; height: min(68vh, 700px); min-height: 500px; margin-bottom: 20px; }
.question-scroll, .answers-scroll { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border: 1px solid #bbb; padding: 20px; background: #fff; }
.question-scroll:focus, .answers-scroll:focus { outline: 3px solid rgba(21, 101, 192, 0.2); outline-offset: -3px; }
.answers-scroll { background: #fafafa; }
.question-text { max-width: 100%; font-size: 17px; font-weight: bold; line-height: 1.65; margin-bottom: 18px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.shared-question-box { margin: 0 0 26px; padding: 18px; border: 1px solid #777; border-radius: 8px; background: #fff; }
.shared-question-text { max-width: 100%; margin-bottom: 14px; font-size: 17px; font-weight: 700; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.question-passage.shared-passage { margin: 0; }
.question-passage { max-width: 100%; margin: 12px 0 20px; font-size: 16px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.passage-inline-image { width: 100%; max-width: 100%; margin: 20px auto; text-align: center; }
.passage-inline-image img { display: block; width: 100%; height: auto; margin: 0 auto; border: 1px solid #ccc; cursor: zoom-in; }
.question-table-wrap { max-width: 100%; margin: 18px 0 24px; overflow-x: auto; }
.question-table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.question-table th, .question-table td { min-width: 76px; padding: 8px 10px; border: 1px solid #333; text-align: center; vertical-align: middle; white-space: pre-wrap; }
.question-table th { background: #f5f5f5; font-weight: 700; }
.question-view-box { margin: 20px 0 24px; padding: 0 18px 16px; border: 1px solid #333; font-size: 16px; line-height: 1.85; }
.view-box-title { margin: -1px auto 10px; padding: 0 12px; text-align: center; font-weight: 700; }
.view-box-content { white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.options { display: flex; flex-direction: column; gap: 10px; margin-left: 10px; }
.options label { max-width: 100%; cursor: pointer; font-size: 15px; line-height: 1.7; display: flex; align-items: flex-start; overflow-wrap: anywhere; word-break: keep-all; }
.options input { flex: 0 0 auto; margin: 4px 10px 0 0; accent-color: #000; }
.btn { font-family: inherit; background: #fff; border: 1px solid #000; padding: 10px 20px; font-size: 16px; cursor: pointer; transition: 0.2s; font-weight: bold; }
.btn:hover { background: #eee; }
.btn:disabled { background: #ddd; color: #888; cursor: not-allowed; border-color: #ccc; }
.nav-buttons { display: flex; justify-content: space-between; gap: 12px; }

.score-container { display: flex; flex-direction: column; align-items: center; margin: 20px 0; gap: 10px; }
.score-box { font-size: 42px; font-weight: bold; color: #000; margin: 0; }
.level-box { font-size: 20px; font-weight: bold; color: #d32f2f; }
.leaderboard { width: 100%; border-collapse: collapse; margin-top: 15px; }
.leaderboard th, .leaderboard td { border: 1px solid #ccc; padding: 12px; text-align: center; font-size: 14px; }
.leaderboard th { background-color: #f9f9f9; }
.question-image-box {
    text-align: center; 
    margin: 15px 0 25px 0;
}

.q-image {
    width: 100%;
    max-width: 100%;       
    height: auto;
    border: 1px solid #000; 
    padding: 10px;        
    background-color: #fff;
    box-sizing: border-box;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}
.q-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    background-color: rgba(0, 0, 0, 0.95); 
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 75%;
    user-select: none;
    -webkit-user-drag: none; 
     transition: transform 0.05s ease-out; 
     animation: zoomIn 0.2s ease-out;
}
#modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
    font-size: 16px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes timerPulse {
    50% { opacity: 0.55; }
}

@media (max-width: 600px) {
    body { padding: 0; }
    .exam-paper { min-height: 100vh; padding: 24px 18px; }
    .brand-link { gap: 12px; }
    .brand-logo { width: 78px; height: 78px; }
    .brand-copy { width: 153px; }
    .brand-acronym { font-size: 53px; }
    .brand-english { margin-top: 5px; font-size: 5.75px; }
    .brand-korean { margin-top: 6px; font-size: 15px; }
    .site-home-button { top: 10px; left: 10px; }
    .site-home-screen { padding-top: 54px; }
    .site-home-logo { width: min(280px, 82%); }
    .menu-screen { padding-top: 28px; }
    .timer { text-align: left; }
    .student-info table { width: 100%; }
    .question-container { height: 66vh; min-height: 440px; gap: 10px; }
    .question-scroll, .answers-scroll { padding: 14px; }
    .question-text { font-size: 16px; }
    .question-passage { font-size: 15px; line-height: 1.75; }
    .options { margin-left: 0; }
    .options label { font-size: 15px; }
}
