/**
 * animations.css - ANTIGRAVITY 효과 및 애니메이션
 * 위치: /assets/css/animations.css
 *
 * 선택된 ANTIGRAVITY 효과:
 * 1. Particle Ring (입자 고리) - 게임 시작/성공 시 시각적 피드백
 * 2. Noise Pattern (노이즈 패턴) - 배경 효과
 * 3. Light Spiral (빛 나선) - 카운트다운/긴장감 연출
 */

/* ==========================================
   BASE ANIMATION UTILITIES
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

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

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

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

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

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

/* Animation Classes */
.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-out { animation: fadeOut 0.5s ease forwards; }
.animate-slide-up { animation: slideUp 0.5s ease forwards; }
.animate-slide-down { animation: slideDown 0.5s ease forwards; }
.animate-slide-left { animation: slideLeft 0.5s ease forwards; }
.animate-slide-right { animation: slideRight 0.5s ease forwards; }
.animate-scale-in { animation: scaleIn 0.5s ease forwards; }
.animate-bounce { animation: bounce 2s ease infinite; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 3s ease infinite; }

/* Animation Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-1000 { animation-delay: 1s; }

/* Scroll Reveal */
[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].animated {
    opacity: 1;
}

[data-animate="fade-in"].animated {
    animation: fadeIn 0.6s ease forwards;
}

[data-animate="slide-up"].animated {
    animation: slideUp 0.6s ease forwards;
}

[data-animate="slide-down"].animated {
    animation: slideDown 0.6s ease forwards;
}

[data-animate="slide-left"].animated {
    animation: slideLeft 0.6s ease forwards;
}

[data-animate="slide-right"].animated {
    animation: slideRight 0.6s ease forwards;
}

[data-animate="scale-in"].animated {
    animation: scaleIn 0.6s ease forwards;
}

/* ==========================================
   ANTIGRAVITY EFFECT 1: PARTICLE RING
   입자 고리 - 게임 시작/성공/실패 시 시각적 피드백
   ========================================== */
.particle-ring {
    position: absolute;
    width: 200px;
    height: 200px;
    pointer-events: none;
}

.particle-ring::before,
.particle-ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.particle-ring::before {
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-bottom-color: var(--accent);
    animation: particle-ring-rotate 2s linear infinite;
}

.particle-ring::after {
    border: 3px solid transparent;
    border-left-color: var(--secondary);
    border-right-color: var(--primary-light);
    animation: particle-ring-rotate 2s linear infinite reverse;
    width: 80%;
    height: 80%;
}

@keyframes particle-ring-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Particle Ring Explosion (Success Effect) */
.particle-ring-explosion {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1000;
}

.particle-ring-explosion .particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: particle-explode 1s ease-out forwards;
}

@keyframes particle-explode {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--x, 100px), var(--y, -100px)) scale(0);
    }
}

/* Particle colors for explosion */
.particle-ring-explosion .particle:nth-child(1) { --x: 150px; --y: -80px; background: var(--primary); }
.particle-ring-explosion .particle:nth-child(2) { --x: -120px; --y: -100px; background: var(--secondary); }
.particle-ring-explosion .particle:nth-child(3) { --x: 80px; --y: 130px; background: var(--accent); }
.particle-ring-explosion .particle:nth-child(4) { --x: -150px; --y: 60px; background: var(--accent-yellow); }
.particle-ring-explosion .particle:nth-child(5) { --x: 100px; --y: 100px; background: var(--accent-cyan); }
.particle-ring-explosion .particle:nth-child(6) { --x: -80px; --y: -140px; background: var(--primary-light); }
.particle-ring-explosion .particle:nth-child(7) { --x: 140px; --y: 40px; background: var(--secondary); }
.particle-ring-explosion .particle:nth-child(8) { --x: -100px; --y: 120px; background: var(--accent-pink); }
.particle-ring-explosion .particle:nth-child(9) { --x: 60px; --y: -150px; background: var(--primary); }
.particle-ring-explosion .particle:nth-child(10) { --x: -140px; --y: -40px; background: var(--accent); }
.particle-ring-explosion .particle:nth-child(11) { --x: 120px; --y: -100px; background: var(--accent-cyan); }
.particle-ring-explosion .particle:nth-child(12) { --x: -60px; --y: 150px; background: var(--accent-yellow); }

/* Success Ring Animation */
.success-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 4px solid var(--success);
    animation: success-ring-expand 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 999;
}

@keyframes success-ring-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* Error Ring Animation */
.error-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--danger);
    animation: error-ring-shake 0.5s ease;
    pointer-events: none;
    z-index: 999;
}

@keyframes error-ring-shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    20%, 60% { transform: translate(calc(-50% + 10px), -50%) rotate(5deg); }
    40%, 80% { transform: translate(calc(-50% - 10px), -50%) rotate(-5deg); }
}

/* ==========================================
   ANTIGRAVITY EFFECT 2: NOISE PATTERN
   노이즈 패턴 - 배경 효과
   ========================================== */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: noise-shift 0.5s steps(10) infinite;
}

@keyframes noise-shift {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(-10%, 5%); }
    30% { transform: translate(5%, -10%); }
    40% { transform: translate(-5%, 15%); }
    50% { transform: translate(-10%, 5%); }
    60% { transform: translate(15%, 0); }
    70% { transform: translate(0, 10%); }
    80% { transform: translate(-15%, 0); }
    90% { transform: translate(10%, 5%); }
    100% { transform: translate(5%, 0); }
}

/* Perlin Noise Background Effect */
.noise-pattern-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
    animation: noise-float 10s ease infinite;
}

@keyframes noise-float {
    0%, 100% {
        background-position: 0% 0%, 100% 0%, 50% 100%;
    }
    25% {
        background-position: 10% 10%, 90% 10%, 45% 90%;
    }
    50% {
        background-position: 0% 20%, 100% 20%, 50% 80%;
    }
    75% {
        background-position: -10% 10%, 110% 10%, 55% 90%;
    }
}

/* Static Noise for Cards */
.card-noise::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.02;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================
   ANTIGRAVITY EFFECT 3: LIGHT SPIRAL
   빛 나선 - 카운트다운/긴장감 연출
   ========================================== */
.light-spiral {
    position: absolute;
    width: 300px;
    height: 300px;
    pointer-events: none;
}

.light-spiral::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: conic-gradient(
        from 0deg,
        transparent,
        var(--primary),
        transparent,
        var(--secondary),
        transparent,
        var(--accent),
        transparent
    );
    border-radius: 50%;
    animation: light-spiral-rotate 3s linear infinite;
    opacity: 0.5;
    filter: blur(20px);
}

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

/* Timer Spiral Effect - for countdown tension */
.timer-spiral {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timer-spiral.active {
    opacity: 1;
}

.timer-spiral::before,
.timer-spiral::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
}

.timer-spiral::before {
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        var(--warning) 25%,
        transparent 50%,
        var(--danger) 75%,
        transparent 100%
    );
    animation: spiral-spin-fast 1s linear infinite;
    filter: blur(15px);
    opacity: 0.7;
}

.timer-spiral::after {
    background: conic-gradient(
        from 180deg,
        transparent 0%,
        var(--danger) 25%,
        transparent 50%,
        var(--warning) 75%,
        transparent 100%
    );
    animation: spiral-spin-fast 1.5s linear infinite reverse;
    filter: blur(10px);
    opacity: 0.5;
}

@keyframes spiral-spin-fast {
    from { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    to { transform: rotate(360deg) scale(1); }
}

/* Danger State - More intense spiral */
.timer-spiral.danger::before {
    animation-duration: 0.5s;
    opacity: 1;
}

.timer-spiral.danger::after {
    animation-duration: 0.7s;
    opacity: 0.8;
}

/* Light Beam Effect */
.light-beam {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--primary),
        var(--accent),
        transparent
    );
    animation: light-beam-move 2s ease infinite;
    opacity: 0.6;
}

@keyframes light-beam-move {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100%) rotate(10deg);
        opacity: 0;
    }
}

/* ==========================================
   GAME-SPECIFIC ANIMATIONS
   ========================================== */

/* Countdown Number Animation */
.countdown-number {
    font-family: var(--font-display);
    font-size: 8rem;
    font-weight: 900;
    color: var(--text-white);
    text-shadow: 0 0 50px var(--glow-primary);
    animation: countdown-pop 1s ease;
}

@keyframes countdown-pop {
    0% {
        transform: scale(2);
        opacity: 0;
    }
    50% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Hint Reveal Animation */
.hint-reveal {
    animation: hint-reveal 0.5s ease forwards;
}

@keyframes hint-reveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Score Pop Animation */
.score-pop {
    animation: score-pop 0.6s ease;
}

@keyframes score-pop {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.3);
        color: var(--accent-yellow);
    }
    100% {
        transform: scale(1);
    }
}

/* Word Reveal Animation */
.word-reveal {
    overflow: hidden;
}

.word-reveal span {
    display: inline-block;
    animation: letter-reveal 0.5s ease forwards;
    animation-delay: calc(var(--i, 0) * 0.05s);
    opacity: 0;
    transform: translateY(100%);
}

@keyframes letter-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Correct Answer Celebration */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease-in forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Game Over Screen */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 35, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.5s ease;
}

.game-over-content {
    text-align: center;
    animation: scaleIn 0.5s ease 0.2s forwards;
    opacity: 0;
}

.game-over-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: var(--space-lg);
}

.game-over-title.success {
    color: var(--success);
    text-shadow: 0 0 30px rgba(34, 197, 94, 0.5);
}

.game-over-title.fail {
    color: var(--danger);
    text-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
}

/* ==========================================
   SLIDER ANIMATIONS
   ========================================== */
.slider-container {
    position: relative;
    overflow: hidden;
}

.slide {
    opacity: 0;
    transform: translateX(100%);
    transition: all var(--transition-slow);
}

.slide.active {
    opacity: 1;
    transform: translateX(0);
}

.slide.prev {
    transform: translateX(-100%);
}

/* Slide Content Animations */
.slide-content {
    animation: slideContentIn 0.8s ease 0.3s forwards;
    opacity: 0;
}

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

/* ==========================================
   BUTTON ANIMATIONS
   ========================================== */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Play Button Glow */
.btn-game {
    animation: btn-glow 2s ease infinite;
}

@keyframes btn-glow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 229, 0, 0.4);
    }
    50% {
        box-shadow: 0 4px 40px rgba(255, 229, 0, 0.6), 0 0 60px rgba(255, 229, 0, 0.3);
    }
}

/* ==========================================
   LOADING STATES
   ========================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: loading-dot 1.4s ease infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-dot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================
   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: 0 0 30px var(--glow-primary);
}

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

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

/* ==========================================
   TRANSITION UTILITIES
   ========================================== */
.transition-none { transition: none !important; }
.transition-all { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }

/* Easing functions */
.ease-in { transition-timing-function: ease-in; }
.ease-out { transition-timing-function: ease-out; }
.ease-in-out { transition-timing-function: ease-in-out; }
.ease-bounce { transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }
