:root {
  --primary: #1ea7ff;
  --primary-soft: #eaf7ff;
  --text: #1f2430;
  --muted: #8a94a6;
  --border: #eef1f6;
  --bg: #f5f7fb;
  --card: #ffffff;
  --danger: #ff6a55;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.06);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  min-width: 320px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
}

.page {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 13px 90px;
  position: relative;
}

.page-top {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px;
  padding: 14px 16px 12px;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1,
.topbar h2,
.section-title,
.card-title {
  margin: 0;
}

.back-btn,
.icon-btn {
  width: 40px;
  height: 40px;
  min-width: 36px;
  min-height: 36px;
  max-width: 44px;
  max-height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.back-btn svg {
  width: 22px;
  height: 22px;
  stroke: #1ea7ff;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  height: 42px;
  padding: 0 14px;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.carousel {
  margin-top: 8px;
  position: relative;
}

.carousel-track {
  position: relative;
  height: 172px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.carousel-slide {
  position: absolute;
  inset: 0;
  padding: 22px;
  color: #fff;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.carousel-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(17, 26, 41, 0.22) 0%, rgba(17, 26, 41, 0.05) 100%);
}

.carousel-slide.active {
  opacity: 1;
  transform: scale(1);
}

.carousel-content {
  position: relative;
  z-index: 1;
  max-width: 72%;
}

.carousel-content small {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.carousel-content h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.carousel-content p {
  margin: 0;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
}

.carousel-dots {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.carousel-dot.active {
  width: 18px;
  border-radius: 999px;
  background: #fff;
}

.section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head a,
.muted {
  color: var(--muted);
}

.quick-grid,
.tool-list,
.order-grid,
.category-grid {
  display: grid;
  gap: 12px;
}

.quick-grid {
  grid-template-columns: repeat(4, 1fr);
}

.quick-item,
.order-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}

.quick-icon,
.order-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 20px;
}

.card,
.panel,
.my-card,
.list-card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  overflow: hidden;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-info {
  padding: 10px;
}

.product-title {
  min-height: 42px;
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.4;
}

.product-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f7ff;
  color: var(--primary);
  font-size: 12px;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-size: 16px;
  font-weight: 600;
  color: var(--danger);
}

.sales {
  font-size: 12px;
  color: var(--muted);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #646e80;
  font-size: 12px;
}

.tabbar a.active {
  color: var(--primary);
}

.tab-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-layout {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 10px;
  margin-top: 16px;
}

.category-nav,
.category-panel {
  min-height: calc(100vh - 170px);
}

.category-nav {
  padding: 8px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.category-tab {
  display: block;
  width: 100%;
  padding: 13px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  color: #546072;
  cursor: pointer;
  font-size: 14px;
}

.category-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.category-panel {
  padding: 14px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.category-cover {
  padding: 13px 15px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f2f8ff 0%, #eafaf6 100%);
  margin-bottom: 16px;
}

.category-cover h3 {
  margin: 0 0 6px;
}

.category-panel-head {
  margin-bottom: 14px;
}

.category-panel-head h3 {
  margin: 0 0 6px;
}

.category-products {
  display: grid;
  gap: 12px;
}

.category-product {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 18px;
  background: #f8fbff;
}

.category-product img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
}

/* 分类项信息区域，左侧为文本信息，右侧为购买按钮 */
.category-product .category-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.category-product .category-meta h4 {
  margin: 0;
  font-size: 14px;
}
.category-product .meta-footer {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}
.category-product .info-left .meta-row,
.category-product .category-meta .meta-row {
  margin-bottom: 0;
}

.category-product h4 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
}

.category-product .sales {
  margin: 4px 0 8px;
}

.buy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 14px 0;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  color: #657085;
  box-shadow: var(--shadow);
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
}

.list-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.list-card img {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  object-fit: cover;
}

.list-body {
  flex: 1;
  display: block;
}

.list-body h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  line-height: 1.4;
}

/* 将价格与销量包裹在 .meta-row 内使用 flex 左右对齐 */
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.my-hero {
  margin: 0 -16px;
  padding: 28px 16px 22px;
  background: linear-gradient(180deg, #e8f7ff 0%, #f6fbff 58%, #f5f7fb 100%);
}

.my-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 12px 26px;
}

.avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.7);
}

.my-name {
  font-size: 24px;
  font-weight: 700;
}

.my-card {
  padding: 22px 18px;
  margin-bottom: 16px;
}

.order-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.order-item {
  padding: 0;
  box-shadow: none;
  background: transparent;
}

.order-item .order-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow: inset 0 0 0 1px rgba(30, 167, 255, 0.08);
}

.order-item .order-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.order-item:nth-child(1) .order-icon {
  color: #25a6ff;
}

.order-item:nth-child(2) .order-icon {
  color: #4f8dff;
}

.order-item:nth-child(3) .order-icon {
  color: #2bb6a8;
}

.order-item:nth-child(4) .order-icon {
  color: #8c6cff;
}

.order-item:nth-child(5) .order-icon {
  color: #ff8f4a;
}

.order-item span {
  display: block;
  font-size: 12px;
  color: #4d5667;
}

.tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.tool-item:last-child {
  border-bottom: 0;
}

.chevron {
  color: #9aa3b2;
  font-size: 22px;
}

.login-wrap {
  padding-top: 30px;
}

.login-panel,
.text-panel {
  padding: 24px 20px;
}

.login-panel h1,
.text-panel h1 {
  margin: 0 0 10px;
  font-size: 30px;
}

.login-panel p,
.text-panel p,
.text-panel li {
  color: #5c6679;
  line-height: 1.8;
}

.text-panel img {
  max-width: 100%;
  height: auto !important;
  display: block;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.input,
.textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f9fbff;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 10px;
}

.btn,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.btn.ghost,
.link-btn.ghost {
  background: #eef7ff;
  color: var(--primary);
}

.list-body .price,
.category-product .price {
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
}
.list-body .sales,
.category-product .sales {
  font-size: 12px;
  color: var(--muted);
}

.empty-box {
  padding: 36px 18px;
  text-align: center;
  color: #6f798b;
}

.meta-list {
  display: grid;
  gap: 12px;
}

.meta-item {
  padding: 16px;
  border-radius: 16px;
  background: #f8fbff;
}

.meta-item strong {
  display: block;
  margin-bottom: 8px;
}

.text-panel h2 {
  margin-top: 24px;
  margin-bottom: 10px;
}

.text-panel ul {
  margin: 0;
  padding-left: 18px;
}

.footer-space {
  height: 12px;
}

@media (max-width: 380px) {
  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid,
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-grid {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 14px;
  }

  .category-layout {
    grid-template-columns: 82px 1fr;
  }
}

/* 详情页专用样式 */
.product-detail .price { font-size: 22px; }
.product-detail .sales { font-size: 12px; color: var(--muted); }
.product-detail .meta-list { grid-template-columns: 1fr; }

.detail-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid var(--border);
  z-index: 40;
  box-shadow: 0 -6px 20px rgba(31,36,48,0.04);
}

.footer-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  color: #4b5563;
  text-decoration: none;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.footer-order {
  min-width: 140px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* 轮播在详情页的高度调整 */
.carousel-track { height: 300px; border-radius: 16px; }
.carousel-slide { padding: 0; }

@media (max-width: 380px) {
  .carousel-track { height: 240px; }
  .footer-btn { font-size: 13px; }
  .footer-order { min-width: 120px; }
}

/* SKU 弹窗样式 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
  padding: 18px;
}
.sku-dialog {
  width: 100%;
  max-width: 680px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(31,36,48,0.12);
}
.sku-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
}
.sku-body { padding: 12px 16px; max-height: 320px; overflow: auto; }
.sku-option-group { margin-bottom:12px; }
.sku-option-group h4 { margin:0 0 8px; font-size:14px; }
.sku-options { display:flex; gap:8px; flex-wrap:wrap; }
.sku-option { padding:8px 12px; border-radius:10px; background:#f7f9fc; border:1px solid transparent; cursor:pointer; color:#344155; }
.sku-option.active { background:var(--primary); color:#fff; border-color:transparent; }
.sku-footer { display:flex; gap:12px; align-items:center; padding:12px 16px; border-top:1px solid var(--border); }
.sku-footer .btn { min-width:160px; }

/* 调整详情页底部内边距，防止遮挡内容 */
.page { padding-bottom: 120px; }

/* 按示例图调整 SKU 弹窗布局和样式 */
.sku-dialog { padding-bottom: 0; }
.sku-top { display:flex; gap:12px; padding:16px; border-bottom:1px solid var(--border); align-items:center; }
.sku-thumb { width:72px; height:72px; border-radius:8px; overflow:hidden; flex:0 0 72px; }
.sku-thumb img { width:100%; height:100%; object-fit:cover; }
.sku-info { flex:1; display:flex; flex-direction:column; gap:6px; }
.sku-price { color:var(--danger); font-size:18px; font-weight:700; }
.sku-stock { color:#6f798b; font-size:13px; }
.spec-selected { margin-top:6px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.spec-pick { display:inline-block; padding:8px 12px; border-radius:18px; background:#eaf7ff; color:var(--primary); font-size:13px; }
.sku-body { padding:12px 16px; }
.sku-option { padding:8px 12px; border-radius:18px; background:#f1f7ff; color:var(--primary); border:1px solid rgba(30,167,255,0.12); }
.sku-option.active { background:var(--primary); color:#fff; }
.sku-meta-row { display:flex; gap:12px; margin:10px 0; align-items:center; }
.meta-label { color:#7f8a9a; font-size:13px; min-width:72px; }
.qty-control { display:flex; align-items:center; gap:8px; }
.qty-control button { width:34px; height:34px; border-radius:50%; border:1px solid var(--border); background:#fff; color:#55606b; font-size:18px; line-height:1; display:inline-flex; align-items:center; justify-content:center; }
.qty-control input { width:60px; height:34px; border-radius:18px; border:1px solid var(--border); text-align:center; }
.sku-confirm { width:100%; padding:12px 16px; border-radius:24px; background:var(--primary); color:#fff; font-weight:700; border:0; }
.sku-footer { padding:12px 16px 18px; border-top:0; }
