:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a919f;
  --line: #e8eaed;
  --brand: #1677ff;
  --brand2: #0f5fd6;
  --price: #ff3141;
  --orange: #ff6a00;
  --ok: #00b578;
  --shadow: 0 6px 20px rgba(15, 23, 42, .06);
  --r: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
.safe-bottom { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* top nav */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: #fff; border-bottom: 1px solid var(--line);
  height: 48px; display: flex; align-items: center; padding: 0 12px; gap: 8px;
}
.nav .back {
  width: 32px; height: 32px; border: 0; background: transparent;
  font-size: 20px; color: var(--text); cursor: pointer; line-height: 1;
}
.nav .title { flex: 1; text-align: center; font-size: 16px; font-weight: 700; margin-right: 32px; }
.nav.home .title { margin-right: 0; text-align: left; }
.nav .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #1677ff, #6366f1);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.nav .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }

/* home search */
.search {
  margin: 12px 12px 8px; background: #fff; border-radius: 999px;
  border: 1px solid var(--line); height: 38px; display: flex; align-items: center;
  padding: 0 14px; color: var(--muted); font-size: 13px; gap: 6px;
}
.banner {
  margin: 0 12px 12px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, #1677ff 0%, #3b82f6 45%, #6366f1 100%);
  color: #fff; padding: 18px 16px; box-shadow: var(--shadow);
}
.banner .tag {
  display: inline-block; font-size: 11px; background: rgba(255,255,255,.2);
  padding: 3px 8px; border-radius: 999px; margin-bottom: 8px;
}
.banner h2 { margin: 0 0 6px; font-size: 20px; }
.banner p { margin: 0; font-size: 12px; opacity: .9; line-height: 1.5; }

.sec { padding: 4px 14px 8px; display: flex; justify-content: space-between; align-items: center; }
.sec h3 { margin: 0; font-size: 15px; font-weight: 700; }
.sec span { font-size: 12px; color: var(--muted); }

/* product grid - homepage */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 0 12px 20px;
}
.card {
  background: var(--card); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card .cover {
  height: 132px; display: grid; place-items: center; position: relative;
  background: linear-gradient(160deg, #eef4ff, #f8fafc);
}
.card .cover .emoji { font-size: 46px; }
.card .cover .ribbon {
  position: absolute; left: 0; top: 8px;
  background: var(--orange); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 0 8px 8px 0;
}
.card .body { padding: 10px; }
.card .name {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  height: 36px; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card .sub { margin-top: 4px; font-size: 11px; color: var(--muted); }
.card .row { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card .price { color: var(--price); font-weight: 800; font-size: 16px; }
.card .price small { font-size: 11px; }
.card .price .o { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: line-through; }
.card .buy {
  border: 0; border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700; padding: 6px 10px; cursor: pointer; white-space: nowrap;
}

/* product detail */
.p-cover {
  height: 280px; background: linear-gradient(160deg, #e8f1ff, #ffffff);
  display: grid; place-items: center; position: relative;
}
.p-cover .emoji { font-size: 96px; }
.p-cover .ribbon {
  position: absolute; left: 12px; top: 12px;
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.p-panel { background: #fff; margin-top: -16px; border-radius: 16px 16px 0 0; padding: 16px; position: relative; }
.p-title { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.4; }
.p-promo {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 10px;
  background: linear-gradient(90deg, #fff1f0, #fff7e6);
  color: #cf1322; font-size: 13px; font-weight: 700;
}
.p-price { margin-top: 12px; color: var(--price); font-size: 28px; font-weight: 800; }
.p-price small { font-size: 14px; }
.p-price .o { margin-left: 8px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: line-through; }
.p-meta { margin-top: 8px; display: flex; gap: 12px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.p-meta .star { color: #faad14; }
.p-block { margin-top: 14px; background: #fff; border-top: 8px solid var(--bg); padding: 14px 16px; }
.p-block h4 { margin: 0 0 10px; font-size: 14px; }
.p-block p, .p-block li { margin: 0; color: #4e5969; font-size: 13px; line-height: 1.7; }
.p-block ul { margin: 0; padding-left: 18px; }
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.bottom-inner {
  max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
}
.icon-btn {
  width: 48px; text-align: center; color: var(--muted); font-size: 11px; border: 0; background: transparent; cursor: pointer;
}
.icon-btn .i { font-size: 18px; display: block; margin-bottom: 2px; color: var(--text); }
.btn-buy {
  flex: 1; border: 0; border-radius: 999px; height: 42px;
  background: linear-gradient(90deg, #ff9f43, var(--orange));
  color: #fff; font-size: 15px; font-weight: 800; cursor: pointer;
}
.btn-pay {
  flex: 1; border: 0; border-radius: 999px; height: 42px;
  background: linear-gradient(90deg, #1677ff, #3b82f6);
  color: #fff; font-size: 15px; font-weight: 800; cursor: pointer;
}
.btn-pay:disabled, .btn-buy:disabled { opacity: .55; }

/* checkout / pay page */
.pay-head {
  background: linear-gradient(135deg, #1677ff, #3b82f6);
  color: #fff; padding: 18px 16px 28px;
}
.pay-head h1 { margin: 0; font-size: 18px; font-weight: 800; }
.pay-head p { margin: 6px 0 0; font-size: 12px; opacity: .9; }
.pay-card {
  margin: -16px 12px 12px; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden;
}
.pay-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 14px 14px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.pay-row:last-child { border-bottom: 0; }
.pay-row .k { color: var(--muted); flex-shrink: 0; }
.pay-row .v { text-align: right; font-weight: 600; word-break: break-all; }
.pay-row .v.price { color: var(--price); font-size: 20px; font-weight: 800; }
.pay-goods {
  display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line);
}
.pay-goods .thumb {
  width: 64px; height: 64px; border-radius: 10px;
  background: linear-gradient(160deg, #eef4ff, #f8fafc);
  display: grid; place-items: center; font-size: 28px; flex-shrink: 0;
}
.pay-goods .info { flex: 1; min-width: 0; }
.pay-goods .name { font-size: 14px; font-weight: 700; line-height: 1.4; }
.pay-goods .sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.method {
  display: flex; align-items: center; gap: 10px;
}
.method .alipay {
  width: 28px; height: 28px; border-radius: 6px; background: #1677ff; color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.check { color: var(--ok); font-weight: 800; }
.qty-box { display: flex; align-items: center; gap: 10px; }
.qty-box button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 16px; cursor: pointer;
}
.tips {
  margin: 0 14px 20px; color: var(--muted); font-size: 12px; line-height: 1.7;
}
.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%) translateY(-140%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; z-index: 99; transition: .25s; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.foot {
  text-align: center; color: #a0a7b3; font-size: 11px; padding: 8px 12px 20px; line-height: 1.6;
}

/* bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar-inner {
  max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr);
}
.tabbar a {
  text-align: center; color: var(--muted); font-size: 11px; padding: 4px 0; font-weight: 500;
  position: relative;
}
.tabbar a .i { display: block; font-size: 20px; line-height: 1.2; margin-bottom: 2px; }
.tabbar a.active { color: var(--brand); font-weight: 700; }
.tabbar .badge {
  position: absolute; top: 0; left: 54%; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: #ff3141; color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; display: none;
}
.page.has-tab { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

/* dual action buttons on product bottom */
.btn-cart {
  flex: 1; border: 0; border-radius: 999px; height: 42px;
  background: linear-gradient(90deg, #ffb347, #ff9f43);
  color: #fff; font-size: 14px; font-weight: 800; cursor: pointer;
}
.btn-buy-now {
  flex: 1; border: 0; border-radius: 999px; height: 42px;
  background: linear-gradient(90deg, #ff6a00, #ff3141);
  color: #fff; font-size: 14px; font-weight: 800; cursor: pointer;
}

/* cart page */
.cart-item {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px;
  background: #fff; margin: 0 12px 10px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line);
}
.cart-item .thumb {
  width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center;
  font-size: 28px; background: linear-gradient(160deg, #eef4ff, #f8fafc);
}
.cart-item .nm { font-size: 14px; font-weight: 700; line-height: 1.35; }
.cart-item .sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.cart-item .row { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.cart-item .pr { color: var(--price); font-weight: 800; font-size: 16px; }
.cart-item .del { border: 0; background: transparent; color: #8a919f; font-size: 12px; cursor: pointer; }
.cart-empty { padding: 60px 20px; text-align: center; color: var(--muted); line-height: 1.7; }
.cart-empty a { color: var(--brand); font-weight: 700; }

/* orders list */
.order-card {
  background: #fff; margin: 0 12px 10px; border-radius: 12px; border: 1px solid var(--line);
  overflow: hidden;
}
.order-card .hd {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.order-card .hd .st { font-weight: 700; }
.order-card .hd .st.pending { color: #faad14; }
.order-card .hd .st.paid { color: #1677ff; }
.order-card .hd .st.shipped { color: #00b578; }
.order-card .hd .st.done { color: #00b578; }
.order-card .hd .st.cancelled { color: #8a919f; }
.order-card .body { padding: 12px 14px; }
.order-card .line {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center;
  margin-bottom: 8px;
}
.order-card .line:last-child { margin-bottom: 0; }
.order-card .line .t {
  width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center;
  font-size: 22px; background: #f5f6f8;
}
.order-card .line .n { font-size: 13px; font-weight: 700; }
.order-card .line .q { font-size: 12px; color: var(--muted); margin-top: 2px; }
.order-card .line .p { font-size: 13px; font-weight: 700; color: var(--price); }
.order-card .ft {
  padding: 10px 14px 12px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}
.order-card .ft .sum { font-size: 13px; }
.order-card .ft .sum b { color: var(--price); font-size: 16px; }
.order-card .ft .acts { display: flex; gap: 8px; }
.order-card .ft .acts a, .order-card .ft .acts button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text);
}
.order-card .ft .acts .primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

/* checkout address */
.addr-card {
  margin: -16px 12px 12px; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px;
}
.addr-card .lab { font-size: 13px; font-weight: 700; margin: 0 0 10px; }
.addr-card .lab .req { color: #ff3141; margin-right: 2px; }
.addr-card .inp {
  width: 100%; border: 1px solid #e8eaed; border-radius: 10px;
  padding: 11px 12px; font-size: 14px; outline: none; margin-bottom: 10px;
  font-family: inherit; background: #fff;
}
.addr-card .inp:focus { border-color: #1677ff; box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.addr-card textarea.inp { min-height: 72px; resize: vertical; line-height: 1.5; }
.addr-card .err { color: #ff3141; font-size: 12px; margin: -4px 0 8px; display: none; }

.field-card { margin-top: 0; }
.field-label {
  font-size: 13px; font-weight: 700; margin-bottom: 8px; display: flex;
  justify-content: space-between; align-items: center;
}
.field-label .req { color: #ff3141; margin-right: 4px; }
.field-label .hint { color: #8a919f; font-weight: 500; font-size: 12px; }
.field-input {
  width: 100%; border: 1px solid #e8eaed; border-radius: 10px;
  padding: 12px 14px; font-size: 15px; outline: none; background: #fff;
  font-family: inherit;
}
.field-input:focus { border-color: #1677ff; box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.methods { display: grid; gap: 10px; margin-top: 4px; }
.method-opt {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid #e8eaed; border-radius: 12px; padding: 12px 14px;
  background: #fff; cursor: pointer; user-select: none;
}
.method-opt.active {
  border-color: #1677ff;
  background: linear-gradient(180deg, #f5f9ff, #fff);
  box-shadow: 0 0 0 3px rgba(22,119,255,.08);
}
.method-opt .icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.method-opt .icon.alipay { background: linear-gradient(135deg, #1677ff, #3b82f6); }
.method-opt .icon.wxpay { background: linear-gradient(135deg, #07c160, #10b981); }
.method-opt .txt { flex: 1; min-width: 0; }
.method-opt .txt .n { font-size: 14px; font-weight: 700; color: #0f172a; }
.method-opt .txt .d { font-size: 12px; color: #8a919f; margin-top: 2px; }
.method-opt .radio {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cbd5e1;
  display: grid; place-items: center; flex-shrink: 0;
}
.method-opt.active .radio { border-color: #1677ff; }
.method-opt.active .radio::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #1677ff;
}

/* category page */
.cat-layout {
  display: grid; grid-template-columns: 92px 1fr; min-height: calc(100vh - 48px - 64px);
  background: #fff;
}
.cat-side {
  background: #f5f6f8; border-right: 1px solid var(--line); overflow-y: auto;
}
.cat-side button {
  display: block; width: 100%; border: 0; background: transparent;
  padding: 14px 8px; font-size: 13px; color: #4e5969; text-align: center; cursor: pointer;
  border-left: 3px solid transparent;
}
.cat-side button.active {
  background: #fff; color: var(--brand); font-weight: 700;
  border-left-color: var(--brand);
}
.cat-main { padding: 12px; overflow-y: auto; }
.cat-main h3 { margin: 0 0 12px; font-size: 14px; }
.cat-icons {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 8px;
}
.cat-icon {
  text-align: center; color: var(--text); font-size: 12px; line-height: 1.3;
}
.cat-icon .bubble {
  width: 48px; height: 48px; border-radius: 16px; margin: 0 auto 6px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(160deg, #eef4ff, #f8fafc);
}
.cat-products { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.cat-item {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.cat-item .thumb {
  width: 72px; height: 72px; border-radius: 10px; display: grid; place-items: center;
  font-size: 30px; background: linear-gradient(160deg, #eef4ff, #f8fafc);
}
.cat-item .nm { font-size: 13px; font-weight: 700; line-height: 1.35; }
.cat-item .ds { margin-top: 4px; font-size: 11px; color: var(--muted); }
.cat-item .pr { color: var(--price); font-weight: 800; font-size: 15px; white-space: nowrap; }

/* about / footer page */
.about-hero {
  background: #fff; text-align: center; padding: 36px 16px 24px;
  border-bottom: 8px solid var(--bg);
}
.about-logo {
  width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 12px;
  background: linear-gradient(135deg, #1677ff, #6366f1);
  color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800;
  box-shadow: 0 10px 24px rgba(22,119,255,.28);
}
.about-hero h1 { margin: 0; font-size: 20px; }
.about-hero p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.about-list { background: #fff; }
.about-list a, .about-list .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 16px; border-bottom: 1px solid var(--line); font-size: 14px;
  background: #fff; color: var(--text);
}
.about-list .row span:last-child, .about-list a span:last-child {
  color: var(--muted); font-size: 13px;
}
.about-note {
  padding: 16px; color: #a0a7b3; font-size: 11px; line-height: 1.7; text-align: center;
}
