:root {
  color-scheme: light;
  --ink: #090909;
  --muted: #a2a2a2;
  --line: #ededed;
  --soft: #f7f7f7;
  --paper: #ffffff;
  --brand: #1c1c1c;
  --logo: #fbf2df;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #f0f0f0; }
body { color: var(--ink); letter-spacing: 0; }
button, input, textarea { color: inherit; font: inherit; letter-spacing: 0; }
button { border: 0; cursor: pointer; }
[hidden] { display: none !important; }

.app-shell {
  position: relative;
  width: min(100%, 414px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--paper);
  border-inline: 1px solid #b9b9b9;
  padding-bottom: calc(67px + env(safe-area-inset-bottom));
}

.topbar { height: 64px; padding: 16px 17px 0; background: #fff; }
.topline { position: relative; height: 70px; display: flex; align-items: center; justify-content: center; }
.topline h1 { margin: 0; font-size: 14px; font-weight: 600; transform: translateY(7px); }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; padding: 0; background: transparent; }
.icon-button svg { width: 21px; height: 21px; stroke-width: 2; }
.home-button { position: absolute; left: -14px; top: 23px; }
.mini-program-actions {
  position: absolute;
  top: 27px;
  right: -12px;
  display: grid;
  grid-template-columns: 32px 1px 32px 1px 38px;
  align-items: center;
  justify-items: center;
  width: 120px;
  height: 32px;
  border: 1px solid #e7e7e7;
  border-radius: 18px;
  background: rgba(255,255,255,.95);
}
.mini-program-actions svg { width: 20px; height: 20px; stroke-width: 2; }
.mini-program-actions span { width: 1px; height: 19px; background: #dfdfdf; }
.search-box {
  display: grid;
  grid-template-columns: 24px 1fr 28px;
  align-items: center;
  height: 31px;
  padding: 0 5px;
  background: #f7f7f7;
}
.search-box svg { width: 19px; height: 19px; color: #aaa; stroke-width: 1.7; }
.search-box svg:last-child { width: 22px; height: 22px; color: #383838; }
.search-box input { width: 100%; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-family: system-ui, sans-serif; font-size: 14px; }
.search-box input::placeholder { color: #c5c5c5; }

.merchant-profile { position: relative; height: 173px; padding-top: 13px; text-align: center; }
.complaint-trigger {
  position: absolute;
  top: 36px;
  left: -1px;
  width: 68px;
  height: 31px;
  padding-right: 12px;
  border: 1px solid #e9e9e9;
  border-left: 0;
  border-radius: 0 18px 18px 0;
  background: #fff;
  font-size: 14px;
}
.merchant-logo {
  display: flex;
  width: 70px;
  height: 70px;
  margin: 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--logo);
  line-height: .9;
}
.merchant-logo span:first-child { font-size: 17px; font-weight: 700; transform: translate(5px, 2px); }
.merchant-logo span:last-child { font-size: 16px; }
.merchant-profile h2 { margin: 32px 0 15px; font-size: 18px; line-height: 1; font-weight: 700; }
.merchant-profile p { margin: 0; padding: 0 20px; color: var(--muted); font-size: 14px; line-height: 20px; }

.content-tabs { display: grid; height: 55px; grid-template-columns: 1fr 1fr; align-items: start; }
.tab-button { position: relative; height: 55px; padding: 12px 0 0; background: #fff; color: #a0a0a0; font-size: 18px; font-weight: 700; }
.tab-button small { font-size: 13px; font-weight: 600; }
.tab-button::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 49px; height: 2px; background: transparent; transform: translateX(-50%); }
.tab-button.is-active { color: #050505; }
.tab-button.is-active::after { background: #111; }
.album-content { min-height: 360px; }

.dynamic-list { padding: 23px 19px 0 17px; }
.dynamic-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 92px;
  grid-template-rows: 58px 38px;
  column-gap: 13px;
  min-height: 110px;
  padding-bottom: 13px;
}
.dynamic-card:not(:first-child) { position: relative; top: -1px; }
.dynamic-image-wrap { position: relative; grid-row: 1 / 3; width: 96px; height: 97px; overflow: hidden; background: #eee; }
.dynamic-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.image-count { position: absolute; right: 5px; bottom: 5px; color: #fff; font-family: Arial, sans-serif; font-size: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.dynamic-copy { min-width: 0; padding-top: 2px; }
.dynamic-copy h3 { display: -webkit-box; overflow: hidden; margin: 0 0 3px; color: #575757; font-size: 14px; font-weight: 400; line-height: 20px; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.dynamic-copy p { margin: 0; color: #676767; font-size: 14px; line-height: 17px; }
.dynamic-meta { display: flex; grid-column: 2; grid-row: 2; align-self: end; align-items: baseline; gap: 8px; padding-bottom: 8px; white-space: nowrap; }
.dynamic-meta strong { font-size: 14px; }
.dynamic-meta time { color: #929292; font-size: 12px; }
.share-button { grid-column: 3; grid-row: 2; align-self: end; width: 92px; height: 31px; margin-bottom: -2px; border: 1px solid #262626; background: #fff; font-size: 14px; }

.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; padding: 10px 1px 16px 11px; }
.shop-card { min-width: 0; margin: 0 0 15px; padding: 0; border: 0; background: #fff; text-align: left; }
.shop-card img { display: block; width: 100%; aspect-ratio: 197 / 264; object-fit: cover; background: #eee; }
.shop-card h3 { display: -webkit-box; overflow: hidden; min-height: 24px; margin: 17px 8px 0; color: #4f4f4f; font-size: 14px; font-weight: 400; line-height: 20px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.shop-card .ellipsis { margin: -4px 8px 0; color: #777; font-size: 14px; }
.shop-meta { display: flex; align-items: baseline; justify-content: space-between; margin: 12px 8px 0; }
.shop-meta time { color: #999; font-size: 12px; }
.shop-meta strong { font-size: 14px; }

.empty-state { display: grid; min-height: 300px; place-items: center; padding: 50px; color: #999; text-align: center; }
.empty-state svg { width: 42px; height: 42px; margin-bottom: 10px; stroke-width: 1.2; }
.loading-state { display: flex; height: 120px; align-items: center; justify-content: center; gap: 5px; }
.loading-state span { width: 5px; height: 5px; border-radius: 50%; background: #777; animation: pulse 1s ease-in-out infinite; }
.loading-state span:nth-child(2) { animation-delay: .15s; }
.loading-state span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 50% { opacity: .25; transform: translateY(-3px); } }

.bottom-actions {
  position: fixed;
  z-index: 20;
  right: max(calc((100vw - 414px) / 2 + 3px), 3px);
  bottom: 0;
  left: max(calc((100vw - 414px) / 2 + 3px), 3px);
  display: grid;
  height: calc(54px + env(safe-area-inset-bottom));
  padding: 0 14px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: 88px 1fr;
  gap: 4px;
  background: rgba(255,255,255,.97);
  border-top: 0;
}
.category-trigger { display: flex; height: 48px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: #fff; font-size: 14px; }
.category-trigger svg { width: 23px; height: 23px; transform: rotate(-7deg); stroke-width: 1.7; }
.contact-trigger { height: 48px; background: var(--brand); color: #fff; font-size: 14px; }

.sheet-backdrop { position: fixed; z-index: 65; inset: 0; background: rgba(0,0,0,.68); }
.bottom-sheet {
  position: fixed;
  z-index: 70;
  right: max(calc((100vw - 414px) / 2), 0px);
  bottom: 0;
  left: max(calc((100vw - 414px) / 2), 0px);
  max-height: 78dvh;
  overflow: auto;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: #fff;
  box-shadow: 0 -10px 30px rgba(0,0,0,.08);
  animation: sheet-in .22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }
.sheet-handle { width: 36px; height: 4px; margin: 0 auto 7px; border-radius: 2px; background: #dedede; }
.sheet-title-row { display: flex; height: 48px; align-items: center; justify-content: space-between; }
.sheet-title-row h3 { margin: 0; font-size: 18px; }
.sheet-close { margin-right: -10px; }
.category-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding-top: 8px; }
.category-option { height: 44px; border: 1px solid #e4e4e4; border-radius: 4px; background: #fff; font-size: 14px; }
.category-option.is-selected { border-color: #111; background: #111; color: #fff; }
.contact-options { padding-top: 4px; }
.contact-row { display: grid; width: 100%; height: 72px; grid-template-columns: 36px 1fr 24px; align-items: center; border-bottom: 1px solid #eee; background: #fff; color: #111; text-align: left; text-decoration: none; }
.contact-row > svg { width: 22px; height: 22px; stroke-width: 1.7; }
.contact-row span { display: flex; flex-direction: column; gap: 4px; }
.contact-row small { color: #999; font-size: 12px; }
.contact-row strong { font-family: system-ui, sans-serif; font-size: 15px; font-weight: 500; }
.sheet-form { display: grid; gap: 15px; padding: 8px 0; }
.sheet-form label { display: grid; gap: 7px; font-size: 14px; }
.sheet-form input, .sheet-form textarea { width: 100%; border: 1px solid #dedede; border-radius: 3px; outline: 0; background: #fff; font-family: system-ui, sans-serif; font-size: 14px; }
.sheet-form input { height: 42px; padding: 0 11px; }
.sheet-form textarea { padding: 10px 11px; resize: vertical; }
.primary-button, .secondary-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; border-radius: 3px; font-size: 14px; }
.primary-button { background: #1c1c1c; color: #fff; }
.secondary-button { border: 1px solid #222; background: #fff; }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }

.share-sheet { display: grid; height: calc(132px + env(safe-area-inset-bottom)); max-height: none; grid-template-columns: repeat(3, 1fr); padding: 22px 20px calc(14px + env(safe-area-inset-bottom)); border-radius: 0; overflow: hidden; }
.share-sheet > button { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 10px; padding: 0; border: 0; background: #fff; }
.share-sheet strong { font-size: 15px; font-weight: 400; }
.share-icon { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 50%; background: #f7f7f7; }
.share-icon svg { width: 24px; height: 24px; stroke-width: 1.8; }

.product-dialog { position: fixed; z-index: 60; inset: 0; max-width: 414px; margin: 0 auto; overflow: auto; background: #fff; animation: sheet-in .18s ease-out; }
.dialog-back { position: fixed; z-index: 2; top: 12px; margin-left: 10px; border-radius: 50%; background: rgba(255,255,255,.88); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.detail-gallery { position: relative; width: 100%; aspect-ratio: 1 / 1.18; overflow: hidden; background: #eee; touch-action: pan-y; }
.detail-gallery > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-arrow { position: absolute; top: 50%; display: grid; width: 36px; height: 36px; place-items: center; padding: 0; border-radius: 50%; background: rgba(255,255,255,.86); box-shadow: 0 2px 10px rgba(0,0,0,.12); transform: translateY(-50%); }
.gallery-arrow svg { width: 20px; height: 20px; }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-count { position: absolute; right: 14px; bottom: 12px; padding: 4px 9px; border-radius: 12px; background: rgba(0,0,0,.58); color: #fff; font-family: Arial, sans-serif; font-size: 12px; }
.gallery-thumbnails { display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto; scrollbar-width: none; }
.gallery-thumbnails:empty { display: none; }
.gallery-thumbnails::-webkit-scrollbar { display: none; }
.gallery-thumb { flex: 0 0 54px; width: 54px; height: 54px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 3px; background: #eee; }
.gallery-thumb.is-active { border-color: #171717; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { padding: 22px 20px 32px; }
.detail-price { margin-bottom: 10px; font-size: 22px; font-weight: 700; }
.detail-body h3 { margin: 0; font-size: 20px; line-height: 1.45; }
.detail-body p { margin: 18px 0; color: #777; font-family: system-ui, sans-serif; font-size: 14px; line-height: 1.8; }
.detail-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 88px; max-width: 300px; padding: 10px 15px; border-radius: 4px; background: rgba(20,20,20,.92); color: #fff; font-family: system-ui, sans-serif; font-size: 13px; text-align: center; transform: translateX(-50%); }

@media (max-width: 360px) {
  .dynamic-list { padding-inline: 12px; }
  .dynamic-card { grid-template-columns: 88px minmax(0,1fr) 78px; column-gap: 9px; }
  .dynamic-image-wrap { width: 88px; height: 89px; }
  .share-button { width: 78px; }
}

@media (min-width: 700px) {
  .app-shell { box-shadow: 0 0 30px rgba(0,0,0,.06); }
}
