/* ===== YENİ ANİMASYONLAR ===== */

/* Tile Bounce Animasyonu */
.tile.bounce-tile {
    animation: tileBounce 0.4s ease-out;
}

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

/* Tile Glow Animasyonu (Büyük tile'lar için) */
.tile.glow-tile {
    animation: tileGlow 2s ease-in-out infinite alternate;
}

@keyframes tileGlow {
    0% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Score Counter Animasyonu */
.score-counter {
    transition: all 0.3s ease-in-out;
}

.score-counter.counting {
    animation: scoreCount 0.5s ease-out;
}

@keyframes scoreCount {
    0% {
        transform: scale(1);
        color: #776e65;
    }
    50% {
        transform: scale(1.2);
        color: #f59563;
    }
    100% {
        transform: scale(1);
        color: #776e65;
    }
}

/* Progress Bar Animasyonu */
.progress-bar {
    transition: width 0.3s ease-in-out;
}

.progress-bar.animating {
    animation: progressFill 0.5s ease-out;
}

@keyframes progressFill {
    0% {
        width: 0%;
    }
    100% {
        width: var(--progress-width);
    }
}

/* Button Pulse Animasyonu */
.btn-pulse {
    animation: buttonPulse 0.3s ease-out;
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Screen Shake Animasyonu (Kazanınca) */
.screen-shake {
    animation: screenShake 0.6s ease-in-out;
}

@keyframes screenShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

/* Particle Explosion Animasyonu */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: particleExplode 0.8s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0;
    }
}

/* Floating Particles (Background) */
.floating-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

/* Gradient Shift Animasyonu */
.gradient-shift {
    animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background: linear-gradient(135deg, #faf8ef, #f4e4bc);
    }
    50% {
        background: linear-gradient(135deg, #f4e4bc, #faf8ef);
    }
}

/* Breathing Effect (Game Board) */
.breathing-board {
    animation: breathing 3s ease-in-out infinite;
}

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

/* Trail Effect (Moving Tiles) */
.tile.trail-tile {
    position: relative;
}

.tile.trail-tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    opacity: 0.3;
    transform: scale(0.8);
    animation: trailFade 0.3s ease-out forwards;
}

@keyframes trailFade {
    0% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    100% {
        opacity: 0;
        transform: scale(1.2);
    }
}

/* ===== ANİMASYONLAR ===== */

/* Tile Animasyonları */
.tile {
    transition: all 0.15s ease-in-out;
    transform-origin: center;
}

.tile.new-tile {
    animation: tileAppear 0.3s ease-out;
}

.tile.merged-tile {
    animation: tileMerge 0.3s ease-out;
}

.tile.moving-tile {
    transition: transform 0.15s ease-in-out;
}

@keyframes tileAppear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes tileMerge {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Skor Animasyonu */
.score-box {
    transition: all 0.3s ease-in-out;
}

.score-box.score-updated {
    animation: scoreUpdate 0.5s ease-out;
}

@keyframes scoreUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        background: linear-gradient(135deg, #f4e4bc, #faf8ef);
    }
    100% {
        transform: scale(1);
        background: #faf8ef;
    }
}

/* Hedef Ulaşma Animasyonu */
.target-reached-animation {
    animation: targetReached 1s ease-out;
}

@keyframes targetReached {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
    75% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Menü Geçiş Animasyonları */
.screen {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.screen.screen-out {
    opacity: 0;
    transform: translateX(-20px);
}

.screen.screen-in {
    opacity: 1;
    transform: translateX(0);
}

/* Buton Animasyonları */
.menu-btn, .control-btn, .restart-button {
    transition: all 0.2s ease-in-out;
    transform-origin: center;
}

.menu-btn:hover, .control-btn:hover, .restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.menu-btn:active, .control-btn:active, .restart-button:active {
    transform: translateY(0) scale(0.98);
}

/* Game Over Animasyonu */
.game-over-screen {
    animation: gameOverAppear 0.5s ease-out;
}

@keyframes gameOverAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Konfeti Animasyonu */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confettiFall 2s ease-out forwards;
}

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

/* Başarı Animasyonu */
.success-animation {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(76, 175, 80, 0.6);
    }
    100% {
        transform: scale(1);
    }
}

/* Tahta Sallanma Animasyonu */
.game-board.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}
