/* ============================================
   responsive-patch.css v1
   全面响应式适配补丁
   ============================================ */

/* ====== 1. 顶部安全区适配（刘海屏/灵动岛） ====== */

/* 首页顶部栏 - 增加安全区顶部间距 */
.top-bar {
    padding-top: calc(25px + env(safe-area-inset-top, 0px)) !important;
}

/* 登录/注册页面 - 安全区顶部间距 */
#auth-screen {
    padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
}

/* 启动屏 - 安全区适配 */
#splash-screen {
    padding-top: env(safe-area-inset-top, 0px) !important;
}

/* 朋友圈封面按钮 - 安全区适配 */
#moments-header .moments-header-btn:first-child {
    margin-top: env(safe-area-inset-top, 0px) !important;
}

/* 朋友圈封面区域 - 增加顶部安全区 */
#moments-header {
    padding-top: env(safe-area-inset-top, 0px) !important;
}

/* 弹窗在安全区内正确定位 */
.modal-overlay {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 鸟群页面横幅 - 安全区适配 */
.flock-banner {
    padding-top: calc(28px + env(safe-area-inset-top, 0px)) !important;
}

/* 全局Toast - 避免被状态栏遮挡 */
#global-toast {
    top: calc(20px + env(safe-area-inset-top, 0px)) !important;
}


/* ====== 2. 平板适配 (481px - 899px) ====== */
@media (min-width: 481px) and (max-width: 899px) {
    /* 容器略微放大 */
    .app-container {
        max-width: 420px !important;
    }
    
    /* 登录卡片放大 */
    .auth-card {
        max-width: 380px !important;
    }
    
    /* 小鸟展示区略微放大 */
    #main-bird {
        width: 240px !important;
        height: 240px !important;
    }
    
    /* 互动按钮略微放大 */
    .action-icon {
        width: 54px !important;
        height: 54px !important;
        font-size: 28px !important;
    }
    
    /* 互动按钮文字 */
    .action-btn {
        font-size: 12px !important;
    }
    
    /* 底部导航略微放大 */
    .nav-item {
        min-width: 55px !important;
        max-width: 65px !important;
    }
    
    .nav-icon {
        font-size: 22px !important;
    }
}


/* ====== 3. 大屏桌面适配 (1200px+) ====== */
@media (min-width: 1200px) {
    /* 容器略微放大 */
    .app-container {
        max-width: 460px !important;
    }
    
    /* 登录卡片放大 */
    .auth-card {
        max-width: 400px !important;
    }
    
    /* 小鸟展示区放大 */
    #main-bird {
        width: 250px !important;
        height: 250px !important;
    }
    
    /* 桌面端显示产品展示 */
    .product-showcase {
        width: 100% !important;
        max-width: 360px !important;
        margin-bottom: 16px !important;
    }
}

/* 超大屏 (1600px+) */
@media (min-width: 1600px) {
    .app-container {
        max-width: 480px !important;
    }
}


/* ====== 4. 横屏模式增强适配 ====== */

/* 现代手机横屏 (高度 400-600px) */
@media (max-height: 600px) and (orientation: landscape) and (min-width: 600px) {
    /* 底部导航更紧凑 */
    .bottom-nav {
        height: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
        padding-top: 6px !important;
    }
    
    /* 页面底部留白减少 */
    .page {
        padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    /* 互动网格改为更多列 */
    .action-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 8px 8px !important;
    }
    
    /* 小鸟缩小 */
    #main-bird {
        width: 160px !important;
        height: 160px !important;
    }
    
    /* 鸟容器最小高度减少 */
    .bird-container {
        min-height: 180px !important;
    }
    
    /* 顶部栏更紧凑 */
    .top-bar {
        padding: 10px 20px 5px !important;
        padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    }
    
    /* 统计容器更紧凑 */
    .stats-container {
        margin-top: 5px !important;
    }
    
    /* 互动按钮缩小 */
    .fab-interact {
        margin-bottom: 15px !important;
        padding: 10px 30px !important;
        font-size: 16px !important;
    }
    
    /* 弹窗高度限制 */
    .modal-box {
        max-height: 90dvh !important;
    }
}

/* 极小横屏 (高度 < 400px) */
@media (max-height: 400px) and (orientation: landscape) {
    .bottom-nav {
        height: calc(55px + env(safe-area-inset-bottom, 0px)) !important;
        padding-top: 4px !important;
    }
    
    .page {
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .action-grid {
        grid-template-columns: repeat(8, 1fr) !important;
        gap: 5px 5px !important;
    }
    
    #main-bird {
        width: 130px !important;
        height: 130px !important;
    }
    
    .bird-container {
        min-height: 140px !important;
    }
    
    .fab-interact {
        margin-bottom: 10px !important;
        padding: 8px 25px !important;
        font-size: 14px !important;
    }
    
    .top-bar {
        padding: 5px 15px 2px !important;
        padding-top: calc(5px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .stats-container {
        margin-top: 2px !important;
        gap: 6px !important;
    }
    
    .stat-badge {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }
}


/* ====== 5. 超小屏幕适配 (280px-320px) ====== */
@media (max-width: 320px) {
    /* 小鸟缩小 */
    #main-bird {
        width: 180px !important;
        height: 180px !important;
    }
    
    /* 互动按钮更小 */
    .action-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 20px !important;
    }
    
    /* 卡片内边距减少 */
    .card-box {
        padding: 15px !important;
    }
    
    /* 菜单项内边距减少 */
    .menu-item {
        padding: 14px 15px !important;
        font-size: 14px !important;
    }
    
    /* 统计标签缩小 */
    .stat-badge {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }
    
    /* 弹窗宽度调整 */
    .modal-box {
        width: 96% !important;
        padding: 18px !important;
    }
    
    /* 鸟群横幅紧凑 */
    .flock-banner {
        padding: 20px 15px 16px !important;
        padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-banner-title {
        font-size: 17px !important;
    }
}


/* ====== 6. 折叠屏适配 ====== */
@media (min-width: 580px) and (max-width: 720px) and (min-height: 580px) {
    /* 折叠屏展开态 - 利用更大屏幕 */
    .app-container {
        max-width: 420px !important;
    }
    
    #main-bird {
        width: 230px !important;
        height: 230px !important;
    }
}


/* ====== 7. 字体缩放zoom防溢出修复 ====== */

/* 确保zoom缩放时不会出现水平滚动条 */
.app-container {
    overflow-x: hidden !important;
}

#main-app {
    overflow-x: hidden !important;
}

/* zoom模式下确保宽度计算正确 */
#main-app[style*="zoom"] {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* modal-overlay 在zoom模式下不溢出 */
#modal-overlay[style*="zoom"] {
    max-width: 100% !important;
    overflow-x: hidden !important;
}


/* ====== 8. iPad Pro & 大平板专属优化 ====== */
@media (min-width: 768px) and (max-width: 899px) and (min-height: 768px) {
    /* iPad竖屏 - 更大容器 */
    .app-container {
        max-width: 450px !important;
        height: 85dvh !important;
        border-radius: 30px !important;
        border: 6px solid #fff !important;
        box-shadow: 0 20px 60px rgba(0,0,0,0.12) !important;
    }
    
    body {
        background: linear-gradient(135deg, #e8e0f0 0%, #d5e3f0 100%) !important;
        background-attachment: fixed !important;
    }
    
    /* 小鸟更大 */
    #main-bird {
        width: 260px !important;
        height: 260px !important;
    }
    
    /* 互动按钮更大 */
    .action-icon {
        width: 56px !important;
        height: 56px !important;
        font-size: 30px !important;
    }
    
    /* 底部导航更大 */
    .nav-item {
        min-width: 62px !important;
        max-width: 72px !important;
    }
    
    .nav-icon {
        font-size: 26px !important;
    }
}

/* iPad横屏 */
@media (min-width: 900px) and (max-width: 1199px) and (min-height: 700px) {
    /* 桌面已有样式基础上微调 */
    .app-container {
        max-width: 440px !important;
    }
}


/* ====== 9. 触控优化 ====== */

/* 增大触摸目标 - 对小屏设备 */
@media (max-width: 380px) {
    .menu-item {
        min-height: 48px !important;
    }
    
    .nav-item {
        min-height: 48px !important;
    }
    
    .close-btn {
        width: 36px !important;
        height: 36px !important;
    }
}


/* ====== 10. 深色模式 + 安全区组合 ====== */
@media (prefers-color-scheme: dark) {
    /* 深色模式下桌面边框颜色调整 */
    @media (min-width: 900px) {
        .app-container {
            border-color: #2a2a2a !important;
        }
    }
}


/* ====== 11. 输入法弹出适配 ====== */

/* 当虚拟键盘弹出时（interactive-widget=resizes-content 已在viewport设置）*/
/* 确保弹窗内容不会被键盘遮挡 */
.modal-box {
    scroll-padding-bottom: 300px;
}

/* 确保页面内容在键盘弹出时可滚动 */
.page {
    scroll-padding-bottom: 200px;
}


/* ====== 12. 打印样式（虽然不太可能用到） ====== */
@media print {
    .bottom-nav,
    .fab-interact,
    .action-grid,
    #splash-screen,
    .modal-overlay {
        display: none !important;
    }
    
    .app-container {
        max-width: 100% !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* ============================================
   登录页布局修复
   ============================================ */

/* 确保登录/注册切换时产品展示区正确显示/隐藏 */
#auth-bird-select {
    /* 不强制 display，让 JS switchAuthTab 控制 */
    flex-shrink: 0;
}

/* 注册模式下产品展示区布局优化 */
#auth-screen .product-showcase {
    width: 100%;
    max-width: 360px;
    margin-bottom: 16px;
}

#auth-screen .product-header {
    color: white;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

#auth-screen .product-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#auth-screen .product-card {
    flex: 1;
    min-width: 0;
    max-width: 110px;
}

/* 登录卡片在窄屏下不被产品展示区推挤 */
@media (max-width: 380px) {
    #auth-screen .product-card img,
    #auth-screen .product-card svg {
        height: 75px !important;
    }
    
    #auth-screen .product-name {
        font-size: 10px !important;
        padding: 6px 2px !important;
    }
    
    #auth-screen .product-header {
        font-size: 13px !important;
    }
}

/* 修复登录页整体布局 - 确保内容居中且不溢出 */
#auth-screen {
    display: flex;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    min-height: 100% !important;
    box-sizing: border-box !important;
}

/* 登录成功后 JS 会设置 display:none，确保这个内联样式能生效 */
#auth-screen[style*="display: none"],
#auth-screen[style*="display:none"] {
    display: none !important;
}

/* 登录卡片安全间距 */
#auth-screen .auth-card {
    margin-top: 0 !important;
    flex-shrink: 0;
}

/* ============================================
   全面布局修复 - 解决所有错位问题
   ============================================ */

/* 1. 统一页面容器的安全区处理 */
.page {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* 2. 鸟群页面布局修复 */
#page-flock {
    overflow-x: hidden !important;
}

.flock-banner {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
}

.flock-banner-content {
    width: 100% !important;
    box-sizing: border-box !important;
}

.flock-stats {
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: space-around !important;
}

.flock-stat-item {
    flex: 1 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.flock-quick-actions {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
}

.flock-quick-btn {
    flex: 1 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* 3. 我的页面布局修复 */
#page-profile {
    overflow-x: hidden !important;
}

.wx-profile-card {
    box-sizing: border-box !important;
    max-width: calc(100% - 24px) !important;
    width: auto !important;
}

/* 微信风格菜单项 */
.wx-menu-item {
    display: flex !important;
    align-items: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 56px !important;
    gap: 12px !important;
}

.wx-menu-item > span:first-child {
    flex-shrink: 0 !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.wx-menu-item > span:nth-child(2) {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    font-size: 15px !important;
}

.wx-menu-item > svg {
    flex-shrink: 0 !important;
    margin-left: auto !important;
}

/* 4. 底部导航栏精确对齐 */
.bottom-nav {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.nav-item {
    flex: 1 !important;
    max-width: none !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px 2px !important;
    box-sizing: border-box !important;
}

.nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    text-align: center !important;
}



/* 5. 通用容器修复 */
.app-container {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* 6. 防止任何元素溢出 */
* {
    box-sizing: border-box !important;
}

/* 7. 确保所有 flex 容器正确处理溢出 */
[class*="flock-"],
[class*="wx-"],
.bottom-nav,
.nav-item {
    min-width: 0 !important;
}

/* 8. 小屏幕适配增强 (<= 375px) */
@media (max-width: 375px) {
    .flock-banner {
        padding: 20px 16px 18px !important;
        padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-banner-title {
        font-size: 18px !important;
        margin-bottom: 12px !important;
    }
    
    .flock-stats {
        gap: 8px !important;
    }
    
    .flock-stat-item {
        padding: 6px 10px !important;
    }
    
    .flock-stat-num {
        font-size: 16px !important;
    }
    
    .flock-stat-label {
        font-size: 11px !important;
    }
    
    .flock-quick-actions {
        gap: 8px !important;
        margin: 12px 0 !important;
    }
    
    .flock-quick-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    
    .flock-quick-btn span {
        font-size: 10px !important;
    }
    
    .wx-profile-card {
        padding: 14px !important;
        margin: 10px 12px !important;
    }
    
    .wx-menu-item {
        padding: 14px 12px !important;
        font-size: 14px !important;
    }
    
    .bottom-nav {
        height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .nav-item {
        padding: 6px 2px !important;
    }
    
    .nav-icon {
        font-size: 20px !important;
    }
    
    
}

/* 9. 中等屏幕适配 (376px - 414px) */
@media (min-width: 376px) and (max-width: 414px) {
    .flock-banner {
        padding: 24px 18px 20px !important;
        padding-top: calc(24px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-quick-icon {
        width: 46px !important;
        height: 46px !important;
    }
    
    .wx-menu-item {
        padding: 15px 14px !important;
    }
}

/* 10. 确保所有页面内容不会与底部导航重叠 */
.page {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
}

/* 11. 修复可能的滚动问题 */
#page-flock,
#page-profile {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
}

/* 12. 确保文字不会溢出 */
.flock-banner-title,
.flock-stat-label,
.flock-quick-btn span,


/* ============================================
   终极响应式优化 - 确保所有设备完美适配
   ============================================ */

/* 1. 全局盒模型统一 */
*, *::before, *::after {
    box-sizing: border-box !important;
}

/* 2. 页面容器统一处理 */
.page {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
}

/* 3. 鸟群页面精确优化 */
#page-flock {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
}

.flock-banner {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 28px 20px 22px !important;
    padding-top: calc(28px + env(safe-area-inset-top, 0px)) !important;
}

.flock-banner-content {
    width: 100% !important;
    max-width: 100% !important;
}

.flock-stats {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.flock-stat-item {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
}

.flock-stat-num {
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

.flock-stat-label {
    font-size: 12px !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    text-align: center !important;
}

/* 快捷操作栏优化 */
.flock-quick-actions {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin: 16px 0 14px !important;
    padding: 0 !important;
}

.flock-quick-btn {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 !important;
}

.flock-quick-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
}

.flock-quick-btn span {
    font-size: 11px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    word-wrap: break-word !important;
    word-break: break-all !important;
}

/* 4. 我的页面精确优化 */
#page-profile {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
}

.wx-profile-card {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 12px !important;
    padding: 18px !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
}

.wx-menu-item {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    padding: 16px !important;
    gap: 12px !important;
    min-height: 56px !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}

.wx-menu-item:last-child {
    border-bottom: none !important;
}

.wx-menu-item > span:first-child {
    flex-shrink: 0 !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
}

.wx-menu-item > span:nth-child(2) {
    flex: 1 !important;
    min-width: 0 !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    font-size: 15px !important;
}

.wx-menu-item > svg {
    flex-shrink: 0 !important;
    width: 14px !important;
    height: 14px !important;
    margin-left: auto !important;
}

/* 5. 底部导航栏精确优化 */
.bottom-nav {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    padding-top: 10px !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    gap: 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
}

.nav-item {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px 2px !important;
    gap: 4px !important;
}

.nav-icon {
    width: 100% !important;
    height: auto !important;
    font-size: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}



/* 6. 小屏幕精确适配 (<= 375px) */
@media (max-width: 375px) {
    .flock-banner {
        padding: 20px 16px 18px !important;
        padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-banner-title {
        font-size: 18px !important;
        margin-bottom: 12px !important;
    }
    
    .flock-stats {
        gap: 8px !important;
    }
    
    .flock-stat-item {
        padding: 6px 10px !important;
    }
    
    .flock-stat-num {
        font-size: 16px !important;
    }
    
    .flock-stat-label {
        font-size: 11px !important;
    }
    
    .flock-quick-actions {
        gap: 8px !important;
        margin: 12px 0 !important;
    }
    
    .flock-quick-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    
    .flock-quick-btn span {
        font-size: 10px !important;
    }
    
    .wx-profile-card {
        padding: 14px !important;
        margin: 10px 12px !important;
        width: calc(100% - 24px) !important;
    }
    
    .wx-menu-item {
        padding: 14px 12px !important;
        font-size: 14px !important;
    }
    
    .bottom-nav {
        height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
        padding-top: 8px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    .nav-icon {
        font-size: 20px !important;
    }
    
    
}

/* 7. 中等屏幕适配 (376px - 414px) */
@media (min-width: 376px) and (max-width: 414px) {
    .flock-banner {
        padding: 24px 18px 20px !important;
        padding-top: calc(24px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-quick-icon {
        width: 46px !important;
        height: 46px !important;
    }
    
    .wx-menu-item {
        padding: 15px 14px !important;
    }
}

/* 8. 确保所有flex容器正确处理溢出 */
[class*="flock-"],
[class*="wx-"],
.bottom-nav,
.nav-item,
.flock-stats,
.flock-quick-actions {
    min-width: 0 !important;
}

/* 9. 防止文字溢出 */
.flock-banner-title,
.flock-stat-label,
.flock-quick-btn span,
.wx-menu-item > span:nth-child(2) {
    word-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    overflow-wrap: break-word !important;
}

/* 10. 优化滚动体验 */
#page-flock,
#page-profile {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    scroll-behavior: smooth !important;
}

/* 11. 确保所有图片不会溢出 */
img {
    max-width: 100% !important;
    height: auto !important;
}

/* 12. 优化触摸目标 */
.nav-item,
.flock-quick-btn,
.wx-menu-item {
    min-height: 44px !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
}


/* ============================================
   最终精确修复 - 解决底部导航栏对称性问题
   ============================================ */

/* 1. 修复底部导航栏的对称性和对齐 */
.bottom-nav {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-radius: 0 !important; /* 移除圆角，避免不对称 */
    display: flex !important;
    justify-content: space-evenly !important; /* 使用space-evenly确保均匀分布 */
    align-items: center !important;
    gap: 0 !important;
    box-sizing: border-box !important;
}

/* 2. 确保导航项完全均匀分布 */
.nav-item {
    flex: 1 1 0% !important; /* 强制等宽 */
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

.nav-icon {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 0 !important;
}



/* 3. 修复所有页面的底部间距 */
.page {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    margin-bottom: 0 !important;
}

/* 4. 确保鸟群页面布局完美 */
#page-flock {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.flock-banner {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 28px 20px 22px !important;
    padding-top: calc(28px + env(safe-area-inset-top, 0px)) !important;
    box-sizing: border-box !important;
}

.flock-stats {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.flock-stat-item {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.flock-quick-actions {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin: 16px 0 14px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.flock-quick-btn {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* 5. 确保我的页面布局完美 */
#page-profile {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.wx-profile-card {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 12px !important;
    padding: 18px !important;
    box-sizing: border-box !important;
}

.wx-menu-item {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    padding: 16px !important;
    gap: 12px !important;
    min-height: 56px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* 6. 小屏幕精确适配 (<= 375px) */
@media (max-width: 375px) {
    .bottom-nav {
        height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .nav-item {
        padding: 8px 0 !important;
    }
    
    .nav-icon {
        font-size: 20px !important;
    }
    
    
    
    .flock-banner {
        padding: 20px 16px 18px !important;
        padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-stats {
        gap: 8px !important;
    }
    
    .flock-stat-item {
        padding: 6px 10px !important;
    }
    
    .flock-quick-actions {
        gap: 8px !important;
    }
    
    .flock-quick-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    
    .flock-quick-btn span {
        font-size: 10px !important;
    }
}

/* 7. 中等屏幕适配 (376px - 414px) */
@media (min-width: 376px) and (max-width: 414px) {
    .flock-quick-icon {
        width: 46px !important;
        height: 46px !important;
    }
}

/* 8. 确保所有flex容器正确处理溢出 */
[class*="flock-"],
[class*="wx-"],
.bottom-nav,
.nav-item {
    min-width: 0 !important;
}

/* 9. 优化触摸目标 */
.nav-item,
.flock-quick-btn,
.wx-menu-item {
    min-height: 44px !important;
}

/* 10. 确保页面容器不会溢出 */
.app-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}


/* ============================================
   终极精确修复 - 确保像素级完美对齐
   ============================================ */

/* 1. 底部导航栏 - 移除圆角，确保完全对称 */
.bottom-nav {
    border-radius: 0 !important; /* 移除圆角 */
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    padding: 10px 0 !important; /* 移除左右padding */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    gap: 0 !important;
    box-sizing: border-box !important;
}

/* 2. 导航项 - 确保完全等宽 */
.nav-item {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    height: 64px !important; /* 固定高度 */
}

.nav-icon {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 0 !important;
    font-size: 22px !important;
}



/* 3. 页面容器 - 确保精确的底部间距 */
.page {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 4. 鸟群页面 - 精确对齐 */
#page-flock {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
}

.flock-banner {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 28px 20px 22px !important;
    padding-top: calc(28px + env(safe-area-inset-top, 0px)) !important;
    box-sizing: border-box !important;
}

.flock-stats {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.flock-stat-item {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.flock-quick-actions {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin: 16px 0 14px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.flock-quick-btn {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* 5. 我的页面 - 精确对齐 */
#page-profile {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
}

.wx-profile-card {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 12px !important;
    padding: 18px !important;
    box-sizing: border-box !important;
}

.wx-menu-item {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    padding: 16px !important;
    gap: 12px !important;
    min-height: 56px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* 6. 小屏幕精确适配 (<= 375px) */
@media (max-width: 375px) {
    .bottom-nav {
        height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
        padding: 8px 0 !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .nav-item {
        height: 54px !important;
        padding: 6px 0 !important;
    }
    
    .nav-icon {
        font-size: 20px !important;
    }
    
    
    
    .flock-banner {
        padding: 20px 16px 18px !important;
        padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .flock-stats {
        gap: 8px !important;
    }
    
    .flock-stat-item {
        padding: 6px 10px !important;
    }
    
    .flock-quick-actions {
        gap: 8px !important;
    }
    
    .flock-quick-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    
    .flock-quick-btn span {
        font-size: 10px !important;
    }
}

/* 7. 中等屏幕适配 (376px - 414px) */
@media (min-width: 376px) and (max-width: 414px) {
    .flock-quick-icon {
        width: 46px !important;
        height: 46px !important;
    }
}

/* 8. 确保所有flex容器正确处理溢出 */
[class*="flock-"],
[class*="wx-"],
.bottom-nav,
.nav-item {
    min-width: 0 !important;
}

/* 9. 优化触摸目标 */
.nav-item,
.flock-quick-btn,
.wx-menu-item {
    min-height: 44px !important;
}

/* 10. 确保页面容器不会溢出 */
.app-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 11. 防止任何元素溢出 */
* {
    box-sizing: border-box !important;
}

/* 12. 确保所有图片不会溢出 */
img {
    max-width: 100% !important;
    height: auto !important;
}


/* ============================================
   紧急修复：底部导航栏显示不完整
   ============================================ */

/* 1. 移除 app-container 的 overflow: hidden */
.app-container {
    overflow: visible !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

/* 2. 确保底部导航栏完全可见 */
.bottom-nav {
    position: fixed !important; /* 改为 fixed 确保不被裁剪 */
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 9999 !important; /* 提高 z-index */
    margin: 0 !important;
    padding: 10px 0 !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    gap: 0 !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
}

/* 3. 确保页面内容有足够的底部空间 */
.page {
    padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px)) !important;
}


/* ============================================
   最终修复：确保底部导航栏完全可见
   ============================================ */

/* 1. 强制底部导航栏使用 fixed 定位 */
.bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 10px 0 !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    gap: 0 !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
}

/* 2. 确保 app-container 不会裁剪底部导航栏 */
.app-container {
    overflow: visible !important;
    overflow-x: hidden !important;
}

/* 3. 确保页面内容有足够的底部空间 */
.page {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
}


/* ============================================
   最终修复：移除底部导航栏的 transform
   ============================================ */
.bottom-nav {
    transform: none !important;
}



/* ============================================
   最终修复：底部导航栏文字完整显示
   ============================================ */
.bottom-nav .nav-item {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    padding: 4px 1px !important;
    overflow: visible !important;
}

.bottom-nav .nav-item > span:last-child {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    display: block !important;
    word-wrap: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}
