:root {
  --paper: #f6f1e7;
  --paper-deep: #eee5d5;
  --card: #fffdf8;
  --ink: #2d2b27;
  --muted: #756f65;
  --green: #3d5b47;
  --green-soft: #e7eee9;
  --cinnabar: #9a3932;
  --bronze: #8f6c3e;
  --line: rgba(61, 55, 45, .12);
  --shadow: 0 18px 48px rgba(56, 48, 38, .16);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #e9e4da;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.65), transparent 30%),
    linear-gradient(135deg, #e9e4da, #dcd6cb);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
.desktop-note {
  position: fixed;
  left: 38px;
  top: 48px;
  width: 270px;
  display: flex;
  gap: 14px;
  color: #5e584f;
  line-height: 1.55;
}
.desktop-note .note-mark {
  width: 54px; height: 54px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--cinnabar);
  color: white;
  font-family: "Noto Serif SC", serif;
  font-size: 28px;
}
.desktop-note strong { color: #3e3a34; }
.desktop-note p { font-size: 13px; margin: 5px 0 8px; }
.desktop-note a { color: var(--green); text-decoration: none; font-weight: 700; }
.desktop-note code { font-size: 12px; background: rgba(255,255,255,.55); padding: 1px 4px; border-radius: 4px; }
.phone-shell {
  position: relative;
  width: min(430px, 100%);
  height: min(880px, calc(100vh - 36px));
  min-height: 680px;
  overflow: hidden;
  background: var(--paper);
  border: 10px solid #252421;
  border-radius: 42px;
  box-shadow: 0 28px 80px rgba(34, 31, 27, .28);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}
.phone-shell::before {
  content: "";
  position: absolute;
  z-index: 30;
  top: 6px; left: 50%; transform: translateX(-50%);
  width: 112px; height: 24px;
  border-radius: 0 0 14px 14px;
  background: #252421;
  pointer-events: none;
}
.app-header {
  height: 82px;
  padding: 23px 16px 10px;
  background: rgba(246,241,231,.96);
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand { display: flex; justify-content: center; align-items: center; gap: 9px; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand div { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-family: "Noto Serif SC", "Songti SC", serif; font-size: 18px; letter-spacing: .15em; white-space: nowrap; }
.brand span { color: var(--muted); font-size: 10px; margin-top: 1px; white-space: nowrap; }
.icon-button { border: 0; background: transparent; font-size: 29px; color: var(--ink); padding: 0; width: 42px; height: 42px; border-radius: 50%; }
.icon-button:active { background: rgba(61,91,71,.08); }
.announcement { padding: 8px 16px; font-size: 12px; color: #6f5a36; background: #efe3c9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-view { overflow-y: auto; overscroll-behavior: contain; padding-bottom: max(22px, env(safe-area-inset-bottom)); scrollbar-width: none; }
.app-view::-webkit-scrollbar { display: none; }
.tabbar { height: calc(66px + env(safe-area-inset-bottom)); background: rgba(255,253,248,.98); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: max(4px, env(safe-area-inset-bottom)); z-index: 8; }
.tabbar button { position: relative; border: 0; background: transparent; color: #8b857c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 11px; }
.tabbar img { width: 25px; height: 25px; object-fit: contain; opacity: .72; }
.tabbar button.active { color: var(--green); font-weight: 700; }
.tabbar button.active img { opacity: 1; filter: saturate(1.4); }
.cart-tab em { position: absolute; top: 8px; right: 25px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--cinnabar); font-size: 10px; font-style: normal; border: 2px solid white; }
.hidden { display: none !important; }
.loading { min-height: 480px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.loading span { width: 28px; height: 28px; border: 3px solid rgba(61,91,71,.15); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.loading p { font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero { padding: 14px 14px 6px; }
.hero img { width: 100%; display: block; border-radius: 18px; box-shadow: 0 10px 24px rgba(65,54,38,.12); aspect-ratio: 2.08/1; object-fit: cover; }
.section { padding: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-family: "Noto Serif SC", "Songti SC", serif; font-size: 20px; letter-spacing: .04em; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.link-button { border: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 700; }
.category-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.category-card { border: 0; background: transparent; padding: 0; color: var(--ink); }
.category-card img { width: 100%; aspect-ratio: 1; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); }
.category-card span { display: block; margin-top: 6px; font-size: 13px; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-card { border: 0; padding: 0 0 12px; overflow: hidden; background: var(--card); border-radius: 17px; text-align: left; color: var(--ink); box-shadow: 0 8px 22px rgba(57,50,40,.08); }
.product-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.product-card .body { padding: 10px 11px 0; }
.product-card h3 { font-size: 14px; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card p { font-size: 11px; color: var(--muted); margin: 0; height: 32px; line-height: 1.45; overflow: hidden; }
.product-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.price { color: var(--cinnabar); font-weight: 800; }
.price small { font-size: 10px; }
.sales { font-size: 10px; color: #999188; }
.badge { display: inline-flex; font-size: 10px; color: var(--green); background: var(--green-soft); padding: 2px 6px; border-radius: 8px; margin-bottom: 5px; }

.search-panel { padding: 14px; }
.search-box { display: flex; gap: 8px; }
.search-box input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--line); border-radius: 14px; background: white; padding: 0 14px; outline: none; }
.search-box input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(61,91,71,.08); }
.primary, .secondary, .danger { border: 0; border-radius: 13px; padding: 11px 16px; font-weight: 700; }
.primary { background: var(--green); color: white; }
.secondary { background: var(--green-soft); color: var(--green); }
.danger { background: #f7e9e6; color: var(--cinnabar); }

.category-layout { padding: 14px; }
.category-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.category-chips button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 8px 15px; border-radius: 18px; }
.category-chips button.active { color: white; background: var(--green); border-color: var(--green); }

.detail-cover { width: 100%; aspect-ratio: 1.2; object-fit: cover; display: block; }
.detail-body { position: relative; margin-top: -18px; background: var(--paper); border-radius: 22px 22px 0 0; padding: 22px 16px 110px; min-height: 360px; }
.detail-body h1 { margin: 5px 0 7px; font-family: "Noto Serif SC", serif; font-size: 23px; }
.detail-subtitle { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
.detail-price { color: var(--cinnabar); font-size: 26px; font-weight: 800; margin-bottom: 18px; }
.detail-price del { font-size: 13px; color: #a8a096; margin-left: 8px; font-weight: 400; }
.sku-title, .detail-description h3 { font-size: 14px; margin: 18px 0 10px; }
.sku-list { display: flex; flex-wrap: wrap; gap: 9px; }
.sku-list button { border: 1px solid var(--line); border-radius: 10px; background: white; padding: 8px 12px; color: var(--ink); }
.sku-list button.active { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.detail-description ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.detail-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; padding: 12px 14px; background: rgba(255,253,248,.97); border-top: 1px solid var(--line); margin: 0 -16px -110px; transform: translateY(110px); }

.empty { min-height: 390px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty .seal { width: 70px; height: 70px; display: grid; place-items: center; background: var(--cinnabar); color: white; border-radius: 14px; font-family: "Noto Serif SC", serif; font-size: 32px; margin-bottom: 14px; }
.empty h3 { color: var(--ink); margin: 0 0 8px; }
.empty p { margin: 0 0 18px; font-size: 13px; line-height: 1.7; }

.cart-list { padding: 12px 14px 120px; }
.cart-item { display: grid; grid-template-columns: 88px 1fr; gap: 12px; background: var(--card); border-radius: 16px; padding: 10px; margin-bottom: 10px; box-shadow: 0 7px 20px rgba(57,50,40,.06); }
.cart-item > img { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; }
.cart-item h3 { margin: 2px 0 5px; font-size: 14px; }
.cart-item .sku { color: var(--muted); font-size: 11px; }
.cart-item-warning { color: var(--cinnabar); font-size: 10px; line-height: 1.45; margin-top: 4px; }
.cart-item .line-bottom { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; }
.quantity { display: flex; align-items: center; gap: 8px; }
.quantity button { border: 0; background: var(--green-soft); color: var(--green); width: 27px; height: 27px; border-radius: 50%; font-weight: 800; }
.remove-link { border: 0; background: transparent; color: #9a8f82; font-size: 11px; margin-left: 6px; }
.cart-summary { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; background: rgba(255,253,248,.98); border-top: 1px solid var(--line); padding: 12px 14px; margin: 0 -14px -120px; transform: translateY(120px); }
.cart-summary p { margin: 0; font-size: 12px; color: var(--muted); }
.cart-summary strong { font-size: 20px; color: var(--cinnabar); }

.checkout { padding: 14px 14px 30px; }
.panel { background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: 0 7px 20px rgba(57,50,40,.06); }
.panel h3 { font-size: 14px; margin: 0 0 10px; }
.address-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.address-card strong { font-size: 14px; }
.address-card p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 5px 0 0; }
.checkout-line { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0; font-size: 13px; }
.checkout-line.total { font-size: 16px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.checkout textarea { width: 100%; min-height: 72px; resize: none; border: 1px solid var(--line); background: white; border-radius: 11px; padding: 10px; outline: none; }
.checkout .submit { width: 100%; height: 48px; font-size: 16px; }
.checkout-alert { border: 1px solid rgba(154,57,50,.24); background: #fff8f5; }
.checkout-alert h3 { color: var(--cinnabar); }
.checkout-alert ul { margin: 0 0 12px; padding-left: 20px; color: #76524d; font-size: 12px; line-height: 1.65; }
.checkout-notice { margin: -2px 2px 12px; padding: 9px 11px; border-radius: 10px; background: #efe3c9; color: #6f5a36; font-size: 12px; line-height: 1.55; }
.mini-order-item { display: grid; grid-template-columns: 58px 1fr auto; gap: 9px; align-items: center; margin: 10px 0; }
.mini-order-item img { width: 58px; height: 58px; object-fit: cover; border-radius: 9px; }
.mini-order-item h4 { margin: 0 0 4px; font-size: 13px; }
.mini-order-item p { margin: 0; font-size: 11px; color: var(--muted); }
.mini-order-item.invalid { opacity: .72; }
.mini-order-item .checkout-item-error { color: var(--cinnabar); margin-top: 4px; line-height: 1.4; }
.detail-order-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }

.profile { padding-bottom: 24px; }
.profile-hero { margin: 14px; padding: 22px 18px; border-radius: 20px; color: white; background: linear-gradient(135deg, #3d5b47, #66806d); display: flex; gap: 14px; align-items: center; box-shadow: 0 12px 28px rgba(61,91,71,.23); }
.profile-hero img { width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); }
.profile-hero h2 { margin: 0 0 4px; font-family: "Noto Serif SC", serif; }
.profile-hero p { margin: 0; font-size: 12px; opacity: .8; }
.order-shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.order-shortcuts button { border: 0; background: transparent; padding: 9px 0; color: var(--ink); font-size: 11px; }
.order-shortcuts b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green-soft); color: var(--green); margin: 0 auto 7px; font-size: 15px; }
.menu-list button { width: 100%; border: 0; background: transparent; display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); color: var(--ink); }
.menu-list button:last-child { border-bottom: 0; }

.order-page { padding: 12px 14px 30px; }
.order-filter { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
.order-filter button { flex: 0 0 auto; border: 0; background: var(--card); padding: 7px 12px; border-radius: 16px; color: var(--muted); }
.order-filter button.active { background: var(--green); color: white; }
.order-card { background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 11px; box-shadow: 0 7px 20px rgba(57,50,40,.06); }
.order-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 10px; }
.order-head strong { color: var(--green); }
.order-total { text-align: right; font-size: 13px; margin-top: 10px; }
.order-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.order-actions button { padding: 7px 11px; border-radius: 10px; font-size: 11px; }

.form-panel label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.form-panel input { width: 100%; margin-top: 5px; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; background: white; outline: none; }
.form-panel .row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(70px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: min(320px, calc(100vw - 28px)); padding: 10px 15px; background: rgba(35,33,30,.9); color: white; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); }
.dialog-mask { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(31,29,26,.48); padding: 20px; }
.dialog { width: min(330px, 100%); padding: 22px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.dialog h3 { margin: 0 0 10px; font-family: "Noto Serif SC", serif; }
.dialog p { color: var(--muted); line-height: 1.6; font-size: 13px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

@media (max-width: 820px) {
  body { padding: 0; display: block; background: var(--paper); }
  .desktop-note { display: none; }
  .phone-shell { width: 100%; height: 100vh; height: 100dvh; min-height: 560px; border: 0; border-radius: 0; box-shadow: none; }
  .phone-shell::before { display: none; }
  .app-header { padding-top: max(10px, env(safe-area-inset-top)); height: calc(66px + env(safe-area-inset-top)); }
}

@media (max-width: 360px) {
  .app-header { grid-template-columns: 36px minmax(0, 1fr) 36px; padding-left: 8px; padding-right: 8px; }
  .icon-button { width: 36px; height: 36px; }
  .brand { gap: 6px; }
  .brand img { width: 34px; height: 34px; }
  .brand strong { font-size: 16px; letter-spacing: .1em; }
  .brand span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .section, .category-layout, .search-panel { padding-left: 10px; padding-right: 10px; }
  .category-row { gap: 6px; }
  .category-card span { font-size: 12px; }
  .product-grid { gap: 8px; }
  .product-card .body { padding-left: 9px; padding-right: 9px; }
  .cart-list { padding-left: 10px; padding-right: 10px; }
  .cart-item { grid-template-columns: 72px minmax(0, 1fr); gap: 9px; }
  .cart-item > img { width: 72px; height: 72px; }
  .cart-item .line-bottom { align-items: flex-start; flex-direction: column; gap: 7px; margin-top: 8px; }
  .quantity { gap: 6px; flex-wrap: wrap; }
  .cart-summary { margin-left: -10px; margin-right: -10px; }
  .checkout { padding-left: 10px; padding-right: 10px; }
  .mini-order-item { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 7px; }
  .mini-order-item img { width: 50px; height: 50px; }
  .form-panel .row { grid-template-columns: 1fr; gap: 0; }
  .order-actions { flex-wrap: wrap; }
}
