/* ============================================
   공통 스타일 - 찐테스트 (프리미엄 버전)
   ============================================ */

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #FFF8F9;
    color: #3D3250;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === 귀여운 파스텔 컬러 팔레트 === */
:root {
    --bg-primary: #FFF8F9;
    --bg-secondary: #FFF0F3;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFF5F7;

    --text-primary: #3D3250;
    --text-secondary: #7B6F8E;
    --text-muted: #B8AEC8;

    --neon-purple: #C084FC;
    --neon-pink: #F9A8D4;
    --neon-blue: #93C5FD;
    --neon-cyan: #67E8F9;
    --neon-green: #6EE7B7;
    --neon-yellow: #FDE68A;
    --neon-red: #FCA5A5;

    --gradient-main: linear-gradient(135deg, #C084FC, #F9A8D4);
    --gradient-card: linear-gradient(145deg, #FFFFFF, #FFF5F7);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-glow: 0 4px 20px rgba(192, 132, 252, 0.15);
    --shadow-card: 0 4px 16px rgba(192, 132, 252, 0.08);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* === Typography === */
.text-gradient {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Container === */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === 질문 카드 === */
.question-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    border: 1.5px solid rgba(192, 132, 252, 0.1);
    box-shadow: var(--shadow-card);
    animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.question-number {
    font-size: 0.85rem;
    color: var(--neon-purple);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 28px;
}

/* === 선택지 버튼 (프리미엄) === */
.option-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: #FFFFFF;
    border: 1.5px solid rgba(192, 132, 252, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(192, 132, 252, 0.06);
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    background: #FFF5F7;
    border-color: var(--neon-pink);
    box-shadow: 0 6px 20px rgba(249, 168, 212, 0.18);
    transform: translateY(-3px);
}

.option-btn:active {
    transform: scale(0.98);
}

.option-btn.selected {
    background: rgba(249, 168, 212, 0.1);
    border-color: var(--neon-pink);
    box-shadow: 0 4px 16px rgba(249, 168, 212, 0.2);
}

/* Confetti 애니메이션 (선택 시) */
@keyframes confettiPop {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: scale(1.8) rotate(180deg); opacity: 0; }
}

/* === 프로그레스 바 === */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0;
    background: var(--bg-primary);
}

.progress-bar {
    height: 4px;
    background: rgba(192, 132, 252, 0.1);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-main);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 2px 2px 0;
    position: relative;
}

.progress-text {
    text-align: center;
    padding: 8px 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* === 결과 페이지 공통 === */
.result-container {
    padding: 40px 0 100px;
    text-align: center;
}

.result-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.result-type-name {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(192, 132, 252, 0.1));
}

.result-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    padding: 0 10px;
}

/* === 공유 버튼 영역 (프리미엄) === */
.share-section {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid rgba(192, 132, 252, 0.08);
}

.share-title {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-xl);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.share-btn:hover {
    transform: translateY(-3px) scale(1.02);
}

.share-btn:active {
    transform: scale(0.97);
}

.share-btn.kakao {
    background: #FEE500;
    color: #191919;
    box-shadow: 0 4px 12px rgba(254, 229, 0, 0.3);
}

.share-btn.kakao:hover {
    box-shadow: 0 6px 20px rgba(254, 229, 0, 0.4);
}

.share-btn.copy-link {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid rgba(192, 132, 252, 0.15);
    box-shadow: 0 2px 8px rgba(192, 132, 252, 0.06);
}

.share-btn.copy-link:hover {
    border-color: var(--neon-pink);
    box-shadow: 0 6px 20px rgba(249, 168, 212, 0.15);
}

.share-btn.twitter {
    background: #1DA1F2;
    color: white;
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.3);
}

.share-btn.twitter:hover {
    box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

.share-btn.instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 39, 67, 0.3);
}

.share-btn.instagram:hover {
    box-shadow: 0 6px 20px rgba(220, 39, 67, 0.4);
}

/* === 다른 테스트 추천 (프리미엄) === */
.other-tests {
    margin-top: 40px;
}

.other-tests h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}

.test-link-card {
    display: block;
    padding: 22px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1.5px solid rgba(192, 132, 252, 0.1);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.test-link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.test-link-card:hover {
    border-color: var(--neon-pink);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.test-link-card:hover::before {
    opacity: 1;
}

.test-link-card .emoji {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.test-link-card .title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.test-link-card .desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === 시작 화면 === */
.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px 20px;
    position: relative;
}

.start-emoji {
    font-size: 4.5rem;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(192, 132, 252, 0.15));
}

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

.start-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.3;
}

.start-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.start-btn {
    display: inline-block;
    padding: 16px 48px;
    background: var(--gradient-main);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(249, 168, 212, 0.3);
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    animation: btnShimmer 3s ease-in-out infinite;
}

@keyframes btnShimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.start-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(249, 168, 212, 0.4);
}

.start-btn:active {
    transform: scale(0.97);
}

/* === 로딩/전환 애니메이션 (개선) === */
.calculating-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.calculating-screen.active {
    display: flex;
}

/* 캐릭터 로딩 애니메이션 */
.calc-character {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: calcCharBounce 0.6s ease-in-out infinite alternate;
    filter: drop-shadow(0 4px 12px rgba(192, 132, 252, 0.2));
}

@keyframes calcCharBounce {
    0% { transform: translateY(0) rotate(-5deg); }
    100% { transform: translateY(-12px) rotate(5deg); }
}

/* 로딩 프로그레스 바 */
.calc-progress {
    width: 200px;
    height: 6px;
    background: rgba(192, 132, 252, 0.1);
    border-radius: 3px;
    margin: 16px auto;
    overflow: hidden;
}

.calc-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-main);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* 기존 스피너 유지 (폴백) */
.calc-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid rgba(249, 168, 212, 0.15);
    border-top-color: var(--neon-pink);
    border-right-color: var(--neon-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 24px;
    display: none;
}

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

.calc-text {
    font-size: 1.05rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
    font-weight: 500;
    transition: all 0.3s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 복사 시 confetti 폭발 */
@keyframes copyConfetti {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0) rotate(360deg); opacity: 0; }
}

.copy-confetti-particle {
    position: fixed;
    font-size: 1rem;
    pointer-events: none;
    z-index: 9999;
    animation: copyConfetti 0.8s ease-out forwards;
}

/* === 토스트 알림 (개선) === */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #FFFFFF;
    color: var(--text-primary);
    padding: 14px 28px;
    border-radius: var(--radius-xl);
    border: 1.5px solid var(--neon-pink);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 30px rgba(249, 168, 212, 0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* === 반응형 === */
@media (max-width: 360px) {
    .question-text {
        font-size: 1.1rem;
    }
    .option-btn {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    .start-title {
        font-size: 1.5rem;
    }
    .share-buttons {
        gap: 8px;
    }
    .share-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* ============================================
   다크모드 - 딥 네이비/퍼플 + 밝은 파스텔
   ============================================ */
[data-theme="dark"] {
    --bg-primary: #1A1625;
    --bg-secondary: #221D30;
    --bg-card: #2A2438;
    --bg-card-hover: #332D42;

    --text-primary: #F0E6FF;
    --text-secondary: #B8A8D4;
    --text-muted: #7B6F8E;

    --neon-purple: #D4A5FF;
    --neon-pink: #FFB8D9;
    --neon-blue: #A5C8FF;
    --neon-green: #8DF0C8;
    --neon-yellow: #FFE9A5;
    --neon-red: #FFB5B5;

    --gradient-main: linear-gradient(135deg, #D4A5FF, #FFB8D9);
    --gradient-card: linear-gradient(145deg, #2A2438, #332D42);

    --shadow-glow: 0 4px 20px rgba(212, 165, 255, 0.15);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] body,
[data-theme="dark"].cute-theme {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .question-card {
    background: var(--bg-card);
    border-color: rgba(212, 165, 255, 0.1);
}

[data-theme="dark"] .option-btn {
    background: var(--bg-card);
    border-color: rgba(212, 165, 255, 0.12);
    color: var(--text-primary);
}

[data-theme="dark"] .option-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--neon-pink);
}

[data-theme="dark"] .start-screen,
[data-theme="dark"] .calculating-screen {
    background: var(--bg-primary);
}

[data-theme="dark"] .toast {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--neon-pink);
}

[data-theme="dark"] .share-btn.copy-link {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: rgba(212, 165, 255, 0.15);
}

[data-theme="dark"] .test-link-card {
    background: var(--bg-card);
    border-color: rgba(212, 165, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .progress-container {
    background: var(--bg-primary);
}

[data-theme="dark"] .progress-bar {
    background: rgba(212, 165, 255, 0.1);
}

/* 다크모드 토글 버튼 */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1.5px solid rgba(192, 132, 252, 0.15);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(192, 132, 252, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 20px rgba(192, 132, 252, 0.2);
}

[data-theme="dark"] .theme-toggle {
    background: rgba(42, 36, 56, 0.9);
    border-color: rgba(212, 165, 255, 0.2);
}

/* === 접근성 === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
