:root {
  --ink: #241c14;
  --ink-2: #3a2f24;
  --gold: #c39b4e;
  --gold-deep: #8a6b2c;
  --cream: #f8f5ef;
  --card: #ffffff;
  --line: #f0ebe1;
  --muted: #8b8073;
  --muted-2: #b3a898;
  --danger: #b4441f;
  --ok: #4f6b38;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(36, 28, 20, .10);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #ece8e0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; padding: 0; }
input, textarea { outline: none; border: none; background: none; }
img { display: block; max-width: 100%; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--cream);
  position: relative;
  overflow-x: clip; /* 用 clip 而非 hidden：hidden 会让 .cats 的 sticky 失效 */
}

/* ---------- 店头 ---------- */
.hero {
  background: var(--ink);
  padding: 18px 16px 16px;
  color: #f7eedd;
}
.hero-row { display: flex; align-items: center; }
.logo {
  width: 64px; height: 64px; flex: 0 0 64px; position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 34%, #2e2318 0%, #171008 76%);
  border: 1px solid rgba(195, 155, 78, .85);
  box-shadow: inset 0 0 0 3px rgba(195, 155, 78, .12), 0 2px 10px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.logo::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  border: 1px solid rgba(195, 155, 78, .2); pointer-events: none;
}
.logo-cn {
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  font-size: 26px; font-weight: 700; line-height: 1; color: #ecd39a;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55); margin-top: 1px;
}
.logo-line {
  width: 15px; height: 1px; margin: 3px 0 3px;
  background: rgba(195, 155, 78, .55);
}
.logo-sub {
  font-size: 7px; letter-spacing: 1.2px; text-indent: 1.2px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  color: #b99a66;
}
.hero-main { margin-left: 13px; flex: 1; min-width: 0; }
.shop-name { font-size: 17px; font-weight: 600; color: #f7eedd; }
.shop-tag {
  margin-left: 7px; padding: 1px 6px; border-radius: 4px;
  background: rgba(195, 155, 78, .2); color: #e0c48a; font-size: 10px; vertical-align: 2px;
}
.shop-slogan { display: block; margin-top: 4px; font-size: 12px; color: #c9bda9; }
.shop-meta { display: block; margin-top: 3px; font-size: 11px; color: #9c9081; }
.notice {
  margin-top: 12px; padding: 7px 10px; border-radius: 8px;
  background: rgba(247, 238, 221, .08);
  font-size: 11px; color: #c9bda9; display: flex; gap: 6px;
}
.notice b { color: var(--gold); font-weight: 500; }

/* ---------- 取餐方式 ---------- */
.mode-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.mode-btn {
  padding: 5px 14px; border-radius: 8px; background: #f6f2ea;
  display: flex; flex-direction: column; align-items: flex-start;
}
.mode-btn .t { font-size: 13px; font-weight: 600; }
.mode-btn .s { font-size: 10px; color: var(--muted); margin-top: 1px; }
.mode-btn.on { background: var(--ink); }
.mode-btn.on .t { color: #f7eedd; }
.mode-btn.on .s { color: var(--gold); }
.mode-eta { margin-left: auto; text-align: right; }
.mode-eta .n { font-size: 13px; font-weight: 600; }
.mode-eta .l { font-size: 10px; color: var(--muted); display: block; }

/* ---------- 菜单 ---------- */
.menu-wrap { display: flex; align-items: flex-start; }
.cats {
  width: 88px; flex: 0 0 88px; background: #f2ece1;
  position: sticky; top: 62px; max-height: calc(100vh - 62px); min-height: calc(100vh - 62px);
  overflow-y: auto;
  padding-bottom: 120px;
}
.cat-item {
  display: block; width: 100%; text-align: left;
  padding: 14px 8px 14px 12px; border-left: 3px solid transparent;
  font-size: 12px; color: #7d7365; line-height: 1.3;
}
.cat-item.on { background: var(--cream); border-left-color: var(--gold); color: var(--ink); font-weight: 600; }

.goods { flex: 1; min-width: 0; padding: 0 12px 140px; }
.group-title {
  display: block; margin: 14px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink);
}
.goods-empty { padding: 60px 0; text-align: center; color: var(--muted-2); font-size: 12px; }

.good {
  display: flex; padding: 10px; margin-bottom: 8px;
  background: var(--card); border-radius: 12px;
}
.pic {
  width: 72px; height: 72px; flex: 0 0 72px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; overflow: hidden; position: relative;
}
.pic img { width: 100%; height: 100%; object-fit: cover; }
.sold-mask {
  position: absolute; inset: 0; background: rgba(36, 28, 20, .58);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
}
.good-main { margin-left: 10px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.good-title { display: flex; align-items: flex-start; gap: 5px; }
.good-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.good-tag {
  flex: 0 0 auto; padding: 1px 5px; border-radius: 3px; margin-top: 1px;
  background: #faf0dc; color: var(--gold-deep); font-size: 10px; white-space: nowrap;
}
.good-desc {
  margin-top: 3px; font-size: 11px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.good-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; }
.price { font-size: 15px; font-weight: 600; }
.price i { font-size: 11px; font-style: normal; font-weight: 600; margin-right: 1px; }

.ctrl { display: flex; align-items: center; gap: 7px; }
.ctrl .num { min-width: 18px; text-align: center; font-size: 13px; font-weight: 600; }
.mini {
  width: 27px; height: 27px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 16px; line-height: 1;
}
.mini.plus { background: var(--ink); color: #f7eedd; }
.mini.minus { background: #f2ece1; color: var(--ink); }
.mini.off { background: #efe9dd; color: #b3a898; }

/* ---------- 购物车条 ---------- */
.cartbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px;
  width: calc(min(480px, 100vw) - 24px);
  height: 56px; border-radius: 28px; background: var(--ink);
  box-shadow: 0 8px 24px rgba(36, 28, 20, .28);
  display: flex; align-items: center; padding: 0 8px 0 10px;
  z-index: 40;
}
.cartbar.hide { display: none; }
.cart-ico {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  background: var(--ink-2); display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.cart-ico b {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--gold); color: var(--ink);
  font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.cart-money { margin-left: 10px; flex: 1; display: flex; flex-direction: column; }
.cart-money .a { color: #f7eedd; font-size: 16px; font-weight: 600; }
.cart-money .h { color: #a1957f; font-size: 10px; }
.cart-go {
  height: 44px; padding: 0 22px; border-radius: 22px;
  background: var(--gold); color: var(--ink); font-size: 14px; font-weight: 600;
  display: flex; align-items: center;
}

/* ---------- 覆盖页 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60; background: var(--cream);
  max-width: 480px; margin: 0 auto; display: flex; flex-direction: column;
}
.sheet[hidden] { display: none; }
.sheet-head {
  display: flex; align-items: center; height: 50px; padding: 0 12px;
  background: #fff; border-bottom: 1px solid var(--line); flex: 0 0 50px;
  position: sticky; top: 0; z-index: 5;
}
.back { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.sheet-title { font-size: 15px; font-weight: 600; margin-left: 4px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 12px; padding-bottom: 90px; }

.card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.card-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .lnk { font-size: 11px; color: var(--muted); font-weight: 400; }

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid #efe9dd;
  background: #faf7f1; text-align: left;
}
.seg button .t { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.seg button .s { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.seg button.on { background: var(--ink); border-color: var(--ink); }
.seg button.on .t { color: #f7eedd; }
.seg button.on .s { color: var(--gold); }

.field { display: flex; align-items: center; padding: 11px 0; border-bottom: 1px solid #f5f1e9; }
.field:last-child { border-bottom: none; }
.field[hidden] { display: none; }
.pickup-addr { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.field label { width: 66px; flex: 0 0 66px; font-size: 13px; color: #5f5548; }
.field input, .field textarea {
  flex: 1; font-size: 13px; padding: 4px 0; color: var(--ink); min-width: 0;
}
.field textarea { resize: none; height: 44px; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }

.line { display: flex; align-items: center; padding: 9px 0; border-bottom: 1px solid #f7f4ee; }
.line:last-child { border-bottom: none; }
.line .pic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px; font-size: 18px; }
.line .nm { margin-left: 9px; flex: 1; font-size: 13px; min-width: 0; }
.line .nm small { display: block; color: var(--muted); font-size: 10px; }
.line .pr { font-size: 13px; font-weight: 600; margin-right: 8px; }

.fee { display: flex; justify-content: space-between; padding: 7px 0; font-size: 12px; color: var(--muted); }
.fee b { color: var(--ink); font-weight: 500; }
.fee.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; font-size: 14px; }
.fee.total b { font-size: 17px; font-weight: 600; }
.fee .cut { color: var(--danger); }

.paybar {
  position: sticky; bottom: 0; flex: 0 0 auto;
  display: flex; align-items: center; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.paybar .sum { flex: 1; font-size: 11px; color: var(--muted); }
.paybar .sum b { display: block; font-size: 19px; color: var(--ink); font-weight: 600; }
.paybar .go {
  height: 46px; padding: 0 30px; border-radius: 23px; background: var(--ink); color: #f7eedd;
  font-size: 15px; font-weight: 600; display: flex; align-items: center;
}
.paybar .go:disabled { background: #d8d1c5; color: #fff; }

/* ---------- 成功页 ---------- */
.done { padding: 26px 16px; text-align: center; }
.done-ico { display: flex; justify-content: center; }
.done-t { margin-top: 8px; font-size: 17px; font-weight: 600; }
.done-s { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pickup-no {
  margin: 18px auto 0; width: 132px; padding: 14px 0; border-radius: 12px;
  background: var(--ink); color: #f7eedd;
}
.pickup-no small { display: block; font-size: 10px; color: #a1957f; }
.pickup-no b { display: block; font-size: 30px; letter-spacing: 1px; color: var(--gold); }
.done-btns { display: flex; gap: 10px; margin-top: 20px; }
.done-btns button {
  flex: 1; height: 44px; border-radius: 22px; font-size: 14px; font-weight: 600;
}
.done-btns .ghost { background: #fff; border: 1px solid #e4dbcb; color: var(--ink); }
.done-btns .solid { background: var(--ink); color: #f7eedd; }

/* ---------- 订单列表 ---------- */
.order-card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.order-top { display: flex; align-items: center; justify-content: space-between; }
.order-time { font-size: 13px; font-weight: 600; }
.order-type {
  margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #f6f2ea;
  color: var(--muted); font-size: 10px;
}
.badge { padding: 2px 8px; border-radius: 5px; font-size: 11px; }
.badge.wait { background: #fbe6d6; color: var(--danger); }
.badge.live { background: #faf1dd; color: var(--gold-deep); }
.badge.done { background: #eaf0e3; color: var(--ok); }
.badge.cancel { background: #f1efe9; color: var(--muted-2); }
.order-items { margin-top: 8px; font-size: 12px; color: #5f5548; line-height: 1.5; }
.order-foot {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #f5f1e9;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: var(--muted-2);
}
.order-foot b { font-size: 15px; color: var(--ink); }
.empty { padding: 70px 0; text-align: center; color: var(--muted-2); }
.empty .ico { font-size: 40px; }
.empty p { margin: 8px 0 0; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(10px);
  background: rgba(36, 28, 20, .92); color: #fff; padding: 9px 16px; border-radius: 18px;
  font-size: 12px; opacity: 0; transition: .22s; pointer-events: none; z-index: 200;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 481px) {
  #app { box-shadow: 0 0 40px rgba(0, 0, 0, .08); min-height: 100vh; }
}
