:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #d92d20;
  --brand-dark: #b42318;
  --green: #067647;
  --amber: #b54708;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.site-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 0 18px 28px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 248, 0.96);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.nav a {
  padding: 8px 0;
}

.app {
  padding: 22px 0;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: 0;
}

.quiet-button,
.secondary {
  background: #344054;
}

.filters {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 88px;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.filters > button {
  height: 42px;
}

.page-intro {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.filters label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filters input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  min-height: 40px;
  border-radius: 0;
  background: #fff;
  color: var(--muted);
}

.segmented button + button {
  border-left: 1px solid var(--line);
}

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

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

.product-card,
.detail-layout,
.jump-card,
.empty-panel,
.loading-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.product-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.product-image {
  display: block;
  width: 150px;
  height: 150px;
  overflow: hidden;
  border-radius: 8px;
  background: #eef1f4;
}

.product-image img,
.detail-image,
.jump-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-main {
  min-width: 0;
}

.card-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.card-topline span,
.reward-grid span {
  border-radius: 6px;
  background: #f2f4f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.card-topline span {
  padding: 4px 7px;
}

.price-row,
.detail-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
}

.price-row strong,
.detail-price strong {
  color: var(--brand);
  font-size: 22px;
}

.price-row span,
.detail-price span {
  color: var(--muted);
  text-decoration: line-through;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.reward-grid span {
  padding: 8px;
  line-height: 1.35;
}

.reward-grid b {
  display: block;
  margin-top: 3px;
  color: var(--green);
  font-size: 15px;
}

.reward-grid.large span {
  padding: 12px;
  font-size: 14px;
}

.card-actions,
.detail-actions,
.dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.card-actions button,
.detail-actions button,
.quiet-button,
.primary-link,
.secondary-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-link {
  background: var(--brand);
  color: #fff;
}

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

.detail-layout,
.jump-card {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 24px;
  padding: 18px;
}

.detail-image {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #eef1f4;
}

.detail-main {
  min-width: 0;
  padding: 10px 0;
}

.back-link {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.fine-print {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.jump-card img {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #eef1f4;
}

.empty-panel,
.loading-panel {
  padding: 24px;
  color: var(--muted);
  line-height: 1.7;
}

.empty-panel.error h1 {
  margin-bottom: 10px;
  color: var(--ink);
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer p {
  max-width: 720px;
  margin: 8px 0 0;
  line-height: 1.7;
}

.legal-links {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: var(--ink);
}

.footer-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

dialog {
  width: min(94vw, 520px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.24);
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
}

.dialog-body {
  padding: 18px;
}

.dialog-body header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-body h2 {
  margin: 0;
}

.text-close {
  min-height: 32px;
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
}

.dialog-body p {
  margin: 14px 0 10px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-dialog {
  min-width: min(480px, 92vw);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.auth-tabs button {
  min-height: 40px;
  border-radius: 0;
  background: #fff;
  color: var(--muted);
}

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

#authForm {
  display: grid;
  gap: 12px;
}

#authForm label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#authForm input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

#authForm > button {
  min-height: 42px;
  margin-top: 4px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--brand);
  font-size: 13px;
}

.auth-notice {
  margin: 12px 0 0 !important;
  font-size: 12px;
}

.auth-notice a {
  color: var(--brand);
}

.account-gate,
.account-panel,
.legal-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 24px;
}

.account-gate {
  max-width: 640px;
}

.account-gate > p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
}

.account-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.wallet-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.wallet-grid span {
  color: var(--muted);
  font-size: 13px;
}

.wallet-grid strong {
  margin-top: 8px;
  font-size: 22px;
}

.legal-page {
  max-width: 820px;
  margin: 0 auto;
}

.legal-page h1 {
  margin-bottom: 8px;
}

.legal-page h2 {
  margin-top: 28px;
}

.legal-page p {
  line-height: 1.9;
}

.legal-date {
  color: var(--muted);
  font-size: 13px;
}

textarea {
  width: 100%;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  resize: vertical;
}

@media (max-width: 860px) {
  .product-list {
    grid-template-columns: 1fr;
  }

  .filters,
  .detail-layout,
  .jump-card,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .segmented {
    min-width: 0;
  }

  .footer-meta {
    justify-items: start;
    text-align: left;
  }

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

@media (max-width: 540px) {
  .site-shell {
    padding: 0 12px 24px;
  }

  .nav {
    display: none;
  }

  .toolbar {
    display: grid;
  }

  h1 {
    font-size: 24px;
  }

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

  .product-card {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .product-image {
    width: 112px;
    height: 112px;
  }

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

  .card-actions {
    display: grid;
  }

  .card-actions button,
  .card-actions a {
    width: 100%;
  }

  .account-heading {
    display: grid;
  }
}

@media (max-width: 380px) {
  .product-card {
    grid-template-columns: 1fr;
  }

  .product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}
