:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #6d6a67;
  --line: #ece7e1;
  --paper: #fffdfb;
  --soft: #f7f0e8;
  --accent: #e7334c;
  --accent-2: #0f8f7a;
  --gold: #b78a35;
  --shadow: 0 18px 48px rgba(42, 26, 16, 0.14);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #ebe7e2;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 22px 80px rgba(0, 0, 0, 0.18);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 253, 251, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand img {
  width: 34px;
  height: 34px;
}

.icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.scan-icon,
.bell-icon,
.magnifier,
.nav-home,
.nav-grid,
.nav-spark,
.nav-bag,
.nav-user {
  display: block;
  width: 19px;
  height: 19px;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.scan-icon {
  mask-image: linear-gradient(#000 0 0);
  background:
    linear-gradient(currentColor 0 0) left top / 7px 2px no-repeat,
    linear-gradient(currentColor 0 0) left top / 2px 7px no-repeat,
    linear-gradient(currentColor 0 0) right top / 7px 2px no-repeat,
    linear-gradient(currentColor 0 0) right top / 2px 7px no-repeat,
    linear-gradient(currentColor 0 0) left bottom / 7px 2px no-repeat,
    linear-gradient(currentColor 0 0) left bottom / 2px 7px no-repeat,
    linear-gradient(currentColor 0 0) right bottom / 7px 2px no-repeat,
    linear-gradient(currentColor 0 0) right bottom / 2px 7px no-repeat;
}

.bell-icon {
  mask-image: radial-gradient(circle at 50% 84%, transparent 0 2px, #000 2.2px 4px, transparent 4.3px), radial-gradient(ellipse at 50% 45%, #000 0 9px, transparent 9.3px);
}

.magnifier {
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: transparent;
  mask-image: none;
}

.magnifier::after {
  content: "";
  position: absolute;
}

.search-strip {
  padding: 8px 16px 12px;
}

.search-strip label {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #8a8580;
}

.search-strip input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.hero {
  min-height: 222px;
  margin: 0 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 8px;
  color: #fff;
  background:
    radial-gradient(circle at 78% 27%, rgba(255, 255, 255, 0.86) 0 2px, transparent 2.5px),
    linear-gradient(132deg, rgba(17, 17, 17, 0.92) 0 42%, rgba(17, 17, 17, 0.45) 72%),
    url("data:image/svg+xml,%3Csvg width='900' height='520' viewBox='0 0 900 520' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='900' height='520' fill='%23d68b70'/%3E%3Cpath d='M520 80c90-25 185 12 214 95 27 77-12 162-96 207-84 44-213 46-293-8-78-53-106-153-52-219 42-52 124-54 227-75Z' fill='%23f0d7c4'/%3E%3Cpath d='M617 112c-56 12-91 68-78 125l38 168 158-38-41-172c-13-56-43-92-77-83Z' fill='%23111111'/%3E%3Cpath d='M432 150c-45 9-72 48-65 93l31 194 128-20-32-199c-8-45-31-75-62-68Z' fill='%23e7334c'/%3E%3Ccircle cx='646' cy='94' r='42' fill='%23f6c6a4'/%3E%3Ccircle cx='441' cy='132' r='34' fill='%23f4bd9d'/%3E%3Cpath d='M128 106h160v310H128z' fill='%23fffdfb' opacity='.82'/%3E%3Cpath d='M149 136h118v28H149zm0 54h118v28H149zm0 54h84v28h-84z' fill='%23b78a35' opacity='.8'/%3E%3C/svg%3E") center / cover;
  box-shadow: var(--shadow);
}

.hero-copy p,
.campaign p,
.cart-head p {
  margin: 0 0 5px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0.8;
}

.hero-copy h1 {
  margin: 0;
  max-width: 250px;
  font-size: 34px;
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-copy span {
  display: block;
  max-width: 230px;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 1.5;
}

.primary-pill {
  align-self: flex-start;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.flash-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 16px 8px;
}

.flash-row article {
  min-height: 68px;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.flash-row strong,
.flash-row span {
  display: block;
}

.flash-row strong {
  font-size: 14px;
}

.flash-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  scrollbar-width: none;
}

.category-tabs button {
  flex: 0 0 auto;
  min-width: 66px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.category-tabs button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.campaign {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 16px 14px;
  padding: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e9f5f1, #fff5ed);
  border: 1px solid #dbe8e3;
}

.campaign h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.campaign span {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-2);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

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

.product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-art {
  position: relative;
  display: grid;
  min-height: 178px;
  place-items: center;
  background: var(--soft);
}

.product-art svg {
  width: 100%;
  height: 178px;
  display: block;
}

.product-art em {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(17, 17, 17, 0.82);
  color: #fff;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}

.heart {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #8a8580;
  font-size: 17px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.heart.active {
  color: var(--accent);
}

.section-head {
  padding: 2px 16px 14px;
}

.section-head p,
.profile-card p,
.list-card p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.section-head h2,
.profile-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

.category-board,
.new-board,
.profile-view {
  padding: 16px 0 104px;
}

.category-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px;
}

.category-tile {
  min-height: 142px;
  padding: 14px;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--tile) 25%, #ece7e1);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tile) 14%, #fff), #fff);
  color: var(--ink);
}

.category-tile strong,
.category-tile span,
.category-tile em {
  display: block;
}

.category-tile strong {
  font-size: 20px;
}

.category-tile span {
  min-height: 38px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.category-tile em {
  margin-top: 14px;
  color: var(--tile);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.product-list {
  display: grid;
  gap: 12px;
  padding: 0 16px;
}

.list-card {
  display: grid;
  grid-template-columns: 92px 1fr 36px;
  gap: 12px;
  align-items: center;
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-art {
  width: 92px;
  height: 92px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--soft);
}

.mini-art svg {
  width: 92px;
  height: 92px;
}

.list-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.list-card span {
  display: block;
  margin: 5px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.list-card strong {
  color: var(--accent);
}

.list-card button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 16px 14px;
  padding: 18px;
  border-radius: 8px;
  background: #111;
  color: #fff;
}

.profile-card p {
  color: rgba(255, 255, 255, 0.68);
}

.avatar {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.profile-actions,
.policy-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 14px;
}

.profile-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-actions button,
.download-app,
.policy-list button {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.download-app {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.order-panel {
  margin: 0 16px 14px;
  padding: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-panel .section-head {
  padding-top: 0;
}

.order-states {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 12px;
}

.order-states span {
  display: grid;
  min-height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.36);
}

.detail-drawer.open {
  display: flex;
}

.detail-panel {
  position: relative;
  width: min(100%, 430px);
  max-height: 90vh;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  background: #fff;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 26px;
}

.detail-art {
  height: 310px;
  overflow: hidden;
  background: var(--soft);
}

.detail-art svg {
  width: 100%;
  height: 310px;
}

.detail-body {
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
}

.detail-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 7px;
  background: #fff2f4;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.detail-body h2 {
  margin: 12px 0 8px;
  font-size: 24px;
  line-height: 1.18;
}

.detail-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.detail-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 14px 0;
}

.detail-price strong {
  color: var(--accent);
  font-size: 28px;
}

.detail-price del {
  color: #a8a19b;
  font-size: 14px;
}

.detail-spec {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.detail-spec span {
  color: var(--muted);
}

.detail-spec strong {
  text-align: right;
  font-size: 14px;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  margin-top: 16px;
}

.detail-actions button {
  min-height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.detail-actions .secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.qty-row {
  display: inline-grid;
  grid-template-columns: 30px 32px 30px;
  align-items: center;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty-row button {
  height: 30px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

.qty-row em {
  font-style: normal;
  text-align: center;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 80;
  transform: translate(-50%, 20px);
  min-width: 136px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.9);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.product-body {
  padding: 10px;
}

.product-body h3 {
  min-height: 38px;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
}

.rating {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 11px;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.price-row strong {
  color: var(--accent);
  font-size: 17px;
}

.price-row button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.95);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  position: relative;
  display: grid;
  gap: 3px;
  place-items: center;
  min-height: 54px;
  border-radius: 8px;
  background: transparent;
  color: #817a72;
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav button.active {
  color: var(--accent);
}

.nav-home {
  clip-path: polygon(50% 5%, 95% 42%, 82% 42%, 82% 95%, 58% 95%, 58% 65%, 42% 65%, 42% 95%, 18% 95%, 18% 42%, 5% 42%);
}

.nav-grid {
  mask-image: linear-gradient(#000 0 0);
  background:
    linear-gradient(currentColor 0 0) left top / 8px 8px no-repeat,
    linear-gradient(currentColor 0 0) right top / 8px 8px no-repeat,
    linear-gradient(currentColor 0 0) left bottom / 8px 8px no-repeat,
    linear-gradient(currentColor 0 0) right bottom / 8px 8px no-repeat;
}

.nav-spark {
  clip-path: polygon(50% 0, 61% 35%, 98% 38%, 68% 59%, 79% 96%, 50% 73%, 21% 96%, 32% 59%, 2% 38%, 39% 35%);
}

.nav-bag {
  clip-path: polygon(25% 28%, 75% 28%, 88% 96%, 12% 96%);
}

.nav-user {
  clip-path: circle(28% at 50% 28%);
  box-shadow: 0 12px 0 5px currentColor;
}

#cartBadge {
  position: absolute;
  top: 4px;
  right: 17px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 11px;
  line-height: 18px;
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.36);
}

.cart-drawer.open {
  display: flex;
}

.cart-panel {
  width: min(100%, 430px);
  max-height: 76vh;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  background: #fff;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
}

.cart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cart-head h2 {
  margin: 0;
  font-size: 20px;
}

.close-cart {
  font-size: 25px;
  line-height: 1;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cart-line strong {
  display: block;
  font-size: 14px;
}

.cart-line span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.cart-total strong {
  color: var(--accent);
  font-size: 22px;
}

.checkout-btn {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

@media (max-width: 350px) {
  .hero-copy h1 {
    font-size: 29px;
  }

  .product-grid {
    gap: 8px;
    padding-inline: 12px;
  }
}
