/* 平台首页：全部店铺。色调和店铺前台一致，以中性色为底；每家店的卡片用它自己的主色，页面顶部的淡淡底色也取自各店的主色 */
:root {
  --bg: #f6f6f8;
  --card: #ffffff;
  --text: #17181c;
  --sub: #565a66;
  --muted: #7b7f8a;
  --line: #ececf0;
  --field: #f3f4f7;
  --ok: #0b8f5f;
  --ok-bg: #e6f6ee;
  --warn: #a86200;
  --warn-bg: #fdf2dc;
  --shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 8px 24px rgba(20, 22, 30, .06);
  --shadow-lg: 0 4px 10px rgba(20, 22, 30, .06), 0 18px 44px rgba(20, 22, 30, .12);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --smooth: cubic-bezier(.22, 1, .36, 1);
  --wash: 16%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1013;
    --card: #1a1b20;
    --text: #f2f3f5;
    --sub: #c3c6cf;
    --muted: #9a9eaa;
    --line: #2a2c33;
    --field: #24262d;
    --ok: #34d399;
    --ok-bg: rgba(52, 211, 153, .14);
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .45);
    --wash: 22%;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
body {
  touch-action: pan-x pan-y;
  position: relative; margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans Thai", "Sukhumvit Set", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* 顶部的淡底色：取前几家店的主色，很淡地晕开，店铺换了颜色首页也跟着变 */
body::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 380px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(75% 100% at 0% 0%, color-mix(in srgb, var(--h1, transparent) var(--wash), transparent), transparent 72%),
    radial-gradient(60% 85% at 100% 0%, color-mix(in srgb, var(--h2, transparent) calc(var(--wash) * .8), transparent), transparent 70%);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
/* 店少的时候把整页收窄居中，免得一两张卡片孤零零贴在左上角 */
body[data-n="0"] .wrap, body[data-n="1"] .wrap { max-width: 540px; }
body[data-n="2"] .wrap { max-width: 900px; }
main { flex: 1; padding-bottom: 36px; }

/* ---------- 顶栏 ---------- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--text); color: var(--bg); font-weight: 800; font-size: 16px; }
.brand strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; white-space: nowrap; transition: transform .35s var(--spring); }
.pill:active { transform: scale(.9); }

/* ---------- 开头 ---------- */
.hero { padding: 18px 2px 4px; }
.hero h1 { margin: 0; font-size: 27px; line-height: 1.25; font-weight: 800; letter-spacing: -.2px; text-wrap: balance; overflow-wrap: anywhere; }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.hero p:empty { display: none; }
.search { display: flex; align-items: center; gap: 8px; height: 48px; margin-top: 18px; padding: 0 16px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { box-shadow: 0 0 0 2px var(--text), var(--shadow); }
@media (min-width: 720px) { .hero { padding-top: 30px; } .hero h1 { font-size: 34px; } .hero p { font-size: 15px; } }

.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; margin: 22px 2px 12px; }
.sec-h h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--sub); }
.filter { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--sub); font-size: 12.5px; font-weight: 600; transition: transform .35s var(--spring), background .15s, color .15s; }
.filter i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.filter[aria-pressed="true"] { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1.500px var(--ok); }
.filter:active { transform: scale(.92); }

/* ---------- 店铺卡片 ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { body:not([data-n="0"]):not([data-n="1"]) .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { body:not([data-n="0"]):not([data-n="1"]):not([data-n="2"]) .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.shop {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow);
  color: inherit; text-decoration: none; transition: transform .4s var(--spring), box-shadow .25s ease-out;
}
.shop:active { transform: scale(.975); }
.shop:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
@media (hover: hover) {
  .shop:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
  .shop:hover .s-go svg { transform: translateX(2px); }
}
.grid.intro .shop { animation: rise .55s var(--smooth) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.s-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, var(--c), var(--c2)); color: var(--ink); font-weight: 800; font-size: 22px; }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.s-tx b { font-size: 16.500px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-tx small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-go { flex: none; display: inline-flex; align-items: center; gap: 1px; height: 34px; padding: 0 9px 0 14px; border-radius: 999px; background: linear-gradient(135deg, var(--c), var(--c2)); color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.s-go svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.600; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease-out; }

.s-pics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pic { display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--field); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 休息中的店：商品图压暗一点，文字保持清楚 */
.shop.off .pic { opacity: .6; filter: saturate(.7); }
/* 大卡片：全平台只有一两家店时用，多展示几个商品，带品名和价格 */
.shop.big { gap: 14px; padding: 18px; }
.s-pics.cap { gap: 14px 10px; }
.item { display: flex; flex-direction: column; min-width: 0; }
.item b { margin-top: 7px; font-size: 12.500px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item em { font-style: normal; font-size: 12.500px; font-weight: 700; line-height: 1.35; color: var(--pr); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.s-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--field); color: var(--sub); font-size: 12.500px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tag i { position: relative; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag svg { flex: none; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.200; stroke-linecap: round; stroke-linejoin: round; }
.tag.open { background: var(--ok-bg); color: var(--ok); }
.tag.open i::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ping 2.400s ease-out infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.800); opacity: 0; } }
.tag.closed { background: var(--warn-bg); color: var(--warn); }
.tag.cart { background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--ct); }

/* ---------- 空状态 / 页脚 ---------- */
.empty { margin: 56px 0 24px; text-align: center; color: var(--muted); }
.empty svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.500; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.empty p { margin: 10px 0 0; }
.foot { padding-top: 8px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .shop, .pill, .filter, .s-go svg { transition: none; }
  .grid.intro .shop, .tag.open i::after { animation: none; }
}

/* ---------- 顶栏右侧：商户入驻 + 语言 ---------- */
.top-r { display: flex; align-items: center; gap: 8px; }
.pill.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.foot a { color: inherit; }
.foot small { display: block; max-width: 520px; margin: 6px auto 0; font-size: 11px; line-height: 1.5; opacity: .75; }

/* ---------- 跨店商品搜索结果 ---------- */
#results { margin-bottom: 8px; }
.rg { margin-bottom: 12px; padding: 14px 0 14px 14px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.rg-h { display: flex; align-items: center; gap: 10px; padding-right: 14px; color: inherit; text-decoration: none; min-width: 0; }
.rg-h .logo { width: 36px; height: 36px; border-radius: 11px; font-size: 15px; }
.rg-h b { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-h .tag { height: 24px; }
.rg-row { display: flex; gap: 10px; margin-top: 12px; padding-right: 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.rg-row::-webkit-scrollbar { display: none; }
.pt { flex: none; width: 118px; display: flex; flex-direction: column; color: inherit; text-decoration: none; scroll-snap-align: start; }
.pt .pic { width: 118px; }
.pt b { margin-top: 7px; font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pt em { margin-top: 2px; font-style: normal; font-size: 13px; font-weight: 700; color: var(--pr); font-variant-numeric: tabular-nums; }
.pt.out .pic { opacity: .45; }
.pt.out em { color: var(--muted); font-weight: 600; }
.pt.more { justify-content: center; align-items: center; width: 90px; color: var(--sub); font-size: 13px; font-weight: 600; }
.res-empty { padding: 18px 4px 6px; color: var(--muted); font-size: 14px; }

/* ---------- 入驻申请弹窗 ---------- */
.dlg { width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 24px; background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); }
.dlg::backdrop { background: rgba(10, 12, 18, .45); backdrop-filter: blur(3px); }
.dlg-in { padding: 20px 20px 22px; }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dlg-h h3 { margin: 0; font-size: 19px; }
.dlg .x { width: 34px; height: 34px; border-radius: 50%; background: var(--field); color: var(--sub); font-size: 14px; }
.dlg-sub { margin: 6px 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.dlg label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.dlg label span { font-size: 13px; font-weight: 600; color: var(--sub); }
.dlg input, .dlg select, .dlg textarea { width: 100%; min-width: 0; padding: 11px 12px; border: 0; border-radius: 12px; background: var(--field); color: var(--text); font: inherit; font-size: 15px; outline: none; }
.dlg textarea { resize: vertical; }
.dlg input:focus, .dlg select:focus, .dlg textarea:focus { box-shadow: 0 0 0 2px var(--text); }
.dlg .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.dlg .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dlg-err { margin: 0 0 10px; color: #d93025; font-size: 13.5px; }
.dlg-btn { width: 100%; height: 48px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 15.5px; font-weight: 700; }
.dlg-btn:disabled { opacity: .55; }
.dlg-done { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 4px 2px; }
.dlg-done svg { width: 54px; height: 54px; padding: 12px; border-radius: 50%; background: var(--ok-bg); fill: none; stroke: var(--ok); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dlg-done b { margin-top: 12px; font-size: 17px; }
.dlg-done p { margin: 6px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
@media (max-width: 420px) { .dlg .two { grid-template-columns: 1fr; } .pill.ghost { padding: 0 10px; } }

/* ---------- 首页模版 ---------- */
/* 这个文件是「经典简洁」布局，也是各种风格共用的底子（弹窗、搜索结果、标签）。新版布局在 home-v2.css，每种风格自己的颜色和装饰在 /home-tpl/<编号>.css */
html:not([data-layout="v2"]) .v2only { display: none !important; }
.pill.icon { width: 36px; padding: 0; display: grid; place-items: center; }
.pill.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.q-clear { flex: none; width: 28px; height: 28px; margin-right: -6px; border-radius: 50%; display: grid; place-items: center; background: var(--field); color: var(--muted); }
.q-clear svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.4; }
.search input::-webkit-search-cancel-button { display: none; }
/* 手机浏览器（尤其苹果）给 type=search 的输入框自带外观和左边的装饰位，会在文字前面多出一段空白：全部去掉 */
.search input { -webkit-appearance: none; appearance: none; padding: 0; border-radius: 0; }
.search input::-webkit-search-decoration, .search input::-webkit-search-results-decoration { -webkit-appearance: none; display: none; }
/* 评分、页脚的平台客服和规则链接 */
.tag.rate { background: #fff3d6; color: #8a5a00; }
.s-rate { margin-right: 6px; color: #d48806; font-weight: 700; }
.foot .foot-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; font-size: 12px; opacity: 1; }
.foot .foot-links a { color: inherit; }
@media (prefers-color-scheme: dark) { .tag.rate { background: rgba(251, 191, 36, .16); color: #fbbf24; } }

/* 排序方式：一排小标签，放不下时可以左右滑 */
.sorts { display: flex; gap: 6px; margin: -4px -16px 12px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
.sorts::-webkit-scrollbar { display: none; }
.sort { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background-color .15s, color .15s, transform .35s var(--spring); }
.sort svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sort:active { transform: scale(.94); }
.sort.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
/* 推广、新店的小标记 */
.adt, .newt { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 4px; font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 17px; vertical-align: 1px; }
.adt { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.newt { background: var(--ok-bg); color: var(--ok); }
.tag.adt { margin: 0; padding: 0 9px; border-radius: 999px; font-size: 12px; line-height: inherit; vertical-align: 0; }
/* 加载下一批 */
.list-more { padding: 18px 0 6px; text-align: center; color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .sort { transition: none; } }

/* 离我多远：放在卡片信息最前面 */
.s-dist { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; color: var(--text); font-weight: 700; vertical-align: -2px; }
.s-dist svg, .tag.dist svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.s-nodist { margin-right: 6px; font-style: normal; color: var(--muted); }
