/* ==========================================================================
   네이버 나눔스퀘어 네오 (Naver NanumSquare Neo) 폰트 불러오기
   ========================================================================== */
@font-face {
    font-family: 'NanumSquareNeo';
    src: url('https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareNeo/NanumSquareNeoTTF-cBd.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'NanumSquareNeo';
    src: url('https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareNeo/NanumSquareNeoTTF-bRg.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'NanumSquareNeo';
    src: url('https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareNeo/NanumSquareNeoTTF-aLt.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}

:root {
    --font-primary: 'NanumSquareNeo', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
    --primary-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
    --primary-color: #7C3AED;
    --primary-hover: #6D28D9;
    --accent-pink: #EC4899;
    --accent-teal: #06B6D4;
    --card-bg-light: #ffffff;
    --card-border-light: rgba(99, 102, 241, 0.12);
    --shadow-soft: 0 10px 30px -5px rgba(99, 102, 241, 0.1);
    --shadow-hover: 0 20px 40px -10px rgba(99, 102, 241, 0.2);
}

[data-bs-theme="dark"] {
    --card-bg-dark: #1E1B2E;
    --card-border-dark: rgba(139, 92, 246, 0.25);
    --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 40px -10px rgba(139, 92, 246, 0.3);
}

html, body {
    touch-action: pan-x pan-y;
}

body {
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-color: #F8FAFC;
    color: #1E293B;
}

[data-bs-theme="dark"] body {
    background-color: #0F0D17;
    color: #F1F5F9;
}

/* ==========================================================================
   유틸리티 & 컴포넌트
   ========================================================================== */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-brand {
    background: var(--primary-gradient);
    color: #ffffff;
}

.custom-card {
    border-radius: 1.25rem;
    border: 1px solid var(--card-border-light);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

[data-bs-theme="dark"] .custom-card {
    background: #191528;
    border-color: rgba(139, 92, 246, 0.2);
}

.custom-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.btn-brand {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 0.85rem;
    padding: 0.75rem 1.75rem;
    font-weight: 700;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
}

/* 버튼 광택 쉬머 효과 */
.btn-brand::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(60deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: rotate(25deg);
    animation: buttonShimmer 4s infinite ease-in-out;
}

@keyframes buttonShimmer {
    0% { left: -60%; }
    30% { left: 140%; }
    100% { left: 140%; }
}

.btn-brand:hover, .btn-brand:focus {
    color: #ffffff;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 28px rgba(236, 72, 153, 0.45);
}

.btn-brand:active {
    transform: translateY(-1px) scale(0.99);
}

/* 성별 선택 세그먼트 버튼 */
.btn-check:checked + .gender-btn {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-check:checked + .gender-btn i {
    color: #ffffff !important;
}

.gender-btn {
    border: none !important;
    color: inherit;
    transition: all 0.25s ease;
}

/* ==========================================================================
   부유(Floating) & 부드러운 순차 등장 애니메이션
   ========================================================================== */
.fade-in-up {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

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

.anim-float {
    animation: floating 3.2s ease-in-out infinite;
}

.anim-float-delayed {
    animation: floating 3.8s ease-in-out 1.2s infinite;
}

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

.anim-pulse {
    animation: pulseHeart 2s infinite ease-in-out;
}

@keyframes pulseHeart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 12px rgba(236, 72, 153, 0.5)); }
}

/* ==========================================================================
   네비게이션 & 헤더
   ========================================================================== */
.navbar-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
}

.theme-toggle-btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(124, 58, 237, 0.2);
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.theme-toggle-btn:hover {
    transform: rotate(20deg);
    background-color: rgba(124, 58, 237, 0.1);
}

/* ==========================================================================
   업로드 영역 & 스캐닝 애니메이션
   ========================================================================== */
.upload-dropzone {
    border: 2px dashed rgba(124, 58, 237, 0.35);
    border-radius: 1.5rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.03);
    position: relative;
    overflow: hidden;
}

.upload-dropzone:hover, .upload-dropzone.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
}

.preview-container {
    position: relative;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.preview-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* 스캐너 레이저 애니메이션 */
.scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, #EC4899, #6366F1, transparent);
    box-shadow: 0 0 15px #EC4899, 0 0 25px #6366F1;
    display: none;
    animation: scanAnimation 2.2s infinite ease-in-out;
}

@keyframes scanAnimation {
    0% {
        top: 0%;
        opacity: 0.9;
    }
    50% {
        top: 96%;
        opacity: 1;
    }
    100% {
        top: 0%;
        opacity: 0.9;
    }
}

/* ==========================================================================
   점수 배지 & 도식 시각화
   ========================================================================== */
.score-badge-circle {
    width: 125px;
    height: 125px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.45);
    animation: pulseBadge 2.8s infinite alternate ease-in-out;
}

/* 후광 네온 링 효과 */
.score-badge-circle::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #EC4899, #8B5CF6, #06B6D4, #EC4899);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotateRing 6s linear infinite;
}

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

@keyframes pulseBadge {
    0% {
        transform: scale(1);
        box-shadow: 0 10px 25px rgba(236, 72, 153, 0.35);
    }
    100% {
        transform: scale(1.06);
        box-shadow: 0 18px 40px rgba(124, 58, 237, 0.6);
    }
}

.score-number {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
}

.score-unit {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

/* 프로그레스 바 차오름 애니메이션 */
.progress-bar {
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-container {
    position: relative;
    margin: 0 auto;
    max-width: 440px;
    min-height: 320px;
}

/* ==========================================================================
   특징 태그 & 인포 카드 & 프로필 메타 칩
   ========================================================================== */
.profile-meta-capsule {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.12);
    max-width: 100%;
}

[data-bs-theme="dark"] .profile-meta-capsule {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.2s ease;
}

.meta-chip:hover {
    transform: translateY(-1px);
}

.meta-chip-female {
    background: rgba(236, 72, 153, 0.12);
    color: #DB2777;
    border: 1px solid rgba(236, 72, 153, 0.25);
}

[data-bs-theme="dark"] .meta-chip-female {
    background: rgba(236, 72, 153, 0.2);
    color: #F472B6;
    border-color: rgba(236, 72, 153, 0.35);
}

.meta-chip-male {
    background: rgba(59, 130, 246, 0.12);
    color: #2563EB;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-bs-theme="dark"] .meta-chip-male {
    background: rgba(59, 130, 246, 0.2);
    color: #60A5FA;
    border-color: rgba(59, 130, 246, 0.35);
}

.meta-chip-age {
    background: rgba(139, 92, 246, 0.12);
    color: #7C3AED;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

[data-bs-theme="dark"] .meta-chip-age {
    background: rgba(139, 92, 246, 0.2);
    color: #A78BFA;
    border-color: rgba(139, 92, 246, 0.35);
}

.meta-chip-shape {
    background: rgba(14, 165, 233, 0.12);
    color: #0284C7;
    border: 1px solid rgba(14, 165, 233, 0.25);
}

[data-bs-theme="dark"] .meta-chip-shape {
    background: rgba(14, 165, 233, 0.2);
    color: #38BDF8;
    border-color: rgba(14, 165, 233, 0.35);
}

.badge-theme-adaptive {
    background: rgba(124, 58, 237, 0.08);
    color: #4B5563;
    border: 1px solid rgba(124, 58, 237, 0.15);
    font-weight: 600;
}

[data-bs-theme="dark"] .badge-theme-adaptive {
    background: rgba(255, 255, 255, 0.08);
    color: #CBD5E1;
    border-color: rgba(255, 255, 255, 0.15);
}

.header-subtitle-badge {
    font-size: 0.72rem !important;
    padding: 0.25rem 0.65rem !important;
    letter-spacing: -0.01em;
    vertical-align: middle;
    font-weight: 500 !important;
}

.pill-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(124, 58, 237, 0.2);
}

[data-bs-theme="dark"] .badge-theme-adaptive {
    background: rgba(124, 58, 237, 0.08);
    color: #4B5563;
    border: 1px solid rgba(124, 58, 237, 0.15);
    font-weight: 600;
}

[data-bs-theme="dark"] .badge-theme-adaptive {
    background: rgba(255, 255, 255, 0.08);
    color: #CBD5E1;
    border-color: rgba(255, 255, 255, 0.15);
}

.header-subtitle-badge {
    font-size: 0.72rem !important;
    padding: 0.25rem 0.65rem !important;
    letter-spacing: -0.01em;
    vertical-align: middle;
    font-weight: 500 !important;
}

.pill-tag {
    background: rgba(139, 92, 246, 0.15);
    color: #C4B5FD;
    border-color: rgba(139, 92, 246, 0.3);
}

.highlight-box {
    border-left: 4px solid var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    padding: 1.25rem;
    border-radius: 0 0.85rem 0.85rem 0;
}

[data-bs-theme="dark"] .highlight-box {
    background: rgba(139, 92, 246, 0.08);
}

/* ==========================================================================
   로딩 오버레이
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 13, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.pulse-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #EC4899;
    border-right: 4px solid #8B5CF6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   푸터
   ========================================================================== */
footer {
    margin-top: auto;
    padding: 2.5rem 0;
    border-top: 1px solid rgba(124, 58, 237, 0.1);
    font-size: 0.875rem;
}

