/* 고양이 MBTI 테스트 스타일 */

/* 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 화면 전환 */
.screen {
    display: none;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 시작 화면 */
.start-content {
    padding: 60px 40px;
    text-align: center;
}

.logo {
    margin-bottom: 40px;
}

/* 로고 툴팁 */
.logo a[href="/index.html"] {
    position: relative;
    display: inline-block;
}

.logo a[href="/index.html"]::after {
    content: "캣팁 홈으로";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.logo a[href="/index.html"]::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.logo a[href="/index.html"]:hover::after,
.logo a[href="/index.html"]:hover::before {
    opacity: 1;
    visibility: visible;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 80px;
    height: 80px;
    margin-bottom: 13px;
    border-radius: 50%;
    transition: transform 0.3s ease;
    cursor: pointer;
}
.logo-img:hover {
    transform: scale(1.1);
}

.main-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(102,126,234,0.10);
    color: #4a3fa2;
    font-weight: 900;
    text-align: center;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.15rem;
    color: #e0e0e0;
    font-weight: 400;
    margin-bottom: 0;
    text-shadow: 0 2px 6px rgba(0,0,0,0.13);
    text-align: center;
    opacity: 0.9;
    line-height: 1.5;
}

.intro {
    margin-top: 18px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
    border-radius: 18px;
    border: 1.5px solid #e0e0fa;
    box-shadow: 0 4px 18px rgba(102,126,234,0.08);
    padding: 26px 18px 18px 18px;
    text-align: center;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

.intro::before {
    content: '';
    position: absolute;
    top: -40px; left: -40px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, #b7bfff33 0%, transparent 80%);
    z-index: 0;
}

.intro-text {
    font-size: 0.97rem;
    color: #4a4a6a;
    margin-bottom: 18px;
    line-height: 1.7;
    font-weight: 500;
    text-shadow: 0 1px 6px rgba(102,126,234,0.05);
    position: relative;
    z-index: 1;
}

.features {
    display: flex;
    justify-content: center;
    gap: 13px;
    margin-bottom: 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.feature {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #5a5a7a;
    font-size: 0.99rem;
    background: #f7f5ff;
    border-radius: 9px;
    padding: 7px 14px;
    box-shadow: 0 1px 4px rgba(102,126,234,0.04);
    font-weight: 500;
    border: 1px solid #e0e0fa;
    transition: background 0.18s, box-shadow 0.18s;
}

.feature i {
    color: #7b5de3;
    font-size: 1.13rem;
    filter: drop-shadow(0 1px 2px #e0e0fa);
}

.feature:hover {
    background: #ede9fe;
    box-shadow: 0 2px 8px #b7bfff33;
}

.start-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

#start-screen .home-btn {
    background-color: transparent;
    border: 2px solid #a3bffa;
    color: #667eea;
    padding: 10px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

#start-screen .home-btn:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 테스트 화면 */
.test-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 5%;
}

.progress-text {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 60px;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.pause-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.question-container {
    padding: 40px 30px;
    min-height: 200px;
    display: flex;
    align-items: center;
}

.question-content {
    width: 100%;
    text-align: center;
}

.question-number {
    color: #667eea;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    line-height: 1.6;
    margin-bottom: 20px;
}

.question-description {
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
}

.answer-container {
    padding: 0 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-btn {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1rem;
    line-height: 1.5;
}

.answer-btn:hover {
    border-color: #667eea;
    background: #f7fafc;
    transform: translateY(-2px);
}

.answer-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.navigation {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #e2e8f0;
}

.nav-btn {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.nav-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #e2e8f0;
    color: #a0aec0;
    border-color: #e2e8f0;
    transform: none;
    box-shadow: none;
}

.nav-btn:disabled:hover {
    background: #e2e8f0;
    color: #a0aec0;
    border-color: #e2e8f0;
    transform: none;
    box-shadow: none;
}

.result-header {
    padding: 1.5rem; /* 패딩 원상 복구 */
    text-align: center;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.result-content {
    padding: 1.5rem; /* 패딩 원상 복구 */
}

.result-image-container {
    padding: 1.5rem 0;
    text-align: center;
}

.result-image {
    max-width: 100%;
    width: 280px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    animation: halo-glow 2.5s infinite alternate ease-in-out;
}

@keyframes halo-glow {
    from {
        box-shadow: 0 0 15px 5px rgba(118, 75, 162, 0.2), 0 0 25px 10px rgba(102, 126, 234, 0.2), 0 10px 30px rgba(0,0,0,0.1);
    }
    to {
        box-shadow: 0 0 25px 10px rgba(118, 75, 162, 0.4), 0 0 40px 15px rgba(102, 126, 234, 0.3), 0 10px 30px rgba(0,0,0,0.1);
    }
}

.result-title {
    font-size: 1.1rem;
    color: #667eea;
    margin-bottom: 20px;
}

.mbti-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mbti-type {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.mbti-name {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 500;
}

.result-description {
    position: relative;
    margin-bottom: 2rem;
    padding: 1.5rem 1.5rem 1.5rem 3.5rem; /* 따옴표 공간 확보를 위해 왼쪽 패딩 조정 */
    background: linear-gradient(135deg, #f5f3ff, #ede9fe); /* 연보라색 그라데이션 배경 */
    border-radius: 12px;
    border: 1px solid #ddd6fe; /* 테두리 색상 변경 */
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); /* 그림자 효과 추가 */
    line-height: 1.8;
}

.result-description::before {
    content: '“';
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 4rem; /* 따옴표 크기 조정 */
    color: #c4b5fd; /* 따옴표 색상 변경 */
    font-family: 'Georgia', serif;
    line-height: 1;
}

.description-text {
    color: #5b21b6; /* 짙은 보라색으로 텍스트 색상 변경 */
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 0;
    font-weight: 500;
    text-align: left;
}

.personality-traits,
.care-tips,
.compatibility {
    margin-bottom: 2rem;
    text-align: center;
}

.personality-traits h3,
.care-tips h3,
.compatibility h3 {
    font-size: 1.5rem;
    color: #805ad5;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
    padding-bottom: 0.5rem;
}

.personality-traits h3::after,
.care-tips h3::after,
.compatibility h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(135deg, #b794f4, #805ad5);
    border-radius: 2px;
}

.traits-list,
.care-tips-list,
.compatibility-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.trait-item,
.care-tip-item,
.compatibility-item {
    background-color: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.trait-item:hover,
.care-tip-item:hover,
.compatibility-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.trait-item h4,
.care-tip-item h4,
.compatibility-item h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.trait-item p,
.care-tip-item p,
.compatibility-item p {
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

.result-actions {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    display: flex; /* 버튼 정렬을 위해 flex 유지 */
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    border: none;
    font-size: 0.95rem;
}

.restart-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.share-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: linear-gradient(135deg, #38a169, #2f855a);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.copy-btn {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: linear-gradient(135deg, #dd6b20, #c05621);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(237, 137, 54, 0.3);
}

.home-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.home-btn:hover {
    background: #edf2f7;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-weight: 500;
}

.resume-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.resume-btn:hover {
    transform: translateY(-2px);
}

.restart-modal-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.restart-modal-btn:hover {
    background: #edf2f7;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .start-content {
        padding: 40px 20px;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .features {
        flex-direction: column;
        gap: 20px;
    }
    
    .test-header {
        padding: 15px 20px;
    }
    
    .question-container {
        padding: 30px 20px;
    }
    
    .answer-container {
        padding: 0 20px 20px;
    }
    
    .navigation {
        padding: 15px 20px;
    }
    
    .result-header {
        padding: 30px 20px;
    }
    
    .result-content {
        padding: 30px 20px;
    }
    
    .result-actions {
        padding: 20px;
        flex-direction: column;
    }
    
    .mbti-type {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.8rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .answer-btn {
        padding: 15px;
        font-size: 0.95rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    header {
        padding-top: 6px;
        padding-bottom: 2px;
    }
    .logo-img {
        width: 62px;
        height: 62px;
        margin-bottom: 8px;
        padding: 4px;
    }
    .main-title {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    .subtitle {
        font-size: 0.95rem;
    }
    .intro {
        padding: 13px 4px 8px 4px;
        max-width: 98vw;
    }
    .intro-text {
        font-size: 0.87rem;
        margin-bottom: 12px;
    }
    .features {
        gap: 7px;
    }
    .feature {
        font-size: 0.93rem;
        padding: 5px 7px;
    }
    .feature i {
        font-size: 0.98rem;
    }
}

/* 답변 선택 안내 메시지 */
.answer-hint {
    text-align: center;
    font-size: 0.95rem;
    margin-top: 15px;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 42px; /* 고정 높이로 레이아웃 쉬프트 방지 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-hint.prompt {
    color: #c53030;
    background-color: #fff5f5;
    animation: pulse 1.5s infinite;
}

.answer-hint.success {
    color: #2f855a;
    background-color: #f0fff4;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.3);
    }
    70% {
        transform: scale(1.01);
        box-shadow: 0 0 0 8px rgba(229, 62, 62, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
}

/* 결과 화면 애니메이션 */
#result-screen.active .result-header,
#result-screen.active .result-content > *,
#result-screen.active .result-actions > * {
    animation: result-fade-in 0.6s ease-out backwards;
}

#result-screen.active .result-image-container { animation-delay: 0.1s; }
#result-screen.active .result-description { animation-delay: 0.2s; }
#result-screen.active .personality-traits { animation-delay: 0.3s; }
#result-screen.active .care-tips { animation-delay: 0.4s; }
#result-screen.active .compatibility { animation-delay: 0.5s; }
#result-screen.active .result-actions > *:nth-child(1) { animation-delay: 0.6s; }
#result-screen.active .result-actions > *:nth-child(2) { animation-delay: 0.7s; }
#result-screen.active .result-actions > *:nth-child(3) { animation-delay: 0.8s; }
#result-screen.active .result-actions > *:nth-child(4) { animation-delay: 0.9s; }

@keyframes result-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-actions .home-btn:hover {
    background-color: #667eea;
    color: white;
}
