/* 기본 설정 */
:root {
    --primary-color: #e74c3c;
    --secondary-color: #c0392b;
    --accent-color: #f39c12;
    --light-color: #fff5f5;
    --dark-color: #2c3e50;
    --text-color: #34495e;
    --border-color: #ecf0f1;
    --shadow-color: rgba(231, 76, 60, 0.2);
    --gradient-1: linear-gradient(135deg, #e74c3c, #c0392b);
    --gradient-2: linear-gradient(135deg, #f39c12, #e67e22);
    --gradient-3: linear-gradient(135deg, #3498db, #2980b9);
    --medical-gradient: linear-gradient(135deg, #ff6b6b, #ee5a52);
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --vh: 1vh;
}

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

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 50%, #ffd6d6 100%);
    min-height: calc(var(--vh, 1vh) * 100);
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* 페이지 전환 */
.page {
    display: block;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(20px);
}

.visible {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

.page.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: var(--medical-gradient);
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 30px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>') repeat;
    animation: float 20s linear infinite;
}

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

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

/* 인트로 섹션 */
.intro-section {
    text-align: center;
    margin: 40px 0;
    padding: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-left: 5px solid var(--primary-color);
}

.intro-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.intro-section h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.intro-section p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-color);
}

/* 기능 소개 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.feature-item {
    background: white;
    padding: 25px 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-top: 3px solid var(--accent-color);
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.feature-text h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.feature-text p {
    font-size: 0.9rem;
    color: #7f8c8d;
    line-height: 1.4;
}

/* 버튼 */
.start-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 40px auto;
    padding: 18px 30px;
    background: var(--medical-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.start-btn:hover::before {
    width: 300px;
    height: 300px;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px var(--shadow-color);
}

/* 경고 텍스트 */
.warning-text {
    text-align: center;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 20px;
    padding: 15px;
    background: #fef9e7;
    border-radius: 10px;
    border-left: 4px solid var(--warning-color);
}

/* 진행률 바 */
.progress-container {
    margin-bottom: 40px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--medical-gradient);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* 질문 컨테이너 */
.question-container {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border-left: 5px solid var(--primary-color);
}

#questionTitle {
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.4;
}

.question-description {
    font-size: 1rem;
    color: #7f8c8d;
    margin-bottom: 30px;
    text-align: center;
    padding: 15px;
    background: var(--light-color);
    border-radius: 10px;
}

/* 답변 옵션 */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-option {
    padding: 20px 25px;
    background: white;
    border: 2px solid #ecf0f1;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.answer-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: var(--medical-gradient);
    transition: width 0.3s ease;
    z-index: 1;
}

.answer-option:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.answer-option:hover::before {
    width: 5px;
}

.answer-option.selected {
    background: var(--medical-gradient);
    color: white;
    border-color: var(--secondary-color);
    transform: scale(1.02);
    box-shadow: 0 8px 25px var(--shadow-color);
}

/* 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
}

/* 분석 단계 */
.analysis-steps {
    margin: 30px 0;
}

.step-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.step-item.active {
    background: var(--light-color);
    border-left: 4px solid var(--primary-color);
}

.step-icon {
    font-size: 1.5rem;
}

.step-text {
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    margin-left: 15px;
    text-align: left;
}

.step-check {
    font-size: 1.2rem;
    font-weight: bold;
}

/* 타이머 */
.timer-container {
    margin: 30px 0;
}

.timer-circle {
    width: 80px;
    height: 80px;
    border: 4px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: white;
}

.timer-display {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* 결과 페이지 */
.result-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-left: 5px solid var(--primary-color);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

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

.result-title {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.result-subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
}

/* 결과 내용 */
.result-content {
    margin-bottom: 40px;
}

.result-content > div {
    background: white;
    margin: 20px 0;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border-left: 4px solid var(--accent-color);
}

.result-content h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 15px;
    font-weight: 600;
}

/* 액션 버튼들 */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 30px;
}

.action-buttons button {
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.detail-btn {
    background: var(--gradient-3);
    color: white;
}

.share-btn {
    background: #fee500;
    color: #3c1e1e;
}

.other-test-btn {
    background: var(--gradient-2);
    color: white;
}

.restart-btn {
    background: #95a5a6;
    color: white;
}

.action-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* 가이드 모달 */
.guide-modal {
    max-width: 900px;
    max-height: 90vh;
    text-align: left;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.close-btn {
    font-size: 2rem;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--primary-color);
}

.guide-section {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 4px solid var(--primary-color);
}

.guide-section h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.info-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.symptom-checklist, .warning-list {
    margin: 15px 0;
}

.symptom-checklist label, .warning-list p {
    display: block;
    margin: 10px 0;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    transition: all 0.3s ease;
}

.symptom-checklist label:hover {
    background: var(--light-color);
    transform: translateX(5px);
}

.treatment-levels, .exercise-types {
    display: grid;
    gap: 15px;
    margin: 20px 0;
}

.level-item, .exercise-category {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    border-left: 4px solid var(--accent-color);
}

.level-item h4, .exercise-category h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* 광고 */
.ad-container {
    margin: 30px 0;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px dashed #ddd;
}

.popup-ad-space {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .features {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .question-container {
        padding: 30px 20px;
    }
    
    #questionTitle {
        font-size: 1.4rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 30px 20px;
    }
    
    .guide-modal {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .intro-section h2 {
        font-size: 1.5rem;
    }
    
    .intro-section p {
        font-size: 1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .answer-option {
        padding: 15px 20px;
        font-size: 0.95rem;
    }
    
    .result-title {
        font-size: 1.7rem;
    }
}
