:root {
  --brand: #bd315d;
  --brand-soft: #fff2f6;
  --line: #e3e4e8;
  --text: #30323a;
  --muted: #8b8e97;
  --green: #16854e;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f6f6f7;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: #f6f6f7;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 9px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid #efb3c3;
}

.brandMark {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  background: transparent;
  font-weight: 800;
  font-size: 18px;
  isolation: isolate;
}

.brandMark::before,
.brandMark::after {
  position: absolute;
  inset: 5px;
  z-index: -1;
  content: "";
  background: var(--brand);
}

.brandMark::before {
  opacity: 0.72;
  transform: rotate(45deg);
}

.brandMark::after {
  opacity: 0.86;
}

.smallButton {
  flex: 0 0 auto;
  height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--brand);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.searchBox {
  flex: 1;
  min-width: 0;
  height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 2px solid var(--brand);
  border-radius: 24px;
  background: #fff;
}

.searchIcon {
  color: var(--brand);
  font-size: 22px;
  line-height: 1;
}

.searchBox input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
}

.cartButton {
  display: none;
}

.categoryBar {
  position: sticky;
  top: 66px;
  z-index: 4;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px clamp(12px, 3vw, 26px) 10px;
  background: #fff;
  scrollbar-width: none;
}

.categoryBar::-webkit-scrollbar,
.thumbRow::-webkit-scrollbar {
  display: none;
}

.categoryButton {
  flex: 0 0 auto;
  min-width: 72px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: #565a64;
  background: #fff;
}

.categoryButton.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 14px;
  font-weight: 700;
}

.resultMeta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(12px, 3vw, 26px);
  color: var(--muted);
  font-size: 13px;
}

.productGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0 clamp(10px, 3vw, 24px) 96px;
}

.productCard {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  text-align: left;
  box-shadow: 0 2px 8px rgba(33, 35, 42, 0.035);
}

.productImageWrap {
  position: relative;
  aspect-ratio: 1.5;
  display: grid;
  place-items: center;
  background: #fff;
}

.productImageWrap img {
  width: 94%;
  height: 82%;
  object-fit: contain;
}

.badgeRow {
  position: absolute;
  left: 8px;
  top: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag {
  padding: 2px 7px;
  border-radius: 12px;
  color: #fff;
  background: #ffb800;
  font-size: 11px;
  font-weight: 800;
}

.newTag {
  padding: 2px 7px;
  border-radius: 12px;
  color: #fff;
  background: #16854e;
  font-size: 11px;
  font-weight: 800;
}

.productInfo {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3px 12px 9px;
  text-align: center;
}

.code {
  display: block;
  color: #a1a4ab;
  font-size: 10.5px;
  line-height: 1.3;
}

.name {
  min-height: 32px;
  display: -webkit-box;
  overflow: hidden;
  margin: 1px 0 0;
  color: #444853;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.priceRow {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
}

.priceGroup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.price {
  color: var(--green);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.1;
}

.priceTag {
  flex: 0 0 auto;
  padding: 2px 6px 3px;
  border-radius: 10px;
  color: #fff;
  background: #ffb800;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.emptyState {
  padding: 90px 16px;
  color: var(--muted);
  text-align: center;
}

.loadingState {
  grid-column: 1 / -1;
  padding: 110px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.bottomNav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 68px;
  border-top: 1px solid #efb3c3;
  background: rgba(255, 255, 255, 0.98);
}

.navItem {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  color: #a0a3aa;
  background: transparent;
  font-size: 11.5px;
}

.navItem.active {
  color: var(--brand);
  font-weight: 800;
}

.navIcon {
  width: 22px;
  height: 22px;
  display: block;
}

.navIcon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

dialog {
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(22, 24, 30, 0.35);
}

.detailDialog {
  width: min(960px, 100vw);
  height: min(920px, 100vh);
}

.detailContent {
  height: 100%;
  overflow-y: auto;
  background: #fff;
}

.detailHeader {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid #ececf0;
  background: #fff;
}

.detailHeader h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--brand);
  font-size: clamp(17px, 3.2vw, 25px);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.closeButton,
.closeInfo {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  color: #74767c;
  background: transparent;
  font-size: 38px;
  line-height: 1;
}

.heroStage {
  position: relative;
  height: min(54vh, 500px);
  min-height: 290px;
  display: grid;
  place-items: center;
  background: #fff;
}

.heroStage img,
.heroVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.heroVideo {
  display: block;
  background: #fff;
}

.imageStep {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 44px;
  height: 58px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(48, 50, 58, 0.36);
  font-size: 44px;
  line-height: 1;
  transform: translateY(-50%);
}

.imageStep.prev {
  left: 10px;
}

.imageStep.next {
  right: 10px;
}

.thumbRow {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 13px 16px 16px;
  border-bottom: 1px solid #e0e1e5;
  scrollbar-width: none;
}

.thumbButton {
  flex: 0 0 82px;
  height: 74px;
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f7f7f8;
}

.thumbButton.active {
  border-color: var(--brand);
}

.thumbButton img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.videoBadge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 10px;
  color: #fff;
  background: rgba(189, 49, 93, 0.92);
  font-size: 11px;
  font-weight: 800;
}

.detailActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid #e0e1e5;
}

.detailPrice {
  color: var(--green);
  font-size: 22px;
  font-weight: 900;
}

.detailTag {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  color: #fff;
  background: #ffb800;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.detailTag:empty {
  display: none;
}

.heartButton {
  width: 42px;
  height: 42px;
  border: 0;
  color: #d73651;
  background: transparent;
  font-size: 34px;
}

.specGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 18px;
  margin: 0;
  padding: 18px 16px 30px;
  font-size: 14px;
}

.specItem {
  min-width: 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 7px;
  line-height: 1.45;
}

.specItem.wide {
  grid-column: 1 / -1;
}

.specItem dt {
  color: var(--brand);
  font-weight: 800;
}

.specItem dd {
  min-width: 0;
  margin: 0;
  word-break: break-word;
}

.infoDialog {
  width: min(420px, calc(100vw - 32px));
}

.infoContent {
  position: relative;
  padding: 28px 24px 24px;
  border-radius: 8px;
  background: #fff;
}

.infoContent h2 {
  margin: 0 40px 12px 0;
  color: var(--brand);
  font-size: 22px;
}

.infoContent p {
  margin: 0;
  color: #4f5360;
  line-height: 1.7;
}

.closeInfo {
  position: absolute;
  top: 8px;
  right: 8px;
}

@media (min-width: 720px) {
  .productGrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .productGrid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 9px;
    min-height: 62px;
    padding: 8px 12px;
  }

  .brandMark {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }

  .smallButton {
    display: none;
  }

  .searchBox {
    height: 42px;
    padding: 0 12px;
  }

  .cartButton {
    display: none;
  }

  .categoryBar {
    top: 62px;
  }

  .productGrid {
    gap: 10px;
    padding-inline: 10px;
  }

  .productInfo {
    padding-left: 12px;
  }

  .specGrid {
    grid-template-columns: 1fr;
  }
}
