/* 移動端性能優化 CSS - 保持與桌面端一致的視覺效果 */

/* 基礎優化 */
@media (max-width: 768px) {
    /* 保留必要的視覺效果，只移除性能消耗大的 */
    * {
        text-shadow: none !important;
    }
    
    /* 保留重要的動畫，移除複雜的 */
    .btn:hover,
    .card:hover {
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    }
    
    /* 優化字體載入 */
    body {
        font-display: swap;
        text-rendering: optimizeSpeed;
    }
    
    /* 減少重排和重繪 */
    .container,
    .row,
    .col {
        contain: layout;
    }
    
    /* 保持背景效果但優化 */
    .personalities-container {
        background-attachment: scroll !important; /* 移除 fixed 以提升性能 */
    }
    
    /* 優化圖片 */
    img {
        max-width: 100%;
        height: auto;
        loading: lazy;
        decoding: async;
    }
    
    /* 保留漸變效果，這是品牌特色 */
    .mbti-card,
    .nav-premium-cta,
    .btn-primary {
        /* 保持原有樣式 */
    }
    
    /* 簡化卡片樣式 */
    .card {
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* 優化按鈕 */
    .btn {
        padding: 0.75rem 1rem;
        border-radius: 6px;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    /* 減少間距 */
    .py-5 {
        padding: 2rem 0 !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    /* 優化導航 */
    .personalities-header {
        padding: 0.5rem 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    /* 簡化文字效果 */
    .display-5 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    .compatibility-score {
        font-size: 2rem !important;
        font-weight: 600 !important;
    }
    
    /* 優化進度條 */
    .progress-bar {
        height: 8px;
        border-radius: 4px;
        background: #e9ecef;
    }
    
    .progress-fill {
        background: #4a90e2;
        border-radius: 4px;
        transition: width 0.3s ease;
    }
    
    /* 優化解鎖區域 */
    .unlock-section {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 1.5rem;
    }
    
    /* 減少視覺複雜度 */
    .analysis-item {
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 6px;
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* 優化模態框 */
    .ad-modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
        padding: 1rem;
        border-radius: 8px;
    }
    
    /* 觸摸目標優化 */
    .btn,
    .nav-button,
    .ad-close {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 字體大小優化 */
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-text {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* 極小屏幕優化 */
@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
    
    .compatibility-score {
        font-size: 1.75rem !important;
    }
    
    .display-5 {
        font-size: 1.3rem !important;
    }
    
    /* 簡化 MBTI 卡片 */
    .mbti-card {
        font-size: 1.2rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    /* 優化間距 */
    .py-5 {
        padding: 1.5rem 0 !important;
    }
    
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
}

/* 減少動作優化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 低性能設備優化 */
@media (max-width: 768px) and (max-device-pixel-ratio: 1.5) {
    /* 進一步簡化樣式 */
    .card,
    .btn,
    .analysis-item {
        border-radius: 4px !important;
    }
    
    /* 移除所有陰影 */
    * {
        box-shadow: none !important;
        filter: none !important;
        backdrop-filter: none !important;
    }
    
    /* 簡化字體 */
    body {
        font-family: system-ui, -apple-system, sans-serif;
    }
}

/* 觸摸設備優化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加觸摸目標 */
    .btn,
    .nav-button,
    button {
        min-height: 48px;
        padding: 0.75rem 1rem;
    }
    
    /* 移除懸停效果 */
    .btn:hover,
    .card:hover,
    .nav-button:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    /* 優化點擊反饋 */
    .btn:active {
        opacity: 0.8;
    }
}

/* 網絡優化 */
@media (max-width: 768px) {
    /* 延遲載入非關鍵內容 */
    .unlock-section:not(.visible) {
        content-visibility: auto;
        contain-intrinsic-size: 200px;
    }
    
    /* 優化圖片載入 */
    .mbti-img {
        loading: lazy;
        decoding: async;
        width: 100%;
        height: auto;
    }
} 