/* ============ 用户端 H5 ============ */

.app {
  position: relative;
  width: 100%;
  max-width: var(--page-max);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(31, 26, 23, .04), var(--sh-lg);
  overflow-x: hidden;
}
@media (max-width: 520px) {
  .app { box-shadow: none; }
}

.view[hidden] { display: none; }

/* ---------- 顶部 ---------- */

.home-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }

/* 搜索入口 */
.search-entry {
  display: flex; align-items: center; gap: 8px;
  margin: 0 16px; padding: 0 6px 0 14px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-400);
  font-size: 13.5px;
  box-shadow: var(--sh-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-entry:hover { border-color: var(--brand-200); }
.search-entry .ph { flex: 1; text-align: left; }
.search-entry .go {
  height: 32px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--brand-50); color: var(--brand-600);
  font-size: 12.5px; font-weight: 600;
  display: grid; place-items: center;
}

/* ---------- 频道切换 ---------- */

.channel-switch {
  display: flex; gap: 4px;
  margin: 14px 16px 0;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
}
.ch-tab {
  flex: 1;
  height: 38px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-500);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.ch-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: var(--sh-sm);
}
.ch-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-300);
  flex: none;
}
.ch-taobao .ch-dot { background: #F2620F; }
.ch-jd .ch-dot { background: #D2232A; }

.channel-switch.sm { margin: 6px 16px 2px; padding: 3px; }
.channel-switch.sm .ch-tab { height: 32px; font-size: 12.5px; }

/* 渠道色：淘宝橙 / 京东红，只用于识别，不抢品牌红 */
.ch-tag {
  background: rgba(255, 255, 255, .94);
  color: var(--ink-700);
  box-shadow: 0 1px 3px rgba(31, 26, 23, .12);
}
.ch-tag.ch-taobao { color: #C2410C; }
.ch-tag.ch-jd { color: #C8102E; }

.ch-name { font-weight: 600; }
.ch-name.ch-taobao { color: #C2410C; }
.ch-name.ch-jd { color: #C8102E; }

/* 底部换频道入口 */
.channel-more {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: calc(100% - 32px);
  margin: 4px 16px 8px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  font-size: 12.5px; color: var(--ink-500);
  text-align: left;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.channel-more b { color: var(--brand-600); }
.channel-more svg { color: var(--ink-300); flex: none; }
.channel-more:hover { border-color: var(--brand-200); color: var(--ink-700); }

/* 跨频道提示 */
.cross-tip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--gold-50);
  color: var(--gold-600);
  font-size: 12px;
  text-align: left;
}
.cross-tip .go { font-weight: 700; flex: none; }
.cross-tip:hover { background: var(--gold-100); }

/* 分类空态 */
.grid-empty {
  grid-column: 1 / -1;
  padding: 30px 16px;
  text-align: center;
  color: var(--ink-500);
  font-size: 13px;
}
.grid-empty .chip { margin-top: 12px; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  margin: 16px;
  padding: 20px;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: linear-gradient(135deg, #F0563A 0%, #DB3C24 52%, #A22712 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(160, 45, 20, .22);
}
.hero::before,
.hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .10);
}
.hero::before { width: 180px; height: 180px; right: -60px; top: -70px; }
.hero::after { width: 110px; height: 110px; right: 44px; bottom: -64px; background: rgba(255, 255, 255, .07); }

.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .18);
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.hero h2 {
  position: relative; z-index: 1;
  margin-top: 12px;
  font-size: 23px; line-height: 1.28; font-weight: 700;
  letter-spacing: -.01em;
}
.hero p {
  position: relative; z-index: 1;
  margin-top: 6px; font-size: 12.5px;
  color: rgba(255, 255, 255, .82);
}
.hero .hero-cta {
  position: relative; z-index: 1;
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: var(--r-pill);
  background: #fff; color: var(--brand-600);
  font-size: 13px; font-weight: 700;
}
.hero .coupon {
  position: absolute; right: 16px; bottom: 18px; z-index: 1;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .95);
  color: var(--brand-600);
  font-size: 12px; font-weight: 700;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
}
.hero .coupon b {
  display: block;
  font-family: var(--font-num);
  font-size: 19px; letter-spacing: -.02em;
}
.hero .coupon span { font-size: 10px; font-weight: 600; color: var(--ink-400); }

/* ---------- 分类 ---------- */

.cat-row {
  display: flex; gap: 8px;
  padding: 4px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-row::-webkit-scrollbar { display: none; }
/* 分类多于一屏时横向滑动，胶囊不被压缩，避免出现「营养保…」这种半截字 */
.cat-row .chip { flex: none; white-space: nowrap; }

/* ---------- 列表 ---------- */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 4px 16px 10px;
}
.section-head h2 { font-size: 15px; font-weight: 700; }
.section-head span { font-size: 11.5px; color: var(--ink-400); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 8px;
}
.grid.flat { padding: 0; }

.p-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 140ms var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.p-card:active { transform: scale(.985); }
.p-card:hover { box-shadow: var(--sh-md); }

.p-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
}
.p-media img { width: 100%; height: 100%; object-fit: cover; }
.p-flags {
  position: absolute; left: 8px; top: 8px;
  display: flex; gap: 4px;
}
.p-off {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(201, 52, 30, .92);
  color: #fff; font-size: 10.5px; font-weight: 700;
  font-family: var(--font-num);
  letter-spacing: .01em;
  backdrop-filter: blur(2px);
}

.p-body {
  padding: 10px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.p-title {
  font-size: 13px; font-weight: 500; line-height: 1.42;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 37px;
}
.p-sub {
  margin-top: 3px;
  font-size: 11.5px; color: var(--ink-400);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

/* 价格：现价 + 原价 */
.p-price-row {
  margin-top: 7px;
  display: flex; align-items: baseline; gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 2px;
}
.p-price-row .price {
  font-size: 18px; flex: none;
  white-space: nowrap;
}
.p-price-row .price-old {
  font-size: 11.5px; flex: none;
  white-space: nowrap;
}

/* 复制口令 */
.copy-btn {
  margin-top: 9px;
  width: 100%; height: 32px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 12.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), transform 120ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.copy-btn:hover { background: var(--brand-100); }
.copy-btn:active { transform: scale(.97); }
.copy-btn svg { flex: none; }
.copy-btn.done {
  background: var(--ok-50);
  color: var(--ok-600);
  border-color: rgba(18, 161, 80, .18);
}

/* ---------- 页脚 ---------- */

.site-foot {
  padding: 18px 24px 34px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-300);
  line-height: 1.7;
}
.site-foot a { color: var(--ink-400); text-decoration: underline; text-underline-offset: 2px; }
.site-foot a:hover { color: var(--brand-600); }

/* ---------- 搜索页 ---------- */

.search-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 249, 245, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.search-bar.stuck { border-color: var(--line); }

.search-field {
  flex: 1; display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 6px 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-sm);
}
.search-field:focus-within { border-color: var(--brand-500); }
.search-field input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font-size: 14px;
}
.search-field input::placeholder { color: var(--ink-300); }
.search-field .clear {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-300);
}
.search-field .submit {
  height: 30px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--brand-500); color: #fff;
  font-size: 12.5px; font-weight: 600;
}
.text-btn:hover { color: var(--brand-600); }

.panel { padding: 6px 16px 28px; }
.panel-block { margin-bottom: 22px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.panel-head h3 { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.panel-head .hint { font-size: 11.5px; color: var(--ink-300); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.result-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 10px;
  font-size: 12.5px; color: var(--ink-500);
}
.result-meta b { color: var(--ink-900); font-weight: 600; }
.sort-row { display: flex; gap: 14px; padding: 0 16px 12px; }
.sort-btn { font-size: 12.5px; color: var(--ink-500); padding: 4px 0; }
.sort-btn[aria-pressed="true"] { color: var(--brand-600); font-weight: 600; }
.sort-btn[aria-pressed="true"]::after {
  content: ""; display: block; height: 2px; margin-top: 2px;
  background: var(--brand-500); border-radius: 1px;
}

.rows { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.row-item {
  display: flex; gap: 12px; padding: 10px;
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  min-width: 0;
  cursor: pointer;
  transition: transform 140ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.row-item:active { transform: scale(.99); }
.row-item img {
  width: 86px; height: 86px; border-radius: 10px;
  object-fit: cover; background: var(--surface-3); flex: none;
}
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-body h4 {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-body .sub { font-size: 11.5px; color: var(--ink-400); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-body .row-foot {
  display: flex; align-items: baseline; gap: 7px;
  margin-top: auto; padding-top: 8px; min-width: 0;
}
.row-foot .price { font-size: 17px; white-space: nowrap; }
.row-foot .price-old { font-size: 11.5px; white-space: nowrap; }

/* 行内复制按钮 */
.copy-btn.sm {
  width: auto; height: 30px;
  margin: 0 0 0 auto; padding: 0 12px;
  font-size: 12px; flex: none;
  align-self: center;
}

.search-empty { padding: 28px 16px; }
.search-empty .icon-wrap {
  width: 62px; height: 62px; margin: 0 auto 14px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-500);
}
.search-empty h3 { text-align: center; font-size: 15px; font-weight: 600; }
.search-empty p {
  text-align: center; font-size: 12.5px; color: var(--ink-500);
  margin: 6px auto 18px; max-width: 260px;
}
.search-empty .chip-wrap { justify-content: center; }
.search-empty .cross-btn {
  display: flex; width: fit-content;
  margin: -6px auto 16px;
}

/* ---------- 口令兜底浮层 ---------- */

.tkl-mask {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(31, 26, 23, .46);
  backdrop-filter: blur(3px);
}
.tkl-box {
  width: 100%; max-width: 300px;
  padding: 20px 18px 16px;
  background: var(--surface);
  border-radius: var(--r-xl);
  text-align: center;
  box-shadow: var(--sh-lg);
}
.tkl-box h4 { font-size: 15px; font-weight: 700; }
.tkl-name {
  margin-top: 4px;
  font-size: 12px; color: var(--ink-400);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tkl-code {
  margin: 14px 0 10px;
  padding: 12px 10px;
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--brand-700);
  font-family: var(--font-num);
  font-size: 16px; font-weight: 700; letter-spacing: .02em;
  word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.tkl-tip { font-size: 11.5px; color: var(--ink-400); line-height: 1.65; }
.tkl-box .btn { width: 100%; margin-top: 16px; height: 40px; font-size: 14px; }

/* ---------- 列表顶部轻提示 ---------- */

.tkl-hint {
  display: flex; align-items: center; gap: 5px;
  margin: 0 16px 10px;
  font-size: 11.5px;
  color: var(--ink-400);
}
.tkl-hint b { color: var(--brand-600); font-weight: 600; }
.tkl-hint svg { flex: none; color: var(--brand-500); }
