:root {
  --bg: #f6f1ea; --panel: #fff; --ink: #2b211b; --muted: #8a7b70; --line: #e5dbd0;
  --brand: #3b2a20; --accent: #b86b2b; --ok: #2f7d4f; --warn: #c0392b; --soft: #f1e7dc;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); padding-bottom: 96px;
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

.top { background: var(--brand); color: #fff; padding: 18px 16px 14px; display: flex; align-items: center; gap: 12px; }
.top > div { flex: 1; min-width: 0; }
.mine-btn { flex-shrink: 0; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: #fff; border-radius: 20px; padding: 8px 14px; cursor: pointer; }
.mine-btn span { display: inline-block; margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); font-size: .8rem; }
.top h1 { margin: 0; font-size: 1.3rem; }
.where { margin: 4px 0 0; opacity: .85; }
.closed { margin: 16px; padding: 14px 16px; border-radius: 12px; background: #fdecea; color: var(--warn); font-weight: 700; }
.loading { text-align: center; color: var(--muted); padding: 40px 16px; }
.error { color: var(--warn); min-height: 1.2em; margin: 6px 0 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }

.cats { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a { flex: 0 0 auto; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: inherit; white-space: nowrap; }
.cats a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.menu { padding: 4px 12px; max-width: 720px; margin: 0 auto; }
.menu h2 { font-size: 1.05rem; margin: 20px 4px 8px; scroll-margin-top: 64px; }
.item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: pointer;
}
.item img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: var(--soft); }
.item .info { flex: 1; min-width: 0; }
.item .name { display: block; font-weight: 700; line-height: 1.3; }
.item .price { display: block; color: var(--accent); margin-top: 4px; font-size: .95rem; }
.item .plus { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.item[disabled] { opacity: .5; cursor: not-allowed; }
.item[disabled] .plus { background: var(--muted); font-size: .7rem; }

.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  max-width: 696px; margin: 0 auto; padding: 16px 20px; border: 0; border-radius: 16px;
  background: var(--accent); color: #fff; font-size: 1.05rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); cursor: pointer;
}
.cart-bar strong { font-size: 1.25rem; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 18px; min-height: 50px; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; flex: 1; }
.btn:disabled { opacity: .5; }

.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88dvh;
  border-radius: 20px 20px 0 0; color: var(--ink);
}
.sheet::backdrop { background: rgba(30,20,10,.45); }
.sheet form { padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 8px; font-size: 1.25rem; }
.sheet h3 { margin: 0 0 8px; font-size: .9rem; color: var(--muted); font-weight: 400; }
#item-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; margin-bottom: 12px; }
.field { margin: 14px 0; }
.field input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border-radius: 22px; border: 1px solid var(--line); cursor: pointer; }
.chip input { width: 20px; height: 20px; }
.qty-row { display: flex; justify-content: space-between; align-items: center; }
.qty-row h3 { margin: 0; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 1.2rem; cursor: pointer; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }

.cart { list-style: none; margin: 0; padding: 0; }
.cart li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart .n { font-weight: 600; }
.cart small { color: var(--muted); }
.sum { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; margin-top: 8px; }
.sum strong { font-size: 1.6rem; color: var(--brand); }

.done { max-width: 480px; margin: 24px auto; padding: 28px 20px; text-align: center; background: var(--panel); border-radius: 20px; }
.done-label { color: var(--muted); margin: 0; }
.done-no { font-size: 4.5rem; font-weight: 800; color: var(--brand); margin: 4px 0; letter-spacing: 2px; }
.done-status { font-size: 1.2rem; font-weight: 700; padding: 12px; border-radius: 12px; background: var(--soft); }
.done-status.ready { background: #e6f4ec; color: var(--ok); font-size: 1.5rem; }
.done-status.cancelled { background: #fdecea; color: var(--warn); }
.bill { text-align: left; margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; }
.bill h3 { margin: 0 0 8px; font-size: 1rem; }
.done-items { list-style: none; padding: 0; margin: 0; }
.done-items li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 1.05rem; }
.done-items .q { color: var(--muted); }
.done-items .a { font-weight: 700; min-width: 56px; text-align: right; }
.done-note { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff3e0; color: var(--accent); }
.bill-sum { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
.bill-sum span { color: var(--muted); }
.bill-sum strong { font-size: 1.6rem; color: var(--brand); }
.done-time { margin: 6px 0 0; color: var(--muted); font-size: .85rem; text-align: right; }
.done-actions { display: flex; gap: 10px; justify-content: center; }
.mine-list { list-style: none; margin: 0; padding: 0; }
.mine-list button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.mine-list .no { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.mine-list small { display: block; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 50; max-width: calc(100vw - 32px); }
.promo-bar { margin: 0; padding: 10px 16px; background: #fff3e0; color: #8a4b00; font-size: .95rem; border-bottom: 1px solid var(--line); }
.promo-bar a { color: var(--accent); font-weight: 700; white-space: nowrap; }
.done-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.stamp-line { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff3e0; color: #6b3a00; font-size: .95rem; line-height: 1.6; }
.stamp-line b { color: var(--accent); font-size: 1.1rem; }
.stamp-line a { color: var(--accent); font-weight: 700; white-space: nowrap; }
