@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Oswald:wght@400;500;600;700&display=swap');

:root {
    /* 안전/건축 테마 색상 */
    --primary-orange: #FF6B35;
    --primary-yellow: #FFD166;
    --warning-red: #E63946;
    --dark-navy: #1A1A2E;
    --dark-blue: #16213E;
    --accent-blue: #0F3460;
    --light-gray: #F8F9FA;
    --medium-gray: #E9ECEF;
    --text-dark: #212529;
    --text-light: #6C757D;
    --success-green: #06D6A0;
    --white: #FFFFFF;
    
    /* 그라데이션 */
    --gradient-safety: linear-gradient(135deg, #FF6B35 0%, #F7931E 50%, #FFD166 100%);
    --gradient-dark: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
    --gradient-header: linear-gradient(135deg, #1A1A2E 0%, #0F3460 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--light-gray);
    min-height: 100vh;
}

/* 배경 패턴 - 건축적 그리드 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(26, 26, 46, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 46, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== HEADER (기본 스타일) ==================== */
header {
    background: var(--gradient-header);
    color: var(--white);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 0.5rem;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--primary-orange);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-menu a:hover::before,
.nav-menu a.active::before {
    width: 80%;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 107, 53, 0.2);
}

/* ==================== HERO SECTION ==================== */
.hero {
    background: var(--gradient-dark);
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: var(--gradient-safety);
    opacity: 0.1;
    transform: rotate(-15deg);
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--white);
}

.hero h2 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* 안전 아이콘 장식 */
.safety-icons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.safety-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 107, 53, 0.2);
    border: 2px solid var(--primary-orange);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    animation: float 3s ease-in-out infinite;
}

.safety-icon:nth-child(2) { animation-delay: 0.5s; }
.safety-icon:nth-child(3) { animation-delay: 1s; }
.safety-icon:nth-child(4) { animation-delay: 1.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================== MAIN CONTENT ==================== */
main {
    min-height: calc(100vh - 200px);
    padding: 2.5rem 0;
}

.intro {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 5px solid var(--primary-orange);
    position: relative;
    overflow: hidden;
}

.intro::after {
    content: '🏗️';
    position: absolute;
    right: 20px;
    bottom: 10px;
    font-size: 4rem;
    opacity: 0.1;
}

.intro h2 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    color: var(--dark-navy);
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.intro p {
    color: var(--text-light);
    font-size: 1rem;
}

/* ==================== CERTIFICATE CARDS ==================== */
.certificates h2 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    color: var(--dark-navy);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.certificates h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-safety);
    border-radius: 2px;
}

.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.cert-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
}

.cert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-safety);
}

.cert-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(255, 107, 53, 0.2);
}

.cert-card-header {
    background: var(--gradient-dark);
    padding: 1.5rem;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cert-icon {
    width: 50px;
    height: 50px;
    background: var(--gradient-safety);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.cert-card-header h3 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
}

.cert-card-body {
    padding: 1.5rem;
}

.cert-card-body p {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.cert-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    background: var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.stat-item strong {
    color: var(--primary-orange);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.875rem 1.75rem;
    background: var(--gradient-safety);
    color: var(--white);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: var(--gradient-dark);
    box-shadow: 0 4px 15px rgba(26, 26, 46, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(26, 26, 46, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-green) 0%, #05B384 100%);
    box-shadow: 0 4px 15px rgba(6, 214, 160, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(6, 214, 160, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-orange);
    color: var(--primary-orange);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary-orange);
    color: var(--white);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ==================== EXAM PAGE STYLES ==================== */
.exam-header {
    background: var(--white);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-left: 5px solid var(--primary-orange);
}

.exam-info {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.exam-info > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exam-info span:first-child {
    font-weight: 700;
    color: var(--dark-navy);
}

.exam-info span:last-child {
    color: var(--primary-orange);
    font-weight: 600;
}

/* PDF 다운로드/보기 버튼 */
.pdf-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1.25rem;
    background: var(--white);
    color: var(--dark-navy);
    text-decoration: none;
    border-radius: 10px;
    border: 2px solid var(--medium-gray);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.pdf-btn:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.05);
}

.pdf-btn.download {
    background: var(--gradient-safety);
    color: var(--white);
    border: none;
}

.pdf-btn.download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

/* ==================== QUESTION CONTAINER ==================== */
.question-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ==================== QUESTION SUBJECT ==================== */
.question-subject {
    margin-bottom: 1rem;
}

.subject-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.subject-law {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.subject-general {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.subject-diagnosis {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.subject-other {
    background: var(--gradient-safety);
}

/* ==================== QUESTION IMAGE ==================== */
.question-image-container {
    margin: 1rem 0 1.5rem;
    text-align: center;
}

.question-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 2px solid var(--medium-gray);
    cursor: zoom-in;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.question-image:hover {
    border-color: var(--primary-orange);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.2);
}

/* 이미지 확대 모달 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: zoom-out;
    padding: 2rem;
}

.image-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-modal img {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
    z-index: 3001;
}

.image-modal-close:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .image-modal {
        padding: 1rem;
    }
    
    .image-modal-close {
        top: 10px;
        right: 15px;
        font-size: 2rem;
    }
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--medium-gray);
}

.question-number {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark-navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-number::before {
    content: '';
    width: 40px;
    height: 40px;
    background: var(--gradient-safety);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-number span {
    background: var(--gradient-safety);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.question-text {
    font-size: 1.1rem;
    line-height: 1.9;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    white-space: pre-line;
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary-orange);
}

/* ==================== OPTIONS ==================== */
.options {
    list-style: none;
    margin-bottom: 1.5rem;
}

.option {
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    border: 2px solid var(--medium-gray);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.option:hover {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.03);
    transform: translateX(5px);
}

.option.selected {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.option.correct {
    border-color: var(--success-green);
    background: rgba(6, 214, 160, 0.1);
    box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.1);
}

.option.incorrect {
    border-color: var(--warning-red);
    background: rgba(230, 57, 70, 0.1);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-orange);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.option label {
    cursor: pointer;
    flex: 1;
    line-height: 1.6;
}

/* ==================== EXPLANATION ==================== */
.explanation {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(6, 214, 160, 0.1) 0%, rgba(5, 179, 132, 0.05) 100%);
    border-left: 4px solid var(--success-green);
    border-radius: 12px;
    display: none;
}

.explanation.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.explanation h4 {
    color: var(--success-green);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation h4::before {
    content: '💡';
}

.explanation p {
    color: var(--text-dark);
    line-height: 1.8;
}

/* ==================== NAVIGATION BUTTONS ==================== */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.navigation-buttons button {
    flex: 1;
    min-width: 140px;
    padding: 1rem;
    font-size: 1rem;
}

/* ==================== QUESTION LIST ==================== */
.question-list {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.question-list h3 {
    margin-bottom: 1rem;
    color: var(--dark-navy);
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-weight: 600;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
}

.question-btn {
    padding: 0.75rem;
    border: 2px solid var(--medium-gray);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.question-btn:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.question-btn.current {
    border-color: var(--primary-orange);
    background: var(--gradient-safety);
    color: var(--white);
}

.question-btn.answered {
    background: rgba(6, 214, 160, 0.15);
    border-color: var(--success-green);
    color: var(--success-green);
}

/* ==================== PDF VIEWER SECTION ==================== */
.pdf-section {
    background: var(--white);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.pdf-section h3 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    color: var(--dark-navy);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-section h3::before {
    content: '📋';
}

.pdf-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.pdf-card {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.pdf-card:hover {
    border-color: var(--primary-orange);
    background: var(--white);
}

.pdf-card-icon {
    width: 50px;
    height: 50px;
    background: var(--gradient-safety);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.pdf-card-info {
    flex: 1;
    min-width: 0;
}

.pdf-card-info h4 {
    font-size: 0.95rem;
    color: var(--dark-navy);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-card-info p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.pdf-card-actions {
    display: flex;
    gap: 0.5rem;
}

.pdf-card-actions a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--white);
    color: var(--dark-navy);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--medium-gray);
}

.pdf-card-actions a:hover {
    background: var(--primary-orange);
    color: var(--white);
    border-color: var(--primary-orange);
}

/* ==================== FOOTER ==================== */
footer {
    background: var(--gradient-dark);
    color: var(--white);
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 3rem;
}

footer p {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 992px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .cert-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        width: 100%;
        justify-content: center;
    }

    .nav-menu a {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .hero {
        padding: 2.5rem 0;
    }

    .hero h2 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .safety-icons {
        gap: 1rem;
    }

    .safety-icon {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }

    .intro,
    .question-container,
    .question-list,
    .pdf-section {
        padding: 1.25rem;
    }

    .exam-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem;
    }

    .exam-info {
        flex-direction: column;
        gap: 0.75rem;
    }

    .pdf-actions {
        width: 100%;
    }

    .pdf-btn {
        flex: 1;
        justify-content: center;
    }

    .navigation-buttons {
        flex-direction: column;
    }

    .navigation-buttons button {
        width: 100%;
    }

    .question-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }

    .question-text {
        font-size: 1rem;
        padding: 1rem;
    }

    .option {
        padding: 1rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    header h1::before {
        font-size: 1.2rem;
    }

    .nav-menu a {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .cert-card-header {
        padding: 1rem;
    }

    .cert-card-body {
        padding: 1rem;
    }

    .cert-stats {
        flex-direction: column;
    }

    .pdf-cards {
        grid-template-columns: 1fr;
    }

    .pdf-card {
        flex-wrap: wrap;
    }

    .pdf-card-actions {
        width: 100%;
        margin-top: 0.5rem;
    }

    .pdf-card-actions a {
        flex: 1;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.btn:active {
    transform: scale(0.98);
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-safety);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-orange);
}

/* ==================== QUESTION GRID STATUS ==================== */
.question-btn.correct-answer {
    background: var(--success-green) !important;
    border-color: var(--success-green) !important;
    color: var(--white) !important;
}

.question-btn.wrong-answer {
    background: var(--warning-red) !important;
    border-color: var(--warning-red) !important;
    color: var(--white) !important;
}

.question-list-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-light);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 2px solid var(--medium-gray);
}

.legend-dot.current {
    background: var(--gradient-safety);
    border: none;
}

.legend-dot.answered {
    background: rgba(6, 214, 160, 0.15);
    border-color: var(--success-green);
}

.legend-dot.correct {
    background: var(--success-green);
    border: none;
}

.legend-dot.wrong {
    background: var(--warning-red);
    border: none;
}

/* ==================== HEADER ACTIONS ==================== */
.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    background: var(--gradient-dark);
    color: var(--white);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem 2rem;
    background: var(--light-gray);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== RESULT SUMMARY ==================== */
.result-summary {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.result-score {
    text-align: center;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 6px;
    background: var(--gradient-safety);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.score-circle.pass {
    background: rgba(6, 214, 160, 0.1);
}

.score-circle.pass::before {
    background: linear-gradient(135deg, var(--success-green), #05B384);
}

.score-circle.fail {
    background: rgba(230, 57, 70, 0.1);
}

.score-circle.fail::before {
    background: linear-gradient(135deg, var(--warning-red), #C1121F);
}

.score-number {
    font-family: 'Oswald', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.score-circle.pass .score-number {
    color: var(--success-green);
}

.score-circle.fail .score-number {
    color: var(--warning-red);
}

.score-unit {
    font-size: 1rem;
    color: var(--text-light);
}

.score-status {
    font-size: 1.2rem;
    font-weight: 600;
}

.fail-notice {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--warning-red);
    font-weight: 500;
}

/* ==================== SUBJECT SCORES ==================== */
.subject-scores {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--medium-gray);
}

.subject-scores h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--dark-navy);
    font-weight: 600;
}

.subject-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.subject-score-item {
    background: var(--light-gray);
    padding: 1.25rem;
    border-radius: 12px;
    border: 2px solid var(--medium-gray);
    transition: all 0.3s ease;
}

.subject-score-item.fail {
    border-color: var(--warning-red);
    background: rgba(230, 57, 70, 0.1);
}

.subject-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.subject-name {
    font-weight: 600;
    color: var(--dark-navy);
    font-size: 0.95rem;
}

.fail-badge {
    background: var(--warning-red);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.subject-score-value {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.subject-score-number {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-navy);
}

.subject-score-item.fail .subject-score-number {
    color: var(--warning-red);
}

.subject-score-unit {
    font-size: 1rem;
    color: var(--text-light);
}

.subject-score-detail {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ==================== RESULT STATS ==================== */
.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-box {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid transparent;
}

.stat-box.correct {
    border-color: var(--success-green);
    background: rgba(6, 214, 160, 0.1);
}

.stat-box.wrong {
    border-color: var(--warning-red);
    background: rgba(230, 57, 70, 0.1);
}

.stat-box.unanswered {
    border-color: var(--text-light);
}

.stat-box.total {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.1);
}

.stat-number {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.stat-box.correct .stat-number { color: var(--success-green); }
.stat-box.wrong .stat-number { color: var(--warning-red); }
.stat-box.unanswered .stat-number { color: var(--text-light); }
.stat-box.total .stat-number { color: var(--primary-orange); }

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ==================== RESULT SECTIONS ==================== */
.result-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--medium-gray);
}

.result-section h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--dark-navy);
}

.wrong-section h4 { color: var(--warning-red); }
.correct-section h4 { color: var(--success-green); }
.unanswered-section h4 { color: var(--text-light); }

.result-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-list.collapsed {
    max-height: 0;
    overflow: hidden;
    margin: 0;
}

.result-item {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid var(--medium-gray);
}

.result-item.wrong {
    border-left-color: var(--warning-red);
    background: rgba(230, 57, 70, 0.05);
}

.result-item.correct {
    border-left-color: var(--success-green);
    background: rgba(6, 214, 160, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.result-item.unanswered {
    border-left-color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.result-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-item-num {
    font-weight: 700;
    color: var(--dark-navy);
    font-size: 0.95rem;
}

.result-item-question {
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
}

.result-item.correct .result-item-question,
.result-item.unanswered .result-item-question {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-item-answers {
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.result-item-answers p {
    margin-bottom: 0.25rem;
}

.label {
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.wrong-label {
    background: rgba(230, 57, 70, 0.15);
    color: var(--warning-red);
}

.correct-label {
    background: rgba(6, 214, 160, 0.15);
    color: var(--success-green);
}

.result-item-explanation {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--medium-gray);
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

.goto-btn {
    flex-shrink: 0;
}

.toggle-list-btn {
    margin-top: 0.75rem;
}

/* ==================== MODAL RESPONSIVE ==================== */
@media (max-width: 768px) {
    .modal-content {
        max-height: 95vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-footer {
        padding: 1rem;
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
    }

    .result-summary {
        flex-direction: column;
        gap: 1.5rem;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-number {
        font-size: 2.5rem;
    }

    .result-stats {
        width: 100%;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .result-item.correct,
    .result-item.unanswered {
        flex-wrap: wrap;
    }

    .result-item.correct .goto-btn,
    .result-item.unanswered .goto-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0.5rem;
    }

    .result-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .stat-box {
        padding: 0.75rem 0.5rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .subject-scores-grid {
        grid-template-columns: 1fr;
    }

    .subject-score-item {
        padding: 1rem;
    }

    .subject-score-number {
        font-size: 1.75rem;
    }
}

/* ==================== HEADER TITLE & SUBTITLE ==================== */
.header-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.main-header h1 a,
.desktop-header h1 a {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.main-header h1 a::before,
.desktop-header h1 a::before {
    content: '⚠';
    font-size: 1.5rem;
    background: var(--gradient-safety);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.main-header h1 a:hover,
.desktop-header h1 a:hover {
    opacity: 0.8;
}

.header-subtitle {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.3px;
    opacity: 0.7;
    margin-top: 0.05rem;
    margin-left: 2rem;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
    text-align: left;
}

/* ==================== MAIN HEADER (홈페이지용) ==================== */
.main-header {
    background: var(--gradient-header);
    color: var(--white);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.main-header h1 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
}


/* ==================== DESKTOP HEADER (시험페이지용) ==================== */
.desktop-header {
    background: var(--gradient-header);
    color: var(--white);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.desktop-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.desktop-header h1 {
    font-family: 'Oswald', 'Noto Sans KR', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
}


/* ==================== EXAM MAIN LAYOUT ==================== */
.exam-body {
    background: var(--light-gray);
}

.exam-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
    height: calc(100vh - 70px);
}

/* 문제 영역 패널 */
.questions-panel {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.questions-header {
    padding: 0.6rem 1rem;
    background: var(--gradient-dark);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.exam-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* PDF 버튼 섹션 */
.pdf-buttons-section {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.pdf-button-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}

.pdf-label {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.9;
    margin-right: 0.2rem;
}

.pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pdf-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.pdf-btn.pdf-view {
    background: rgba(6, 214, 160, 0.2);
    border-color: rgba(6, 214, 160, 0.3);
}

.pdf-btn.pdf-view:hover {
    background: rgba(6, 214, 160, 0.3);
    border-color: rgba(6, 214, 160, 0.5);
}

.pdf-btn.pdf-download {
    background: rgba(255, 107, 53, 0.2);
    border-color: rgba(255, 107, 53, 0.3);
}

.pdf-btn.pdf-download:hover {
    background: rgba(255, 107, 53, 0.3);
    border-color: rgba(255, 107, 53, 0.5);
}

.exam-badge {
    background: var(--gradient-safety);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.exam-info-text {
    opacity: 0.8;
    font-size: 0.8rem;
}

.questions-progress {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.questions-progress strong {
    color: var(--primary-yellow);
}

/* 문제 스크롤 영역 */
.questions-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    align-content: start;
}

/* 문제 카드 */
.question-card {
    background: var(--white);
    border: 2px solid var(--medium-gray);
    border-radius: 10px;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.question-card:hover {
    border-color: var(--primary-orange);
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.1);
}

.question-card.highlight {
    animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
    50% { box-shadow: 0 0 0 6px rgba(255, 107, 53, 0.3); }
}

.question-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.question-number-badge {
    width: 32px;
    height: 32px;
    background: var(--gradient-safety);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.question-card .question-text {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    white-space: pre-line;
    background: var(--light-gray);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    border-left: 3px solid var(--primary-orange);
}

/* 문제 이미지 */
.question-card .question-image-container {
    margin: 0.4rem 0;
    text-align: center;
}

.question-card .question-image {
    max-width: 100%;
    max-height: 150px;
    border-radius: 6px;
    border: 2px solid var(--medium-gray);
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.question-card .question-image:hover {
    border-color: var(--primary-orange);
}

/* 선택지 리스트 */
.options-list {
    list-style: none;
    margin-bottom: 0.3rem;
}

.options-list .option-item:last-child {
    margin-bottom: 0;
}

.option-item {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.25rem;
    border: 1px solid var(--medium-gray);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    -webkit-tap-highlight-color: transparent;
}

.option-item:hover {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.03);
}

.option-item.selected {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.08);
}

.option-item.correct {
    border-color: var(--success-green);
    background: rgba(6, 214, 160, 0.1);
}

.option-item.incorrect {
    border-color: var(--warning-red);
    background: rgba(230, 57, 70, 0.1);
}

.option-item input[type="radio"] {
    display: none;
}

.option-item label {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    cursor: pointer;
    flex: 1;
    line-height: 1.4;
}

.option-number {
    width: 20px;
    height: 20px;
    background: var(--medium-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.option-item.selected .option-number {
    background: var(--primary-orange);
    color: var(--white);
}

.option-item.correct .option-number {
    background: var(--success-green);
    color: var(--white);
}

.option-item.incorrect .option-number {
    background: var(--warning-red);
    color: var(--white);
}

.option-text {
    flex: 1;
    font-size: 0.8rem;
}

/* 문제 액션 버튼 */
.question-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.question-actions .btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

/* 해설 */
.question-card .explanation {
    margin-top: 0.5rem;
    padding: 0.6rem;
    background: linear-gradient(135deg, rgba(6, 214, 160, 0.1) 0%, rgba(5, 179, 132, 0.05) 100%);
    border-left: 3px solid var(--success-green);
    border-radius: 6px;
    display: none;
}

.question-card .explanation.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-card .explanation h4 {
    color: var(--success-green);
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.question-card .explanation h4::before {
    content: '💡';
    font-size: 0.9em;
}

.question-card .explanation p {
    color: var(--text-dark);
    font-size: 0.75rem;
    line-height: 1.5;
}

/* ==================== ANSWER SHEET PANEL (DESKTOP) ==================== */
.answer-sheet-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: calc(100vh - 90px);
    position: sticky;
    top: 80px;
}

/* 타이머 섹션 */
.timer-section {
    background: var(--gradient-dark);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    color: var(--white);
}

.timer-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.timer-display {
    font-family: 'Oswald', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary-yellow);
}

.timer-display.warning {
    color: var(--primary-orange);
    animation: pulse 1s ease-in-out infinite;
}

.timer-display.critical {
    color: var(--warning-red);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timer-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    background: var(--success-green);
    border-radius: 3px;
    transition: width 1s linear;
}

.timer-bar-fill.warning {
    background: var(--primary-orange);
}

.timer-bar-fill.critical {
    background: var(--warning-red);
}

/* 답안지 */
.answer-sheet {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.answer-sheet-header {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-sheet-header h3 {
    font-size: 0.85rem;
    color: var(--dark-navy);
}

.answer-legend {
    display: flex;
    gap: 0.5rem;
    font-size: 0.65rem;
    color: var(--text-light);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid var(--medium-gray);
}

.legend-dot.answered {
    background: var(--success-green);
    border-color: var(--success-green);
}

.legend-dot.current {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
}

.legend-dot.unanswered {
    background: var(--white);
    border-color: var(--medium-gray);
}

/* 답안 섹션 */
.answer-sections {
    padding: 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
}

.answer-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.answer-section:not(:last-child) {
    margin-bottom: 0.4rem;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--dark-navy);
    margin-bottom: 0.3rem;
    padding: 0.25rem 0.5rem;
    background: var(--light-gray);
    border-radius: 4px;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    flex: 1;
}

.answer-btn {
    width: 100%;
    padding: 0.25rem;
    min-height: 28px;
    border: 1px solid var(--medium-gray);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    color: var(--text-dark);
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-btn:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.answer-btn.answered {
    background: var(--success-green);
    border-color: var(--success-green);
    color: var(--white);
}

.answer-btn.current {
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.3);
}

/* 제출 버튼 섹션 */
.submit-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.submit-section .btn {
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* ==================== SUBJECT BADGE ==================== */
.subject-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--white);
}

.subject-law {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.subject-general {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.subject-diagnosis {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.subject-other {
    background: var(--gradient-safety);
}

/* ==================== MOBILE HEADER (기본 숨김) ==================== */
.exam-header-mobile {
    display: none;
}

/* ==================== MOBILE BOTTOM NAV (기본 숨김) ==================== */
.mobile-bottom-nav {
    display: none;
}

/* ==================== MOBILE ANSWER MODAL (기본 숨김) ==================== */
.mobile-answer-modal {
    display: none;
}

/* ==================== RESPONSIVE - MOBILE ==================== */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .main-header h1 {
        font-size: 1.4rem;
    }
    
    .header-title {
        align-items: center;
    }
    
    .header-subtitle {
        margin-left: 0;
        font-size: 0.6rem;
        white-space: nowrap;
    }
    
    .main-header h1 a::before,
    .desktop-header h1 a::before {
        font-size: 1.2rem;
    }
    
    /* 시험 페이지에서 데스크톱 헤더 숨김 */
    .exam-body .desktop-header {
        display: none;
    }
    
    /* 모바일 헤더 표시 */
    .exam-header-mobile {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--gradient-header);
        color: var(--white);
    }
    
    .mobile-header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .back-btn {
        color: var(--white);
        text-decoration: none;
        font-size: 1.5rem;
        padding: 0.25rem 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        flex-shrink: 0;
        transition: opacity 0.2s ease;
    }
    
    .back-btn:hover {
        opacity: 0.8;
    }
    
    .mobile-title {
        flex: 1;
        text-align: center;
        min-width: 0;
        overflow: hidden;
    }
    
    .mobile-exam-name {
        font-weight: 600;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }
    
    .menu-toggle-btn {
        background: none;
        border: none;
        color: var(--white);
        font-size: 1.5rem;
        padding: 0.25rem 0.5rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        flex-shrink: 0;
        transition: opacity 0.2s ease;
    }
    
    .menu-toggle-btn:hover {
        opacity: 0.8;
    }
    
    .mobile-timer-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
        background: rgba(0, 0, 0, 0.2);
        font-size: 0.85rem;
        gap: 0.75rem;
    }
    
    .mobile-timer {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .timer-icon {
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .timer-text {
        font-family: 'Oswald', monospace;
        font-weight: 700;
        color: var(--primary-yellow);
        font-size: 1.1rem;
        white-space: nowrap;
    }
    
    .timer-text.warning {
        color: var(--primary-orange);
    }
    
    .timer-text.critical {
        color: var(--warning-red);
        animation: pulse 0.5s ease-in-out infinite;
    }
    
    .mobile-progress {
        color: rgba(255, 255, 255, 0.8);
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* 메인 레이아웃 조정 */
    .exam-main {
        display: block;
        padding: 0;
        height: auto;
        padding-top: 100px;
        padding-bottom: 70px;
    }
    
    .questions-panel {
        border-radius: 0;
        height: auto;
        min-height: calc(100vh - 170px);
    }
    
    .questions-header {
        display: none;
    }
    
    .questions-scroll-area {
        padding: 1rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 데스크톱 답안지 패널 숨김 */
    .answer-sheet-panel {
        display: none;
    }
    
    /* 문제 카드 모바일 스타일 */
    .question-card {
        padding: 0.6rem;
    }
    
    .question-card .question-text {
        font-size: 0.8rem;
        font-weight: 700;
        padding: 0.5rem;
        line-height: 1.4;
    }
    
    /* 모바일 하단 네비게이션 */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }
    
    .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 0.5rem;
        background: none;
        border: none;
        color: var(--text-light);
        cursor: pointer;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .nav-item:active {
        background: var(--light-gray);
    }
    
    .nav-item .nav-icon {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    .nav-item .nav-label {
        font-size: 0.7rem;
        font-weight: 500;
    }
    
    .nav-item.nav-answer-sheet {
        color: var(--primary-orange);
    }
    
    .nav-item.nav-submit {
        color: var(--success-green);
    }
    
    /* 모바일 답안지 모달 */
    .mobile-answer-modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2000;
        align-items: flex-end;
        justify-content: center;
    }
    
    .mobile-answer-modal.show {
        display: flex;
    }
    
    .mobile-answer-content {
        background: var(--white);
        width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        display: flex;
        flex-direction: column;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .mobile-answer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.25rem;
        border-bottom: 2px solid var(--medium-gray);
    }
    
    .mobile-answer-header h3 {
        font-size: 1.1rem;
        color: var(--dark-navy);
    }
    
    .close-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-light);
        cursor: pointer;
        padding: 0.25rem;
    }
    
    .mobile-answer-body {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
    }
    
    .mobile-answer-legend {
        display: flex;
        justify-content: center;
        gap: 1.5rem;
        margin-bottom: 1rem;
        font-size: 0.8rem;
        color: var(--text-light);
    }
    
    .mobile-answer-sections {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .mobile-answer-section .section-title {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }
    
    .mobile-answer-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    
    .mobile-answer-grid .answer-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
        aspect-ratio: 1;
    }
    
    .mobile-answer-footer {
        display: flex;
        gap: 0.75rem;
        padding: 1rem;
        border-top: 2px solid var(--medium-gray);
    }
    
    .mobile-answer-footer .btn {
        flex: 1;
        padding: 0.875rem;
    }
}
