:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #e8e2d8;
  --accent: #d94635;
  --accent-dark: #a72f23;
  --green: #517b65;
  --yellow: #f5c84b;
  --shadow: 0 20px 50px rgba(38, 36, 30, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 244, 239, 0.96) 360px),
    var(--bg);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

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

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(232, 226, 216, 0.8);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.nav {
  width: min(1180px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.nav-links,
.cart-button,
.hero-actions,
.section-heading,
.cart-header,
.cart-total {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  letter-spacing: 0;
}

.nav-links {
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
}

.cart-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.cart-button {
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.cart-button strong {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 8px;
  font-size: 13px;
}

main {
  width: min(1180px, calc(100% - 40px));
  flex: 1;
  margin: 0 auto;
}

.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 34px;
  border-top: 1px solid rgba(232, 226, 216, 0.9);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 4px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.category-page,
.service-page,
.profile-page {
  padding: 42px 0 92px;
}

.hero {
  min-height: calc(100vh - 72px);
  max-height: 760px;
  padding: 56px 0 34px;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 1.14fr);
  align-items: center;
  gap: 54px;
}

.hero-copy h1 {
  margin: 12px 0 18px;
  max-width: 640px;
  font-size: 72px;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 520px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.hero-actions {
  gap: 14px;
  margin-top: 28px;
}

.primary-link,
.secondary-link,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-link,
.primary-button {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(217, 70, 53, 0.24);
}

.secondary-link {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.secondary-link.compact {
  min-height: 40px;
  font-size: 14px;
}

.hero-media {
  position: relative;
}

.hero-media img {
  width: 100%;
  aspect-ratio: 1 / 0.86;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics {
  margin: -10px 0 62px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.metrics div {
  padding: 24px 28px;
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics strong {
  display: block;
  font-size: 28px;
}

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

.home-products {
  padding-bottom: 92px;
}

.shop-layout {
  display: block;
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: 30px;
  letter-spacing: 0;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h2 {
  margin: 8px 0 0;
  font-size: 34px;
}

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

.service-panel,
.profile-card,
.profile-action,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(31, 41, 51, 0.06);
}

.service-panel {
  padding: 24px;
}

.service-panel span {
  color: var(--accent);
  font-weight: 900;
}

.service-panel h3 {
  margin: 12px 0 10px;
  font-size: 22px;
}

.service-panel p,
.profile-card p,
.profile-action span {
  color: var(--muted);
  line-height: 1.7;
}

.profile-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 26px;
}

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

.profile-card h2 {
  max-width: 420px;
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.35;
}

.profile-card p {
  margin: 0;
  font-size: 15px;
}

.logout-button {
  min-height: 38px;
  margin-top: 20px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.logout-button[hidden] {
  display: none;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.login-panel {
  margin-top: 18px;
  padding: 22px;
}

.login-panel[hidden] {
  display: none;
}

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

.login-panel label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.login-panel input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.login-panel input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(217, 70, 53, 0.14);
}

.login-panel .primary-button {
  width: 100%;
  margin-top: 4px;
  border: 0;
  cursor: pointer;
}

.login-panel .primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.login-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--accent-dark);
}

.profile-action {
  min-height: 118px;
  padding: 22px;
  cursor: pointer;
  text-align: left;
}

.profile-action strong,
.profile-action span {
  display: block;
}

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

.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.sort-label {
  color: var(--muted);
  font-size: 14px;
}

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

.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(31, 41, 51, 0.06);
}

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

.product-content {
  padding: 16px;
}

.product-tag {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.product-content h3 {
  margin: 0 0 8px;
  min-height: 48px;
  font-size: 18px;
  line-height: 1.35;
}

.product-content p {
  min-height: 44px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price {
  color: var(--accent);
  font-size: 22px;
  font-weight: 900;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.card-actions button,
.card-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.card-actions button {
  color: #fff;
  border: 0;
  background: var(--ink);
  cursor: pointer;
}

.card-actions a {
  border: 1px solid var(--line);
  background: #fff;
}

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

.detail-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 760px);
  justify-content: center;
  gap: 24px;
  align-items: start;
}

.detail-summary,
.detail-image-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.detail-summary {
  position: sticky;
  top: 96px;
}

.detail-summary > div {
  padding: 20px;
}

.detail-summary span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.detail-summary h3 {
  margin: 8px 0;
  font-size: 24px;
}

.detail-summary p {
  color: var(--muted);
  line-height: 1.7;
}

.detail-summary strong {
  display: block;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 30px;
}

.detail-summary .primary-button {
  width: 100%;
}

.detail-image-wrap img {
  width: 100%;
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: rgba(31, 41, 51, 0);
  transition: background 0.24s ease;
}

.cart-drawer.open {
  pointer-events: auto;
  background: rgba(31, 41, 51, 0.38);
}

.cart-panel {
  width: min(420px, calc(100% - 28px));
  height: calc(100% - 28px);
  margin: 14px 14px 14px auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #fff;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.24s ease;
}

.cart-drawer.open .cart-panel {
  transform: translateX(0);
}

.cart-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.cart-header button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: #f2eee7;
  cursor: pointer;
  font-size: 26px;
}

.cart-items {
  flex: 1;
  padding: 18px 0;
  overflow: auto;
}

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

.cart-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.cart-qty span,
.empty-cart {
  color: var(--muted);
}

.cart-qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
}

.cart-qty button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.cart-qty strong {
  min-width: 18px;
  color: var(--ink);
  text-align: center;
  font-size: 14px;
}

.cart-qty button:hover {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.cart-item-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.cart-item-side button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.cart-item-side button:hover {
  color: var(--accent);
  border-color: rgba(217, 70, 53, 0.35);
}

.cart-total {
  justify-content: space-between;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  font-size: 18px;
}

.checkout {
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 70;
  padding: 12px 18px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  transform: translate(-50%, 90px);
  transition: transform 0.24s ease;
}

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

.checkout-page {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  padding: 28px;
  overflow: auto;
  background: rgba(31, 41, 51, 0.42);
}

.checkout-page.open {
  display: block;
}

.checkout-card {
  width: min(980px, 100%);
  margin: 0 auto 88px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.checkout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.checkout-head h2 {
  margin: 6px 0 0;
  font-size: 30px;
}

.checkout-head button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: #f2eee7;
  cursor: pointer;
  font-size: 28px;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  padding: 24px;
}

.order-panel,
.pay-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.order-panel h3,
.pay-panel h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.order-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.order-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.order-item h4 {
  margin: 0 0 5px;
  font-size: 16px;
}

.order-item span {
  color: var(--muted);
}

.order-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  font-size: 18px;
}

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

.pay-methods {
  display: grid;
  gap: 12px;
}

.pay-method {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.pay-method.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 70, 53, 0.12);
}

.pay-logo {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.wechat {
  background: #19b75b;
}

.alipay {
  background: #1677ff;
}

.pay-method strong,
.pay-method small {
  display: block;
}

.pay-method small {
  margin-top: 4px;
  color: var(--muted);
}

.pay-code {
  display: grid;
  place-items: center;
  margin: 18px 0;
  padding: 18px;
  border-radius: 8px;
  background: #f8f5ee;
  text-align: center;
}

.qr-code {
  width: 136px;
  height: 136px;
  padding: 8px;
  border: 8px solid #fff;
  background: #fff;
}

.qr-code img,
.qr-code canvas {
  width: 100%;
  height: 100%;
}

.qr-code[data-ready="true"] {
  display: block;
}

.pay-code p {
  margin: 12px 0 0;
  color: var(--muted);
}

.checkout-submit {
  width: 100%;
}

.bottom-tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  display: none;
  border-top: 1px solid #e7e7e7;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.bottom-tabbar {
  grid-template-columns: repeat(4, 1fr);
  height: 74px;
  max-width: 572px;
  margin: 0 auto;
}

.tab-item {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #8491a5;
  cursor: pointer;
  font-size: 12px;
}

.tab-item.active {
  color: #ff2b83;
}

.tab-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
}

.tab-icon.home::before {
  position: absolute;
  inset: 7px 4px 3px;
  content: "";
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 4px;
}

.tab-icon.home::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 12px;
  height: 12px;
  content: "";
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

.tab-icon.category::before {
  position: absolute;
  inset: 3px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(30deg);
}

.tab-icon.service::before {
  position: absolute;
  inset: 4px 3px 6px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 3px;
}

.tab-icon.service::after {
  position: absolute;
  right: 5px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  content: "";
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.tab-icon.profile::before {
  position: absolute;
  top: 3px;
  left: 7px;
  width: 8px;
  height: 8px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 50%;
}

.tab-icon.profile::after {
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  height: 8px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 8px 8px 0 0;
  border-bottom: 0;
}

@media (max-width: 980px) {
  body {
    padding-bottom: 88px;
  }

  .nav {
    width: min(100% - 28px, 780px);
  }

  .nav-links {
    display: none;
  }

  main {
    width: min(100% - 28px, 780px);
  }

  .site-footer {
    width: min(100% - 28px, 780px);
    padding-bottom: 104px;
  }

  .hero {
    min-height: auto;
    max-height: none;
    padding: 32px 0 28px;
    grid-template-columns: 1fr;
    gap: 24px;
  }

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

  .hero-copy p {
    font-size: 16px;
  }

  .metrics {
    margin: 8px 0 42px;
    grid-template-columns: 1fr;
  }

  .metrics div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics div:last-child {
    border-bottom: 0;
  }

  .detail-shell,
  .checkout-layout,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .detail-summary {
    position: static;
  }

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

  .profile-actions {
    grid-template-columns: 1fr;
  }

  .bottom-tabbar {
    display: grid;
  }
}

@media (max-width: 560px) {
  .nav {
    height: 62px;
  }

  .brand span:last-child,
  .cart-button span {
    display: none;
  }

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

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .detail-summary {
    display: grid;
    grid-template-columns: 116px 1fr;
  }

  .detail-summary img {
    width: 116px;
    height: 100%;
    object-fit: cover;
  }

  .detail-summary > div {
    padding: 14px;
  }

  .detail-summary h3 {
    font-size: 19px;
  }

  .detail-summary p {
    display: none;
  }

  .category-page,
  .service-page,
  .profile-page {
    padding-top: 26px;
  }

  .page-heading h2,
  .profile-card h2 {
    font-size: 24px;
  }

  .profile-card {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 16px;
    padding: 20px;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    font-size: 18px;
  }

  .profile-card p {
    font-size: 14px;
  }

  .logout-button {
    min-height: 36px;
    margin-top: 16px;
    padding: 0 14px;
  }

  .checkout-page {
    padding: 12px;
  }

  .checkout-card {
    margin-bottom: 82px;
  }

  .checkout-head,
  .checkout-layout {
    padding: 16px;
  }

  .order-item {
    grid-template-columns: 58px 1fr auto;
  }

  .order-item img {
    width: 58px;
    height: 58px;
  }
}
