/* Barley Eat diner H5 — house style: deep purple system on a
   metallic-grey gloss ground, textured buttons, glass nameplates. */
:root {
  --purple: #5E35B1;
  --purple-deep: #4527A0;
  --purple-light: #EDE7F6;
  --gold: #9A7B00;
  --ink: #241b33;
  --muted: #6f6580;
  --line: #d9d2e8;
  --ok: #1e8e3e;
  --bad: #c62828;
  --card: #ffffff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #cfd0d6 0%, #e8e9ec 55%, #d7d8de 100%);
  min-height: 100vh;
}
#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #6a43c0, var(--purple) 60%, var(--purple-deep));
  color: #fff;
  box-shadow: 0 2px 8px rgba(38, 20, 84, .35);
}
#top-title { font-size: 17px; font-weight: 700; flex: 1; text-align: left; letter-spacing: .5px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn, .chip-btn {
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.14);
  color: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.icon-btn { width: 36px; height: 36px; padding: 0; font-size: 18px; line-height: 1; }
#view { padding: 12px 12px 96px; max-width: 640px; margin: 0 auto; }
.nameplate {
  display: inline-block;
  background: linear-gradient(180deg, rgba(94,53,177,.16), rgba(94,53,177,.30));
  border: 1px solid rgba(94,53,177,.35);
  color: var(--purple-deep);
  font-weight: 700; font-size: 15px;
  padding: 6px 14px; border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 1px 3px rgba(38,20,84,.18);
  margin: 10px 0 8px;
}
.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(36,27,51,.10), inset 0 1px 0 #fff;
  padding: 14px;
  margin-bottom: 12px;
}
.store-card { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.store-logo { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--purple-light); flex: none; }
.store-logo-fallback {
  width: 56px; height: 56px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #7e57c2, var(--purple-deep));
  color: #fff; font-size: 22px; font-weight: 700;
}
.store-meta { flex: 1; min-width: 0; }
.store-name { font-size: 16px; font-weight: 700; overflow-wrap: break-word; }
.store-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; margin-top: 5px; margin-right: 5px;
  background: var(--purple-light); color: var(--purple-deep);
}
.badge.ok { background: #e2f3e5; color: var(--ok); }
.badge.off { background: #f6e3e3; color: var(--bad); }
.cat-title { margin-top: 16px; }
.product {
  display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eee9f7;
}
.product:last-child { border-bottom: none; }
.product img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--purple-light); }
.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 15px; overflow-wrap: break-word; }
.product-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }
.price-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.price { color: var(--gold); font-weight: 700; font-size: 15px; }
.price-was { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stepper button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--purple-light));
  color: var(--purple-deep); font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 1px 2px rgba(38,20,84,.18);
}
.stepper .qty { min-width: 20px; text-align: center; font-weight: 700; }
.add-btn {
  margin-left: auto; border: none; cursor: pointer;
  background: linear-gradient(180deg, #7e57c2, var(--purple));
  color: #fff; font-weight: 700; font-size: 13.5px;
  padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 2px 5px rgba(38,20,84,.35), inset 0 1px 0 rgba(255,255,255,.4);
}
.add-btn:disabled { opacity: .45; box-shadow: none; }
#cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 25;
  max-width: 616px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, #54349e, var(--purple-deep));
  color: #fff; border-radius: 999px; padding: 10px 16px;
  box-shadow: 0 6px 18px rgba(38,20,84,.45);
  cursor: pointer;
}
#cart-bar .cb-total { font-weight: 800; font-size: 16px; }
#cart-bar .cb-go { margin-left: auto; font-weight: 700; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--purple-deep); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; font-size: 15px; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #f3f0fa; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  background: #fff; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(94,53,177,.22);
}
.primary-btn {
  width: 100%; border: none; cursor: pointer;
  background: linear-gradient(180deg, #7e57c2, var(--purple) 55%, var(--purple-deep));
  color: #fff; font-size: 16px; font-weight: 700;
  padding: 14px; border-radius: 12px;
  box-shadow: 0 4px 10px rgba(38,20,84,.35), inset 0 1px 0 rgba(255,255,255,.4);
}
.primary-btn:disabled { opacity: .5; }
.ghost-btn {
  border: 1.5px solid var(--purple); color: var(--purple-deep); background: #fff;
  font-weight: 700; font-size: 14px; padding: 10px 14px; border-radius: 10px; cursor: pointer; width: 100%;
}
.danger-btn {
  border: 1.5px solid var(--bad); color: var(--bad); background: #fff;
  font-weight: 700; font-size: 14px; padding: 10px 14px; border-radius: 10px; cursor: pointer; width: 100%;
}
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line); background: #f3f0fa; font-weight: 700; color: var(--muted); font-size: 14.5px;
}
.tabs button.on {
  background: linear-gradient(180deg, #7e57c2, var(--purple));
  color: #fff; border-color: var(--purple-deep);
}
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 11px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line); background: #f3f0fa; font-weight: 700; color: var(--muted); font-size: 14.5px;
}
.seg button.on { background: linear-gradient(180deg, #7e57c2, var(--purple)); color: #fff; border-color: var(--purple-deep); }
.money-row { display: flex; justify-content: space-between; font-size: 14.5px; padding: 4px 0; gap: 12px; }
.money-row .lbl { color: var(--muted); }
.money-row.disc .val { color: var(--ok); font-weight: 700; }
.money-row.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; font-size: 16.5px; font-weight: 800; }
.money-row.total .val { color: var(--gold); }
.pay-opt {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 9px;
  cursor: pointer; background: #fff;
}
.pay-opt.on { border-color: var(--purple); background: var(--purple-light); }
.pay-opt.disabled { opacity: .48; cursor: not-allowed; background: #f4f4f6; }
.pay-opt .po-name { font-weight: 700; font-size: 15px; }
.pay-opt .po-tag { margin-left: auto; font-size: 12px; color: var(--muted); }
.order-row { cursor: pointer; }
.order-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.order-store { font-weight: 700; font-size: 15.5px; }
.order-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status-chip {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; background: var(--purple-light); color: var(--purple-deep);
}
.status-chip.done { background: #e2f3e5; color: var(--ok); }
.status-chip.bad { background: #f6e3e3; color: var(--bad); }
.steps { display: flex; margin: 14px 0 4px; }
.step { flex: 1; text-align: center; position: relative; font-size: 11.5px; color: var(--muted); padding-top: 16px; }
.step::before {
  content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: #cfc8de; border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #cfc8de;
}
.step::after {
  content: ''; position: absolute; top: 9.5px; left: calc(-50% + 8px); right: calc(50% + 8px);
  height: 2px; background: #cfc8de;
}
.step:first-child::after { display: none; }
.step.hit { color: var(--purple-deep); font-weight: 700; }
.step.hit::before { background: var(--purple); box-shadow: 0 0 0 1.5px var(--purple); }
.step.hit::after { background: var(--purple); }
.pickup-code-box {
  text-align: center; padding: 18px 10px;
  background: linear-gradient(180deg, #f7f3ff, var(--purple-light));
  border: 1.5px dashed var(--purple); border-radius: 14px; margin: 10px 0;
}
.pickup-code { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--purple-deep); }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 42px 10px; font-size: 14.5px; }
#toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(30, 20, 55, .94); color: #fff; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; z-index: 60; max-width: 88vw; text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
#sheet-root .scrim {
  position: fixed; inset: 0; background: rgba(24, 14, 48, .5); z-index: 40;
}
#sheet-root .sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: #fff; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 82vh; overflow-y: auto; max-width: 640px; margin: 0 auto;
}
.opt-group { margin-bottom: 14px; }
.opt-group .og-name { font-weight: 700; font-size: 14.5px; margin-bottom: 7px; }
.opt-choice {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: 7px; font-size: 14.5px; cursor: pointer;
}
.opt-choice.on { border-color: var(--purple); background: var(--purple-light); }
.opt-choice .oc-price { margin-left: auto; color: var(--gold); font-weight: 700; }
.addr-item {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 9px; cursor: pointer; background: #fff;
}
.addr-item.on { border-color: var(--purple); background: var(--purple-light); }
.addr-item .a-name { font-weight: 700; font-size: 14.5px; }
.addr-item .a-line { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }
.row-flex { display: flex; gap: 10px; }
.row-flex > * { flex: 1; }

/* marketplace home: search + category rail + big cards (2026-11-17) */
.market-search {
  display: flex; align-items: center; gap: 8px;
  background: #f3f0fa; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 9px 14px; margin: 4px 0 10px;
}
.market-search:focus-within { background: #fff; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(94,53,177,.22); }
.market-search .ms-ico { font-size: 15px; flex: none; }
.market-search input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 15px; color: var(--ink);
}
.market-search .ms-clear {
  flex: none; border: none; cursor: pointer; width: 24px; height: 24px; border-radius: 50%;
  background: var(--purple-light); color: var(--purple-deep); font-size: 13px; line-height: 1;
}
.cat-rail {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cat-rail::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 72px; padding: 8px 6px 7px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 12px; background: #f3f0fa;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.cat-chip .cat-ico { font-size: 21px; line-height: 1.15; }
.cat-chip .cat-name { max-width: 88px; text-align: center; overflow-wrap: normal; word-break: keep-all; }
.cat-chip.on {
  background: linear-gradient(180deg, #7e57c2, var(--purple));
  color: #fff; border-color: var(--purple-deep);
  box-shadow: 0 2px 5px rgba(38,20,84,.30), inset 0 1px 0 rgba(255,255,255,.4);
}
.market-card { padding: 0; overflow: hidden; cursor: pointer; }
.mc-cover { position: relative; height: 148px; background: var(--purple-light); }
.mc-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mc-cover-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #7e57c2, var(--purple) 55%, var(--purple-deep));
}
.mc-cover-ico { font-size: 54px; filter: drop-shadow(0 3px 6px rgba(24,10,60,.45)); }
.mc-cat {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(255,255,255,.88); color: var(--purple-deep);
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.mc-body { padding: 12px 14px 13px; }
.mc-body .store-name { font-size: 17.5px; }
.mc-tags .badge { margin-top: 2px; }
.badge.promo { background: #fdf3d7; color: var(--gold); border: 1px solid #e8d48a; }

/* marketplace home v2: location row + category text tabs + filter
   chips + paused-card greying (2026-11-17, Uber-skeleton / Barley skin) */
.loc-row {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--purple-deep); font-weight: 600;
  padding: 1px 2px 9px;
}
.loc-row .loc-ico { font-size: 14px; }
.cat-tabs {
  display: flex; gap: 2px; overflow-x: auto;
  border-bottom: 1.5px solid var(--line);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  margin: 0 -2px 10px; padding: 0 2px;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none; border: none; background: transparent; cursor: pointer;
  font-size: 14.5px; font-weight: 600; color: var(--muted);
  padding: 8px 10px 9px; position: relative; white-space: nowrap;
}
.cat-tab.on { color: var(--purple-deep); font-weight: 800; }
.cat-tab.on::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: -1.5px;
  height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, #7e57c2, var(--purple-deep));
}
.filter-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 0 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.f-chip {
  flex: none; border: 1.5px solid var(--line); cursor: pointer;
  background: #f3f0fa; color: var(--purple-deep);
  font-size: 13px; font-weight: 700;
  padding: 7px 14px; border-radius: 999px;
}
.f-chip.on {
  background: linear-gradient(180deg, #7e57c2, var(--purple));
  color: #fff; border-color: var(--purple-deep);
  box-shadow: 0 2px 5px rgba(38,20,84,.30), inset 0 1px 0 rgba(255,255,255,.4);
}
.market-card.is-paused .mc-cover-img { filter: grayscale(.9); opacity: .6; }
.market-card.is-paused .mc-cover-fallback { filter: grayscale(.65); opacity: .75; }
.market-card.is-paused .mc-body { opacity: .68; }
.mc-paused-tag {
  position: absolute; left: 10px; top: 10px;
  background: rgba(140, 30, 30, .88); color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}

/* diner list: distance + ratings (2026-11-17) */
.store-rating { font-size: 12.5px; color: #9A7B00; margin: 3px 0 5px; font-weight: 600; }
.store-rating.none { color: var(--muted); font-weight: 400; }
.badge.dist { background: #e8e4f5; color: #4527A0; }
.rate-card .store-sub { margin-bottom: 6px; font-size: 13px; }
.rate-stars { display: flex; gap: 4px; }
.rate-star { background: none; border: none; font-size: 28px; line-height: 1.1; color: #9A7B00; cursor: pointer; padding: 2px 3px; }
.rate-star:disabled { cursor: default; }

/* marketplace home v3: two-column grid cards, square 1:1 covers
   (2026-11-17, Ocean). The list becomes a 2-up grid; cards slim down:
   square cover, one-line name, rating + distance on one meta row,
   at most two tags, no address line (store page carries it). */
#market-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
#market-list .empty { grid-column: 1 / -1; }
#market-list .market-card { margin-bottom: 0; }
.mc-cover { height: auto; aspect-ratio: 1 / 1; }
.mc-cover-ico { font-size: 44px; }
.mc-cat { right: 8px; bottom: 8px; font-size: 11px; padding: 2px 8px; }
.mc-paused-tag { left: 8px; top: 8px; font-size: 11px; padding: 2px 8px; }
.mc-body { padding: 8px 10px 10px; }
.mc-body .store-name {
  font-size: 15px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.mc-meta { display: flex; align-items: baseline; gap: 6px; }
.mc-meta .store-rating {
  margin: 3px 0 5px; flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-meta-dist { flex: none; font-size: 12px; font-weight: 700; color: var(--purple-deep); }
.mc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.mc-tags .badge { margin: 0; font-size: 10.5px; padding: 2px 7px; }
