/* 增强视觉效果 - 粒子系统与动画 */

/* 粒子画布容器 */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* 背景光效层 */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: floatOrb 20s ease-in-out infinite;
}

.glow-orb:nth-child(1) {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.3) 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.glow-orb:nth-child(2) {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(155, 89, 182, 0.3) 0%, transparent 70%);
    top: 50%;
    right: -100px;
    animation-delay: -7s;
    animation-duration: 25s;
}

.glow-orb:nth-child(3) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 107, 157, 0.2) 0%, transparent 70%);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
    animation-duration: 22s;
}

@keyframes floatOrb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 50px) scale(0.95);
    }
    75% {
        transform: translate(-50px, -20px) scale(1.05);
    }
}

/* 星光粒子效果 */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
    opacity: 0;
}

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

/* 技能特效 - 能量环 */
.skill-effect-ring {
    position: fixed;
    pointer-events: none;
    z-index: 100;
}

.energy-ring {
    width: 100px;
    height: 100px;
    border: 3px solid;
    border-radius: 50%;
    animation: energyRingPulse 0.8s ease-out forwards;
}

.energy-ring.fire {
    border-color: #ff6b35;
    box-shadow: 0 0 20px #ff6b35, inset 0 0 20px rgba(255, 107, 53, 0.3);
}

.energy-ring.ice {
    border-color: #00d4ff;
    box-shadow: 0 0 20px #00d4ff, inset 0 0 20px rgba(0, 212, 255, 0.3);
}

.energy-ring.lightning {
    border-color: #f39c12;
    box-shadow: 0 0 20px #f39c12, inset 0 0 20px rgba(243, 156, 18, 0.3);
}

.energy-ring.dark {
    border-color: #9b59b6;
    box-shadow: 0 0 20px #9b59b6, inset 0 0 20px rgba(155, 89, 182, 0.3);
}

.energy-ring.light {
    border-color: #f1c40f;
    box-shadow: 0 0 20px #f1c40f, inset 0 0 20px rgba(241, 196, 15, 0.3);
}

@keyframes energyRingPulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* 粒子爆发效果 */
.particle-burst {
    position: fixed;
    pointer-events: none;
    z-index: 100;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: particleBurst 0.8s ease-out forwards;
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 命中闪烁效果 */
.hit-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    pointer-events: none;
    z-index: 50;
    animation: hitFlash 0.15s ease-out forwards;
}

@keyframes hitFlash {
    0% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
    }
}

/* 暴击星星效果 */
.crit-stars {
    position: fixed;
    pointer-events: none;
    z-index: 100;
}

.crit-star {
    position: absolute;
    font-size: 24px;
    color: #f39c12;
    animation: critStarFloat 1s ease-out forwards;
    text-shadow: 0 0 10px #f39c12;
}

@keyframes critStarFloat {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translate(var(--x), var(--y)) scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), calc(var(--y) - 50px)) scale(0.5) rotate(360deg);
        opacity: 0;
    }
}

/* 回合切换动画 */
.turn-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: turnFadeIn 0.3s ease-out forwards;
}

.turn-text {
    font-size: 64px;
    font-weight: 900;
    background: linear-gradient(135deg, #00d4ff, #9b59b6, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: turnTextGlow 1s ease-in-out infinite;
}

@keyframes turnFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes turnTextGlow {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 20px rgba(0, 212, 255, 0.5));
    }
    50% {
        filter: brightness(1.3) drop-shadow(0 0 40px rgba(155, 89, 182, 0.8));
    }
}

/* 护盾环绕动画 */
.shield-orb {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 2px solid rgba(52, 152, 219, 0.5);
    border-radius: 50%;
    animation: shieldOrbit 3s linear infinite;
    pointer-events: none;
}

.shield-orb::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #3498db;
    border-radius: 50%;
    box-shadow: 0 0 10px #3498db;
}

@keyframes shieldOrbit {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Buff 特效 */
.buff-effect {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.buff-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.buff-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: buffParticleRise 2s ease-in-out infinite;
}

@keyframes buffParticleRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-30px) scale(0);
        opacity: 0;
    }
}

/* 按钮悬停光效 */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.btn-glow:hover::before {
    animation: btnShine 0.8s ease;
}

@keyframes btnShine {
    0% {
        transform: translateX(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: translateX(100%) rotate(45deg);
        opacity: 0;
    }
}

/* 加载时的粒子效果 */
.loading-particles {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 50px auto;
}

.loading-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: loadingParticle 1.5s ease-in-out infinite;
}

.loading-particle:nth-child(1) {
    background: #00d4ff;
    animation-delay: 0s;
}

.loading-particle:nth-child(2) {
    background: #9b59b6;
    animation-delay: 0.2s;
}

.loading-particle:nth-child(3) {
    background: #ff6b9d;
    animation-delay: 0.4s;
}

.loading-particle:nth-child(4) {
    background: #f39c12;
    animation-delay: 0.6s;
}

@keyframes loadingParticle {
    0%, 100% {
        transform: translate(45px, 0) scale(0.5);
        opacity: 0.3;
    }
    50% {
        transform: translate(0, -20px) scale(1);
        opacity: 1;
    }
}

/* 胜利/失败特效 */
.victory-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.5) 100%);
    animation: victoryFade 2s ease-out forwards;
}

.defeat-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    animation: defeatFade 2s ease-out forwards;
}

@keyframes victoryFade {
    0% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes defeatFade {
    0% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* 数字选择时的光效 */
.number-btn.selected {
    position: relative;
    overflow: hidden;
}

.number-btn.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: numberShine 1s ease infinite;
}

@keyframes numberShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 角色选择时的光圈 */
.character-card.selected::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 22px;
    background: linear-gradient(45deg, #00d4ff, #9b59b6, #ff6b9d, #f39c12);
    background-size: 400% 400%;
    animation: gradientBorder 3s ease infinite;
    z-index: -1;
}

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

/* 房间列表项悬停光效 */
.room-item:hover {
    position: relative;
    overflow: hidden;
}

.room-item:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: roomItemShine 1s ease;
}

@keyframes roomItemShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 血条变化时的光效 */
.hp-bar {
    position: relative;
    overflow: hidden;
}

.hp-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: hpBarShine 2s ease-in-out infinite;
}

@keyframes hpBarShine {
    0%, 100% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
}

/* 闪避成功时的残影效果 */
.dodge-success {
    position: relative;
}

.dodge-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    filter: blur(10px);
    opacity: 0.5;
    animation: dodgeAfterimage 0.3s ease-out forwards;
}

@keyframes dodgeAfterimage {
    0% {
        opacity: 0.5;
        transform: translateX(-10px);
    }
    100% {
        opacity: 0;
        transform: translateX(10px);
    }
}

/* 技能冷却指示器 */
.skill-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: inherit;
    animation: cooldownPulse 1s ease-in-out infinite;
}

@keyframes cooldownPulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.4;
    }
}
