:root {
  color-scheme: light;
  --brand: #aa3032;
  --brand-deep: #98262a;
  --brand-soft: #c33a3d;
  --page: #e9eef3;
  --card: #ffffff;
  --text: #151515;
  --muted: #73767a;
  --line: #e4e8ec;
  --price: #df3337;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--text);
}

button { font: inherit; }

.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--page);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgb(0 0 0 / 8%);
}

.brand-logo {
  display: block;
  width: 66%;
  height: 64px;
  margin: 0 auto;
  padding: 18px 0 14px;
  object-fit: contain;
}

.filter-bar {
  display: flex;
  gap: 5px;
  padding: 0 6px 6px;
  overflow: hidden;
}

.category-button,
.brand-tab {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: var(--brand-soft);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.category-button {
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.category-arrow { font-size: 12px; transition: transform .18s ease; }
.category-button[aria-expanded="true"] .category-arrow { transform: rotate(180deg); }

.brand-tabs {
  min-width: 0;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.brand-tabs::-webkit-scrollbar { display: none; }

.brand-tab {
  flex: 0 0 62px;
  padding: 0 8px;
  cursor: pointer;
  scroll-snap-align: start;
}

.brand-tab[aria-pressed="true"], .category-button.is-filtered { background: var(--brand-deep); }

.category-menu {
  position: absolute;
  inset: 100% 0 auto;
  padding: 5px 28px 12px;
  background: var(--brand);
  box-shadow: 0 12px 24px rgb(78 10 12 / 22%);
}

.category-menu button {
  width: 100%;
  min-height: 54px;
  padding: 12px 2px;
  border: 0;
  border-bottom: 1px solid rgb(255 255 255 / 16%);
  background: transparent;
  color: #fff;
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.category-menu button:last-child { border-bottom: 0; }
.category-menu button[aria-pressed="true"] { color: #ffd8d9; }

main { padding: 6px; }

.status-line {
  height: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.product-card {
  min-width: 0;
  overflow: hidden;
  border-radius: 7px;
  background: var(--card);
}

.product-image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
}

.product-image {
  position: absolute;
  inset: 10px;
  display: block;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: contain;
}

.product-copy {
  margin: 0 7px;
  padding: 9px 0 10px;
  border-top: 1px solid var(--line);
}

.product-name {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-path {
  padding: 5px 3px 10px;
  color: var(--brand-deep);
  font-size: 14px;
  line-height: 1.5;
}

.filter-path[hidden] { display: none; }

.reset-category {
  padding: 10px 16px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: white;
  color: var(--brand);
  cursor: pointer;
}
.reset-category:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.product-spec {
  margin: 5px 0 0px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.product-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  color: var(--price);
  line-height: 1.15;
  white-space: nowrap;
}

.currency { font-size: 14px; }
.product-price strong { font-size: 25px; font-weight: 600; }
.price-unit { font-size: 14px; font-weight: 700; }
.divider { display: none; }
.unit-price { color: var(--muted); font-size: 12px; margin-left: 3px; }

html[data-price-mode="hide"] .product-price { display: none; }


.empty-state {
  grid-column: 1 / -1;
  padding: 48px 20px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-size: 16px;
}

@media (max-width: 360px) {
  .brand-logo { height: 60px; }
  .filter-bar { gap: 6px; padding-inline: 7px; }
  .category-button { flex-basis: 60px; }
  .brand-tab { flex-basis: 62px; padding-inline: 8px; }
  main { padding: 7px; }
  .product-grid { gap: 6px; }
  .product-copy { margin-inline: 8px; }
  .divider { margin-inline: 4px; }
}

button:focus-visible { outline: 2px solid white; outline-offset: -4px; }
.category-menu { max-height: calc(100dvh - 110px); overflow-y: auto; }

@media (min-width: 721px) {
  body { border-inline: 1px solid #dfe4e9; }
}
