/* SoulLink - 动画样式 */

/* ============ 加载动画 ============ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

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

.fortune-loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--color-text-secondary);
}

/* ============ 卡片翻转动画 ============ */
.flip-card {
    perspective: 1000px;
    width: 120px;
    height: 168px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-bg-tertiary), var(--color-bg-secondary));
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-md);
    font-size: 3rem;
}

.flip-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--color-purple), var(--color-secondary));
}

/* ============ 浮动卡片动画 ============ */
.floating-cards {
    position: relative;
    width: 200px;
    height: 200px;
}

.floating-card {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
}

.card-1 {
    top: 0;
    left: 50%;
    animation-delay: 0s;
}

.card-2 {
    top: 30%;
    right: 0;
    animation-delay: 1.5s;
}

.card-3 {
    bottom: 20%;
    left: 10%;
    animation-delay: 3s;
}

.card-4 {
    bottom: 0;
    right: 20%;
    animation-delay: 4.5s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-15px) rotate(5deg);
    }
    75% {
        transform: translateY(-5px) rotate(-5deg);
    }
}

/* ============ 星光闪烁 ============ */
.star-twinkle {
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ============ 渐入动画 ============ */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

/* ============ 脉冲动画 ============ */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============ 进度条动画 ============ */
.progress-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-purple));
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
    background-size: 200% 100%;
}

@keyframes progress {
    0% {
        width: 0%;
        background-position: 0% 50%;
    }
    50% {
        width: 70%;
        background-position: 100% 50%;
    }
    100% {
        width: 100%;
        background-position: 0% 50%;
    }
}

/* ============ 卡片悬停效果 ============ */
.card-hover {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

/* ============ 渐变边框动画 ============ */
.gradient-border {
    position: relative;
    background: var(--color-bg-card);
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--color-gold), var(--color-purple), var(--color-gold));
    border-radius: inherit;
    z-index: -1;
    animation: gradientRotate 3s linear infinite;
    background-size: 200% 200%;
}

@keyframes gradientRotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============ 打字机效果 ============ */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-gold);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    from, to { border-color: transparent; }
    50% { border-color: var(--color-gold); }
}

/* ============ 旋转动画 ============ */
.rotate {
    animation: rotate 10s linear infinite;
}

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

/* ============ 弹跳动画 ============ */
.bounce {
    animation: bounce 1s ease infinite;
}

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

/* ============ 滑入动画 ============ */
.slide-up {
    animation: slideUp 0.5s ease forwards;
}

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

/* ============ 占卜特殊动画 ============ */
.tarot-spread {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin: var(--space-xl) 0;
}

.tarot-spread .spread-card {
    width: 100px;
    height: 140px;
    background: linear-gradient(135deg, var(--color-bg-tertiary), var(--color-bg-secondary));
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0;
    transform: translateY(50px) rotateY(180deg);
    animation: spreadCard 0.6s ease forwards;
}

.tarot-spread .spread-card:nth-child(1) { animation-delay: 0s; }
.tarot-spread .spread-card:nth-child(2) { animation-delay: 0.3s; }
.tarot-spread .spread-card:nth-child(3) { animation-delay: 0.6s; }
.tarot-spread .spread-card:nth-child(4) { animation-delay: 0.9s; }
.tarot-spread .spread-card:nth-child(5) { animation-delay: 1.2s; }

@keyframes spreadCard {
    to {
        opacity: 1;
        transform: translateY(0) rotateY(0);
    }
}

/* ============ 呼吸灯效果 ============ */
.breathe {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* ============ 响应式动画 ============ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
