/* 기본 설정 */
:root {
    --primary-color: #ff6b35;
    --secondary-color: #f7931e;
    --accent-color: #ffd23f;
    --dark-color: #2c1810;
    --light-color: #fff8f3;
    --text-color: #3a2817;
    --border-color: #ffe4d6;
    --shadow-color: rgba(255, 107, 53, 0.3);
    --gradient-1: linear-gradient(135deg, #ff6b35, #f7931e);
    --gradient-2: linear-gradient(135deg, #ffd23f, #ffa726);
    --gradient-3: linear-gradient(135deg, #a855f7, #9333ea);
    --music-gradient: linear-gradient(135deg, #ff9a56, #ffad56);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --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, #fff8f3 0%, #ffe4d6 50%, #ffd4a3 100%);
    min-height: calc(var(--vh, 1vh) * 100);
    overflow-x: hidden;
    position: relative;
}

/* 음악 노트 배경 애니메이션 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(247, 147, 30, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 210, 63, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundFlow 20s ease-in-out infinite alternate;
}

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

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

/* 광고 컨테이너 스타일 */
.ad-container {
    margin: 20px 0;
    padding: 15px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--accent-color);
    box-shadow: 0 8px 25px var(--shadow-color);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-container.top {
    margin-top: 0;
    margin-bottom: 30px;
}

.ad-container.mid {
    margin: 30px 0;
    padding: 20px;
}

.ad-container.result {
    margin: 35px 0;
    padding: 20px;
}

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

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

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

.music-note-bg {
    position: absolute;
    font-size: 8rem;
    opacity: 0.15;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(15deg);
    animation: musicFloat 4s ease-in-out infinite;
}

@keyframes musicFloat {
    0%, 100% { transform: translate(-50%, -50%) rotate(15deg) scale(1); }
    50% { transform: translate(-50%, -50%) rotate(-15deg) scale(1.1); }
}

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

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

/* 인트로 섹션 */
.intro-section {
    text-align: center;
    margin: 40px 0;
    padding: 35px;
    background: white;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border-left: 6px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.intro-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.05) 0%, transparent 70%);
    animation: introGlow 6s ease-in-out infinite;
}

@keyframes introGlow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.intro-icon {
    font-size: 4.5rem;
    margin-bottom: 25px;
    animation: bounce 3s infinite;
    position: relative;
    z-index: 1;
}

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

.intro-section h2 {
    color: var(--primary-color);
    font-size: 1.9rem;
    margin-bottom: 20px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.intro-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    position: relative;
    z-index: 1;
}

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

.feature-item {
    background: white;
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    border-top: 4px solid var(--accent-color);
    position: relative;
    overflow: hidden;
}

.feature-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.1), transparent);
    transition: left 0.6s ease;
}

.feature-item:hover::before {
    left: 100%;
}

.feature-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.feature-text h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.feature-text p {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* 시작 버튼 */
.start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin: 40px auto;
    padding: 20px 35px;
    background: var(--music-gradient);
    color: white;
    border: none;
    border-radius: 60px;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 10px 30px 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.3);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

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

.start-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 45px var(--shadow-color);
}

.btn-icon {
    font-size: 1.6rem;
    animation: iconPulse 2s infinite;
}

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

/* 경고 텍스트 */
.warning-text {
    text-align: center;
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 25px;
    padding: 18px;
    background: linear-gradient(135deg, #fef3cd, #fde68a);
    border-radius: 15px;
    border-left: 4px solid var(--warning-color);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

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

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 107, 53, 0.2);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: var(--music-gradient);
    width: 0%;
    transition: width 0.6s ease;
    border-radius: 5px;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

/* 질문 컨테이너 */
.question-container {
    background: white;
    padding: 45px 35px;
    border-radius: 25px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.12);
    margin-bottom: 30px;
    border-left: 6px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.question-container::before {
    content: '🎵';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    opacity: 0.1;
    animation: questionFloat 4s ease-in-out infinite;
}

@keyframes questionFloat {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(10deg) scale(1.1); }
}

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

.question-description {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 35px;
    text-align: center;
    padding: 20px;
    background: var(--light-color);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

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

.answer-option {
    padding: 25px 30px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.4s 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(--music-gradient);
    transition: width 0.4s ease;
    z-index: 1;
}

.answer-option::after {
    content: '🎵';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.answer-option:hover {
    border-color: var(--primary-color);
    transform: translateX(8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

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

.answer-option:hover::after {
    opacity: 0.6;
}

.answer-option.selected {
    background: var(--music-gradient);
    color: white;
    border-color: var(--secondary-color);
    transform: scale(1.03);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.answer-option.selected::after {
    opacity: 1;
}

/* 모달 */
.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(8px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 45px 35px;
    border-radius: 25px;
    max-width: 550px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,0.4);
    position: relative;
}

.loading-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

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

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

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

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

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

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

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

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

/* 결과 페이지 */
.result-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 35px;
    background: white;
    border-radius: 25px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.12);
    border-left: 6px solid var(--primary-color);
}

.result-icon {
    font-size: 4.5rem;
    margin-bottom: 25px;
    animation: resultBounce 2s infinite;
}

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

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

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

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

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

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

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

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

.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: #9ca3af;
    color: white;
}

.action-buttons button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.close-btn {
    font-size: 2.2rem;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.3s ease;
}

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

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

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

.site-list, .device-methods, .quality-guide, .pro-tips {
    margin: 20px 0;
}

.site-item, .device-item, .quality-item, .tip-item {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-left: 4px solid var(--accent-color);
}

.site-item h4, .device-item h4, .quality-item h4, .tip-item h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.safety-checklist {
    margin: 20px 0;
}

.safety-checklist label {
    display: block;
    margin: 12px 0;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    border-left: 3px solid var(--accent-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

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

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

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

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

@media (max-width: 480px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .intro-section h2 {
        font-size: 1.6rem;
    }
    
    .intro-section p {
        font-size: 1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .answer-option {
        padding: 20px 25px;
        font-size: 0.95rem;
    }
    
    .result-title {
        font-size: 1.9rem;
    }
    
    .start-btn {
        font-size: 1.2rem;
        padding: 18px 30px;
    }
}
