/* ============================================
   Edge浏览器兼容性修复补丁
   ============================================ */

/* Edge浏览器检测 */
@supports (-ms-ime-align:auto) {
    /* 修复CSS变量兼容性 - 使用具体值替代变量 */
    :root {
        --primary: #4A90D9;
        --primary-light: #6BA5E7;
        --accent: #FF8C42;
        --bg: #F5F7FA;
        --bg-card: #FFFFFF;
        --bg-secondary: #EDF1F7;
        --text: #2C3E50;
        --text-secondary: #7F8C8D;
        --border: #E8ECF1;
        --radius: 12px;
        --radius-sm: 8px;
        --radius-lg: 16px;
    }

    /* 修复布局容器 */
    .app-container {
        max-width: 480px;
        margin: 0 auto;
        min-height: 100vh;
        background: #F5F7FA;
        position: relative;
    }

    .page-container {
        padding: 12px 16px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        min-height: 100vh;
    }

    /* 修复分类导航 - 使用Flexbox替代Grid */
    .category-nav {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        margin-bottom: 16px;
    }

    .category-item {
        -ms-flex: 0 0 calc(25% - 9px);
        flex: 0 0 calc(25% - 9px);
        margin-right: 12px;
        margin-bottom: 12px;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-direction: column;
        flex-direction: column;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: center;
        justify-content: center;
        padding: 12px 4px;
        background: #FFFFFF;
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        cursor: pointer;
        box-sizing: border-box;
    }

    .category-item:nth-child(4n) {
        margin-right: 0;
    }

    /* 修复游戏网格 - 使用Flexbox替代Grid */
    .game-grid {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .game-card {
        -ms-flex: 0 0 calc(50% - 6px);
        flex: 0 0 calc(50% - 6px);
        margin-right: 12px;
        margin-bottom: 12px;
        background: #FFFFFF;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        cursor: pointer;
        box-sizing: border-box;
    }

    .game-card:nth-child(2n) {
        margin-right: 0;
    }

    /* 修复按钮样式 */
    .btn {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: center;
        justify-content: center;
        padding: 10px 24px;
        border-radius: 25px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        border: none;
        background: transparent;
    }

    .btn-primary {
        background: linear-gradient(135deg, #4A90D9, #6BA5E7);
        color: #fff;
        box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
    }

    /* 修复底部导航 */
    .bottom-nav {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: justify;
        justify-content: space-around;
        padding: 8px 0;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        background: #FFFFFF;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
    }

    .bottom-nav .nav-item {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-direction: column;
        flex-direction: column;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: center;
        justify-content: center;
        gap: 4px;
        color: #7F8C8D;
        font-size: 11px;
        min-width: 60px;
        cursor: pointer;
        padding: 4px 8px;
    }

    /* 修复登录选项 */
    .login-options {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-direction: column;
        flex-direction: column;
        gap: 12px;
    }

    .login-btn {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 24px;
        border-radius: 30px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        border: none;
        transition: all 0.2s;
    }

    /* 修复卡片样式 */
    .card {
        background: #FFFFFF;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        margin-bottom: 12px;
    }

    /* 修复顶部导航 */
    .top-nav {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: justify;
        justify-content: space-between;
        padding: 12px 16px;
        background: linear-gradient(135deg, #4A90D9, #6BA5E7);
        color: #fff;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* 修复游戏卡片图片 */
    .game-card .game-cover {
        width: 100%;
        height: 120px;
        background: #EDF1F7;
        overflow: hidden;
    }

    .game-card .game-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* 修复公告栏 */
    .notice-bar {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        gap: 8px;
        background: linear-gradient(135deg, #FFF8E1, #FFF3CD);
        padding: 10px 14px;
        border-radius: 8px;
        margin-bottom: 14px;
        font-size: 13px;
        color: #856404;
    }

    /* 修复用户头部 */
    .user-header {
        background: linear-gradient(135deg, #4A90D9, #6BA5E7);
        padding: 24px 16px;
        border-radius: 0 0 16px 16px;
        color: #fff;
        margin-bottom: 16px;
    }

    .user-info {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        gap: 14px;
    }

    /* 修复弹窗遮罩 */
    .dialog-overlay {
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        -ms-flex-pack: center;
        justify-content: center;
        z-index: 1000;
        padding: 20px;
    }

    .dialog-content {
        width: 100%;
        max-width: 320px;
        background: #FFFFFF;
        border-radius: 16px;
        padding: 24px;
        text-align: center;
    }
}

/* Edge旧版本兼容性 */
@-ms-viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 1.0;
    user-scalable: no;
}

/* 修复Edge的弹性滚动 */
body {
    -ms-overflow-style: none;
    touch-action: pan-y;
}

/* 修复Edge的字体渲染 */
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

/* 修复Edge的按钮点击效果 */
button {
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

/* 修复Edge的图片显示 */
img {
    -ms-interpolation-mode: bicubic;
}

/* 修复Edge的渐变背景 */
.gradient-bg {
    background: #4A90D9;
    background: -ms-linear-gradient(135deg, #4A90D9, #6BA5E7);
    background: linear-gradient(135deg, #4A90D9, #6BA5E7);
}
