﻿/* ===== WhyKaiX 发卡平台 · 商城样式 ===== */
:root {
  --primary: #4F5BFF;
  --primary-dark: #3730A3;
  --primary-light: #EEF0FF;
  --accent: #22D3EE;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #22D3EE;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(30, 41, 59, .06), 0 8px 24px rgba(79, 91, 255, .08);
  --shadow-hover: 0 4px 12px rgba(30, 41, 59, .08), 0 16px 40px rgba(79, 91, 255, .14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding: 28px 20px 48px; }

/* ===== 顶部导航 ===== */
.topbar {
  background: linear-gradient(135deg, #3730A3 0%, #22D3EE 55%, #22D3EE 100%);
  color: #fff;
  box-shadow: 0 2px 16px rgba(79, 91, 255, .35);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  backdrop-filter: blur(4px);
}
.brand .logo-img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: rgba(255,255,255,.18); }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.brand-slogan { font-size: 13px; opacity: .85; }

/* ===== 前台筛选工具条（分类 + 搜索） ===== */
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-tab {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.cat-tab:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cat-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(79, 91, 255, .3);
}
.search-bar { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; max-width: 420px; }
.search-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
  background: #f8fafc;
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 91, 255, .12); background: #fff; }
.btn-search {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}
.btn-search:hover { transform: translateY(-1px); opacity: .9; box-shadow: 0 6px 16px rgba(79, 91, 255, .3); }
.btn-clear {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.btn-clear:hover { color: var(--danger); border-color: var(--danger); }
@media (max-width: 640px) {
  .shop-toolbar { flex-direction: column; align-items: stretch; }
  .search-bar { max-width: none; }
}

/* ===== 商品列表 ===== */
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 20px; border-radius: 4px; background: linear-gradient(180deg, var(--primary), var(--accent)); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.product-thumb {
  background: linear-gradient(160deg, #f8f9ff, #eef0fb);
  height: 170px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.product-thumb .no-img { font-size: 42px; opacity: .35; }
.product-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.product-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; line-height: 1.4; }
.product-desc {
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 12px; flex: 1;
}
.product-bottom { display: flex; align-items: center; justify-content: space-between; }
.product-price { font-size: 20px; font-weight: 800; color: var(--danger); }
.product-price small { font-size: 13px; font-weight: 600; margin-right: 2px; }
.btn-detail {
  border: none; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--primary); background: var(--primary-light);
  padding: 8px 16px; border-radius: 10px;
  transition: transform .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.btn-detail:hover { background: var(--primary); color: #fff; }

/* ===== 商品详情 ===== */
.detail-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
.detail-top { display: grid; grid-template-columns: 380px 1fr; }
.detail-img {
  background: linear-gradient(160deg, #f8f9ff, #eef0fb);
  display: flex; align-items: center; justify-content: center;
  min-height: 360px; padding: 24px;
}
.detail-img img { width: 100%; height: 100%; max-height: 420px; object-fit: contain; image-rendering: pixelated; }
.detail-img .no-img { font-size: 72px; opacity: .3; }
.detail-info { padding: 28px 30px; display: flex; flex-direction: column; gap: 16px; }
.detail-title { font-size: 24px; font-weight: 800; }
.detail-desc { font-size: 14px; color: var(--text-muted); line-height: 1.8; }
.sku-label { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.sku-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.sku-item {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
  background: #fafbfe;
  position: relative;
}
.sku-item:hover { border-color: var(--primary); }
.sku-item.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(79, 91, 255, .15); }
.sku-item.selected::after {
  content: "✓"; position: absolute; top: 6px; right: 8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sku-item.sold-out { opacity: .55; cursor: not-allowed; background: #f8fafc; }
.sku-item.sold-out:hover { border-color: var(--border); }
.sku-name { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.sku-price { font-size: 16px; font-weight: 800; color: var(--danger); margin-bottom: 4px; }
.sku-stock { font-size: 12px; color: var(--text-muted); }
.sku-stock.empty { color: var(--danger); font-weight: 600; }
.btn-buy {
  border: none; cursor: pointer;
  width: 100%; padding: 15px;
  font-size: 17px; font-weight: 700; color: #fff;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 6px 20px rgba(79, 91, 255, .35);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.btn-buy:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(79, 91, 255, .45); }
.btn-buy:disabled { opacity: .55; cursor: not-allowed; }
.detail-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 18px; flex-wrap: wrap; }

/* ===== 订单页 ===== */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 560px;
  margin: 0 auto;
  overflow: hidden;
}
.order-head {
  padding: 20px 26px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8f9ff, #eef0fb);
}
.order-head h3 { font-size: 18px; font-weight: 800; }
.order-body { padding: 26px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px;
}
.badge-wait { background: #fef3c7; color: #b45309; }
.badge-paid { background: #dbeafe; color: #1d4ed8; }
.badge-done { background: #d1fae5; color: #047857; }
.badge-err  { background: #fee2e2; color: #b91c1c; }
.badge-expired { background: #e2e8f0; color: #475569; }

.info-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.info-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.info-row .k { color: var(--text-muted); }
.info-row .v { font-weight: 700; }
.info-row .v.amount { font-size: 22px; color: var(--danger); font-weight: 800; }
.info-row .v.trade { font-family: Consolas, Monaco, monospace; font-size: 13px; background: #f1f5f9; padding: 4px 10px; border-radius: 8px; }

.qr-box { text-align: center; padding: 18px 0 6px; }
.qr-img {
  width: 240px; height: 240px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 8px; background: #fff;
  object-fit: contain;
}
.qr-tip { font-size: 13px; color: var(--text-muted); margin: 14px 0 4px; line-height: 1.7; }
.qr-tip strong { color: var(--warning); }

/* 支付方式切换选项卡（支付宝 / 微信支付） */
.pay-tabs { display: flex; gap: 10px; margin-top: 16px; }
.pay-tab {
  flex: 1; padding: 10px 0; border-radius: 11px; cursor: pointer;
  border: 1.5px solid var(--border); background: #fff;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: transform .18s ease, border-color .18s ease, color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.pay-tab.active {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-light); box-shadow: 0 3px 10px rgba(79, 91, 255, .18);
}
.pay-tab[data-pay="wechat"].active {
  border-color: #22c55e; color: #16a34a; background: #f0fdf4;
  box-shadow: 0 3px 10px rgba(34, 197, 94, .2);
}
/* 产品详情页支付选择器（比订单页小一号） */
.pay-tabs-sm { gap: 8px; margin-bottom: 0; }
.pay-tab-sm { padding: 7px 0; font-size: 13px; border-radius: 9px; }

/* 微信付款备注短码展示 */
.wx-code-box { text-align: center; margin: 14px 0 4px; }
.wx-code-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.wx-code {
  display: inline-block; font-size: 28px; font-weight: 800; letter-spacing: 8px;
  color: #16a34a; background: #f0fdf4;
  border: 1.5px dashed #86efac; border-radius: 12px;
  padding: 8px 18px 8px 26px; margin-bottom: 10px;
}
.btn-sm { padding: 7px 16px; font-size: 13px; border-radius: 9px; }

/* 微信付款备注提示框 */
.wx-hint-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px;
  padding: 12px 14px; margin: 12px 0 4px; text-align: left;
}
.wx-hint-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.wx-hint-text { font-size: 13px; color: #92400e; line-height: 1.7; }
.wx-hint-text strong { color: #b45309; }

.btn-row { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.btn {
  border: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
  padding: 12px 20px; border-radius: 11px;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease, opacity .18s ease;
  flex: 1;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 4px 14px rgba(79, 91, 255, .3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79, 91, 255, .4); }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { transform: translateY(-1px); background: var(--primary-light); box-shadow: 0 4px 12px rgba(79, 91, 255, .15); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { transform: translateY(-1px); opacity: .92; }

.pay-url-box {
  margin-top: 16px; padding: 12px 14px;
  background: #f8fafc; border: 1px dashed var(--border);
  border-radius: 10px; font-size: 12px;
  word-break: break-all;
}
.pay-url-box a { color: var(--primary); text-decoration: none; }

.card-done {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
  border-radius: 14px;
  padding: 22px;
  margin-top: 8px;
}
.card-done h4 { font-size: 16px; font-weight: 800; color: #047857; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-field {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, .8);
  padding: 12px 16px; border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid #a7f3d0;
}
.card-field .f-label { font-size: 13px; color: #047857; font-weight: 600; }
.card-field .f-value { font-family: Consolas, Monaco, monospace; font-size: 14px; font-weight: 700; color: #065f46; word-break: break-all; text-align: right; margin-left: 12px; }
.btn-copy {
  border: none; cursor: pointer; font-size: 12px; font-weight: 700;
  background: #059669; color: #fff;
  padding: 6px 14px; border-radius: 8px;
  transition: background-color .15s ease, transform .15s ease; flex-shrink: 0; margin-left: 10px;
}
.btn-copy:hover { background: #047857; }
.btn-copy.copied { background: #34d399; }
.card-count-tip { font-size: 13px; color: #6b7280; margin-bottom: 12px; }
.card-block {
  border-radius: 12px; padding: 14px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid #a7f3d0; margin-bottom: 12px;
}
.card-block.multi { border-style: dashed; }
.card-block-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 700; color: #047857;
  margin-bottom: 10px;
}
.card-block-head .btn-copy { margin-left: 0; }

.paid-waiting { text-align: center; padding: 30px 10px; }
.paid-waiting .spinner { margin: 0 auto 16px; }
.paid-waiting p { color: var(--text-muted); font-size: 14px; line-height: 1.8; }

/* ===== 状态提示 ===== */
.alert { border-radius: 12px; padding: 14px 18px; font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

.page-loading { text-align: center; padding: 80px 0; color: var(--text-muted); }
.page-loading p { margin-top: 12px; font-size: 14px; }

.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(79, 91, 255, .07);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 80px 0; color: var(--text-muted); }
.empty-state .icon { font-size: 56px; margin-bottom: 14px; opacity: .4; }
.empty-state p { font-size: 15px; }

/* ===== 页脚 ===== */
.footer {
  text-align: center; padding: 22px;
  font-size: 13px; color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .detail-top { grid-template-columns: 1fr; }
  .detail-img { min-height: 240px; }
}
@media (max-width: 640px) {
  .brand-slogan { display: none; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .product-thumb { height: 130px; }
  .product-body { padding: 12px 14px; }
  .detail-img { min-height: 200px; }
  .detail-info { padding: 20px 22px; }
  .qr-img { width: 200px; height: 200px; }
}

/* ===== 图片放大查看 ===== */
.product-thumb img, .detail-img img, .qr-img { cursor: zoom-in; }
.product-thumb, .detail-img { position: relative; }
.product-thumb::after, .detail-img::after {
  content: '🔍 点击放大';
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(15, 23, 42, .55); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.product-thumb:hover::after, .detail-img:hover::after { opacity: 1; }
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .86);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; animation: lightboxIn .18s ease;
}
.lightbox img {
  max-width: 92vw; max-height: 90vh;
  min-width: min(420px, 88vw); min-height: min(320px, 55vh);
  image-rendering: pixelated; /* 小图放大时保持像素清晰 */
  object-fit: contain;
  border-radius: 10px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  cursor: zoom-out;
}
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 17px; cursor: pointer; line-height: 1;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }
.lightbox-caption {
  position: absolute; left: 0; right: 0; bottom: 22px;
  text-align: center; color: rgba(255, 255, 255, .85); font-size: 13px;
}
@keyframes lightboxIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== 二级商城横幅 ===== */
.mall-banner {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #1B1F6B, #3730A3);
  color: #fff; border-radius: 16px;
  padding: 18px 22px; margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .28);
}
.mall-banner-icon { font-size: 34px; }
.mall-banner-icon .logo-img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.mall-banner-name { font-size: 19px; font-weight: 800; }
.mall-banner-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mall-banner-announcement {
  font-size: 13px; line-height: 1.5; opacity: .92;
  background: rgba(255,255,255,.14); border-radius: 8px;
  padding: 6px 10px; max-width: 100%;
  word-break: break-word; white-space: pre-wrap;
}



/* ===== 售后悬浮按钮（右侧偏下） ===== */
.ticket-fab {
  position: fixed;
  right: 22px;
  bottom: 22%;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 54px;
  height: 54px;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F5BFF, #22D3EE);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(79, 91, 255, .4);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ticket-fab span { line-height: 1; }
.ticket-fab:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(79, 91, 255, .5); }
@media (max-width: 640px) {
  .ticket-fab { right: 14px; bottom: 18%; width: 48px; height: 48px; font-size: 11px; }
}

.brand-logo img { width: 100%; height: 100%; border-radius: 10px; display: block; }

/* ===== 顶栏右侧：账号区（登录 / 注册 / 余额 / 退出） ===== */
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.topbar-link { font-size: 14px; color: #fff; opacity: .92; text-decoration: none; white-space: nowrap; }
.topbar-link:hover { opacity: 1; text-decoration: underline; }
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 13px; line-height: 1; padding: 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); color: #fff; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .28);
  transition: background .15s ease;
}
.nav-chip:hover { background: rgba(255, 255, 255, .3); }
.nav-chip-bal { font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-btn {
  font-size: 13px; line-height: 1; padding: 9px 14px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .32);
  font-family: inherit; transition: background .15s ease, transform .15s ease;
}
.nav-btn:hover { background: rgba(255, 255, 255, .3); }
.nav-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.nav-btn-primary { background: #fff; color: var(--primary-dark); font-weight: 700; border-color: #fff; }
.nav-btn-primary:hover { background: #eef0ff; }
@media (max-width: 640px) {
  .topbar-inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 8px; }
  .brand-slogan { display: none; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .nav-chip, .nav-btn { padding: 7px 10px; font-size: 12.5px; }
}

/* ===== 登录 / 注册弹窗 ===== */
.sx-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .2s ease;
}
.sx-box {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .3); overflow: hidden;
  animation: sxIn .16s ease-out;
}
@keyframes sxIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sx-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sx-head h3 { font-size: 17px; font-weight: 800; }
.sx-close { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0 4px; }
.sx-close:hover { color: var(--danger); }
.sx-body { padding: 18px 20px 20px; }
.sx-field { margin-bottom: 14px; }
.sx-field label { display: block; font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 6px; }
.sx-field input {
  width: 100%; box-sizing: border-box; padding: 10px 13px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.sx-field input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(79, 91, 255, .14); }
.sx-hint { min-height: 18px; font-size: 13px; color: var(--danger); margin-bottom: 6px; word-break: break-word; }
.sx-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sx-btn {
  padding: 10px 20px; border: 0; border-radius: 10px; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 6px 16px rgba(79, 91, 255, .32); transition: transform .15s ease, opacity .15s ease;
}
.sx-btn:hover:not(:disabled) { transform: translateY(-1px); }
.sx-btn:disabled { opacity: .6; cursor: not-allowed; }
.sx-btn-ghost { padding: 10px 4px; border: 0; background: none; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--primary); font-weight: 600; }
.sx-btn-ghost:hover { text-decoration: underline; }
.sx-tip { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }
.sx-tip a { color: var(--primary); font-weight: 600; }

/* ===== 状态补齐：键盘焦点 / 按压 / 禁用 ===== */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.topbar :focus-visible, .lightbox :focus-visible { outline-color: #fff; }
[disabled], .disabled { opacity: .55; cursor: not-allowed; }
.btn-primary:active, .btn-success:active, .btn-search:active,
.btn-buy:active:not(:disabled), .sx-btn:active:not(:disabled),
.cat-tab:active, .sku-item:active, .pay-tab:active, .btn-detail:active { transform: scale(.97); }

/* ===== 入场动画 ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.product-grid .product-card { animation: fadeUp .45s cubic-bezier(.16, 1, .3, 1) backwards; }
.product-grid .product-card:nth-child(1) { animation-delay: 0ms; }
.product-grid .product-card:nth-child(2) { animation-delay: 24ms; }
.product-grid .product-card:nth-child(3) { animation-delay: 48ms; }
.product-grid .product-card:nth-child(4) { animation-delay: 72ms; }
.product-grid .product-card:nth-child(5) { animation-delay: 96ms; }
.product-grid .product-card:nth-child(6) { animation-delay: 120ms; }
.product-grid .product-card:nth-child(7) { animation-delay: 144ms; }
.product-grid .product-card:nth-child(8) { animation-delay: 168ms; }
.product-grid .product-card:nth-child(9) { animation-delay: 192ms; }
.product-grid .product-card:nth-child(10) { animation-delay: 216ms; }
.product-grid .product-card:nth-child(11) { animation-delay: 240ms; }
.product-grid .product-card:nth-child(12) { animation-delay: 264ms; }
.product-grid .product-card:nth-child(n + 13) { animation-delay: 0ms; }

/* ===== 触控目标 ===== */
.btn, .sx-btn { min-height: 44px; }

/* ===== 动效降级 ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
/* ===== 细节增强层（第二轮 · 纯 CSS） ===== */

/* 1. 自定义滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(79, 91, 255, .35); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 91, 255, .55); }

/* 2. 表单 focus 发光环（已有专用环优先级更高，天然不双环） */
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(79, 91, 255, .18); }

/* 3. 按钮微交互：按压收缩（覆盖第一轮 .97 → .96；限交互控件，避免裸 :active 波及 body/遮罩等祖先元素） */
button:active, a:active, .cat-tab:active, .sku-item:active, .pay-tab:active { transform: scale(.96); }
.btn-primary:active, .btn-success:active, .btn-search:active,
.btn-buy:active:not(:disabled), .sx-btn:active:not(:disabled),
.cat-tab:active, .sku-item:active, .pay-tab:active, .btn-detail:active { transform: scale(.96); }

/* 4. 商品卡 hover 内发光（保留既有 translateY 上浮） */
.product-card:hover {
  border-color: rgba(79, 91, 255, .5);
  box-shadow: inset 0 0 0 1px rgba(79, 91, 255, .08), 0 12px 32px rgba(79, 91, 255, .14);
}

/* 5. 骨架 shimmer（SPA 初始加载容器 .page-loading） */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.page-loading {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.6s infinite;
}

/* 6. 弹窗入场：.sx-box 已有 sxIn（.16s ease-out）、.sx-mask 已有 fadeIn（.2s ease），按纪律跳过避免双动画 */
/* 7. 表格 zebra + 行 hover：shop 页（CSS/JS）无 table/.sx-table 类，跳过 */

/* 8. 主题切换过渡 */
body { transition: background-color .3s ease, color .3s ease; }

/* 9. 动效降级：并入既有 reduced-motion 兜底（原 631 行 * 规则已全局关动画/过渡，此处显式收口新挂点） */
@media (prefers-reduced-motion: reduce) {
  .page-loading, body { animation: none !important; transition: none !important; }
  .page-loading { background-image: none; }
}
