:root {
  --brand: #fa550f;
  --brand-soft: #fff2ea;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #8a8f99;
  --line: #eef0f3;
  --radius: 14px;
  --tabbar-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #e9ebee;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.app {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
  overflow-x: hidden;
}

/* ---------- 顶部栏 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--line);
}

.navbar__title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.navbar__back,
.navbar__spacer {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.navbar__back svg {
  width: 20px;
  height: 20px;
}

/* ---------- 首页 ---------- */
.home-top {
  padding: 10px 12px 4px;
}

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 19px;
  background: #fff;
  color: var(--muted);
}

.search svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}

.search input::placeholder {
  color: #b7bcc5;
}

.banner {
  margin: 10px 12px 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(250, 85, 15, 0.12);
}

.banner img {
  height: 148px;
  object-fit: cover;
}

.notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 12px 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: #b8410c;
  font-size: 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 12px 8px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 商品卡 ---------- */
.goods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 12px;
}

.goods-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(20, 24, 35, 0.05);
  display: flex;
  flex-direction: column;
}

.goods-card__img {
  position: relative;
  padding-top: 100%;
  background: #f2f3f5;
}

.goods-card__img img {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
}

.goods-card__tag {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
}

.goods-card__body {
  padding: 9px 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.goods-card__name {
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: var(--brand);
  font-weight: 700;
}

.price small {
  font-size: 12px;
  font-weight: 600;
}

.price b {
  font-size: 18px;
  font-family: 'DIN Alternate', -apple-system, sans-serif;
}

.price em {
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  color: var(--muted);
  margin-left: 3px;
}

/* ---------- 分类 ---------- */
.cate-wrap {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 48px - var(--tabbar-h));
}

.cate-side {
  width: 96px;
  flex: none;
  background: #f0f1f4;
}

.cate-side__item {
  position: relative;
  padding: 16px 8px;
  text-align: center;
  font-size: 13px;
  color: #4a4f58;
}

.cate-side__item.is-active {
  background: var(--bg);
  color: var(--brand);
  font-weight: 600;
}

.cate-side__item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.cate-main {
  flex: 1;
  padding: 12px;
  min-width: 0;
}

.sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.sub-item {
  text-align: center;
  font-size: 12px;
  color: #5b6068;
}

.sub-item img {
  height: 62px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 5px;
}

.sub-item.is-active {
  color: var(--brand);
  font-weight: 600;
}

.sub-item.is-active img {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.cate-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- 横向商品条 ---------- */
.row-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(20, 24, 35, 0.05);
}

.row-card__img {
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f3f5;
}

.row-card__img img {
  height: 100%;
  object-fit: cover;
}

.row-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.row-card__name {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

/* ---------- 详情 ---------- */
.swiper {
  position: relative;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: #f2f3f5;
}

.swiper::-webkit-scrollbar {
  display: none;
}

.swiper img {
  width: 100%;
  flex: none;
  scroll-snap-align: center;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.swiper__dots {
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 2px 9px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  margin: 10px 12px 0;
  padding: 14px;
}

.detail-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.detail-price {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.spec-options {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.spec-option {
  padding: 8px 16px;
  border-radius: 10px;
  background: #f4f5f7;
  border: 1px solid transparent;
  font-size: 13px;
}

.spec-option.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.config-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.config-list li {
  position: relative;
  padding: 5px 0 5px 14px;
  color: #454a52;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}

.config-list li:last-child {
  border-bottom: none;
}

.config-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.7;
}

/* ---------- 底部操作条 ---------- */
.action-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 0.5px solid var(--line);
  z-index: 30;
}

.btn {
  flex: 1;
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.btn--ghost {
  background: var(--brand-soft);
  color: var(--brand);
}

.btn--solid {
  background: linear-gradient(135deg, #ff8a3d, var(--brand));
  color: #fff;
  box-shadow: 0 6px 14px rgba(250, 85, 15, 0.28);
}

.cart-total {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* 购物车里底部导航和结算条同时存在，结算条要让到导航上面 */
.action-bar--above-tabbar {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: 8px;
}

/* ---------- 购物车 ---------- */
.cart-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.cart-item__img {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  flex: none;
  background: #f2f3f5;
}

.cart-item__img img {
  height: 100%;
  object-fit: cover;
}

.cart-item__body {
  flex: 1;
  min-width: 0;
}

.cart-item__name {
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item__spec {
  margin-top: 3px;
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  background: #f4f5f7;
  color: var(--muted);
  font-size: 11px;
}

.cart-item__foot {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4a4f58;
}

.stepper button {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f4f5f7;
  line-height: 1;
  font-size: 16px;
}

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

.empty__icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #eceef1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty__icon svg {
  width: 30px;
  height: 30px;
  opacity: 0.45;
}

.empty__btn {
  display: inline-block;
  margin-top: 18px;
  padding: 9px 26px;
  border-radius: 20px;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-size: 14px;
}

/* ---------- 我的 ---------- */
.mine-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 16px;
  background: linear-gradient(135deg, #ff9350, var(--brand));
  color: #fff;
}

.mine-head__avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.mine-head__name {
  font-size: 17px;
  font-weight: 600;
}

.mine-head__desc {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.mine-orders {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 0 14px;
}

.mine-orders__item {
  text-align: center;
  font-size: 12px;
  color: #5b6068;
}

.mine-orders__item span {
  display: block;
  font-size: 19px;
  margin-bottom: 6px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--line);
  font-size: 14px;
}

.cell:last-child {
  border-bottom: none;
}

.cell__arrow {
  color: #c3c7cf;
  font-size: 13px;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-top: 0.5px solid var(--line);
  z-index: 40;
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #9298a1;
  font-size: 10px;
}

.tabbar__item svg {
  width: 22px;
  height: 22px;
}

.tabbar__item.is-active {
  color: var(--brand);
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: 240px;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
}

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

.install-tip {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 456px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(27, 27, 31, 0.9);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  z-index: 50;
}

.install-tip button {
  flex: none;
  color: #ffb98f;
  font-size: 12px;
}

.hidden {
  display: none !important;
}
