:root {
  color-scheme: light dark;
  --bg: #f5f6f2;
  --surface: #fcfcf9;
  --surface-strong: #ffffff;
  --text: #24211f;
  --muted: #6d6a65;
  --line: #dedfd8;
  --accent: #d83a2f;
  --accent-strong: #b92b23;
  --accent-soft: #f8e6e2;
  --warning: #8a4e05;
  --warning-bg: #fff0cf;
  --radius: 14px;
  --shadow: 0 16px 44px rgba(63, 52, 42, 0.12);
  font-family: "Avenir Next", Avenir, "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-shell { width: min(100%, 760px); min-height: 100dvh; margin: 0 auto; background: var(--surface); padding-bottom: 112px; }

.site-header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  min-height: 70px; padding: 10px 18px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.brand-mark { font-size: 27px; font-weight: 850; letter-spacing: -.055em; }
.brand-mark b { color: var(--accent); font-size: 32px; }
.account { display: grid; justify-items: end; gap: 2px; font-size: 12px; color: var(--muted); }
.account strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 14px; }

main { padding: 0 18px; }
.intro { padding: 30px 0 20px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .08em; }
h1, h2 { margin: 0; letter-spacing: -.035em; line-height: 1.08; }
h1 { max-width: 12ch; font-size: clamp(30px, 8vw, 45px); }
h2 { font-size: 24px; }
.intro > p:last-child { max-width: 34em; margin: 12px 0 0; color: var(--muted); line-height: 1.6; }

.preview-note { display: flex; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 22px; padding: 12px 14px; border-radius: var(--radius); color: var(--warning); background: var(--warning-bg); font-size: 13px; line-height: 1.45; }
.preview-note strong { color: inherit; }
.preview-note span { color: color-mix(in srgb, var(--warning) 80%, var(--text)); }

.tools { position: sticky; top: 70px; z-index: 8; margin: 0 -18px; padding: 12px 18px 8px; background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(14px); }
.search-field input { width: 100%; min-height: 48px; padding: 0 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); color: var(--text); }
.search-field input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.category-nav { display: flex; gap: 7px; margin: 10px -18px 0; padding: 0 18px 5px; overflow-x: auto; scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }
.category-nav button { flex: 0 0 auto; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-strong); color: var(--muted); font-size: 13px; font-weight: 700; }
.category-nav button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fffaf7; }

.loading-grid { display: grid; gap: 14px; padding: 24px 0; }
.loading-grid span { height: 90px; border-radius: var(--radius); background: linear-gradient(100deg, var(--line) 20%, var(--surface-strong) 42%, var(--line) 64%); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position-x: -220%; } }
.category-section { padding: 20px 0 4px; scroll-margin-top: 180px; }
.category-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.category-heading h2 { font-size: 20px; }
.category-heading span { color: var(--muted); font-size: 12px; }
.product-list { display: grid; }
.product-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 94px; border-bottom: 1px solid var(--line); }
.product-copy { min-width: 0; padding: 15px 0; }
.product-copy h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.product-copy .cn { display: block; margin-bottom: 2px; font-size: 16px; }
.product-meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 12px; }
.price { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.quantity { display: grid; grid-template-columns: 40px 34px 40px; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-strong); overflow: hidden; }
.quantity button { width: 40px; height: 42px; border: 0; background: transparent; color: var(--accent); font-size: 23px; line-height: 1; }
.quantity button:disabled { color: color-mix(in srgb, var(--muted) 35%, transparent); }
.quantity output { text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.product-row.selected .quantity { border-color: var(--accent); background: var(--accent-soft); }
.product-row.unavailable { opacity: .68; }
.availability { color: var(--warning); font-weight: 750; }

.empty-state { margin: 35px 0; padding: 26px 20px; border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.empty-state p { margin: 7px auto 18px; max-width: 30em; color: var(--muted); line-height: 1.5; }
.access-error { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.secondary-button { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-strong); color: var(--text); font-weight: 700; }

.order-details { display: grid; gap: 17px; margin-top: 32px; padding: 24px 0 34px; }
.order-details label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.order-details input, .order-details textarea, .order-details select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-strong); color: var(--text); }
.order-details input, .order-details select { min-height: 48px; padding: 0 13px; }
.order-details textarea { padding: 12px 13px; resize: vertical; }

.cart-bar { position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%); display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; width: min(100%, 760px); padding: 13px max(18px, env(safe-area-inset-right)) max(13px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-strong) 96%, transparent); box-shadow: 0 -10px 30px rgba(45, 39, 34, .08); backdrop-filter: blur(15px); }
.cart-summary { display: grid; gap: 1px; min-width: 0; }
.cart-actions { display: flex; gap: 8px; }
.cart-bar span { color: var(--muted); font-size: 12px; }
.cart-bar strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.cart-bar button, .submit-button { min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--accent); color: #fffaf7; font-weight: 800; }
.cart-bar .save-button { padding-inline: 14px; border: 1px solid var(--line); background: var(--surface-strong); color: var(--text); }
.cart-bar button:disabled, .submit-button:disabled { background: color-mix(in srgb, var(--muted) 28%, var(--surface)); color: var(--muted); }
.save-status { margin: -4px 0 0; padding: 11px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; line-height: 1.45; }
.save-status.error { background: var(--warning-bg); color: var(--warning); }

dialog { width: min(calc(100% - 24px), 640px); max-height: calc(100dvh - 32px); margin: auto auto 0; padding: 0; border: 0; border-radius: 20px 20px 0 0; background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(22, 20, 18, .48); backdrop-filter: blur(3px); }
.review-sheet { padding: 22px 20px max(22px, env(safe-area-inset-bottom)); }
.review-sheet > header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.close-button { min-height: 40px; border: 0; background: transparent; color: var(--muted); font-weight: 750; }
.review-lines { max-height: 42dvh; margin: 20px 0; overflow: auto; }
.review-delivery { margin-top: 18px; padding: 11px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; font-weight: 750; line-height: 1.45; }
.review-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-line strong { display: block; font-size: 14px; }
.review-line span { color: var(--muted); font-size: 12px; }
.review-line b { align-self: center; font-variant-numeric: tabular-nums; }
.totals { display: grid; gap: 8px; margin: 0; }
.totals div { display: flex; justify-content: space-between; color: var(--muted); }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.totals .grand-total { margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text); font-size: 18px; font-weight: 850; }
.submit-note { margin: 18px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.submit-status { margin: 10px 0; padding: 11px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 13px; line-height: 1.45; }
.submit-status.error { background: var(--warning-bg); color: var(--warning); }
.submit-button { width: 100%; }

@media (min-width: 720px) {
  body { padding: 28px 0; }
  .app-shell { min-height: calc(100dvh - 56px); border: 1px solid var(--line); border-radius: 20px; overflow: clip; box-shadow: 0 20px 70px rgba(70, 63, 53, .1); }
  .cart-bar { bottom: 28px; border: 1px solid var(--line); border-radius: 0 0 20px 20px; }
  dialog { margin: auto; border-radius: 20px; }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #181918; --surface: #202220; --surface-strong: #282a27; --text: #f1f0ea; --muted: #aaa8a0; --line: #3b3e39; --accent: #ed6658; --accent-strong: #ff796a; --accent-soft: #482925; --warning: #f0bd6b; --warning-bg: #3d3120; --shadow: 0 18px 46px rgba(0, 0, 0, .35); }
}

:root[data-theme="dark"] { --bg: #181918; --surface: #202220; --surface-strong: #282a27; --text: #f1f0ea; --muted: #aaa8a0; --line: #3b3e39; --accent: #ed6658; --accent-strong: #ff796a; --accent-soft: #482925; --warning: #f0bd6b; --warning-bg: #3d3120; --shadow: 0 18px 46px rgba(0, 0, 0, .35); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
