:root {
  --brand: #f28e3a;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #ececec;
  --bg: #f7f4f0;
  --page-x: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  margin: 0;
  background: #fff;
}
html, body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
}
body {
  background: var(--bg);
  padding-top: var(--site-head-offset, 112px);
  padding-bottom: env(safe-area-inset-bottom);
}

.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(17, 24, 39, .06);
  transform: translateZ(0);
}
.site-head::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 100vh;
  background: #fff;
  pointer-events: none;
}
.topbar {
  display: flex;
  align-items: center;
  padding: 16px var(--page-x) 12px;
  background: #fff;
}
.store { font-size: 17px; font-weight: 800; line-height: 1.35; }
.table { margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--brand); line-height: 1.35; }
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px var(--page-x) 12px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  background: #f3f4f6;
  color: var(--ink);
}
.cat.is-on { background: var(--brand); color: #fff; }

.list { padding: 10px var(--page-x) calc(120px + env(safe-area-inset-bottom)); scroll-padding-top: 8px; }
.sec-title { margin: 16px 4px 8px; font-size: 16px; font-weight: 800; scroll-margin-top: calc(var(--site-head-offset, 112px) + 8px); }
.list section { scroll-margin-top: calc(var(--site-head-offset, 112px) + 8px); }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  text-align: left;
}
.item img {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
}
.item-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}
.item-price {
  flex: 0 0 auto;
  margin-right: 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}
.item-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  pointer-events: none;
}

.cart-bar {
  position: fixed;
  left: var(--page-x);
  right: var(--page-x);
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.sheet-mask { position: fixed; inset: 0; z-index: 30; background: rgba(17,24,39,.45); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-height: 86vh; overflow: auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0; background: #fff;
}
.sheet-handle { width: 40px; height: 4px; margin: 6px auto 12px; border-radius: 999px; background: #d1d5db; }
.sheet h2 { margin: 0 0 6px; font-size: 20px; }
.option-price { margin-bottom: 12px; font-weight: 800; color: var(--brand); }
.opt-group { margin-bottom: 14px; }
.opt-title { margin-bottom: 8px; font-size: 15px; font-weight: 800; }
.req { margin-left: 6px; color: #ef4444; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid #e5e7eb; border-radius: 14px; background: #fff;
  padding: 8px 12px; font-size: 14px; font-weight: 700;
}
.chip.is-on { border-color: var(--brand); background: #fff4ea; color: var(--brand); }
.remark-label { display: block; margin: 10px 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.remark-label input {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px;
}
.sheet-error { min-height: 20px; color: #ef4444; font-weight: 700; }
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.qty { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.qty button, .line-qty button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}
.btn-main, .btn-ghost {
  min-height: 46px; border: 0; border-radius: 14px; padding: 0 16px;
  font-size: 16px; font-weight: 800;
}
.btn-main { background: var(--brand); color: #fff; }
.btn-ghost { background: #f3f4f6; }
.btn-block { width: 100%; margin-top: 12px; }
body.cart-open {
  overflow: hidden;
  padding-top: 0;
}
.cart-page {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cart-page-head {
  flex-shrink: 0;
  padding: 12px var(--page-x) 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.cart-back {
  border: 0;
  border-radius: 12px;
  background: #f3f4f6;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.cart-page-head h2 {
  margin: 10px 0 0;
  font-size: 22px;
}
.cart-page-table {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
}
.cart-page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px var(--page-x) 16px;
}
.cart-page-foot {
  flex-shrink: 0;
  padding: 12px var(--page-x) calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 -4px 16px rgba(17, 24, 39, .06);
}
.cart-page-foot .btn-block { margin-top: 8px; }
.cart-empty { margin: 0; padding: 24px 0; text-align: center; color: var(--muted); font-weight: 700; }
.cart-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line-main { flex: 1; min-width: 0; }
.cart-line-name { display: block; font-size: 16px; }
.cart-line-opts { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.cart-line-remark {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--brand);
}
.cart-line-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.cart-line-price { font-weight: 800; white-space: nowrap; }
.cart-line-ops {
  display: flex;
  gap: 8px;
}
.cart-line-ops button {
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}
.cart-line-ops .is-remove { color: #c0392b; }
.item.is-sold-out {
  opacity: .55;
  cursor: not-allowed;
}
.item-sold {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  color: #c0392b;
}
.item.is-sold-out .item-add { display: none; }
.cart-total { margin-top: 0; font-size: 20px; font-weight: 800; text-align: right; }
.success { min-height: 100vh; padding: calc(80px + env(safe-area-inset-top)) 24px 24px; text-align: center; background: #fff; }
.success-kicker { color: var(--muted); font-weight: 700; }
.success-table { font-size: 20px; font-weight: 800; }
.success-no { margin: 8px 0; font-size: 64px; font-weight: 900; color: var(--brand); letter-spacing: 2px; }
.success-hint { color: var(--muted); }
.success-status {
  margin: 8px 0 0;
  font-size: 18px;
  font-weight: 800;
}
.success-status.is-ready { color: var(--brand); }
.success-lines {
  margin: 20px auto 0;
  max-width: 420px;
  text-align: left;
}
.success .btn-main { margin-top: 28px; min-width: 180px; }
.success .btn-ghost { margin-top: 12px; min-width: 180px; }
.blocked { padding: calc(80px + env(safe-area-inset-top)) 24px 24px; text-align: center; font-size: 18px; font-weight: 800; }

.voice-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 var(--page-x);
  pointer-events: none;
}
body.has-cart .voice-dock {
  bottom: calc(86px + env(safe-area-inset-bottom));
}
.voice-dock > * { pointer-events: auto; }
.voice-row {
  position: relative;
  width: min(420px, 100%);
  height: 56px;
}
.mic-bar {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(242, 142, 58, .35);
}
.mic-bar .mic-icon { flex: 0 0 auto; display: block; }
.mic-bar.recording {
  background: #f04438;
  animation: posMicPulse 1s ease-in-out infinite;
}
.mic-bar.busy { background: #667085; cursor: wait; }
.text-toggle {
  position: absolute;
  right: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  color: #4b5563;
  padding: 0;
}
.text-toggle svg { display: block; }
.text-toggle.is-open {
  border-color: var(--brand);
  background: #fff4ea;
  color: var(--brand);
}
.text-chat-panel {
  display: none;
  width: min(420px, 100%);
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, .12);
}
.text-chat-panel:not(.hidden) { display: flex; align-items: center; gap: 8px; }
.text-chat-panel input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
}
.text-chat-panel button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.pos-mic-hint {
  display: none;
  width: min(420px, 100%);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(17, 24, 39, .88);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.pos-mic-hint.show { display: block; }
.pos-toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%);
  box-sizing: border-box;
  max-width: 90vw;
  padding: 18px 18px 14px 44px;
  border-radius: 16px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  pointer-events: auto;
}
body.has-cart .pos-toast { bottom: calc(158px + env(safe-area-inset-bottom)); }
.pos-toast-text {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.pos-toast-close {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
@keyframes posMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 68, 56, .55); }
  50% { box-shadow: 0 0 0 10px rgba(240, 68, 56, 0); }
}
.tables { padding: 16px; }
.table-card {
  display: inline-block; width: 180px; margin: 8px; padding: 12px;
  border-radius: 16px; background: #fff; text-align: center;
}
.table-card img { width: 140px; height: 140px; }
.table-card b { display: block; margin-top: 8px; }
.table-card small { display: block; margin-top: 6px; word-break: break-all; font-size: 11px; color: var(--muted); }
