/* 手机端：设置入口 + 右侧抽屉导航（仅 max-width:768px 生效） */

.m-nav-settings,
.m-nav-drawer,
.m-nav-mask {
    display: none;
}

/* 手机专用适龄提示默认隐藏，避免 PC 套用 .age-tips 右下角样式 */
.m-age-tips {
    display: none !important;
}

@media screen and (max-width: 768px) {
    /* 非首页隐藏社交浮条 */
    .left-menus-wrap {
        display: none !important;
    }

    /*
     * 首页社交浮条：左缘对齐下方下载底框左缘；二维码向右展开
     * 底框宽 = min(92vw, 360px)，水平居中 → 左缘 (100vw - 底框宽) / 2
     */
    .page-home .left-menus-wrap {
        display: block !important;
        left: calc((100vw - min(92vw, 360px)) / 2) !important;
        right: auto !important;
        top: 65% !important;
        opacity: 1 !important;
    }

    .page-home .left-menus-wrap .qrcode {
        left: calc(100% + 8px) !important;
        right: auto !important;
    }

    /* —— 顶栏：Logo 与设置同水平线，左右外边距相等；黑色透明底 —— */
    .header.mobile {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 200;
        pointer-events: none;
    }

    .header.mobile .left {
        pointer-events: auto;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        /* 左右间距一致：Logo 左缘 = 设置 Icon 右缘；顶部纳入系统安全区 */
        padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
        height: auto;
        min-height: calc(52px + env(safe-area-inset-top, 0px));
        background: rgba(0, 0, 0, 0.55) !important;
    }

    .header.mobile .left .left-logo {
        width: 86px !important;
        height: 34px !important;
        margin: 0 !important;
        flex-shrink: 0;
        background-size: contain !important;
        background-position: left center !important;
    }

    .header.mobile .left .btn.active-tag {
        display: none !important;
    }

    .m-nav-settings {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 29px;
        height: 34px;
        margin: 0;
        padding: 0;
        flex-shrink: 0;
        line-height: 0;
        pointer-events: auto;
    }

    /*
     * 16+ 适龄提示：不在顶栏黑底上，落在首页背景左上角、Logo 下方
     */
    .page-home .m-age-tips,
    .page-home .age-tips.m-age-tips {
        display: block !important;
        position: absolute !important;
        left: 16px !important;
        top: calc(52px + env(safe-area-inset-top, 0px) + 28px) !important;
        right: auto !important;
        bottom: auto !important;
        width: 36px !important;
        height: 47px !important;
        margin: 0;
        background: url(../images/ageTips.png?v=1) center center / contain no-repeat !important;
        z-index: 6;
        pointer-events: auto;
    }

    .m-nav-settings img {
        width: 29px;
        height: 25px;
        display: block;
        object-fit: contain;
    }

    .m-nav-mask {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 300;
        background: rgba(0, 0, 0, 0.45);
    }

    .m-nav-mask.open {
        display: block;
    }

    .m-nav-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 78%;
        max-width: 320px;
        z-index: 310;
        background: #fff;
        transform: translateX(100%);
        transition: transform 0.28s ease;
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.18);
    }

    .m-nav-drawer.open {
        transform: translateX(0);
    }

    .m-nav-drawer-hd {
        height: auto;
        min-height: calc(48px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 16px 0;
        background: #000;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        box-sizing: border-box;
        flex-shrink: 0;
    }

    .m-nav-drawer-hd .m-nav-close {
        margin: 11.5px 0;
    }

    .m-nav-close {
        width: 25px;
        height: 25px;
        line-height: 0;
    }

    .m-nav-close img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: contain;
    }

    .m-nav-list {
        list-style: none;
        margin: 0;
        padding: 0;
        background: #fff;
        flex-shrink: 0;
    }

    .m-nav-list li {
        margin: 0;
        padding: 0;
        border-bottom: 1px solid #e8e8e8;
    }

    .m-nav-list a {
        display: flex;
        align-items: center;
        position: relative;
        min-height: 44px;
        padding: 0 24px 0 28px;
        box-sizing: border-box;
        text-decoration: none;
    }

    .m-nav-list a img {
        height: 16px;
        width: auto;
        display: block;
        max-width: 70%;
        object-fit: contain;
        object-position: left center;
    }

    .m-nav-list a.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 26px;
        background: url(../images/mobile-nav/active-line.png) center / 100% 100% no-repeat;
    }

    .m-nav-follow-panel {
        display: none;
        padding: 10px 20px 16px;
        background: #f7f7f7;
        border-bottom: 1px solid #e8e8e8;
        flex-shrink: 0;
    }

    .m-nav-follow-panel.open {
        display: block;
    }

    .m-nav-follow-panel .m-nav-follow-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 0;
        border-bottom: 1px solid #ebebeb;
        color: #333;
        font-size: 14px;
        text-decoration: none;
    }

    .m-nav-follow-panel .m-nav-follow-item:last-of-type {
        border-bottom: none;
    }

    .m-nav-follow-panel .m-nav-follow-item img.icon {
        width: 28px;
        height: 28px;
        object-fit: contain;
    }

    .m-nav-follow-qr {
        display: none;
        text-align: center;
        padding: 12px 0 4px;
    }

    .m-nav-follow-qr.show {
        display: block;
    }

    .m-nav-follow-qr img {
        width: 140px;
        height: auto;
        max-width: 70%;
        margin: 0 auto;
        display: block;
    }

    .m-nav-follow-qr p {
        margin: 8px 0 0;
        font-size: 12px;
        color: #666;
    }

    /* 充值/服务：位于白底区域垂直中部（约 1/2） */
    .m-nav-footer {
        list-style: none;
        margin: auto 0;
        padding: 0;
        background: #e9e9e9;
        flex-shrink: 0;
        width: 100%;
    }

    .m-nav-footer li {
        border-bottom: 1px solid #fff;
    }

    .m-nav-footer li:last-child {
        border-bottom: none;
    }

    .m-nav-footer a {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 44px;
        box-sizing: border-box;
        padding: 0 24px;
        text-decoration: none;
    }

    .m-nav-footer a img {
        /*
         * 统一显示框；contain 不压缩。
         * 宽度按与上方导航相近的约 0.8 倍缩放（122→98），三张同宽源图文字同大。
         */
        width: 98px;
        height: 22px;
        max-width: none;
        flex-shrink: 0;
        display: block;
        object-fit: contain;
        object-position: left center;
    }

    /*
     * 快速注册–开始游戏：按新切图 561×192 整合稿像素对齐
     * 底框 561×177；快速注册 93×128；安卓/即刻畅玩 196×59；开始游戏沿用原切图 145×142
     * 坐标相对整合稿：QR(34,33) 中栏(145,34) 开始游戏(360,19)
     */
    .page-home .center {
        top: auto !important;
        bottom: calc(4.5vh + env(safe-area-inset-bottom, 0px)) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 92% !important;
        margin: 0 !important;
    }

    .center .download-btns.mobile {
        display: block !important;
        position: relative;
        width: 100% !important;
        max-width: 360px;
        margin: 0 auto;
        height: auto !important;
        aspect-ratio: 561 / 192;
        padding: 0 !important;
        box-sizing: border-box;
        background: url(../images/mobile-nav/btn-frame.png?v=1) center bottom / 100% calc(100% * 177 / 192) no-repeat;
        overflow: visible;
    }

    .center .download-btns.mobile .btn-quick-reg {
        position: absolute !important;
        left: calc(100% * 34 / 561) !important;
        top: calc(100% * 33 / 192) !important;
        width: calc(100% * 93 / 561) !important;
        height: calc(100% * 128 / 192) !important;
        flex: none !important;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 0;
    }

    .center .download-btns.mobile .btn-quick-reg img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: fill;
    }

    .center .download-btns.mobile .download-btns-mid {
        position: absolute !important;
        left: calc(100% * 145 / 561) !important;
        top: calc(100% * 34 / 192) !important;
        width: calc(100% * 196 / 561) !important;
        height: calc(100% * 128 / 192) !important;
        flex: none !important;
        min-width: 0;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 0;
    }

    .center .download-btns.mobile .download-btns-mid .client {
        flex: none !important;
        width: 100% !important;
        height: calc(100% * 59 / 128) !important;
        min-height: 0;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        display: block !important;
        line-height: 0;
        background: transparent !important;
        color: transparent !important;
        font-size: 0 !important;
        overflow: hidden;
    }

    .center .download-btns.mobile .download-btns-mid .client img {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        display: block;
        object-fit: fill;
    }

    .center .download-btns.mobile .download-btns-mid .btn-taptap {
        flex: none !important;
        width: 100% !important;
        height: calc(100% * 59 / 128) !important;
        min-height: 0;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 0;
        display: block;
        overflow: hidden;
        border-radius: 0;
    }

    .center .download-btns.mobile .download-btns-mid .btn-taptap img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: fill;
    }

    .center .download-btns.mobile .start-game {
        /*
         * 原有 start-game.png 145×142：黄框约 y=36..139（高 104），叶尖可超出底框
         * 黄框顶 = 安卓按钮顶(34/192)；黄框底 = TapTap 底(34+128)/192
         */
        position: absolute !important;
        left: calc(100% * 360 / 561) !important;
        top: calc(100% * 34 / 192 - 100% * 128 / 192 * 36 / 104) !important;
        width: calc(100% * 128 / 561 * 145 / 104) !important;
        height: calc(100% * 128 / 192 * 142 / 104) !important;
        margin: 0 !important;
        flex: none !important;
        background-size: 100% 100% !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
        z-index: 2;
    }
}
