:root {
  --navy: #1f3a5f;
  --navy-deep: #16293f;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e8eaef;
  --bg: #f6f7f9;
  --card: #ffffff;
  --price: #d9480f;
  --ok: #0f7b4f;
  --warn: #b45309;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 12px 20px 10px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand { display: flex; align-items: baseline; gap: 9px; flex: none; }

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--navy-deep);
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.search {
  flex: 1 1 auto;
  max-width: 420px;
  position: relative;
}

.search input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfbfc;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.search input:focus { border-color: var(--navy); background: #fff; }

.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  opacity: 0.45;
  pointer-events: none;
}

.search .clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: #e9eaee;
  color: var(--muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: none;
}

.search .clear.on { display: block; }

.counter { font-size: 12px; color: var(--muted); white-space: nowrap; }
.counter b { color: var(--navy-deep); font-size: 14px; }

/* ---------- 筛选 ---------- */
.filters {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 20px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: #414a57;
  padding: 6px 13px;
  border-radius: 16px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.chip:hover { border-color: #c9d0da; }

.chip.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 500;
}

.chip .n { opacity: 0.55; margin-left: 5px; font-size: 11px; }

.spacer { flex: 1 1 auto; }

.toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: #414a57;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  flex: none;
}

.toggle input { accent-color: var(--navy); width: 14px; height: 14px; cursor: pointer; }

.sort {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #414a57;
  font-size: 12.5px;
  padding: 0 8px;
  cursor: pointer;
  outline: none;
}

/* ---------- 瀑布流 ---------- */
.waterfall {
  max-width: 1560px;
  margin: 0 auto;
  padding: 4px 20px 60px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  opacity: 0;
  transform: translateY(6px);
  animation: rise 0.35s ease forwards;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px -12px rgba(22, 41, 63, 0.28);
  border-color: #d8dee7;
}

/* 高度由内联 padding-bottom 撑开，不依赖 aspect-ratio，兼容微信/老内核 */
.thumb {
  position: relative;
  height: 0;
  background: #f0f2f5;
  overflow: hidden;
}

.thumb img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.card:hover .thumb img { transform: scale(1.035); }

.thumb .ph {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: repeating-linear-gradient(
    45deg, #f2f4f7, #f2f4f7 10px, #eef1f5 10px, #eef1f5 20px);
  color: #9aa3af;
}

.thumb .ph .ph-cat { font-size: 13px; color: #7b8492; font-weight: 500; }
.thumb .ph .ph-tip { font-size: 11px; letter-spacing: 0.5px; }

.badge {
  position: absolute;
  top: 9px;
  left: 9px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy-deep);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.2px;
  backdrop-filter: blur(4px);
}

.badge.hot { background: var(--navy); color: #fff; }

.thumb .low {
  position: absolute;
  bottom: 9px;
  right: 9px;
  background: rgba(180, 83, 9, 0.94);
  color: #fff;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 5px;
}

.body { padding: 11px 12px 13px; }

.name {
  font-size: 13px;
  line-height: 1.45;
  color: #22262d;
  margin: 0 0 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.tg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 7px;
}

.tg i {
  font-style: normal;
  font-size: 10.5px;
  line-height: 1.6;
  color: #6b5a2e;
  background: #fdf6e3;
  border: 1px solid #f0e2c0;
  padding: 0 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.tagrow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-top: 1px solid var(--line);
  padding: 11px 0 0;
  margin-top: 11px;
}

.tagrow .tl {
  flex: none;
  width: 56px;
  font-size: 12px;
  color: var(--muted);
}

.tagrow .tv { display: flex; flex-wrap: wrap; gap: 6px; }

.tagrow .tv i {
  font-style: normal;
  font-size: 11.5px;
  background: #eef2f7;
  color: #3d4a5c;
  padding: 3px 8px;
  border-radius: 5px;
}

.meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.meta span { white-space: nowrap; }

.foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.price {
  color: var(--price);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.price small { font-size: 11px; font-weight: 500; margin-right: 1px; }
.price.ask { color: #8b93a1; font-size: 13px; font-weight: 500; }

.from {
  font-size: 11px;
  color: #8b93a1;
  font-weight: 400;
  margin-left: 2px;
}

.tagprice {
  font-size: 11px;
  color: #a4abb7;
  text-decoration: line-through;
  margin-left: 4px;
}

.stock { font-size: 11px; color: var(--ok); white-space: nowrap; }
.stock.mid { color: var(--warn); }
.stock.out { color: #99a1ad; }

/* ---------- 空状态 ---------- */
.empty {
  display: none;
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty.on { display: block; }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 20, 28, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.on { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 900px;
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.modal-box .pic {
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box .pic img.main {
  width: 100%;
  height: auto;
  max-height: 66vh;
  object-fit: contain;
  display: block;
}

.thumbs {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 9px;
  overflow-x: auto;
  background: #fff;
  border-top: 1px solid var(--line);
}

.thumbs button {
  position: relative;
  flex: none;
  width: 54px;
  height: 70px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.thumbs button.on {
  border-color: var(--navy);
  box-shadow: 0 0 0 1px var(--navy);
}

.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumbs .hint {
  flex: none;
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  padding: 0 6px 0 2px;
  white-space: nowrap;
}

.thumbs .chartlink {
  flex: none;
  align-self: center;
  font-size: 11px;
  color: var(--navy);
  text-decoration: none;
  border: 1px solid #d7dee8;
  border-radius: 5px;
  padding: 3px 7px;
  white-space: nowrap;
  margin-left: auto;
}

.thumbs .chartlink:hover { background: #f2f6fb; }

.thumbs .cl.chart { background: rgba(31, 58, 95, 0.85); }

.thumbs .cl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 8.5px;
  line-height: 1.4;
  color: #fff;
  background: rgba(20, 26, 36, 0.62);
  padding: 0 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-info { padding: 26px 26px 30px; }

.modal-info .cat {
  display: inline-block;
  background: #eef2f7;
  color: var(--navy);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 5px;
  margin-bottom: 12px;
}

.modal-info h2 {
  font-size: 19px;
  line-height: 1.45;
  margin: 0 0 14px;
  color: #1a1e25;
  font-weight: 600;
}

.modal-price { font-size: 26px; color: var(--price); font-weight: 700; margin-bottom: 4px; }
.modal-price small { font-size: 13px; font-weight: 500; }
.modal-note { font-size: 12px; color: var(--muted); margin-bottom: 20px; }

.spec {
  border-top: 1px solid var(--line);
  padding: 13px 0;
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.spec dt { color: var(--muted); width: 52px; flex: none; margin: 0; }
.spec dd { margin: 0; color: #2c3138; }

.modal-tags { margin-top: 18px; display: flex; gap: 7px; flex-wrap: wrap; }

.modal-tags i {
  font-style: normal;
  font-size: 11.5px;
  background: #f3f5f8;
  color: #55606e;
  padding: 4px 9px;
  border-radius: 6px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

/* ---------- 提示条 ---------- */
.notice {
  max-width: 1560px;
  margin: 14px auto 0;
  padding: 9px 14px;
  border-radius: 8px;
  background: #fff8e8;
  border: 1px solid #f3e2bd;
  color: #8a6516;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.notice b { color: #6d4f10; white-space: nowrap; flex: none; }
.notice span { min-width: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px 8px; }
  .search { order: 3; flex: 1 1 100%; max-width: none; }
  .counter { margin-left: auto; }
  .filters { padding: 0 14px 10px; gap: 6px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .spacer { display: none; }
  .waterfall { padding: 4px 14px 50px; gap: 10px; }
  .col { gap: 10px; }
  .name { font-size: 12.5px; min-height: 36px; }
  .price { font-size: 15.5px; }
  .modal-box { grid-template-columns: 1fr; max-height: 92vh; }
  .modal-box .pic img { max-height: 46vh; object-fit: contain; }
  .modal-info { padding: 18px 18px 24px; }
  .modal-info h2 { font-size: 16px; }
}

/* 卡片双档价：一档（红）/ 二档（蓝） */
.prices {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.prices .p1,
.prices .p2 {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.2px;
}
.prices .p1 { color: #d9480f; }
.prices .p2 { color: #1d6fd0; }
.prices i {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  color: #8b93a1;
  margin-right: 2px;
  transform: translateY(-1px);
}
.prices .p1 i { color: #c0460c; opacity: .75; }
.prices .p2 i { color: #1d6fd0; opacity: .75; }
.prices small { font-size: 10.5px; font-weight: 600; margin-right: 0; }
@media (max-width: 640px) {
  .prices .p1, .prices .p2 { font-size: 14px; }
  .prices i { font-size: 9.5px; }
}

/* 备案信息页脚（工信部要求：首页底部中间位置，链接到 beian.miit.gov.cn） */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  align-items: center;
  padding: 26px 16px 34px;
  font-size: 12.5px;
  color: #98a0aa;
  border-top: 1px solid #eef0f3;
  margin-top: 18px;
}
.site-footer a { color: #8a919b; text-decoration: none; }
.site-footer a:hover { color: #4b5563; text-decoration: underline; }
