/* ================= 星欢商城（独立商城 App 风格） ================= */
body.mall-body {
    padding-top: 0;                 /* 修复全局 body 52px 顶部内边距造成的空白 */
    background: var(--bg-secondary);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}
.mall-body * { box-sizing: border-box; }

/* ---------- 顶部栏（桌面显示导航） ---------- */
.mall-header {
    position: sticky; top: 0; z-index: 200;
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
}
.mall-header-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 24px;
    height: 62px; display: flex; align-items: center; gap: 26px;
}
.mall-brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text-primary); flex-shrink: 0;
}
.mall-logo-chip {
    height: 34px; padding: 0 10px; border-radius: 10px;
    background: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.10); flex-shrink: 0;
}
.mall-logo-chip img { height: 20px; width: auto; display: block; }
.mall-brand-text { font-size: 1.02rem; font-weight: 720; letter-spacing: -.01em; }

.mall-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.mall-nav-link {
    position: relative; padding: 8px 14px; border-radius: 10px;
    font-size: .9rem; color: var(--text-secondary); text-decoration: none;
    transition: color .2s, background .2s;
}
.mall-nav-link:hover { color: var(--text-primary); background: var(--bg-card); }
.mall-nav-link.active { color: var(--accent); font-weight: 650; }
.mall-nav-link.active::after {
    content: ""; position: absolute; left: 50%; bottom: 1px; transform: translateX(-50%);
    width: 18px; height: 2px; border-radius: 2px; background: var(--accent);
}

.mall-header-actions { display: flex; align-items: center; gap: 8px; }
.mall-icon-btn {
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.mall-icon-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.mall-icon-btn svg { width: 18px; height: 18px; }

/* ---------- 主体 ---------- */
.mall-main { max-width: 1200px; margin: 0 auto; padding: 22px 24px 60px; }

.mall-view { display: none; }
.mall-view.active { display: block; animation: mallViewIn .34s cubic-bezier(.22,.8,.25,1); }
@keyframes mallViewIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ---------- 首页主视觉 ---------- */
.m-hero {
    position: relative; overflow: hidden; border-radius: 24px;
    padding: 46px 40px 42px; margin-bottom: 26px;
    background: #143d20;
    color: #fff; box-shadow: 0 24px 60px rgba(15,42,23,.28);
}
.m-hero-eyebrow {
    position: relative; display: inline-block; margin-bottom: 14px;
    font-size: .7rem; font-weight: 700; letter-spacing: .28em;
    padding: 5px 12px; border-radius: 999px;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.24);
}
.m-hero-title { position: relative; font-size: clamp(1.9rem, 4.6vw, 2.9rem); font-weight: 780; letter-spacing: -.03em; line-height: 1.12; }
.m-hero-sub { position: relative; margin-top: 12px; font-size: .95rem; color: rgba(255,255,255,.78); letter-spacing: .04em; }
.m-hero-actions { position: relative; display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.m-hero-btn {
    height: 44px; padding: 0 22px; border-radius: 12px; cursor: pointer;
    border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12);
    color: #fff; font-size: .88rem; font-weight: 600; font-family: inherit;
    display: inline-flex; align-items: center; gap: 8px; transition: all .22s;
}
.m-hero-btn:hover { background: rgba(255,255,255,.2); transform: translateY(-1px); }
.m-hero-btn.primary { background: #fff; color: #123d1c; border-color: #fff; }
.m-hero-btn.primary:hover { filter: brightness(.96); }

/* ---------- 搜索 ---------- */
.m-search-wrap {
    position: relative; margin-bottom: 22px;
}
.m-search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--text-muted); pointer-events: none;
}
.m-search {
    width: 100%; height: 48px; padding: 0 18px 0 46px;
    border-radius: 14px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text-primary);
    font-size: .92rem; font-family: inherit; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.m-search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(26,94,31,.08); }
.m-search::placeholder { color: var(--text-muted); }

/* ---------- 分类 chips ---------- */
.m-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.m-chip {
    padding: 8px 17px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); font-size: .84rem; font-weight: 500;
    font-family: inherit; transition: all .2s; white-space: nowrap;
}
.m-chip:hover { color: var(--text-primary); border-color: var(--border-hover); }
.m-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 18px rgba(26,94,31,.22); }

/* ---------- 区块标题 ---------- */
.m-section { margin-bottom: 30px; }
.m-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.m-section-title { font-size: 1.12rem; font-weight: 720; letter-spacing: -.01em; color: var(--text-primary); }
.m-section-more {
    font-size: .82rem; color: var(--text-muted); background: none; border: none;
    cursor: pointer; font-family: inherit; padding: 6px 8px; border-radius: 8px; transition: color .2s;
}
.m-section-more:hover { color: var(--accent); }

/* ---------- 商品网格 ---------- */
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.m-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--bg); border: 1px solid var(--border); border-radius: 18px;
    overflow: hidden; cursor: pointer;
    transition: transform .35s cubic-bezier(.2,.75,.25,1), box-shadow .35s, border-color .35s;
    animation: mallCardIn .45s both;
}
@keyframes mallCardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.m-card:hover { transform: translateY(-6px); border-color: var(--border-hover); box-shadow: 0 22px 46px rgba(0,0,0,.12); }
[data-theme="dark"] .m-card:hover { box-shadow: 0 22px 46px rgba(0,0,0,.6); }
.m-thumb {
    position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
}
.m-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.m-card:hover .m-thumb img { transform: scale(1.06); }
.m-thumb-empty { color: var(--text-muted); opacity: .45; }
.m-badge {
    position: absolute; top: 12px; left: 12px; padding: 5px 11px;
    font-size: .7rem; font-weight: 600; color: #fff; border-radius: 999px;
    background: rgba(15,20,28,.55); border: 1px solid rgba(255,255,255,.22);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.m-card-body { padding: 15px 15px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.m-name {
    font-size: .97rem; font-weight: 650; line-height: 1.45; color: var(--text-primary);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.m-desc {
    font-size: .8rem; line-height: 1.6; color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.5em;
}
.m-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 4px; }
.m-price { font-size: 1.24rem; font-weight: 750; color: var(--accent); letter-spacing: -.01em; }
.m-price::before { content: "¥"; font-size: .68em; margin-right: 1px; font-weight: 600; }
.m-original { font-size: .8rem; color: var(--text-muted); text-decoration: line-through; }
.m-buy {
    margin-top: 4px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 600; color: var(--text-primary);
    background: var(--bg-card); border: 1px solid var(--border); transition: all .2s;
}
.m-card:hover .m-buy { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 公告 / 消息 ---------- */
.m-msg-list { display: flex; flex-direction: column; gap: 12px; }
.m-msg {
    display: flex; gap: 14px; padding: 18px 18px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 16px;
    transition: border-color .2s, transform .2s;
}
.m-msg:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.m-msg-icon {
    width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(46,204,113,.12); color: var(--accent);
}
.m-msg-icon svg { width: 20px; height: 20px; }
.m-msg-body { min-width: 0; flex: 1; }
.m-msg-title { font-size: .95rem; font-weight: 650; color: var(--text-primary); margin-bottom: 4px; }
.m-msg-text { font-size: .84rem; line-height: 1.65; color: var(--text-secondary); white-space: pre-wrap; }
.m-msg-date { margin-top: 6px; font-size: .72rem; color: var(--text-muted); }

/* ---------- 我的 ---------- */
.m-profile {
    position: relative; overflow: hidden; border-radius: 22px; padding: 28px 24px;
    background: #143d20; color: #fff;
    display: flex; align-items: center; gap: 16px; margin-bottom: 22px;
    box-shadow: 0 20px 50px rgba(15,42,23,.26);
}
.m-avatar {
    width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
    font-size: 1.4rem; font-weight: 750;
}
.m-profile-info { position: relative; }
.m-profile-name { font-size: 1.12rem; font-weight: 720; }
.m-profile-sub { font-size: .8rem; color: rgba(255,255,255,.75); margin-top: 3px; }

.m-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.m-stat {
    padding: 18px 10px; text-align: center; border-radius: 16px;
    background: var(--bg); border: 1px solid var(--border);
}
.m-stat-value { font-size: 1.3rem; font-weight: 750; color: var(--text-primary); }
.m-stat-label { font-size: .74rem; color: var(--text-muted); margin-top: 3px; }

.m-menu { background: var(--bg); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; margin-bottom: 24px; }
.m-menu-item {
    display: flex; align-items: center; gap: 12px; padding: 16px 18px;
    font-size: .9rem; color: var(--text-primary); text-decoration: none;
    border-bottom: 1px solid var(--border); background: none; width: 100%;
    font-family: inherit; cursor: pointer; text-align: left; transition: background .2s;
}
.m-menu-item:last-child { border-bottom: none; }
.m-menu-item:hover { background: var(--bg-card); }
.m-menu-item svg { width: 19px; height: 19px; color: var(--text-secondary); flex-shrink: 0; }
.m-menu-item .m-menu-arrow { margin-left: auto; color: var(--text-muted); }

/* ---------- 订单 ---------- */
.m-order {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
    margin-bottom: 10px;
}
.m-order-main { flex: 1; min-width: 0; }
.m-order-name { font-size: .88rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-order-meta { font-size: .72rem; color: var(--text-muted); margin-top: 3px; }
.m-order-amount { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.m-order-status { font-size: .72rem; padding: 3px 9px; border-radius: 999px; }
.m-order-status.paid { color: var(--accent); background: rgba(46,204,113,.12); }
.m-order-status.pending { color: #c79100; background: rgba(255,193,7,.14); }
[data-theme="dark"] .m-order-status.pending { color: #ffd54f; }
.m-order-status.cancel { color: var(--text-muted); background: var(--bg-card); }

/* ---------- 空状态 / 加载 ---------- */
.m-empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: .88rem; }
.m-empty svg { opacity: .35; margin-bottom: 12px; }
.m-loading { text-align: center; padding: 50px 20px; color: var(--text-muted); font-size: .85rem; }
.m-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.m-skel {
    height: 300px; border-radius: 18px; background: var(--bg-card);
    animation: mallPulse 1.2s ease-in-out infinite;
}
@keyframes mallPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- 移动端底部导航（H5） ---------- */
.mall-tabbar { display: none; }
.mall-mobile-head { display: none; }

@media (max-width: 820px) {
    .mall-nav { display: none; }                 /* 顶部导航在 H5 隐藏，改到底部 */
    .mall-header-inner { height: 54px; padding: 0 16px; gap: 12px; }
    .mall-header-actions .mall-icon-btn:not(.mall-theme-btn) { display: none; }
    .mall-main { padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }
    .m-hero { padding: 32px 22px 30px; border-radius: 20px; }
    .m-hero-sub { font-size: .86rem; }
    .m-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .m-card-body { padding: 11px 11px 13px; gap: 6px; }
    .m-name { font-size: .88rem; }
    .m-desc { display: none; }
    .m-price { font-size: 1.06rem; }
    .m-buy { height: 32px; font-size: .76rem; }
    .m-stats { gap: 8px; }
    .m-stat { padding: 14px 6px; }
    .m-stat-value { font-size: 1.12rem; }

    .mall-tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
        height: calc(58px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--nav-bg);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-top: 1px solid var(--border);
    }
    .mall-tab {
        position: relative; flex: 1; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 2px;
        color: var(--text-muted); text-decoration: none; font-size: .68rem;
        background: none; border: none; font-family: inherit; cursor: pointer;
        transition: color .2s;
    }
    .mall-tab svg { width: 22px; height: 22px; transition: transform .25s; }
    .mall-tab.active { color: var(--accent); }
    .mall-tab.active svg { transform: translateY(-1px) scale(1.08); }
    .mall-tab.active::before {
        content: ""; position: absolute; top: 0; width: 22px; height: 3px;
        border-radius: 0 0 3px 3px; background: var(--accent);
        animation: mallTabIn .26s ease;
    }
    @keyframes mallTabIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- 轻提示 ---------- */
.m-toast {
    position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px);
    z-index: 4000; padding: 10px 18px; border-radius: 12px;
    background: rgba(20,26,36,.92); color: #fff; font-size: .84rem;
    opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.m-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 821px) { .m-toast { bottom: 32px; } }

/* ---------- 登录门禁 ---------- */
.m-auth-gate {
    text-align: center; padding: 54px 22px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 22px;
}
.m-auth-gate-icon {
    width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    background: #1a9e46; color: #fff;
    font-size: 1.5rem; font-weight: 800;
    box-shadow: 0 12px 28px rgba(22,122,59,.28);
}
.m-auth-gate h2 { font-size: 1.2rem; font-weight: 750; color: var(--text-primary); margin-bottom: 8px; }
.m-auth-gate p { font-size: .86rem; color: var(--text-muted); line-height: 1.7; }
.m-auth-gate-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.m-auth-gate-actions .m-hero-btn { color: var(--text-primary); background: var(--bg-card); border-color: var(--border); }
.m-auth-gate-actions .m-hero-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 登录/注册弹窗 ---------- */
.m-auth-modal {
    position: fixed; inset: 0; z-index: 3200; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
}
.m-auth-modal.show { display: flex; }
.m-auth-card {
    width: 100%; max-width: 420px; max-height: 92vh; overflow: auto;
    background: var(--bg); border: 1px solid var(--border); border-radius: 22px;
    padding: 26px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.38);
    animation: mallViewIn .3s cubic-bezier(.22,.8,.25,1);
}
.m-auth-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.m-auth-title { font-size: 1.16rem; font-weight: 750; color: var(--text-primary); }
.m-auth-close {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
    font-size: 1.05rem; line-height: 1;
}
.m-auth-tabs { display: flex; gap: 4px; background: var(--bg-card); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.m-auth-tab {
    flex: 1; height: 36px; border: none; background: none; border-radius: 9px;
    font-size: .85rem; color: var(--text-secondary); cursor: pointer; font-family: inherit;
    transition: all .2s;
}
.m-auth-tab.active { background: var(--bg); color: var(--text-primary); font-weight: 650; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.m-auth-field { margin-bottom: 13px; }
.m-auth-field label { display: block; font-size: .8rem; color: var(--text-secondary); margin-bottom: 6px; }
.m-auth-input {
    width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--form-input-bg);
    color: var(--text-primary); font-size: .92rem; font-family: inherit; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.m-auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(26,94,31,.08); }
.m-auth-code-row { display: flex; gap: 10px; }
.m-auth-code-row .m-auth-input { flex: 1; min-width: 0; }
.m-auth-code-btn {
    height: 46px; padding: 0 13px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary);
    font-size: .8rem; font-family: inherit; white-space: nowrap; transition: all .2s;
}
.m-auth-code-btn:hover { background: var(--bg-card-hover); }
.m-auth-code-btn:disabled { opacity: .55; cursor: not-allowed; }
.m-auth-submit {
    width: 100%; height: 48px; margin-top: 4px; border: none; border-radius: 13px; cursor: pointer;
    background: #1a9e46; color: #fff;
    font-size: .95rem; font-weight: 700; font-family: inherit;
    box-shadow: 0 12px 26px rgba(22,122,59,.26); transition: filter .2s;
}
.m-auth-submit:hover { filter: brightness(1.05); }
.m-auth-submit:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.m-auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: .8rem; }
.m-auth-link { color: var(--accent); cursor: pointer; background: none; border: none; font-family: inherit; font-size: .8rem; padding: 0; }
.m-auth-link:hover { text-decoration: underline; }
.m-auth-msg { min-height: 20px; margin-top: 12px; font-size: .82rem; color: #e5484d; text-align: center; line-height: 1.6; }
.m-auth-msg.ok { color: var(--accent); }
.m-auth-note { font-size: .74rem; color: var(--text-muted); text-align: center; margin-top: 14px; line-height: 1.7; }
