/* =========================================================
   keleqf.cn 商城 UI v2 —— 参照 didipifa.net 风格重写
   品牌色：蓝紫渐变 #4f6ef2 -> #7b5cf0
   价格强调：橙红 #ff5a3c
   布局：移动优先，手机2列 / 平板3列 / PC4列
   ========================================================= */
:root {
  --brand-1: #4f6ef2;
  --brand-2: #7b5cf0;
  --brand-grad: linear-gradient(135deg, #4f6ef2 0%, #7b5cf0 100%);
  --accent: #ff5a3c;
  --accent-deep: #f5461f;
  --ok: #22b573;
  --warn: #f59e0b;
  --danger: #ef4444;
  --bg: #f4f7ff;
  --card-bg: #ffffff;
  --text: #1f2430;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #e8ecf7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(79, 110, 242, 0.08);
  --shadow-hover: 0 10px 28px rgba(79, 110, 242, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand-1); text-decoration: none; }
img { max-width: 100%; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 14px; }
.narrow { max-width: 620px; }
main.wrap { flex: 1; padding-top: 18px; padding-bottom: 48px; }

/* ---------------- 顶部公告条 ---------------- */
.announce {
  background: linear-gradient(90deg, #3b2d8f, #4f6ef2 55%, #7b5cf0);
  color: #fff;
  font-size: 13px;
  overflow: hidden;
  position: relative;
  white-space: nowrap;
}
.announce-track {
  display: inline-block;
  padding: 7px 0;
  animation: announce-scroll 26s linear infinite;
}
.announce:hover .announce-track { animation-play-state: paused; }
.announce-track span { margin-right: 42px; }
.announce-track a { color: #ffe08a; font-weight: 600; }
.announce-track b { color: #ffe08a; }
@keyframes announce-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(79, 110, 242, 0.06);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: .3px;
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-grad);
  color: #fff; font-size: 18px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(79, 110, 242, .35);
}
.brand .logo-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar nav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--line); background: #fff;
  transition: all .2s;
}
.nav-btn:hover { color: var(--brand-1); border-color: var(--brand-1); }
.nav-btn.primary { background: var(--brand-grad); color: #fff; border-color: transparent; }
.nav-btn.primary:hover { opacity: .92; color: #fff; }

/* ---------------- 分类胶囊 ---------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.tab {
  padding: 7px 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 13.5px; color: var(--text-2); font-weight: 600;
  transition: all .18s;
}
.tab:hover { color: var(--brand-1); border-color: var(--brand-1); }
.tab.on {
  background: var(--brand-grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 12px rgba(79, 110, 242, .3);
}

/* ---------------- 商品卡片 ---------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 手机 2 列 */
  gap: 12px;
}
@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } /* 平板 3 列 */
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } /* PC 4 列 */
}
.card {
  display: flex; flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: inherit;
  transition: transform .2s, box-shadow .2s;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

/* 封面区：渐变底 + Emoji / 首字 */
.card-cover {
  height: 92px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  position: relative;
  flex-shrink: 0;
}
.card-cover .cover-first {
  font-size: 44px; font-weight: 800; color: rgba(255,255,255,.95);
  text-shadow: 0 2px 8px rgba(0,0,0,.12);
}
/* 渐变背景组 */
.g1 { background: linear-gradient(135deg, #4f6ef2, #7b5cf0); }
.g2 { background: linear-gradient(135deg, #22b573, #17c3b2); }
.g3 { background: linear-gradient(135deg, #ff7a45, #ff5a3c); }
.g4 { background: linear-gradient(135deg, #722ed1, #b37feb); }
.g5 { background: linear-gradient(135deg, #13a8a8, #36cfc9); }
.g6 { background: linear-gradient(135deg, #f59e0b, #fa8c16); }

/* 推荐 / 特价角标 */
.card-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.card-badge.recommend { background: linear-gradient(135deg, #ff5a3c, #fa8c16); }
.card-badge.sale { background: linear-gradient(135deg, #f5461f, #ff7a45); }

.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  line-height: 1.45; min-height: 38px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-row { display: flex; align-items: center; justify-content: space-between; }

/* 库存标签三态 */
.stock-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
}
.stock-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-tag.ok { background: #e6f9f0; color: var(--ok); }
.stock-tag.low { background: #fff3e0; color: var(--warn); }
.stock-tag.out { background: #f1f2f6; color: var(--text-3); }

/* 价格区 */
.price { color: var(--accent); font-weight: 800; font-size: 17px; line-height: 1.2; }
.price i { font-style: normal; font-size: .72em; font-weight: 700; margin-left: 1px; }
.price-cny { color: var(--text-3); font-size: 11.5px; }

/* 立即购买按钮 */
.buy-btn {
  display: block; text-align: center;
  padding: 8px 0; border-radius: 999px;
  background: var(--brand-grad);
  color: #fff !important; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(79, 110, 242, .3);
  transition: all .18s;
}
.buy-btn:hover { opacity: .9; transform: translateY(-1px); }
.card .buy-btn { margin-top: 2px; }

/* 缺货置灰禁用 */
.card.sold-out { filter: grayscale(.85); opacity: .62; pointer-events: none; }
.card.sold-out .buy-btn { background: var(--text-3); box-shadow: none; }
.card.sold-out .price { color: var(--text-3); }

.empty { color: var(--text-3); padding: 40px 0; text-align: center; font-size: 14px; }

/* ---------------- 面板 / 表单 ---------------- */
.panel {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel.warn { background: #fffdf5; border-color: #ffe1a1; }
.panel.success { background: #f2fcf7; border-color: #a8eccb; }
.panel.address {
  text-align: center;
  background: linear-gradient(180deg, #f4f7ff, #fff);
  border-color: #cdd8ff;
}
.panel .label { font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed #eef1f8; gap: 10px; }
.row:last-child { border-bottom: none; }
.row .k { color: var(--text-2); font-size: 13.5px; flex-shrink: 0; }
.row .v { text-align: right; font-size: 14px; font-weight: 600; word-break: break-all; }
.row.total .v { font-size: 18px; }
.price.big { font-size: 30px; }
.price i { font-style: normal; font-size: .7em; }

.mono { font-family: Consolas, Menlo, "Courier New", monospace; word-break: break-all; }
.small { font-size: 12px; color: var(--text-2); }
.muted { color: var(--text-3); font-size: 12.5px; }
.addr { word-break: break-all; font-size: 13px; color: var(--text); margin-bottom: 12px; background: #fff; border: 1px dashed #b9c6f5; border-radius: 10px; padding: 12px; }
.card-box { width: 100%; font-family: Consolas, Menlo, monospace; font-size: 13px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 120px; resize: vertical; }

.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 34px; height: 34px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; font-size: 16px; cursor: pointer; color: var(--text);
  transition: all .15s;
}
.qty button:hover { border-color: var(--brand-1); color: var(--brand-1); }
.qty input { width: 58px; height: 34px; text-align: center; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }

.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .row-form input {
  width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .row-form input:focus {
  outline: none; border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(79,110,242,.15);
}
.row-form { display: flex; gap: 10px; margin: 16px 0; }
.row-form input { flex: 1; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; text-align: center; color: var(--text);
  transition: all .18s;
}
.btn:hover { border-color: var(--brand-1); color: var(--brand-1); }
.btn.primary {
  background: var(--brand-grad); border-color: transparent; color: #fff;
  box-shadow: 0 5px 14px rgba(79,110,242,.32); width: 100%;
  padding: 12px 20px; font-size: 15.5px;
}
.btn.primary:hover { opacity: .92; color: #fff; transform: translateY(-1px); }
.btn.accent {
  background: linear-gradient(135deg, #ff7a45, #f5461f);
  border-color: transparent; color: #fff;
  box-shadow: 0 5px 14px rgba(245,70,31,.3);
}
.btn.accent:hover { opacity: .92; color: #fff; transform: translateY(-1px); }
.btn.block { width: 100%; }
.btn + .btn { margin-top: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; font-weight: 600; }
.back:hover { color: var(--brand-1); }

/* 标题 */
h1 { font-size: 22px; margin-bottom: 14px; font-weight: 800; letter-spacing: .2px; }
h1 .sub { font-size: 13px; color: var(--text-3); font-weight: 400; margin-left: 8px; }
h2 { font-size: 16px; margin: 20px 0 10px; font-weight: 700; }

/* 状态 */
.status { text-align: center; color: var(--text-2); padding: 12px 0; font-size: 14px; }
.st { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.st-delivered { background: #e6f9f0; color: var(--ok); }
.st-paid, .st-pending { background: #e8f0fe; color: var(--brand-1); }
.st-timeout, .st-failed { background: #fdeceb; color: var(--danger); }

/* 订单列表 */
.order-item { transition: transform .18s, box-shadow .18s; }
.order-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

/* 商品详情头 */
.detail-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.detail-hero .hero-cover {
  width: 84px; height: 84px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.detail-hero .hero-cover .cover-first { font-size: 44px; font-weight: 800; color: rgba(255,255,255,.95); }
.detail-hero h1 { margin-bottom: 4px; font-size: 20px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 支付页金额突出 */
.pay-amount-card {
  background: linear-gradient(135deg, #4f6ef2, #7b5cf0);
  color: #fff; border-radius: var(--radius); padding: 22px 16px;
  text-align: center; margin-bottom: 14px; box-shadow: 0 10px 26px rgba(79,110,242,.35);
}
.pay-amount-card .pay-label { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.pay-amount-card .pay-value { font-size: 40px; font-weight: 800; line-height: 1.25; }
.pay-amount-card .pay-value small { font-size: 16px; font-weight: 600; opacity: .9; }
.pay-amount-card .pay-sub { font-size: 12.5px; opacity: .85; margin-top: 4px; }

/* 完成页成功图标 */
.result-icon { font-size: 52px; text-align: center; margin-bottom: 10px; }

/* 页脚 */
footer { color: var(--text-3); font-size: 12.5px; padding: 18px 14px 34px; text-align: center; border-top: 1px solid var(--line); background: #fff; margin-top: auto; }
footer a { color: var(--brand-1); }
