/* H5 购买页样式 —— 颜色和尺寸全部走 CSS 变量，变量由后台「外观样式」注入 */

:root {
    --primary: #e02e24;
    --accent: #c2410c;
    --page-bg: #f5f6f8;
    --card-bg: #ffffff;
    --text: #1c1f26;
    --muted: #5b6572;
    --border: #e6e8ec;
    --radius: 10px;
    --btn-radius: 10px;
    --card-shadow: none;
    --font: -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    --font-size: 15px;
    --h5-max: 560px;
    --h5-columns: 2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1.7;
    padding-bottom: 40px;
}

a { color: var(--primary); text-decoration: none; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.center { text-align: center; margin: 18px 0; }
.lead { color: var(--muted); margin: 4px 2px 14px; }

.hd {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--card-bg); padding: 14px 16px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.hd-name { font-size: 16px; font-weight: 600; color: var(--text); }

.wrap { padding: 14px 14px 0; max-width: var(--h5-max); margin: 0 auto; }

.card {
    display: block; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
    box-shadow: var(--card-shadow);
}
.card-title { font-size: 16px; margin: 0 0 10px; }
.empty { text-align: center; color: var(--muted); }

.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; }
.flash-info { background: #eef4ff; color: #1a4bd0; }
.flash-success { background: #e8f6f0; color: #12805c; }
.flash-error { background: #fdeceb; color: #c0392b; }
.flash-warning { background: #fff8e6; color: #8a5200; }

/* 首页横幅 */
.banner { display: block; margin-bottom: 14px; border-radius: var(--radius); overflow: hidden; }
.banner img { width: 100%; display: block; }
.banner-text {
    background: var(--primary); color: #fff; padding: 12px 16px; font-size: 14px;
}
.notice {
    background: #fff8e6; color: #8a5200; border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}

/* 封面网格：列数由后台决定 */
.grid { display: grid; grid-template-columns: repeat(var(--h5-columns), 1fr); gap: 12px; }
.cover {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; color: var(--text); box-shadow: var(--card-shadow);
}
.cover-img { width: 100%; height: 132px; object-fit: cover; display: block; background: var(--page-bg); }
.cover-img-empty { background: var(--page-bg); }
.cover-body { padding: 10px 12px 12px; }
.cover-title { font-size: 14px; font-weight: 600; margin-bottom: 6px;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover-foot { display: flex; align-items: baseline; justify-content: space-between; }

.price { color: var(--accent); font-weight: 600; }
.price-lg { font-size: 22px; }
.stock { color: var(--muted); font-size: 12px; }
.stock-out { color: #c0392b; }

/* 详情 */
.detail-img { width: 100%; border-radius: var(--radius); margin-bottom: 14px; display: block; }
.detail-title { font-size: 18px; margin: 0 0 8px; }
.detail-desc { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.detail-row { display: flex; align-items: baseline; justify-content: space-between; }
.qr { width: 180px; height: 180px; display: block; margin: 12px auto; object-fit: contain; }

/* 表单 */
label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
input[type=tel], input[type=text] {
    display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 16px; font-family: inherit; color: var(--text); background: var(--card-bg);
}
input:focus { outline: none; border-color: var(--primary); }

.btn {
    display: inline-block; padding: 10px 18px; border-radius: var(--btn-radius);
    border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
    cursor: pointer; font-size: 15px; font-family: inherit; text-align: center;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 4px 12px; font-size: 13px; }

/* 卡密展示 */
.ok-card { text-align: center; }
.ok-mark {
    width: 52px; height: 52px; line-height: 52px; border-radius: 50%;
    background: #e8f6f0; color: #12805c; font-size: 26px; margin: 0 auto 12px;
}
.card-no {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--page-bg); border: 1px dashed var(--border); border-radius: var(--radius);
    padding: 14px; margin: 14px 0;
}
.card-no .mono { font-size: 15px; word-break: break-all; }

/* 订单 */
.order { color: var(--text); }
.order-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.order-bottom { display: flex; justify-content: space-between; align-items: center; }
.order-time { color: var(--muted); font-size: 12px; margin-top: 6px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px;
         background: var(--page-bg); color: var(--muted); font-size: 12px; }
.badge-ok { background: #e8f6f0; color: #12805c; }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.ft { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 20px 30px; }
.ft-tip { margin: 4px 0 0; }

/* ── 底部三个入口（和小程序对齐：封面 / 我的订单 / 我的）── */
/**
 * 底部菜单（tab 栏）
 *
 * 客户反馈"下面的菜单 UI 没有" —— 原来是纯文字链接，看不出来是底栏。
 * 现在按小程序的样子来：白底 + 顶部细线 + 图标在上文字在下 + 选中态用主色。
 */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; background: var(--card-bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(23,27,46,.06);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    max-width: var(--h5-max); margin: 0 auto;
}
.tabbar a {
    flex: 1; text-align: center; text-decoration: none;
    color: var(--muted); font-size:12px; line-height: 1.5;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar a .ti { font-size: 20px; line-height: 1.1; }
.tabbar a.on { color: var(--primary); font-weight: 600; }

/* 留出底部菜单的高度（图标 + 文字比原来高一点），别让内容被压住 */
body { padding-bottom: 88px; }

/* ── 我的 / 积分明细 ── */
.points-card { color: #fff; }
.points-card .muted { color: rgba(255,255,255,.85); }
.points-big { font-size: 34px; font-weight: 700; margin: 6px 0 10px; }
.points-card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.points-card .btn-mini {
    background: rgba(255,255,255,.92); color: var(--primary); border: 0;
    border-radius: 999px; padding: 6px 14px; font-size: 13px; font-family: inherit;
    /* 窄屏（375px）下"去赚积分"这种四个字的按钮会被挤成两行，很难看 */
    white-space: nowrap; flex: none;
}
.entry { display: flex; align-items: center; justify-content: space-between;
         padding: 14px 0; border-bottom: 1px solid var(--border); color: var(--text);
         text-decoration: none; }
.entry:last-child { border-bottom: 0; }
.entry .arrow { color: var(--muted); }
.log { display: flex; align-items: center; justify-content: space-between; gap: 10px;
       padding: 12px 0; border-bottom: 1px solid var(--border); }
.log:last-child { border-bottom: 0; }
.log .plus { color: #12805c; font-weight: 600; }
.log .minus { color: #c0392b; font-weight: 600; }
.mine-card-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.mine-card-item:last-child { border-bottom: 0; }
.mine-card-item .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
