/* 動く背景の基本スタイル */
#animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* パーティクル背景 */
#particles-canvas {
    width: 100%;
    height: 100%;
}

/* グラデーション背景 */
.gradient-bg {
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #feca57);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* 波形背景 */
.waves-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    bottom: 0;
}

.wave-path {
    animation: waveAnimation 10s linear infinite;
}

@keyframes waveAnimation {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* 幾何学模様背景 */
.geometric-bg {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.geometric-shape {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.1);
    animation: rotate 20s linear infinite;
}

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

/* 星空背景 */
#stars-canvas {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
}

/* バブル背景 */
.bubbles-bg {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #e3f2fd, #bbdefb);
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: float 15s infinite ease-in-out;
}

@keyframes float {
    0%, 100% {
        transform: translateY(100vh) scale(0);
    }
    10% {
        transform: translateY(90vh) scale(1);
    }
    90% {
        transform: translateY(-10vh) scale(1);
    }
}

/* カスタムビデオ背景 */
.video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
}

/* アニメーション速度のバリエーション */
.animated-bg-particles[data-speed="slow"] #particles-canvas {
    animation-duration: 30s;
}

.animated-bg-particles[data-speed="fast"] #particles-canvas {
    animation-duration: 10s;
}

.animated-bg-gradient[data-speed="slow"] .gradient-bg {
    animation-duration: 25s;
}

.animated-bg-gradient[data-speed="fast"] .gradient-bg {
    animation-duration: 8s;
}

/* Cocoonテーマとの互換性調整 */
.cocoon-body #animated-background {
    z-index: -999;
}

/* モバイル対応 */
@media (max-width: 768px) {
    #animated-background {
        opacity: 0.5 !important;
    }
    
    .gradient-bg {
        animation-duration: 20s;
    }
    
    .bubble {
        animation-duration: 10s;
    }
}

/* パフォーマンス最適化 */
@media (prefers-reduced-motion: reduce) {
    #animated-background * {
        animation: none !important;
        transition: none !important;
    }
}