:root {
  --coffee-950: #24130d;
  --coffee-850: #3a251b;
  --coffee-700: #5a3828;
  --coffee-500: #7a5138;
  --amber-600: #b87424;
  --amber-500: #d99a3a;
  --paper: #fffaf2;
  --paper-soft: #f7efe2;
  --white: #ffffff;
  --muted: rgba(36, 19, 13, 0.58);
  --line: rgba(58, 37, 27, 0.1);
  --shadow: 0 10px 26px rgba(36, 19, 13, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--coffee-950);
  background: #ece0d0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 38px rgba(36, 19, 13, 0.16);
}

.page-stack {
  min-height: 100vh;
  padding: 12px 12px 94px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 14px;
}

.top-bar strong {
  display: block;
  font-size: 20px;
  letter-spacing: 0;
}

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

.text-btn {
  min-width: 54px;
  height: 34px;
  border: 1px solid rgba(58, 37, 27, 0.16);
  border-radius: 17px;
  color: var(--coffee-700);
  background: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.home-hero {
  overflow: hidden;
  position: relative;
  min-height: 342px;
  border-radius: 8px;
  background: var(--coffee-850);
  box-shadow: var(--shadow);
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(36, 19, 13, 0.06) 0%, rgba(36, 19, 13, 0.72) 100%);
}

.hero-img {
  display: block;
  width: 100%;
  height: 342px;
  object-fit: cover;
}

.hero-copy {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 2;
  color: var(--white);
}

.hero-copy span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 14px;
  color: #3a251b;
  background: rgba(255, 250, 242, 0.9);
  font-size: 12px;
  font-weight: 800;
}

.hero-copy h1 {
  margin: 12px 0 8px;
  font-size: 31px;
  line-height: 1.16;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 340px;
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  line-height: 1.55;
}

.primary-btn,
.light-btn,
.wechat-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-btn {
  padding: 0 18px;
  color: var(--white);
  background: linear-gradient(135deg, var(--coffee-700), var(--amber-600));
}

.light-btn {
  padding: 0 18px;
  color: var(--coffee-850);
  background: var(--white);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.quick-grid div {
  min-height: 64px;
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  text-align: center;
}

.quick-grid strong,
.quick-grid span {
  display: block;
}

.quick-grid strong {
  font-size: 13px;
}

.quick-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.section-block {
  margin-top: 20px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2,
.page-header h1,
.profile-card h1,
.member-card h1,
.detail-info h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-title span {
  color: var(--amber-600);
  font-size: 12px;
  font-weight: 800;
}

.category-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.category-card,
.product-card,
.order-card,
.mine-item,
.profile-card,
.login-panel,
.benefit-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.category-card {
  min-height: 88px;
  padding: 12px 10px;
  color: var(--coffee-950);
  text-align: left;
}

.category-card span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  background: var(--coffee-700);
  font-size: 14px;
  font-weight: 900;
}

.category-card strong {
  display: block;
  margin-top: 10px;
  font-size: 14px;
}

.category-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.category-card.is-active {
  border-color: rgba(184, 116, 36, 0.42);
  background: #fff3dd;
  box-shadow: 0 8px 18px rgba(184, 116, 36, 0.12);
}

.category-card.is-active span {
  background: linear-gradient(135deg, var(--coffee-700), var(--amber-600));
}

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

.list-end {
  margin-top: 16px;
  color: rgba(36, 19, 13, 0.46);
  font-size: 12px;
  text-align: center;
}

.product-card {
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(36, 19, 13, 0.06);
  cursor: pointer;
}

.product-image {
  position: relative;
  overflow: hidden;
  background: var(--paper-soft);
}

.product-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-image span {
  position: absolute;
  top: 8px;
  left: 8px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  color: var(--white);
  background: rgba(58, 37, 27, 0.74);
  font-size: 11px;
  font-weight: 800;
  line-height: 24px;
}

.product-body {
  padding: 11px;
}

.product-body h3 {
  min-height: 40px;
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
}

.product-desc {
  min-height: 36px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: rgba(36, 19, 13, 0.48);
  font-size: 11px;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.price {
  color: #b34d17;
  font-size: 18px;
  font-weight: 900;
}

.buy-btn,
.pay-btn,
.outline-btn {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.buy-btn,
.pay-btn {
  border: 0;
  color: var(--white);
  background: var(--coffee-700);
}

.outline-btn {
  color: var(--coffee-700);
  background: transparent;
  border: 1px solid rgba(58, 37, 27, 0.2);
}

.detail-page {
  padding-bottom: 10px;
}

.detail-header {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  min-height: 48px;
  margin-bottom: 8px;
}

.detail-header strong {
  text-align: center;
  font-size: 17px;
}

.back-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--coffee-850);
  background: var(--white);
  font-size: 28px;
  line-height: 1;
}

.detail-hero {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.detail-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
}

.detail-hero span {
  position: absolute;
  top: 12px;
  left: 12px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 15px;
  color: var(--white);
  background: rgba(58, 37, 27, 0.76);
  font-size: 12px;
  font-weight: 900;
  line-height: 28px;
}

.detail-info,
.detail-section {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.detail-title p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-title strong {
  flex: 0 0 auto;
  color: #b34d17;
  font-size: 24px;
  font-weight: 900;
}

.detail-desc {
  margin: 14px 0 0;
  color: rgba(36, 19, 13, 0.72);
  font-size: 14px;
  line-height: 1.7;
}

.detail-tags {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.detail-tags span {
  min-height: 34px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--coffee-700);
  background: #fff4df;
  font-size: 12px;
  font-weight: 800;
}

.detail-section h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.detail-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.detail-action {
  position: sticky;
  bottom: calc(76px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  backdrop-filter: blur(12px);
}

.detail-action .outline-btn,
.detail-action .primary-btn {
  min-height: 44px;
}

.page-header {
  padding: 14px 2px 8px;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.order-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--coffee-700);
  background: var(--white);
  font-size: 13px;
  font-weight: 800;
}

.order-tab.is-active {
  color: var(--white);
  background: var(--coffee-700);
}

.order-list {
  display: grid;
  gap: 12px;
}

.order-card {
  padding: 14px;
}

.order-top,
.order-actions,
.order-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-top strong {
  font-size: 13px;
}

.order-status {
  color: #b34d17;
  font-size: 12px;
  font-weight: 900;
}

.order-product {
  align-items: flex-start;
  margin: 12px 0;
}

.order-product p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.order-total {
  color: #b34d17;
  font-weight: 900;
}

.empty-state {
  padding: 38px 16px;
  border: 1px dashed rgba(58, 37, 27, 0.22);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--coffee-950);
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 13px;
}

.member-card,
.profile-card {
  padding: 20px;
  border-radius: 8px;
  color: var(--white);
  background: linear-gradient(135deg, #2d1a12 0%, #5d3b28 60%, #b87424 100%);
  box-shadow: var(--shadow);
}

.member-card span {
  display: inline-block;
  margin-bottom: 12px;
  color: #ffd89a;
  font-size: 13px;
  font-weight: 900;
}

.member-card p {
  margin: 10px 0 18px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.6;
}

.benefit-list {
  display: grid;
  gap: 10px;
}

.benefit-list article {
  padding: 15px;
}

.benefit-list strong,
.benefit-list span {
  display: block;
}

.benefit-list strong {
  font-size: 15px;
}

.benefit-list span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  color: var(--coffee-850);
  background: #f6c16c;
  font-size: 22px;
  font-weight: 900;
}

.avatar-img {
  display: block;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.18);
}

.profile-card p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.5;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.logout-btn {
  color: #7a2d16;
}

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

.mine-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
  color: var(--coffee-950);
  text-align: left;
}

.mine-item span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  background: var(--amber-600);
  font-weight: 900;
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 520px;
  height: calc(66px + env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.97);
  backdrop-filter: blur(14px);
}

.tab-item {
  position: relative;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 0;
  border-radius: 8px;
  color: rgba(36, 19, 13, 0.52);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.tab-item::before {
  content: "";
  position: absolute;
  top: 2px;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: transparent;
}

.tab-item.is-active {
  color: var(--coffee-850);
  background: transparent;
}

.tab-item.is-active::before {
  background: var(--amber-600);
}

.tab-icon {
  display: grid;
  width: 30px;
  height: 26px;
  place-items: center;
  border-radius: 14px;
  font-size: 20px;
  line-height: 1;
}

.tab-item.is-active .tab-icon {
  color: var(--white);
  background: linear-gradient(135deg, var(--coffee-700), var(--amber-600));
  box-shadow: 0 6px 12px rgba(90, 56, 40, 0.22);
}

.user-tab-icon::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translateY(1px);
}

.user-tab-icon::after {
  content: "";
  width: 16px;
  height: 8px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  transform: translateY(-1px);
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(36, 19, 13, 0.5);
}

.modal-mask[hidden] {
  display: none;
}

.login-panel {
  position: relative;
  width: min(100%, 480px);
  padding: 22px;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--coffee-700);
  background: rgba(58, 37, 27, 0.08);
  font-size: 22px;
}

.login-panel h2 {
  margin: 0;
  font-size: 22px;
}

.login-panel p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.wechat-btn {
  width: 100%;
  color: var(--white);
  background: #18a058;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: rgba(36, 19, 13, 0.45);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(58, 37, 27, 0.18);
  border-radius: 8px;
  color: var(--coffee-950);
  background: var(--paper);
  outline: none;
}

.login-form input:focus {
  border-color: var(--amber-600);
  box-shadow: 0 0 0 3px rgba(217, 154, 58, 0.16);
}

.full-btn {
  width: 100%;
  margin-top: 4px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 88px;
  left: 20px;
  z-index: 30;
  max-width: 440px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--white);
  background: rgba(36, 19, 13, 0.92);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 500px) {
  .app-shell {
    min-height: calc(100vh - 24px);
    margin-top: 12px;
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
  }

  .tabbar {
    border-radius: 12px 12px 0 0;
  }
}

@media (max-width: 380px) {
  .page-stack {
    padding-right: 10px;
    padding-left: 10px;
  }

  .hero-copy h1 {
    font-size: 28px;
  }

  .product-grid {
    gap: 10px;
  }

  .product-body {
    padding: 10px;
  }

  .buy-btn {
    padding: 0 8px;
  }
}
