/**
 * 알파벳 단어 (Alphabet Word) - Animation Styles
 * Cosmic-themed animations and effects
 * Version: 1.0.0
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Rotation Animations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* Pulse Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(118, 75, 162, 0.4);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatRotate {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(2deg);
    }
    50% {
        transform: translateY(-10px) rotate(0deg);
    }
    75% {
        transform: translateY(-5px) rotate(-2deg);
    }
}

/* Cosmic Animations */
@keyframes cosmicPulse {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

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

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

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Game-specific Animations */
@keyframes correctAnswer {
    0% {
        background-color: var(--success-light);
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        background-color: var(--success-light);
        transform: scale(1);
    }
}

@keyframes wrongAnswer {
    0%, 100% {
        background-color: var(--error-light);
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

@keyframes scorePopup {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(1);
    }
}

@keyframes comboFlash {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.5);
    }
}

@keyframes letterReveal {
    0% {
        opacity: 0;
        transform: rotateY(90deg);
    }
    100% {
        opacity: 1;
        transform: rotateY(0);
    }
}

@keyframes tileFlip {
    0% {
        transform: rotateY(0);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0);
    }
}

/* Progress Bar Animation */
@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes progressStripe {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 40px 0;
    }
}

/* Loading Animations */
@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes loadingWave {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1);
    }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */

/* Fade Animations */
.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.5s ease forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.5s ease forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.5s ease forwards;
}

.animate-fadeOut {
    animation: fadeOut 0.3s ease forwards;
}

/* Scale Animations */
.animate-scaleIn {
    animation: scaleIn 0.3s ease forwards;
}

.animate-popIn {
    animation: popIn 0.4s ease forwards;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-bounceIn {
    animation: bounceIn 0.6s ease forwards;
}

/* Rotation */
.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-spinSlow {
    animation: spin 3s linear infinite;
}

/* Pulse */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-pulseGlow {
    animation: pulseGlow 2s ease-in-out infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* Shake & Wiggle */
.animate-shake {
    animation: shake 0.5s ease;
}

.animate-wiggle {
    animation: wiggle 0.5s ease infinite;
}

/* Float */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-floatRotate {
    animation: floatRotate 4s ease-in-out infinite;
}

/* Cosmic */
.animate-cosmicPulse {
    background-size: 200% 200%;
    animation: cosmicPulse 3s ease infinite;
}

.animate-starTwinkle {
    animation: starTwinkle 2s ease-in-out infinite;
}

.animate-gradientShift {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

/* Game Animations */
.animate-correct {
    animation: correctAnswer 0.5s ease;
}

.animate-wrong {
    animation: wrongAnswer 0.5s ease;
}

.animate-scorePopup {
    animation: scorePopup 1s ease forwards;
}

.animate-comboFlash {
    animation: comboFlash 0.3s ease;
}

.animate-letterReveal {
    animation: letterReveal 0.4s ease forwards;
}

.animate-tileFlip {
    animation: tileFlip 0.5s ease;
}

/* ============================================
   ANIMATION DELAYS
   ============================================ */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }
.delay-900 { animation-delay: 900ms; }
.delay-1000 { animation-delay: 1000ms; }

/* ============================================
   ANIMATION DURATIONS
   ============================================ */
.duration-fast { animation-duration: 150ms; }
.duration-normal { animation-duration: 300ms; }
.duration-slow { animation-duration: 500ms; }
.duration-slower { animation-duration: 750ms; }
.duration-slowest { animation-duration: 1000ms; }

/* ============================================
   TRANSITION UTILITIES
   ============================================ */
.transition-none { transition: none; }
.transition-all { transition: all var(--transition-base); }
.transition-colors { transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast); }
.transition-opacity { transition: opacity var(--transition-base); }
.transition-transform { transition: transform var(--transition-base); }
.transition-shadow { transition: box-shadow var(--transition-base); }

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate.from-left {
    transform: translateX(-30px);
}

.scroll-animate.from-left.visible {
    transform: translateX(0);
}

.scroll-animate.from-right {
    transform: translateX(30px);
}

.scroll-animate.from-right.visible {
    transform: translateX(0);
}

.scroll-animate.scale {
    transform: scale(0.9);
}

.scroll-animate.scale.visible {
    transform: scale(1);
}

/* Staggered animations for grid items */
.stagger-animate > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-animate.visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger-animate.visible > *:nth-child(2) { transition-delay: 100ms; }
.stagger-animate.visible > *:nth-child(3) { transition-delay: 200ms; }
.stagger-animate.visible > *:nth-child(4) { transition-delay: 300ms; }
.stagger-animate.visible > *:nth-child(5) { transition-delay: 400ms; }
.stagger-animate.visible > *:nth-child(6) { transition-delay: 500ms; }
.stagger-animate.visible > *:nth-child(7) { transition-delay: 600ms; }
.stagger-animate.visible > *:nth-child(8) { transition-delay: 700ms; }
.stagger-animate.visible > *:nth-child(9) { transition-delay: 800ms; }
.stagger-animate.visible > *:nth-child(10) { transition-delay: 900ms; }

.stagger-animate.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   HOVER EFFECTS
   ============================================ */
.hover-lift {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.hover-glow {
    transition: box-shadow var(--transition-fast);
}

.hover-glow:hover {
    box-shadow: var(--shadow-cosmic);
}

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--transition-fast);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-bright {
    transition: filter var(--transition-fast);
}

.hover-bright:hover {
    filter: brightness(1.1);
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

/* Glassmorphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Cosmic Glow Effect */
.cosmic-glow {
    position: relative;
}

.cosmic-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-cosmic);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    filter: blur(10px);
    transition: opacity var(--transition-base);
}

.cosmic-glow:hover::before {
    opacity: 0.7;
}

/* Text Glow */
.text-glow {
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5), 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Neon Effect */
.neon-border {
    box-shadow:
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        0 0 20px var(--primary),
        0 0 40px var(--primary);
}

/* Particle Effect Background */
.particle-bg {
    position: relative;
    overflow: hidden;
}

.particle-bg::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(240, 147, 251, 0.2) 0%, transparent 30%);
    animation: floatRotate 20s ease-in-out infinite;
    z-index: 0;
}

/* Progress Bar with Stripes */
.progress-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    animation: progressStripe 1s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16/9;
}

/* ============================================
   REDUCED MOTION OVERRIDES
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .animate-fadeIn,
    .animate-fadeInUp,
    .animate-fadeInDown,
    .animate-fadeInLeft,
    .animate-fadeInRight,
    .animate-scaleIn,
    .animate-popIn,
    .animate-bounceIn,
    .animate-letterReveal {
        animation: fadeIn 0.01ms forwards;
    }

    .animate-bounce,
    .animate-pulse,
    .animate-pulseGlow,
    .animate-heartbeat,
    .animate-wiggle,
    .animate-float,
    .animate-floatRotate,
    .animate-cosmicPulse,
    .animate-starTwinkle,
    .animate-gradientShift,
    .animate-shimmer,
    .animate-spin,
    .animate-spinSlow {
        animation: none;
    }

    .scroll-animate {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .stagger-animate > * {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }

    .skeleton {
        animation: none;
        background: var(--bg-secondary);
    }

    .progress-striped {
        animation: none;
    }
}
