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

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

/* 인앱 브라우저(카톡·인스타 등)에서 상하 UI로 뷰포트가 줄어도 스크롤 가능하도록 */
html {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background: #FFFFFF;
    min-height: 100vh;
    min-height: 100dvh; /* 동적 뷰포트: 주소창·하단바 있는 실제 보이는 영역 기준 */
    color: #000;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

body.exam-page {
    background: #FFFFFF;
}

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

.header {
    text-align: center;
    color: white;
    padding: 30px 0;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.section {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

.intro-card,
.form-card,
.complete-card,
.waiting-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.intro-card h2,
.form-card h2,
.complete-card h2,
.waiting-card h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #333;
}

.intro-card p,
.complete-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.intro-card ul {
    list-style: none;
    margin: 20px 0;
}

.intro-card li {
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 8px;
    color: #555;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    max-width: 351px;
    padding: 0 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-sizing: border-box;
}

.btn-primary {
    background: #00A264;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #008A54;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #F2F4F6;
    color: #000;
}

.btn-secondary:hover {
    background: #E8EAED;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.gender-selector {
    display: flex;
    gap: 15px;
}

.gender-btn {
    flex: 1;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.gender-btn:hover {
    border-color: #667eea;
}

.gender-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.gender-btn[data-gender="MALE"].selected {
    border-color: #4285f4;
    background: rgba(66, 133, 244, 0.1);
}

.gender-btn[data-gender="FEMALE"].selected {
    border-color: #ea4335;
    background: rgba(234, 67, 53, 0.1);
}

.gender-icon {
    font-size: 2rem;
}

.gender-btn[data-gender="MALE"] .gender-icon {
    color: #4285f4;
}

.gender-btn[data-gender="FEMALE"] .gender-icon {
    color: #ea4335;
}

.gender-btn .already-selected {
    display: block;
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
}

.gender-btn:disabled {
    background: #f5f5f5;
    border-color: #ddd;
}

.form-control {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.progress-bar {
    height: 4px;
    background: #E5E5E5;
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #00A264;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.category-title {
    color: #000;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 24px;
    text-align: left;
}

.questions-container {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.question-card {
    margin-bottom: 40px;
}

.question-card:last-child {
    margin-bottom: 0;
}

.question-number {
    display: block;
    background: transparent;
    color: #000;
    padding: 0;
    font-size: 25px;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 8px;
}

.question-text {
    font-size: 25px;
    font-weight: 500;
    color: #000;
    margin-bottom: 24px;
    line-height: 1.35;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-btn {
    display: flex;
    align-items: center;
    padding: 17px 16px;
    border: none;
    border-radius: 8px;
    background: #F2F4F6;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    gap: 10px;
}

.option-btn:hover {
    background: #E8EAED;
}

.option-btn.selected {
    background: #FFFFFF;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.25);
}

.option-check {
    width: 28.8px;
    height: 28.8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-check .option-check-icon {
    width: 28.8px;
    height: 28.8px;
    object-fit: contain;
    opacity: 0.2;
}

.option-btn.selected .option-check .option-check-icon {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(800%) hue-rotate(130deg);
}

.option-label {
    display: none;
}

.option-text {
    flex: 1;
    color: #000;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.8;
    opacity: 0.5;
}

.option-btn.selected .option-text {
    opacity: 1;
}

.short-answer-input,
.number-answer-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.short-answer-input:focus,
.number-answer-input:focus {
    outline: none;
    border-color: #667eea;
}

.number-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.number-input-wrapper .number-answer-input {
    flex: 1;
    text-align: right;
    font-weight: 600;
}

.number-unit {
    font-size: 1rem;
    color: #666;
    white-space: nowrap;
}

.nav-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #FFFFFF;
    max-width: 393px;
    margin: 0 auto;
}

.nav-buttons .btn {
    flex: 1;
}

.btn-next {
    background: #00A264;
    color: white;
    border-radius: 8px;
    height: 52px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
}

.btn-next:hover {
    background: #008A54;
}

.btn-next:disabled {
    background: #ccc;
}

.btn-prev {
    background: #F2F4F6;
    color: #000;
    border-radius: 8px;
    height: 52px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
}

.complete-icon,
.waiting-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
}

.complete-icon {
    color: #34a853;
}

.waiting-icon {
    font-size: 3rem;
}

.share-link-container {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.share-link {
    flex: 1;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.9rem;
    background: #f8f9fa;
}

.hint {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.questions-section {
    padding-bottom: 100px;
}

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

    .header h1 {
        font-size: 1.5rem;
    }

    .intro-card,
    .form-card,
    .complete-card {
        padding: 20px;
    }

    .gender-btn {
        padding: 15px;
    }
    
    .question-number,
    .question-text {
        font-size: 22px;
    }
}
