:root {
  --bg: #f3efe6;
  --ink: #1c1915;
  --muted: #5f584e;
  --line: #e3d8c6;
  --card: #fffdf8;
  --jade: #0e6b52;
  --jade-deep: #083e30;
  --jade-soft: #e7f4ee;
  --warn-bg: #fff6df;
  --warn-ink: #6d5014;
  --bad: #8d341f;
  --bad-soft: #fdece7;
  --shadow: 0 12px 30px rgba(48, 36, 16, 0.06);
  --radius: 18px;
  --font: "PingFang HK", "PingFang TC", "Hiragino Sans CNS", "Noto Sans CJK TC", "WenQuanYi Micro Hei", "Microsoft JhengHei", "Heiti TC", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 320px at -10% -10%, #e5f3eb 0%, transparent 55%),
    radial-gradient(700px 280px at 110% 0%, #f8e6d6 0%, transparent 50%),
    var(--bg);
  line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--jade-deep); }
img { max-width: 100%; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
.boot { padding: 32px 20px; }

.sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 239, 230, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 12px 0 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}
.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--jade);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand strong { display: block; font-size: 18px; line-height: 1.15; }
.brand small { color: var(--muted); font-size: 12px; }

.role { display: flex; flex-direction: column; gap: 2px; }
.role-label { font-size: 11px; color: var(--muted); }
.segment { display: flex; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px; }
.segment button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.segment button.is-on { background: var(--jade); color: white; }

.mainnav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mainnav a, .tabnav a, .btn, .choice {
  text-decoration: none;
}
.mainnav a, .ghost {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
}
.mainnav a.is-on, .ghost.is-on { background: var(--jade-soft); color: var(--jade-deep); }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 1.3em;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--jade);
  color: white;
  font-size: 12px;
}

.disclaimer {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto 10px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid #efd7a4;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
}
.disclaimer strong { font-weight: 700; }
.disclaimer span { display: inline; }
.persist-warn { display: block; margin-top: 4px; }

.page {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 48px;
  flex: 1;
}
.page-head { margin: 4px 0 16px; }
.kicker {
  margin: 0 0 4px;
  color: var(--jade-deep);
  font-size: 12px;
  letter-spacing: 0.08em;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 32px; line-height: 1.2; margin-bottom: 8px; }
h2 { font-size: 22px; margin-bottom: 8px; }
.lede { color: var(--muted); max-width: 68ch; }

.flash {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.flash-ok { background: var(--jade-soft); color: var(--jade-deep); }
.flash-warn { background: var(--warn-bg); color: var(--warn-ink); }
.flash-bad { background: var(--bad-soft); color: var(--bad); }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
}

.grid-shops, .product-grid, .split, .choice-grid {
  display: grid;
  gap: 14px;
}
.grid-shops { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { grid-template-columns: 1fr; }

.shop-card, .product-card, .panel, .receipt, .order, .gate {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.shop-card {
  overflow: hidden;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
a.shop-card { text-decoration: none; }
.shop-card .strip { height: 8px; background: var(--accent, var(--jade)); }
.shop-card .body, .product-card, .panel, .order, .gate { padding: 14px 14px 16px; }
.panel, .unplugged, .gate, .receipt { margin-bottom: 14px; }
.tight-top { padding-top: 0; }
.spaced { margin-top: 16px; }
.plain-set { border: 0; padding: 0; margin: 0 0 12px; }
label.choice { flex-direction: row; align-items: center; justify-content: flex-start; }
input[type="radio"] { width: auto; margin: 0 8px 0 0; }
.shop-card h2, .product-card h3 { margin-bottom: 4px; overflow-wrap: anywhere; }
.shop-card p, .product-card p { margin-bottom: 8px; }
.meta { color: var(--muted); font-size: 13px; }
.stall {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.is-selected { outline: 2px solid var(--jade); }

.theme-tea { --accent: #9a3e24; --accent-2: #6e2a18; --accent-soft: #f8ece6; }
.theme-plain { --accent: #314155; --accent-2: #1c2836; --accent-soft: #e8eef3; }
.theme-leaf { --accent: #0e6b52; --accent-2: #084838; --accent-soft: #e6f4ee; }
.theme-clay { --accent: #8d5b2a; --accent-2: #5e3b16; --accent-soft: #f8efdf; }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 26px 22px 20px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: white;
  margin-bottom: 16px;
}
.hero h1, .hero p { position: relative; }
.hero p { max-width: 46ch; margin-bottom: 0; }
.pills { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pill {
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.tile {
  height: 92px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft, var(--jade-soft));
  color: var(--accent, var(--jade-deep));
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
}
.price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.product-card { display: flex; flex-direction: column; }
.product-card .btn { margin-top: auto; }

.btn, .choice {
  appearance: none;
  border: 1px solid transparent;
  background: var(--jade);
  color: white;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}
.btn.secondary, .choice {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}
.btn.warn { background: transparent; color: var(--bad); border-color: #efc7be; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.small, .choice { padding: 8px 12px; font-weight: 600; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.section-title { margin: 22px 0 10px; }

.unplugged {
  background: repeating-linear-gradient(-45deg, #f7f4ee, #f7f4ee 8px, #f3eee6 8px, #f3eee6 16px);
  border: 1px dashed #c3b7a4;
  border-radius: 16px;
  padding: 14px;
  margin: 12px 0;
}
.unplugged h2, .unplugged h3 { margin-bottom: 4px; }
.stamp {
  display: inline-flex;
  align-items: center;
  border: 1px dashed currentColor;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  margin-left: 6px;
}

.choice-grid { grid-template-columns: 1fr; }
.choice { width: 100%; min-width: 0; border-radius: 14px; flex-direction: column; align-items: flex-start; text-align: left; }
.choice small { color: var(--muted); font-weight: 500; }
.choice.is-on { border-color: var(--jade); background: var(--jade-soft); color: var(--jade-deep); }
.choice.is-on small { color: var(--jade-deep); }

label { display: block; font-size: 14px; margin-bottom: 10px; }
input, select, textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
}
textarea { min-height: 72px; resize: vertical; }
.form-row { display: grid; gap: 0 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.tabnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabnav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
}
.tabnav a.is-on { background: var(--ink); color: white; }

.scope {
  border-left: 4px solid var(--accent, var(--jade));
  background: var(--accent-soft, var(--jade-soft));
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.line, .stock-row, .order {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.line, .stock-row {
  grid-template-columns: 1fr;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
}
.subtotal { display: flex; justify-content: space-between; font-weight: 700; }

.receipt { max-width: 520px; margin: 0 auto; padding: 8px 18px 22px; border-top: 8px solid var(--jade); }
.receipt h1 { font-size: 26px; }
.receipt dl { display: grid; grid-template-columns: 7em 1fr; gap: 4px 8px; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; }

.footer {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 8px 0 28px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
}
.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--jade-deep);
  cursor: pointer;
  text-decoration: underline;
}

.bottomnav { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:focus-visible { outline: 3px solid var(--jade); outline-offset: 2px; }

@media (min-width: 720px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-row { grid-template-columns: 1.4fr 0.6fr 0.6fr; }
  .line { grid-template-columns: 1.4fr 0.8fr auto auto; }
  .stock-row { grid-template-columns: 1.4fr 0.8fr auto; }
  h1 { font-size: 40px; }
}

@media (min-width: 980px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .split { grid-template-columns: 1.1fr 0.9fr; align-items: start; }
}

@media (max-width: 699px) {
  .mainnav { display: none; }
  .bottomnav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: #fffdf8;
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a, .bottomnav button {
    background: none;
    border: 0;
    padding: 8px 4px;
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
  }
  .bottomnav .is-on { color: var(--jade-deep); font-weight: 700; }
  .page { padding-bottom: 88px; }
  .footer { padding-bottom: 92px; }
  h1 { font-size: 28px; }
  .disclaimer span { display: block; }
}

.feature-split { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 8px 0 18px; }
.feature {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 168px;
  border-radius: 22px;
  padding: 18px;
  color: white;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.feature strong { font-size: 28px; line-height: 1.2; }
.feature span { opacity: 0.9; }
.feature.retail { background: linear-gradient(145deg, #314155, #1b2836); }
.feature.food { background: linear-gradient(145deg, #9a3e24, #6e2a18); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
}
.chip.is-on { background: var(--ink); color: white; border-color: var(--ink); }
.shop-banner {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 196px;
  padding: 22px;
  margin-bottom: 12px;
}
.shop-banner.has-photo { color: white; }
.banner-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shop-id { position: relative; display: flex; gap: 14px; align-items: center; }
.shop-banner.has-photo .shop-id { background: rgba(20, 16, 12, 0.55); border-radius: 16px; padding: 12px; }
.banner-paper { background: linear-gradient(120deg, #f6efe4, #e4d0ae); color: #1c1915; }
.banner-ink { background: linear-gradient(145deg, #243044, #121820); color: white; }
.banner-leaf { background: linear-gradient(145deg, #0e6b52, #0a4a39); color: white; }
.banner-clay { background: linear-gradient(145deg, #9a3e24, #6e2a18); color: white; }
.banner-night { background: linear-gradient(145deg, #1c1a17, #3d3830); color: white; }
.avatar, .avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}
.avatar {
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.55);
  font-size: 30px;
  font-weight: 700;
}
.avatar.square, .avatar.square img { border-radius: 16px; }
.avatar.soft, .avatar.soft img { border-radius: 42% 42% 28% 48%; }
.shopnav, .filters { display: flex; flex-wrap: wrap; gap: 8px; }
.shopnav { margin: 0 0 14px; }
.promo-strip {
  border: 1px dashed #c3b7a4;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(255,253,248,0.7);
}
.promo-strip img { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: white;
}
.badge-off { color: var(--bad); border-color: #efc7be; background: var(--bad-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.kind-retail { box-shadow: inset 8px 0 0 #314155; }
.kind-restaurant { box-shadow: inset 8px 0 0 #9a3e24; }

@media (min-width: 720px) {
  .feature-split { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
