/* ==========================================================================
   游戏动画库 - animations.css
   包含：胜负动画、得分动画、交互反馈、过渡效果
   ========================================================================== */

/* ==========================================================================
   1. 胜负结果动画
   ========================================================================== */

/* 胜利动画 - 放大弹跳 + 金色光晕 */
@keyframes winPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--color-secondary-rgb), 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px 10px rgba(var(--color-secondary-rgb), 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--color-secondary-rgb), 0);
    }
}

.win-animation {
    animation: winPulse 0.6s ease-out forwards;
}

/* 失败动画 - 左右摇晃 + 红色闪烁 */
@keyframes loseShake {
    0%, 100% {
        transform: translateX(0);
        background-color: transparent;
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
        background-color: rgba(var(--color-primary-rgb), 0.2);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
        background-color: rgba(var(--color-primary-rgb), 0.1);
    }
}

.lose-animation {
    animation: loseShake 0.6s ease-out forwards;
}

/* 平局动画 - 上下浮动 */
@keyframes drawFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.draw-animation {
    animation: drawFloat 0.8s ease-in-out 3;
}

/* ==========================================================================
   2. 得分数字动画
   ========================================================================== */

/* 得分增加 - 弹跳放大 */
@keyframes scoreUp {
    0% {
        transform: scale(1);
        color: inherit;
    }
    30% {
        transform: scale(1.5);
        color: var(--color-secondary);
    }
    100% {
        transform: scale(1);
        color: var(--color-secondary);
    }
}

.score-up {
    animation: scoreUp 0.5s ease-out forwards;
}

/* 得分减少 - 缩小抖动 */
@keyframes scoreDown {
    0% {
        transform: scale(1);
        color: inherit;
    }
    30% {
        transform: scale(0.8);
        color: var(--color-primary);
    }
    100% {
        transform: scale(1);
        color: var(--color-primary);
    }
}

.score-down {
    animation: scoreDown 0.4s ease-out forwards;
}

/* 数字滚动效果 */
@keyframes numberRoll {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.number-roll {
    animation: numberRoll 0.3s ease-out forwards;
}

/* ==========================================================================
   3. 卡片/容器动画
   ========================================================================== */

/* 卡片出现 - 从下方滑入 */
@keyframes slideUp {
    0% {
        transform: translateY(30px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

/* 卡片消失 - 向上滑出 */
@keyframes slideOut {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px);
        opacity: 0;
    }
}

.slide-out {
    animation: slideOut 0.3s ease-in forwards;
}

/* 淡入效果 */
@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* 淡出效果 */
@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

/* ==========================================================================
   4. 按钮交互动画
   ========================================================================== */

/* 按钮按下效果 */
@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.btn-press {
    animation: buttonPress 0.15s ease-out;
}

/* 按钮悬停发光 */
@keyframes btnGlow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(var(--color-primary-rgb), 0.5);
    }
}

.btn-hover-glow {
    transition: all 0.3s ease;
}

.btn-hover-glow:hover {
    animation: btnGlow 1s ease-in-out infinite;
    transform: translateY(-2px);
}

/* ==========================================================================
   5. 游戏元素动画
   ========================================================================== */

/* 手势选择 - 弹跳选中 */
@keyframes choiceBounce {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.15);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.choice-bounce {
    animation: choiceBounce 0.5s ease-out forwards;
}

/* 手势对决 - 放大对比 */
@keyframes vsSlam {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    60% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.vs-slam {
    animation: vsSlam 0.4s ease-out forwards;
}

/* 结果文字打字机效果 */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 0.5s steps(20) forwards;
}

/* 正确提示 - 绿色脉冲 */
@keyframes correctPulse {
    0%, 100% {
        background-color: rgba(var(--color-secondary-rgb), 0.2);
        transform: scale(1);
    }
    50% {
        background-color: rgba(var(--color-secondary-rgb), 0.4);
        transform: scale(1.02);
    }
}

.correct-pulse {
    animation: correctPulse 0.5s ease-in-out;
}

/* 错误提示 - 红色抖动 */
@keyframes wrongShake {
    0%, 100% {
        transform: translateX(0);
        background-color: rgba(var(--color-primary-rgb), 0.2);
    }
    20%, 60% {
        transform: translateX(-3px);
    }
    40%, 80% {
        transform: translateX(3px);
    }
}

.wrong-shake {
    animation: wrongShake 0.4s ease-out;
}

/* ==========================================================================
   6. 特效动画
   ========================================================================== */

/* 星星闪烁 */
@keyframes starTwinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.star-twinkle {
    animation: starTwinkle 1s ease-in-out infinite;
}

/* 礼花效果 */
@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) rotate(720deg);
        opacity: 0;
    }
}

.confetti-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: confetti 1s ease-out forwards;
}

/* 弹跳效果 */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.bounce {
    animation: bounce 0.6s ease-in-out;
}

/* 旋转效果 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* 脉冲效果 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   7. 历史记录动画
   ========================================================================== */

/* 新记录滑入 */
@keyframes recordSlideIn {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.record-new {
    animation: recordSlideIn 0.3s ease-out;
}

/* ==========================================================================
   8. 工具类
   ========================================================================== */

/* 禁用动画（性能优化） */
.no-animation,
.no-animation * {
    animation: none !important;
    transition: none !important;
}

/* 动画延迟工具类 */
.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; }

/* 动画持续时间工具类 */
.duration-fast { animation-duration: 0.2s; }
.duration-normal { animation-duration: 0.4s; }
.duration-slow { animation-duration: 0.6s; }
