:root {
  --ink: #22302c;
  --paper: #ece5d6;
  --paper-2: #f7f2e6;
  --jade: #2f4f4a;
  --vermilion: #b4442e;
  --gold: #c8a75c;
  --muted: #6d6455;
  --line: #cfc6b3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #d8d0be;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  -webkit-text-size-adjust: 100%;
}

body { display: flex; justify-content: center; }

.app {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 18px 40px rgba(40,36,28,.14);
  position: relative;
  overflow-x: hidden;
}

/* ---------- 顶部 ---------- */
.topbar {
  background: var(--jade);
  color: #eee6d3;
  padding: 14px 16px 12px;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .06em; }
.brand .stall { font-size: 12px; opacity: .78; }
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 6px; margin-top: 10px;
  font-size: 11px; text-align: center;
  color: #ded5c2;
}
.stats b { display: block; font-size: 15px; color: #fff4dc; font-weight: 600; margin-top: 2px; }

/* ---------- 开摊 ---------- */
.intro { padding: 0; }
.intro.hide, .game.hide { display: none; }
.hero { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #1c2622; }
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 62%; }
.hero-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(18,28,24,.04) 0%, rgba(18,28,24,.16) 42%, rgba(18,28,24,.84) 100%);
}
.hero-copy { position: absolute; left: 20px; right: 20px; bottom: 18px; color: #fff8ea; }
.hero .eyebrow { color: #f2d9a9; border-left-color: #f2d9a9; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.hero h2 {
  color: #fff8ea; font-size: 31px; line-height: 1.25;
  margin: 10px 0 0; letter-spacing: .06em;
  text-shadow: 0 2px 14px rgba(0,0,0,.42);
}
.intro-body { padding: 20px 20px 40px; }
.eyebrow {
  font-size: 11px; letter-spacing: .22em; color: var(--vermilion);
  border-left: 3px solid var(--vermilion); padding-left: 8px;
}
.intro h2 { font-size: 30px; margin: 12px 0 6px; letter-spacing: .04em; }
.intro .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.intro p.lead { font-size: 15px; line-height: 1.95; text-indent: 2em; color: #33302a; }
.guide { margin: 18px 0 0; padding: 14px 16px; background: var(--paper-2); border: 1px solid var(--line); }
.guide li { font-size: 13px; line-height: 1.9; margin-left: -6px; color: #4b4539; }
.namebox { margin-top: 20px; display: flex; gap: 8px; }
.namebox input {
  flex: 1; border: 1px solid var(--line); background: #fffdf7;
  padding: 12px; font-size: 15px; font-family: inherit; color: var(--ink);
}
.btn {
  border: 0; background: var(--vermilion); color: #fff8ea;
  padding: 12px 18px; font-size: 15px; font-family: inherit;
  cursor: pointer; letter-spacing: .06em;
}
.btn:disabled { background: #b8b0a0; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--jade); color: var(--jade); }
.btn.primary { background: var(--jade); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--paper-2); position: sticky; top: 86px; z-index: 12; }
.tab {
  flex: 1; background: none; border: 0; padding: 12px 4px; font-family: inherit;
  font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--jade); border-bottom-color: var(--jade); font-weight: 600; }
.pane { display: none; padding: 14px 14px 26px; }
.pane.show { display: block; }

/* ---------- 摊位 ---------- */
.ctx-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; line-height: 1.7; }

.cust-box { background: var(--paper-2); border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; }
.cust-box.empty { color: var(--muted); }
.cust-box:not(.empty) { border-left: 4px solid var(--gold); }
.cust-who { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cust-ava { width: 34px; height: 34px; object-fit: cover; background: #d9d0bd; }
.cust-desc { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.cust-want { font-size: 14px; margin-bottom: 4px; }
.cust-offer { font-size: 13px; color: #4b4539; }
.cust-ops { display: flex; gap: 8px; margin-top: 12px; }
.cust-ops .btn { flex: 1; padding: 10px 4px; font-size: 14px; }

.row2 { display: flex; gap: 8px; margin-bottom: 12px; }
.row2 .btn { flex: 1; }

table.goods { width: 100%; border-collapse: collapse; font-size: 13px; background: #fbf7ec; }
table.goods th { background: var(--jade); color: #efe7d4; font-weight: 500; padding: 8px 4px; font-size: 12px; }
table.goods td { border-bottom: 1px solid var(--line); padding: 7px 4px; text-align: center; }
table.goods td.g-name { text-align: left; font-size: 12.5px; }
.price-in { width: 52px; padding: 5px; border: 1px solid var(--line); background: #fff; text-align: center; font-family: inherit; }
.mini { border: 1px solid var(--jade); background: transparent; color: var(--jade); font-family: inherit; font-size: 12px; padding: 5px 7px; cursor: pointer; }
.mini.primary { background: var(--jade); color: #f3ead6; }
.mini:disabled { border-color: #bbb2a1; color: #9c9484; cursor: not-allowed; }

.settle-bar { margin: 16px 0 4px; display: flex; gap: 8px; align-items: center; }
.settle-bar .btn { flex: 1; }

.log { margin-top: 16px; background: #fbf7ec; border: 1px solid var(--line); max-height: 200px; overflow: auto; }
.log-line { font-size: 12px; padding: 7px 10px; border-bottom: 1px dashed var(--line); line-height: 1.6; }
.log-line .t { color: #9a8f7a; margin-right: 8px; font-size: 11px; }
.log-line.good { color: #2f5d43; }
.log-line.bad { color: var(--vermilion); }

/* ---------- 点位 ---------- */
.point { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.point.done { background: linear-gradient(90deg, rgba(200,167,92,.14), transparent); }
.p-no { width: 30px; height: 30px; border-radius: 50%; background: var(--jade); color: #f1e8d6; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.point.done .p-no { background: var(--gold); color: #2b2418; }
.p-name { font-size: 15px; font-weight: 700; }
.p-loc { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.p-task { font-size: 12px; color: #4b4539; margin: 4px 0; line-height: 1.6; }
.p-prog { font-size: 11.5px; color: var(--muted); }
.p-prog .ok { color: #2f5d43; }
.p-prog .off { color: var(--vermilion); }
.p-note { font-size: 11.5px; color: #9a7f4e; margin-top: 4px; }
.p-op { align-self: center; }

/* ---------- 券 ---------- */
.coupon-card { background: var(--paper-2); border: 1px solid var(--line); padding: 12px; margin-bottom: 12px; }
.coupon-card.owned { border-color: var(--gold); background: #fdf8ea; }
.c-head { display: flex; justify-content: space-between; align-items: baseline; }
.c-type { font-size: 11px; color: var(--muted); }
.c-title { font-size: 13px; color: #4b4539; margin: 6px 0 10px; line-height: 1.7; }
.c-face { font-size: 14px; color: var(--vermilion); margin-bottom: 10px; }
.c-code { font-size: 26px; letter-spacing: .18em; font-variant-numeric: tabular-nums; color: var(--jade); font-weight: 700; }
.c-qr { margin: 10px 0; }
.c-qr svg { width: 132px; height: 132px; display: block; }
.c-hint { font-size: 11px; color: var(--muted); }

/* ---------- 商家 ---------- */
.merch { padding: 12px 0; border-bottom: 1px solid var(--line); }
.m-head { display: flex; justify-content: space-between; font-size: 14px; }
.m-head span { font-size: 11px; color: var(--muted); }
.m-role { font-size: 12px; color: var(--jade); margin-top: 4px; }
.m-task { font-size: 12px; color: #4b4539; margin-top: 4px; line-height: 1.6; }
.m-coupon { font-size: 12px; color: var(--vermilion); margin-top: 4px; }

/* ---------- 弹层 ---------- */
#receiptMask {
  position: fixed; inset: 0; background: rgba(24,20,14,.62);
  display: none; align-items: center; justify-content: center; padding: 18px; z-index: 60;
}
#receiptMask.show { display: flex; }
.receipt-wrap { width: 100%; max-width: 400px; background: #fff; }
#receiptImg img, #receiptImg canvas { display: block; width: 100%; }
.receipt-ops { display: flex; gap: 8px; padding: 10px; }
.receipt-ops .btn { flex: 1; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 26px; z-index: 70; pointer-events: none;
  opacity: 0; transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.toast-in {
  background: rgba(34,48,44,.95); color: #f6edd8; padding: 12px 16px;
  font-size: 13px; line-height: 1.7; max-width: 320px; border-left: 3px solid var(--gold);
}
small { color: #c9bd9f; }

@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats > div:nth-child(4), .stats > div:nth-child(5) { display: none; }
  .p-prog { font-size: 11px; }
}
