/* 小酒馆顾客端 PWA · LV 深棕金主题 */
:root {
  --bg: #f6f2ea;
  --card: #fff;
  --line: #ece5d8;
  --gold: #b8873f;
  --gold-d: #8a5f1d;
  --gold-l: #f4ead8;
  --green: #0f6e56;
  --green-d: #0c5844;
  --ink: #2a2318;
  --ink-2: #6c6559;
  --ink-3: #a09889;
  --danger: #b05b4a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.5;
  padding-bottom: calc(62px + var(--safe-b));
  overscroll-behavior-y: contain;
}
button { font-family: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
input { font-family: inherit; }
[hidden] { display: none !important; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) 16px 12px;
  background: linear-gradient(135deg, #2a2318, #3a2f1e);
  color: #fff; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), #d8a24a);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; color: #fff;
}
.brand-text { min-width: 0; }
.shop-name { font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-notice { font-size: 11px; color: #d8c9a8; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.icon-btn { font-size: 22px; color: #d8c9a8; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; }
.icon-btn:active { background: rgba(255,255,255,.12); }

/* 页面切换 */
.page { display: none; padding: 14px 14px 20px; }
.page.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.loading, .empty { text-align: center; color: var(--ink-3); padding: 40px 10px; font-size: 14px; }

/* 首页 */
.hero { padding: 18px 16px 22px; }
.hero-title { font-size: 26px; font-weight: 800; letter-spacing: 1px; color: var(--ink); }
.hero-sub { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 16px; text-align: left; box-shadow: 0 2px 10px rgba(42,35,24,.04);
  transition: transform .12s;
}
.entry-card:active { transform: scale(.97); }
.entry-card:nth-child(3) { grid-column: 1 / -1; }
.entry-ico {
  width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; margin-bottom: 12px;
}
.entry-ico.song { background: linear-gradient(135deg, var(--gold), #d8a24a); }
.entry-ico.food { background: linear-gradient(135deg, var(--green), #17a07c); }
.entry-ico.poker { background: linear-gradient(135deg, #3a3f4a, #22262e); }
.entry-label { font-size: 18px; font-weight: 700; }
.entry-desc { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.home-foot { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 22px; }

/* 页面头 */
.page-head { display: flex; align-items: center; gap: 10px; margin: 2px 2px 14px; }
.page-head h2 { font-size: 18px; margin: 0; flex: 1; }
.back-btn { color: var(--ink-2); font-size: 15px; padding: 4px 6px 4px 0; }
.text-btn { color: var(--gold-d); font-size: 13px; padding: 4px; }
.price-pill { font-size: 12px; color: var(--gold-d); background: var(--gold-l); padding: 4px 10px; border-radius: 20px; }

/* 搜索 */
.search-wrap { margin-bottom: 12px; }
.search-input {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 11px 14px; font-size: 14px; outline: none;
}
.search-input:focus { border-color: var(--gold); }

/* 歌曲列表 */
.song-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 160px; }
.song-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
}
.song-item.on { border-color: var(--gold); background: #fffdf8; box-shadow: 0 2px 12px rgba(184,135,63,.13); }
.song-idx { width: 26px; flex: 0 0 26px; text-align: center; color: var(--ink-3); font-size: 13px; }
.song-meta { flex: 1; min-width: 0; }
.song-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.tick {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 13px;
}
.song-item.on .tick { background: var(--gold); border-color: var(--gold); color: #fff; }

/* 结算栏：浮在底部导航(tabbar, 高 56px)之上，避免被 z-index 更高的导航盖住提交按钮 */
.checkout-bar, .cart-bar {
  position: fixed; left: 0; right: 0; bottom: calc(56px + var(--safe-b)); z-index: 30;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; backdrop-filter: blur(8px);
}
body:has(.tabbar) .checkout-bar, body:has(.tabbar) .cart-bar { bottom: calc(56px + var(--safe-b)); z-index: 30; }
.checkout-info { flex: 1; min-width: 0; }
.checkout-song { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checkout-amount, .cart-total { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.checkout-amount b, .cart-total b { font-size: 19px; color: var(--danger); margin-left: 6px; }
.primary-btn {
  background: var(--gold); color: #fff; border-radius: 12px;
  padding: 11px 20px; font-size: 15px; font-weight: 600; white-space: nowrap;
}
.primary-btn:active { background: var(--gold-d); }
.primary-btn[disabled] { background: #ded6c7; }
.primary-btn.wide { width: 100%; margin-top: 16px; padding: 13px; }

/* 点餐 */
.menu-layout { display: flex; gap: 10px; height: calc(100vh - 190px); min-height: 320px; }
.cat-list {
  width: 84px; flex: 0 0 84px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; overflow-y: auto; padding: 6px 0;
}
.cat-item { padding: 12px 6px; text-align: center; font-size: 13px; color: var(--ink-2); }
.cat-item.on { color: var(--gold-d); font-weight: 700; background: var(--gold-l); position: relative; }
.cat-item.on::before { content: ''; position: absolute; left: 0; top: 30%; height: 40%; width: 3px; background: var(--gold); border-radius: 2px; }
.prod-list { flex: 1; overflow-y: auto; padding-right: 2px; padding-bottom: 160px; }
.prod-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; margin-bottom: 9px; display: flex; gap: 10px;
}
.prod-img {
  width: 66px; height: 66px; flex: 0 0 66px; border-radius: 9px; background: var(--gold-l);
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--gold);
  object-fit: cover; overflow: hidden;
}
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
/* v2.89.0 售罄标记 */
.prod-card.sold-out { opacity: .62; }
.prod-img { position: relative; }
.soldout-tag { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 13px;
  display: flex; align-items: center; justify-content: center; border-radius: 9px; }
.soldout-text { font-size: 12px; color: var(--ink-3); }
.prod-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prod-name { font-size: 14px; font-weight: 600; }
.prod-price { color: var(--danger); font-weight: 700; font-size: 15px; margin-top: 3px; }
.prod-price small { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.stepper { align-self: flex-end; display: flex; align-items: center; gap: 10px; }
.step-btn { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold-d); font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.step-btn.minus { border-color: var(--line); color: var(--ink-3); }
.step-num { font-size: 14px; min-width: 14px; text-align: center; }
.cart-icon { position: relative; font-size: 24px; }
.cart-badge {
  position: absolute; top: -6px; right: -8px; background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

/* 订单 */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; padding: 9px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--ink-2); }
.tab.active { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; }
.order-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-no { font-size: 12px; color: var(--ink-3); }
.order-status { font-size: 12px; padding: 3px 9px; border-radius: 12px; background: var(--gold-l); color: var(--gold-d); }
.order-status.paid, .order-status.playing { background: #e4f2e9; color: var(--green); }
.order-status.cancelled { background: #f4e6e2; color: var(--danger); }
.order-main { font-size: 14px; }
.order-sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.order-amount { text-align: right; color: var(--danger); font-weight: 700; margin-top: 6px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(28,26,23,.6);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); width: 100%; max-width: 460px; border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(22px + var(--safe-b)); position: relative;
  max-height: 92vh; overflow-y: auto; animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.modal-close { position: absolute; right: 14px; top: 12px; font-size: 26px; color: var(--ink-3); line-height: 1; }
.modal-title { font-size: 17px; font-weight: 700; text-align: center; }
.pay-amount { text-align: center; font-size: 15px; color: var(--ink-2); margin: 10px 0 14px; }
.pay-amount span { font-size: 34px; font-weight: 800; color: var(--danger); }
.qr-box {
  width: 220px; height: 220px; margin: 0 auto; border: 1px solid var(--line);
  border-radius: 12px; background: #f7f3ec; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-missing { color: var(--ink-3); font-size: 13px; text-align: center; padding: 20px; line-height: 1.8; }
.pay-tip { text-align: center; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 16px; }
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field-row label { width: 40px; flex: 0 0 40px; font-size: 13px; color: var(--ink-2); }
.field-input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; outline: none; min-width: 0;
}
.field-input:focus { border-color: var(--gold); }
.field-input.locked { background: var(--bg-2, #f5f5f5); color: var(--ink-2); }
.pay-note { text-align: center; font-size: 11.5px; color: var(--ink-3); margin-top: 12px; }
.done-modal { text-align: center; }
.done-icon {
  width: 62px; height: 62px; border-radius: 50%; background: #e9f3e6; color: var(--green);
  font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 8px auto 14px;
}
.done-title { font-size: 19px; font-weight: 700; }
.done-desc { font-size: 13px; color: var(--ink-2); margin-top: 8px; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 16;
  height: calc(56px + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.98); border-top: 1px solid var(--line);
  display: flex; backdrop-filter: blur(8px);
}
.tabitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-3); gap: 2px;
}
.tabitem .ti { font-size: 20px; line-height: 1; }
.tabitem.active { color: var(--gold-d); font-weight: 600; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(10px);
  background: rgba(42,35,24,.94); color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 13px; z-index: 80; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
