/* Mobile Performance Fix for yodobloom SAKE */
/* モバイルパフォーマンス最適化CSS */

/* モバイル専用パフォーマンス最適化 */
@media (max-width: 768px) {
    
    /* GPUアクセラレーション最適化 */
    .modern-chat-interface,
    .premium-translate-container,
    .mobile-translate-container {
        transform: translateZ(0);
        will-change: transform, opacity;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* backdrop-filterの無効化（モバイルパフォーマンス向上） */
    .modern-chat-interface,
    .header,
    .language-toggle-btn,
    .mobile-translate-btn {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* 複雑なアニメーションの簡略化 */
    .mobile-translate-dropdown {
        transition: opacity 0.2s ease, visibility 0.2s ease !important;
        transform: none !important;
    }
    
    .mobile-translate-dropdown.active {
        transform: none !important;
    }
    
    /* スクロール最適化 */
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
        will-change: scroll-position;
    }
    
    /* 不要なシャドウの削除（パフォーマンス向上） */
    .mobile-translate-btn {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .mobile-translate-dropdown {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* フォントレンダリング最適化 */
    body {
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: auto;
        text-rendering: optimizeSpeed;
    }
    
    /* 3Dトランスフォームの最適化 */
    .mobile-lang-option:hover {
        transform: none !important;
    }
    
    /* バッテリー消費を抑えるためのアニメーション制限 */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* タッチスクロール最適化 */
    .language-sections,
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* メモリ使用量削減 */
    img {
        image-rendering: optimizeSpeed;
        image-rendering: -webkit-optimize-contrast;
    }
    
    /* モバイル専用の軽量スタイル */
    .mobile-translate-container {
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(255, 182, 193, 0.5);
    }
    
    /* CPU集約的なグラデーションの簡略化 */
    .mobile-translate-btn {
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    .mobile-translate-dropdown {
        background: rgba(255, 255, 255, 0.98) !important;
    }
    
    /* レイアウトリフローの最小化 */
    .mobile-translate-container {
        contain: layout style paint;
    }
    
    /* ハードウェアアクセラレーション強制 */
    .mobile-translate-btn,
    .mobile-translate-dropdown {
        transform: translate3d(0, 0, 0);
    }
}

/* 超低性能デバイス対応 */
@media (max-width: 480px) and (max-height: 800px) {
    .mobile-translate-dropdown {
        max-height: 300px !important;
        overflow-y: auto;
    }
    
    .mobile-lang-list {
        max-height: 200px !important;
    }
    
    /* 更なるパフォーマンス最適化 */
    .mobile-lang-option {
        min-height: 40px !important;
        padding: 8px 12px !important;
    }
}

/* バッテリー節約モード検出 */
@media (prefers-reduced-motion: reduce) {
    .mobile-translate-container * {
        transition: none !important;
        animation: none !important;
    }
}

/* メモリリーク防止 */
.mobile-translate-container.destroyed {
    display: none !important;
    pointer-events: none !important;
}