:root {
  --brand: #e8452c;
  --brand-dark: #c33518;
  --brand-soft: #fff2ee;
  --ink: #1f2328;
  --ink-2: #61676e;
  --ink-3: #9aa1a9;
  --line: #eceff2;
  --bg: #f5f6f8;
  --card: #fff;
  --ok: #16a34a;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(20, 25, 40, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* 后台设了背景图时：铺满整页，分类栏加毛玻璃保证看得清 */
body.has-bg {
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* 背景图不加 fixed 定位（手机上滚动会严重掉帧） */
}
body.has-bg .cats {
  /* 用半透明纯色代替毛玻璃：效果接近，滚动流畅得多 */
  background: rgba(255,255,255,.94);
}
.hero.has-photo { text-shadow: 0 1px 3px rgba(0,0,0,.35); }
img { display: block; max-width: 100%; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; }
a { color: var(--brand); text-decoration: none; }

/* ---------- 顶部（可折叠店牌 + 分类，整体吸顶） ---------- */
/* ── 顶部两种模式 ───────────────────────────────────────────
   模式A（默认，最流畅）：店牌跟着页面滚走，只有分类栏吸顶
      —— 滚动过程中完全没有"大块吸顶元素"，不会每帧重新定位+重绘，
         低端机上也不会卡；而且比折叠更省屏幕空间。
   模式B（可选）：店牌吸顶 + 滚动时折叠成一行（后台开关 fold_header=1）
      —— 好处是店名一直可见，代价是滚动时有一次布局变化。 */
.topbar { position: static; }
.cats { position: sticky; top: 0; z-index: 25; }

body.fold-header .topbar {
  position: sticky; top: 0; z-index: 25;
  contain: layout paint;
  transform: translateZ(0);       /* 独立合成层：滚动时渐变不再被反复重绘 */
}
body.fold-header .cats { position: static; }
.hero {
  background: linear-gradient(135deg, #ff6a3d 0%, var(--brand) 55%, #b62f14 100%);
  color: #fff; padding: 18px 16px 30px; position: relative;
  /* 注意：这里不做 padding/font-size 过渡——那两个属性每帧都要重排+重绘橙色渐变，
     低端手机上会明显卡顿。折叠改成「瞬切」，反而更跟手。 */
}
.hero-line { display: flex; align-items: center; gap: 8px; }
.hero h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.hero .badge {
  background: rgba(255,255,255,.22); padding: 2px 9px; border-radius: 20px; font-size: 12px;
  flex: none;
}
/* 店牌右侧：电话按钮 + 折叠箭头 */
.hero-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.hero-phone {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.22); color: #fff; text-decoration: none;
  padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.hero-phone:active { background: rgba(255,255,255,.34); }
.hero-phone .ico { font-size: 12px; }

.hero .fold-arrow {
  font-size: 13px; opacity: .85;
  padding: 4px 6px; line-height: 1;
  /* 只动 transform，走 GPU 合成，不触发重排 */
  transition: transform .18s ease;
  will-change: transform;
}
.hero .sub { font-size: 13px; opacity: .92; margin-top: 6px; }
/* 折叠态：只留一行店名，分类条紧贴在下面 */
body.fold-header .topbar.compact .hero { padding: 9px 14px 10px; }
body.fold-header .topbar.compact .hero h1 { font-size: 15.5px; }
body.fold-header .topbar.compact .hero .sub { display: none; }
body.fold-header .topbar.compact .hero .badge { font-size: 11px; padding: 1px 8px; }
body.fold-header .topbar.compact .fold-arrow { transform: rotate(180deg); }
body.fold-header .topbar.compact { box-shadow: 0 2px 10px rgba(20,25,40,.12); }

.notice {
  margin: 12px 12px; background: var(--card); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px; color: var(--ink-2);
  display: flex; gap: 8px; align-items: flex-start;
}
.notice b { color: var(--brand); flex: none; }
.closed-banner {
  margin: 0 12px 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: var(--radius); padding: 10px 14px; font-size: 14px;
}

/* ---------- 分类 ---------- */
.cats {
  background: var(--bg);
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px;
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; padding: 7px 15px; border-radius: 20px; background: #fff; color: var(--ink-2);
  font-size: 14px; border: 1px solid var(--line); transition: .15s;
}
.cat.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }

/* ---------- 菜品 ---------- */
.wrap { padding: 12px 12px 120px; max-width: 720px; margin: 0 auto; }
.cat-title { font-size: 15px; font-weight: 700; margin: 16px 4px 8px; display: flex; align-items: center; gap: 8px; }
.cat-title:first-child { margin-top: 4px; }
.cat-title::before { content: ''; width: 4px; height: 15px; background: var(--brand); border-radius: 2px; }

.dish {
  background: var(--card); border-radius: var(--radius); padding: 10px; display: flex; gap: 12px;
  margin-bottom: 10px; box-shadow: var(--shadow); position: relative;
  /* 屏幕外的卡片不参与渲染，长菜单滚动更流畅（老浏览器自动忽略这条） */
  content-visibility: auto;
  contain-intrinsic-size: auto 116px;
}
.dish.out { opacity: .6; }
.dish .thumb {
  width: 92px; height: 92px; flex: none; border-radius: 11px; object-fit: cover; background: var(--brand-soft);
}
.dish .no-img {
  width: 92px; height: 92px; flex: none; border-radius: 11px; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.dish .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish .name { font-weight: 600; font-size: 16px; }
.dish .desc { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dish .row { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.price { color: var(--brand); font-weight: 700; font-size: 17px; }
.price small { font-size: 12px; font-weight: 500; }
.price .unit { color: var(--ink-3); font-size: 12px; font-weight: 400; margin-left: 3px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; transition: .12s;
}
.stepper .minus { border: 1.5px solid var(--brand); color: var(--brand); background: #fff; }
.stepper .plus { background: var(--brand); color: #fff; }
.stepper .plus:active, .stepper .minus:active { transform: scale(.9); }
.stepper .qty { min-width: 18px; text-align: center; font-weight: 600; }
.soldout-tag {
  position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
}

/* ---------- 底部结算栏 ---------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -2px 14px rgba(20,25,40,.07);
}
.bar .cart-icon { position: relative; font-size: 26px; padding: 0 4px; }
.bar .dot {
  position: absolute; top: -4px; right: -6px; background: var(--brand); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px; font-weight: 600;
}
.bar .sum { flex: 1; }
.bar .sum .total { color: var(--brand); font-weight: 700; font-size: 19px; }
.bar .sum .tip { font-size: 11.5px; color: var(--ink-3); }
.btn {
  background: var(--brand); color: #fff; padding: 11px 24px; border-radius: 24px; font-weight: 600;
  transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.97); background: var(--brand-dark); }
.btn[disabled] { background: #d5d8dc; color: #fff; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.grey { background: #f0f1f3; color: var(--ink-2); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 14px; font-size: 13.5px; border-radius: 18px; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15,18,25,.45); z-index: 50; display: none;
  align-items: flex-end; justify-content: center;
}
.mask.on { display: flex; }
.sheet {
  background: var(--card); width: 100%; max-width: 720px; border-radius: 18px 18px 0 0;
  max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2;
}
.sheet-head h3 { margin: 0; font-size: 16px; }
.sheet-head .x { font-size: 22px; color: var(--ink-3); padding: 0 6px; }
.sheet-body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }

.line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: none; }
.line img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: var(--brand-soft); }
.line .m { flex: 1; min-width: 0; }
.line .m .n { font-weight: 600; font-size: 14.5px; }
.line .m .p { color: var(--brand); font-size: 13px; font-weight: 600; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.field label i { color: var(--brand); font-style: normal; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fafbfc; border-radius: 10px;
  padding: 11px 12px; outline: none; transition: .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); background: #fff; }
.field textarea { resize: vertical; min-height: 64px; }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.total-box { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
/* 还差多少免配送费 提示条 */
.gap-tip {
  background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c;
  border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 10px; font-weight: 600;
}
.gap-tip.ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }

/* 结算页里的收款码区块 */
.checkout-pay {
  margin-top: 16px; padding: 14px 12px; border: 1px dashed #f3c9bf;
  border-radius: 12px; background: #fffaf8; text-align: center;
}
.checkout-pay-title { font-size: 13.5px; font-weight: 700; color: var(--brand); margin-bottom: 10px; }
.qr-amount {
  display: inline-block; background: var(--brand); color: #fff; font-weight: 700;
  padding: 4px 14px; border-radius: 16px; font-size: 14px; margin-bottom: 12px;
}
.qr-section .qr-frame img { width: 240px; height: 240px; object-fit: contain; }
.pay-warn {
  margin-top: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c;
  border-radius: 9px; padding: 8px 10px; font-size: 12.5px; line-height: 1.5; text-align: left;
}
/* 「我已付款」主按钮：绿色、加大，紧贴二维码下方 */
.btn-paid {
  background: #16a34a; margin-top: 14px; font-size: 16.5px; padding: 14px 20px;
  box-shadow: 0 3px 10px rgba(22,163,74,.28);
}
.btn-paid:active { background: #15803d; }
.btn-paid::after { content: ''; }
/* 未付款提醒条 */
.unpaid-tip {
  margin: 12px 12px 0; background: #fff7ed; border: 1px solid #fdba74; border-radius: 12px;
  padding: 11px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.unpaid-tip .t { font-weight: 700; color: #c2410c; font-size: 14px; }
.unpaid-tip .s { font-size: 12.5px; color: #9a3412; margin-top: 3px; }.total-box .r { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); margin-bottom: 5px; }
.total-box .r.big { font-size: 16px; color: var(--ink); font-weight: 700; margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed #f3c9bf; }
.total-box .r.big span:last-child { color: var(--brand); font-size: 20px; }

/* ---------- 收款二维码 ---------- */
.pay-box { text-align: center; }
.pay-amount { font-size: 34px; font-weight: 800; color: var(--brand); margin: 4px 0 2px; letter-spacing: .5px; }
.pay-amount small { font-size: 18px; }
.pay-order { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }
.qr-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.qr-tabs button {
  padding: 7px 18px; border-radius: 20px; background: #f2f3f5; color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.qr-tabs button.on { background: var(--brand); color: #fff; }
.qr-frame {
  display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}
.qr-frame img { width: 230px; height: 230px; object-fit: contain; }
.qr-empty { width: 230px; height: 230px; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 13px; text-align: center; padding: 20px; }
.pay-hint { font-size: 13px; color: var(--ink-2); margin: 14px auto 0; max-width: 300px; line-height: 1.6; }
.pay-hint kbd { background: #f2f3f5; border-radius: 4px; padding: 1px 5px; font-size: 12px; }

/* ---------- 状态 ---------- */
.status-steps { display: flex; margin: 10px 0 18px; }
.step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--ink-3); }
.step .cir {
  width: 26px; height: 26px; border-radius: 50%; background: #eceef1; color: #fff; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center; font-size: 13px; position: relative; z-index: 2;
}
.step.done .cir { background: var(--ok); }
.step.cur .cir { background: var(--brand); box-shadow: 0 0 0 4px rgba(232,69,44,.15); }
.step.cur { color: var(--brand); font-weight: 700; }
.step::after {
  content: ''; position: absolute; top: 13px; left: 50%; width: 100%; height: 2px; background: #eceef1; z-index: 1;
}
.step:last-child::after { display: none; }
.step.done::after { background: var(--ok); }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 200;
  background: rgba(24,28,36,.9); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px;
  max-width: 78vw; text-align: center; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.on { opacity: 1; }
.empty { text-align: center; color: var(--ink-3); padding: 50px 20px; font-size: 14px; }
.empty .ico { font-size: 44px; margin-bottom: 10px; }
.loading { text-align: center; color: var(--ink-3); padding: 40px; }

.float-link {
  position: fixed; right: 12px; bottom: 84px; z-index: 25; background: #fff; border-radius: 22px;
  padding: 8px 14px; font-size: 13px; box-shadow: var(--shadow); color: var(--ink-2); border: 1px solid var(--line);
}

/* 微信内置浏览器的引导条 */
.wx-tip {
  margin: 12px 12px 0; background: #eef6ff; border: 1px solid #bcdcff; border-radius: 12px;
  padding: 11px 14px;
}
.wx-tip .t { font-weight: 700; color: #1d4ed8; font-size: 13.5px; }
.wx-tip .s { font-size: 12.5px; color: #1e40af; margin-top: 3px; }
.wx-tip .btns { display: flex; gap: 8px; margin-top: 9px; }

/* 取餐方式选择 */
.method-row { display: flex; gap: 8px; }
.method-btn {
  flex: 1; padding: 11px 8px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #fafbfc; color: var(--ink-2); font-size: 14px; font-weight: 600; transition: .15s;
}
.method-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.method-btn:active { transform: scale(.98); }
.method-field .hint { color: var(--brand); font-weight: 600; }

/* 会员积分区（结算页） */
.member-box {
  background: linear-gradient(135deg, #fff7ed, #fffbf5); border: 1px solid #fed7aa;
  border-radius: 12px; padding: 11px 13px; margin-bottom: 12px;
}
.member-box .mt { font-weight: 700; color: #c2410c; font-size: 14px; }
.member-box .ms { font-size: 12.5px; color: #9a3412; margin-top: 3px; line-height: 1.6; }
.member-box .use {
  display: flex; align-items: center; gap: 8px; margin-top: 9px; padding-top: 9px;
  border-top: 1px dashed #fed7aa; font-size: 13.5px; color: #9a3412; cursor: pointer;
}
.member-box .use input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.member-box.on { background: linear-gradient(135deg, #f0fdf4, #f7fef9); border-color: #bbf7d0; }
.member-box.on .mt { color: #15803d; }
.member-box.on .ms, .member-box.on .use { color: #166534; }
.member-box.on .use { border-top-color: #bbf7d0; }

/* ICP 备案号页脚（合规要求，管理员填了才显示） */
.icp-bar {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  padding: 18px 12px calc(84px + env(safe-area-inset-bottom, 0px));
  line-height: 1.9;
}
.icp-bar a { color: var(--ink-3); text-decoration: none; border-bottom: 1px solid rgba(0,0,0,.12); }
.icp-bar a:active { color: var(--brand); }
