/* Shopafar store — brand: purple #6A28A0, orange #F07818 */
:root {
  --purple: #6A28A0;
  --purple-dark: #4E1D7A;
  --orange: #F07818;
  --lav: #F2ECF8;
  --ink: #222222;
  --gray: #666666;
  --hair: #E7DEF1;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #FBFAFD;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--hair);
  padding-top: 6px;
}
.topbar::before {
  content: ""; display: block; height: 6px;
  background: var(--purple);
  margin: -6px 0 0;
}
.topbar-inner {
  display: flex; align-items: center; gap: 12px;
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
}
.logo { height: 44px; width: auto; }
.search-wrap {
  flex: 1; position: relative; max-width: 460px;
}
.search-icon {
  position: absolute; left: 12px; top: 50%;
  width: 18px; height: 18px; transform: translateY(-50%);
  color: var(--purple); opacity: .7; pointer-events: none;
}
#search {
  width: 100%; padding: 10px 12px 10px 38px;
  border: 2px solid var(--hair); border-radius: 999px;
  font-size: 15px; outline: none; background: #FBFAFD;
}
#search:focus { border-color: var(--purple); background: #fff; }

.cats-wrap { position: relative; }
.cats-wrap::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 42px;
  background: linear-gradient(to right, rgba(255,255,255,0), #fff 85%);
  pointer-events: none; opacity: 0; transition: opacity .25s;
}
.cats-wrap.scrollable:not(.at-end)::after { opacity: 1; }

.chips-wrap { position: relative; }
.chips-wrap::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 42px;
  background: linear-gradient(to right, rgba(255,255,255,0), #fff 85%);
  pointer-events: none; opacity: 0; transition: opacity .25s;
}
.chips-wrap.scrollable:not(.at-end)::after { opacity: 1; }

.cats {
  display: flex; gap: 8px;
  padding: 8px 16px 0; max-width: 1100px; margin: 0 auto;
  overflow-x: auto; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto;
  padding: 8px 18px; border-radius: 10px 10px 0 0;
  border: none; border-bottom: 3px solid transparent;
  background: none; font-size: 14.5px; font-weight: 700; color: var(--gray);
}
.cat.active { color: var(--purple); border-bottom-color: var(--orange); }

.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 8px 16px 10px; max-width: 1100px; margin: 0 auto;
  scrollbar-width: none; border-top: 1px solid var(--hair);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 16px; border-radius: 999px;
  border: 1.5px solid var(--hair); background: #fff;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap;
}
.chip.active { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ---------- grid ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 32px; }
.result-line { font-size: 13px; color: var(--gray); padding: 4px 2px 10px; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.card {
  background: #fff; border: 1px solid var(--hair);
  border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease;
}
.card:active { transform: scale(.985); }
@media (hover: hover) {
  .card:hover { box-shadow: 0 6px 20px rgba(106, 40, 160, .13); }
}
.card-img {
  position: relative; aspect-ratio: 1; background: #fff;
  padding: 14px;
}
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.card-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--hair);
}
.card-dots span.on { background: var(--orange); }
.card-body { padding: 10px 12px 14px; border-top: 1px solid var(--hair); }
.card-brand { font-size: 11px; font-weight: 700; letter-spacing: .8px; color: var(--orange); text-transform: uppercase; }
.card-model {
  font-size: 14.5px; font-weight: 700; margin: 3px 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.5em;
}
.card-colors { font-size: 12px; color: var(--gray); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.card-price .rmb { font-size: 18px; font-weight: 800; color: var(--purple); }
.card-price .alt { font-size: 11.5px; color: var(--gray); }

/* ---------- footer ---------- */
.footer-band {
  background: var(--orange); color: #fff; text-align: center;
  padding: 28px 16px 34px;
}
.footer-band h2 { font-size: 24px; letter-spacing: 2px; margin-bottom: 10px; }
.foot-contact { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.footer-band p { font-size: 14px; }
.qrs { display: flex; justify-content: center; gap: 18px; margin: 16px 0 10px; }
.qrs figure { width: 96px; }
.qrs img { width: 100%; border-radius: 8px; background: #fff; padding: 4px; }
.qrs figcaption { font-size: 12px; margin-top: 4px; }
.foot-note { font-size: 12px; opacity: .9; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 8, 35, .55); }
.modal-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, 94vw); max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 18px;
}
.modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 5;
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: var(--lav); color: var(--purple); font-size: 22px; line-height: 1;
}
.gallery { position: relative; background: #fff; padding: 26px 52px 30px; }
.gal-viewport { height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gal-viewport img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; touch-action: pan-y; }
.gal-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--lav); color: var(--purple); font-size: 26px; line-height: 1;
}
.gal-nav.prev { left: 8px; }
.gal-nav.next { right: 8px; }
.gal-nav[disabled] { opacity: .35; cursor: default; }
.gal-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.gal-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--hair); }
.gal-dots span.on { background: var(--orange); }
.modal-body { padding: 6px 22px 24px; }
.m-brand { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; color: var(--orange); text-transform: uppercase; }
.m-model { font-size: 23px; font-weight: 800; color: var(--purple); margin: 2px 0 6px; }
.m-colors { font-size: 13.5px; color: var(--gray); margin-bottom: 10px; }
.color-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.color-chips button {
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1.5px solid var(--hair); background: #fff;
}
.color-chips button.on { border-color: var(--purple); background: var(--lav); color: var(--purple); }
.variant-list { display: flex; flex-direction: column; gap: 8px; }
.variant {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--hair); border-radius: 12px; padding: 9px 12px;
  background: #FBFAFD;
}
.variant .v-label { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.variant .v-prices { text-align: right; line-height: 1.25; }
.variant .v-rmb { font-size: 16.5px; font-weight: 800; color: var(--purple); }
.variant .v-alt { font-size: 11px; color: var(--gray); }
.variant .v-order {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  background: #25D366; color: #fff; border: none; border-radius: 999px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; text-decoration: none;
}
.variant .v-order svg { width: 15px; height: 15px; fill: currentColor; }
.variant .v-order.wa { background: #25D366; }
.variant .v-order.wc { background: #07C160; cursor: pointer; font-family: inherit; }
.variant .v-actions { flex: 0 0 auto; display: inline-flex; gap: 6px; }
@media (max-width: 560px) {
  .variant { flex-wrap: wrap; }
  .variant .v-label { flex: 1 1 100%; white-space: normal; }
  .variant .v-prices { text-align: left; flex: 1; }
  .variant .v-actions { flex: 1 1 100%; }
  .variant .v-order { flex: 1; justify-content: center; }
}

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  max-width: min(92vw, 460px); background: #221a2e; color: #fff;
  padding: 13px 18px; border-radius: 12px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(20, 10, 40, .35);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  z-index: 999;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.m-spec {
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
  background: var(--lav); border-radius: 10px;
  padding: 10px 13px; margin-bottom: 12px;
}
.m-ref { font-size: 12.5px; color: var(--gray); margin-bottom: 10px; }
.m-ref strong { color: var(--purple); }
.m-note { font-size: 12px; color: var(--gray); margin-top: 14px; }

.empty {
  grid-column: 1 / -1; text-align: center; color: var(--gray);
  padding: 60px 0; font-size: 15px;
}

/* ---------- home page ---------- */
.hero {
  text-align: center;
  padding: 34px 16px 26px;
  background: linear-gradient(160deg, #fff 0%, var(--lav) 60%, #FBE9DA 100%);
  border-bottom: 1px solid var(--hair);
}
.hero-logo { height: 74px; margin: 0 auto 12px; }
.hero h1 {
  font-size: 1.65rem; color: var(--purple-dark);
  margin-bottom: 8px; letter-spacing: 0.2px;
}
.hero-sub { color: var(--gray); font-size: 0.95rem; line-height: 1.55; }
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 11px 22px;
  background: var(--purple); color: #fff;
  border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.98rem;
}
.hero-cta svg { width: 18px; height: 18px; fill: #fff; }
.hero-cta:hover { background: var(--purple-dark); }
.hero-ctas { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hero-cta.wa { background: #25D366; }
.hero-cta.wa:hover { background: #1eb856; }
.hero-cta.wc { background: #07C160; border: none; cursor: pointer; font-family: inherit; }
.hero-cta.wc:hover { background: #06a854; }

.tiles {
  max-width: 1100px; margin: 22px auto; padding: 0 16px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.tile {
  display: flex; flex-direction: column; text-align: left;
  background: #fff; border: 1px solid var(--hair); border-radius: var(--radius);
  overflow: hidden; padding: 0;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.tile:hover { box-shadow: 0 6px 18px rgba(78, 29, 122, 0.14); transform: translateY(-2px); }
.tile-img {
  display: block; height: 150px; background: #fff;
  border-bottom: 1px solid var(--hair);
}
.tile-img img { width: 100%; height: 100%; object-fit: contain; }
.tile-body { padding: 10px 14px 12px; display: block; }
.tile-body h3 { font-size: 1rem; color: var(--purple-dark); margin-bottom: 3px; }
.tile-body p { font-size: 0.82rem; color: var(--gray); }

.qr-panel { text-align: center; padding: 26px 16px 34px; }
.qr-panel h2 { color: var(--purple-dark); font-size: 1.25rem; margin-bottom: 14px; }
.qrs.big { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; }
.qrs.big figure { margin: 0; }
.qrs.big img {
  width: 150px; height: 150px; padding: 8px; background: #fff;
  border: 1px solid var(--hair); border-radius: var(--radius);
}
.qrs.big figcaption { margin-top: 7px; font-size: 0.85rem; color: var(--gray); }
.qr-panel .hero-sub { margin-top: 16px; }

.ship-panel { margin: 6px 14px 18px; padding: 18px 20px; background: #fff;
  border: 1px solid var(--hair); border-radius: var(--radius); }
.ship-panel h2 { color: var(--purple-dark); font-size: 1.15rem; margin-bottom: 10px; }
.ship-panel ul { margin: 0; padding-left: 20px; }
.ship-panel li { font-size: 0.9rem; color: #333; margin-bottom: 7px; line-height: 1.45; }
.ship-panel li strong { color: var(--purple-dark); }
.ship-panel li:last-child { margin-bottom: 0; }

@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile-img { height: 110px; }
  .hero h1 { font-size: 1.3rem; }
  .qrs.big img { width: 118px; height: 118px; }
  .qrs.big { gap: 16px; }
}
