/**
 * 前台样式（手机浏览器 / 微信内置浏览器）
 *
 * 手机优先：底部固定 Tab、卡片圆角、点击区域够大（≥44px）。
 * 一张样式表同时服务首页、分类、详情、我的、积分、分销页。
 */
:root {
    --primary: #c2410c;
    --radius: 12px;
    --ink: #1b1f2a;
    --muted: #5b6572;
    --line: #ecedf1;
    --soft: #f6f7f9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body.site {
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    padding-bottom: 62px;
}

a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* ── 顶部 ── */
.site-head {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line);
}
.site-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.site-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.site-brand-mark {
    width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #ffb020); color: #fff; font-weight: 700;
}
.site-brand-text { display: flex; flex-direction: column; min-width: 0; }
.site-brand-text b { font-size: 15px; }
.site-brand-text i { font-style: normal; font-size:12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-head-link { font-size: 13px; color: var(--primary); }

.site-notice {
    background: #fff8ee; color: #96590d; font-size: 12.5px;
    padding: 8px 14px; border-bottom: 1px solid #ffe6c7;
}
.site-flash { padding: 10px 14px; font-size: 13px; background: #eef3ff; color: #2a4b9b; }
.site-flash-success { background: #ebf9f1; color: #0b6b3f; }
.site-flash-error { background: #fdecec; color: #a52222; }
.site-flash-info { background: #eef3ff; color: #2a4b9b; }

.site-main { padding: 12px 12px 24px; }

/* ── 底部 Tab ── */
.site-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.site-tabs a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 9px 0 8px; font-size:12px; color: var(--muted);
}
.site-tabs a.on { color: var(--primary); font-weight: 600; }
.tab-icon { width: 20px; height: 20px; border-radius: 6px; background: #e9ebf0; position: relative; }
.site-tabs a.on .tab-icon { background: var(--primary); }
.tab-icon-home::after,
.tab-icon-grid::after,
.tab-icon-user::after { content: ''; position: absolute; inset: 5px; background: #fff; border-radius: 2px; opacity: .9; }
.tab-icon-grid::after { inset: 4px; border-radius: 3px; }
.tab-icon-user::after { inset: 6px 6px 3px; border-radius: 50% 50% 3px 3px; }

/* ── 通用块 ── */
.block { margin-bottom: 18px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.block-head h2 { font-size: 16px; }
.block-head a { font-size: 12.5px; color: var(--muted); }

.card-block {
    background: #fff; border-radius: var(--radius); padding: 14px;
    margin-bottom: 12px; box-shadow: 0 1px 2px rgba(20,26,38,.04);
}
.card-block h2 { font-size: 15px; margin-bottom: 10px; }

.empty { background: #fff; border-radius: var(--radius); padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .btn { display: inline-flex; margin-top: 10px; }

/* ── 按钮 ── */
.btn {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 10px 16px; border-radius: 11px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-size: 15px; font-weight: 500; cursor: pointer;
}
.btn + .btn { margin-top: 8px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .6; }

/* ── 轮播 / 首屏 ── */
.banners { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; scroll-snap-type: x mandatory; }
.banners::-webkit-scrollbar { display: none; }
.banner { flex: 0 0 88%; scroll-snap-align: center; border-radius: var(--radius); overflow: hidden; background: #fff; }
.banner img { width: 100%; height: 148px; object-fit: cover; }
.banner-ph {
    display: flex; align-items: center; justify-content: center; height: 148px;
    background: linear-gradient(135deg, var(--primary), #ffb020); color: #fff; font-size: 17px; font-weight: 700;
}

.hero {
    border-radius: var(--radius); padding: 22px 16px; margin-bottom: 14px;
    background: linear-gradient(135deg, var(--primary), #ffb020); color: #fff;
}
.hero h1 { font-size: 20px; margin-bottom: 6px; }
.hero p { margin: 0 0 8px; opacity: .92; font-size: 13px; }
.hero-meta { font-size: 12px; opacity: .85; }

/* ── 首页菜单栏 ── */
.home-menus {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px 2px;
    background: #fff; border-radius: var(--radius); padding: 12px 6px; margin-bottom: 14px;
}
.home-menus a { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; font-size:12px; }
.hm-icon { font-size: 21px; line-height: 1; }
.hm-text { color: var(--ink); }
.hm-badge {
    position: absolute; top: -4px; right: 6px; background: #c81e1e; color: #fff;
    font-size:12px; padding: 0 5px; border-radius: 10px;
}

/* ── 横滑小卡 ── */
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.hscroll::-webkit-scrollbar { display: none; }
.mini-card { flex: 0 0 130px; background: #fff; border-radius: var(--radius); padding: 8px; }
.mini-cover { display: block; height: 76px; border-radius: 9px; overflow: hidden; background: #f1f2f5; margin-bottom: 6px; }
.mini-cover img { width: 100%; height: 100%; object-fit: cover; }
.mini-card b { display: block; font-size: 13px; line-height: 1.4; margin-bottom: 3px; }
.mini-card em { font-style: normal; font-size: 12.5px; color: var(--primary); font-weight: 600; }

/* ── 分类 chips ── */
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chips a {
    background: #fff; padding: 8px 12px; border-radius: 20px; font-size: 13px;
    display: inline-flex; align-items: center; gap: 5px;
}

/* ── 资源卡片 ── */
.rc-list { display: grid; gap: 10px; }
.rc-list-grid, .rc-list-waterfall { grid-template-columns: 1fr 1fr; }

.rc { display: block; background: #fff; border-radius: var(--radius); overflow: hidden; }
.rc-cover { display: block; position: relative; background: #f1f2f5; overflow: hidden; }
.rc-cover img { width: 100%; height: 100%; object-fit: cover; }
.rc-cover-ph {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
    background: linear-gradient(135deg, #ffe6d8, #ffd2ba); color: #b3480f; font-size: 22px; font-weight: 700;
}
.rc-cover-ph.big { min-height: 180px; font-size: 46px; }
.rc-badge {
    position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff;
    font-size:12px; padding: 1px 6px; border-radius: 6px;
}
.rc-body { display: block; padding: 9px 10px 11px; }
.rc-title { display: block; font-size: 14px; line-height: 1.42; margin-bottom: 4px; }
.rc-summary { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.rc-meta { display: block; font-size:12px; color: var(--muted); margin-bottom: 6px; }
.rc-meta em { font-style: normal; margin-right: 8px; }
.rc-top { color: #b3480f; }
.rc-price { display: flex; align-items: baseline; gap: 6px; }
.rc-price b { color: var(--primary); font-size: 16px; }
.rc-price b.free { color: #0b6b3f; }
.rc-price em { font-style: normal; font-size:12px; color: var(--muted); }

.rc-feed .rc-cover { height: 168px; }
.rc-grid .rc-cover { height: 104px; }
.rc-list { display: flex; gap: 10px; padding: 10px; }
.rc-list .rc-cover { width: 104px; height: 74px; flex: 0 0 104px; border-radius: 9px; }
.rc-list .rc-body { padding: 0; flex: 1; min-width: 0; }

/* ── 搜索 ── */
.site-search { display: flex; gap: 8px; margin-bottom: 12px; }
.site-search input {
    flex: 1; min-height: 42px; padding: 8px 12px; border-radius: 11px;
    border: 1px solid var(--line); background: #fff; font: inherit;
}
.site-search button {
    min-height: 42px; padding: 0 16px; border-radius: 11px; border: 0;
    background: var(--primary); color: #fff; font-size: 14px;
}

/* ── 分类页 ── */
.cat-split { display: flex; gap: 10px; margin-bottom: 12px; }
.cat-side { flex: 0 0 96px; background: #fff; border-radius: var(--radius); overflow: hidden; }
.cat-side a { display: block; padding: 12px 10px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.cat-side a.on { background: var(--primary); color: #fff; font-weight: 600; }
.cat-main { flex: 1; min-width: 0; }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs a { flex: 0 0 auto; padding: 7px 13px; background: #fff; border-radius: 20px; font-size: 13.5px; }
.cat-tabs a.on { background: var(--primary); color: #fff; }
.cat-sub { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cat-sub a { font-size: 12.5px; padding: 5px 11px; background: #fff; border-radius: 8px; color: var(--muted); }
.cat-sub a.on { color: var(--primary); font-weight: 600; background: #fff4ee; }
.sort-bar { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; }
.sort-bar::-webkit-scrollbar { display: none; }
.sort-bar a { flex: 0 0 auto; font-size: 12.5px; color: var(--muted); padding: 4px 8px; }
.sort-bar a.on { color: var(--primary); font-weight: 600; }

.pager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 14px 0 8px; }
.pager a { min-width: 32px; text-align: center; padding: 6px 8px; border-radius: 8px; background: #fff; font-size: 13px; }
.pager a.on { background: var(--primary); color: #fff; }

/* ── 详情 ── */
.detail-cover { border-radius: var(--radius); overflow: hidden; background: #fff; margin-bottom: 12px; }
.detail-cover img { width: 100%; height: 200px; object-fit: cover; }
.detail-cover .rc-cover-ph { min-height: 160px; }
.detail-head { background: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.detail-head h1 { font-size: 18px; line-height: 1.4; margin-bottom: 6px; }
.detail-sub { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.detail-price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.detail-price b { font-size: 23px; color: var(--primary); }
.detail-price b.free { color: #0b6b3f; }
.detail-price s { color: var(--muted); font-size: 13px; }
.points-tag {
    font-style: normal; font-size: 12px; background: #fff4ee; color: #b3480f;
    padding: 3px 9px; border-radius: 20px;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.detail-text { font-size: 14px; color: #3b4252; }
.buy-block { position: sticky; bottom: 66px; }
.deliver-box { background: #fafbfd; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; }
.deliver-code { font-size: 14px; }
.deliver-code b { color: var(--primary); font-size: 17px; letter-spacing: 1px; }

/* ── 订单 ── */
.order-card { text-align: center; padding: 22px 16px; }
.order-title { font-size: 19px; margin-bottom: 8px; }
.order-amount { font-size: 26px; font-weight: 700; color: var(--primary); margin: 0 0 8px; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.order-list li { background: #fff; border-radius: var(--radius); }
.order-list a { display: flex; align-items: center; gap: 10px; padding: 11px; }
.ol-cover { width: 62px; height: 46px; flex: 0 0 62px; border-radius: 9px; overflow: hidden; background: #f1f2f5; }
.ol-cover img { width: 100%; height: 100%; object-fit: cover; }
.ol-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ol-main b { font-size: 14px; }
.ol-main em { font-style: normal; }

/* ── 我的 ── */
.profile { background: #fff; border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.profile-card { background: linear-gradient(135deg, var(--primary), #ffb020); color: #fff; }
.profile-card .muted, .profile-card .small { color: rgba(255,255,255,.85); }
.profile-card .profile-points b { color: #fff; }
.profile-avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: #ffe6d8; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #b3480f; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-info b { font-size: 16px; }
.profile-points { text-align: center; display: flex; flex-direction: column; }
.profile-points b { font-size: 19px; color: var(--primary); }
.profile-points span { font-size:12px; color: var(--muted); }
.profile-simple .profile-avatar { width: 44px; height: 44px; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.quick { background: #fff; border-radius: var(--radius); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.quick-icon { font-size: 20px; }
.quick b { font-size: 13px; }
.quick em { font-style: normal; font-size:12px; color: var(--muted); }

.guest-card { background: #fff; border-radius: var(--radius); padding: 24px 16px; text-align: center; margin-bottom: 12px; }
.guest-avatar { font-size: 40px; }
.guest-card h2 { font-size: 17px; margin: 8px 0 6px; }
.guest-card .btn { margin-top: 10px; }

.service-qr { width: 160px; margin: 8px 0; border-radius: 10px; }

/* ── 积分 ── */
.points-head, .dist-head {
    background: linear-gradient(135deg, var(--primary), #ffb020); color: #fff;
    border-radius: var(--radius); padding: 18px 16px; margin-bottom: 12px; text-align: center;
}
.points-num { display: block; font-size: 32px; font-weight: 800; }
.points-label { font-size: 12.5px; opacity: .9; }
.points-sub { display: flex; justify-content: center; gap: 14px; font-size: 12px; opacity: .9; margin-top: 6px; }
.sign-week { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.sign-dot { width: 28px; height: 28px; border-radius: 50%; background: #f1f2f5; color: var(--muted); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.sign-dot.on { background: var(--primary); color: #fff; font-weight: 600; }

.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.log-list li:last-child { border-bottom: 0; }
.log-main { display: flex; flex-direction: column; min-width: 0; }
.log-main b { font-size: 13.5px; }
.log-main em { font-style: normal; }
.log-num { font-weight: 700; white-space: nowrap; }
.log-num.plus { color: #0b6b3f; }
.log-num.minus { color: #a52222; }

/* ── 邀请 / 分销 ── */
.invite-head { background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.invite-head h2 { font-size: 17px; margin-bottom: 6px; }
.invite-code { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.invite-code b { font-size: 22px; letter-spacing: 2px; color: var(--primary); }
.invite-link { display: flex; gap: 8px; margin-bottom: 8px; }
.invite-link input {
    flex: 1; min-width: 0; padding: 9px 11px; border-radius: 10px;
    border: 1px solid var(--line); background: #fafbfd; font-size: 12.5px; font-family: ui-monospace, monospace;
}

.user-list { list-style: none; margin: 0 0 10px; padding: 0; }
.user-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.user-list li:last-child { border-bottom: 0; }
.ul-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #ffe6d8; display: flex; align-items: center; justify-content: center; color: #b3480f; font-weight: 700; }
.ul-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ul-main { display: flex; flex-direction: column; }
.ul-main em { font-style: normal; }

.dist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.dist-grid div { display: flex; flex-direction: column; }
.dist-grid b { font-size: 15px; }
.dist-grid span { font-size:12px; opacity: .88; }

/* ── 表单 / Tab ── */
.form { display: block; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
    width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px;
    border: 1px solid var(--line); background: #fff; font: inherit; color: var(--ink);
}
.field textarea { min-height: 90px; }
.tabs { display: flex; gap: 18px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 2px; font-size: 15px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── 标签 ── */
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size:12px; background: #f1f2f5; color: var(--muted); white-space: nowrap; }
.tag-paid, .tag-published { background: #ebf9f1; color: #0b6b3f; }
.tag-pending, .tag-draft { background: #fff6e8; color: #96590d; }
.tag-closed, .tag-refunded, .tag-rejected, .tag-canceled { background: #fdecec; color: #a52222; }

.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.plain-list { margin: 0 0 10px; padding-left: 18px; }
.plain-list li { margin-bottom: 6px; }

@media (min-width: 560px) {
    .site-main { max-width: 560px; margin: 0 auto; }
    .home-menus { grid-template-columns: repeat(6, 1fr); }
}
