:root {
  color-scheme: light;
  --stage: #dfe5f0;
  --page: #f2f5fa;
  --surface: #ffffff;
  --surface-soft: #eaf7f8;
  --surface-muted: #edf1f7;
  --ink: #071c46;
  --text: #243552;
  --muted: #53627a;
  --subtle: #69758a;
  --line: #d7deea;
  --navy: #08265d;
  --navy-pressed: #061c46;
  --accent: #078f98;
  --accent-strong: #05747c;
  --accent-soft: #d8f2f3;
  --danger: #a83b32;
  --shadow: 0 12px 34px rgb(24 48 91 / 0.1);
  --radius-card: 16px;
  --radius-control: 12px;
  --sheet-radius: 24px;
  font-family:
    "Source Han Sans SC",
    "Noto Sans CJK SC",
    "Microsoft YaHei UI",
    "PingFang SC",
    system-ui,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --stage: #050b17;
    --page: #091326;
    --surface: #101d34;
    --surface-soft: #102e34;
    --surface-muted: #14223a;
    --ink: #f2f6ff;
    --text: #d8e1f1;
    --muted: #adbad0;
    --subtle: #9ca9be;
    --line: #273650;
    --navy: #0e316f;
    --navy-pressed: #0a285c;
    --accent: #4bc4ca;
    --accent-strong: #79dce0;
    --accent-soft: #113b43;
    --danger: #ff9085;
    --shadow: 0 16px 44px rgb(0 0 0 / 0.34);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--stage);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--stage);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.sheet-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button,
input,
summary {
  outline: none;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.app-shell {
  --brand-row-height: calc(66px + env(safe-area-inset-top, 0px));
  width: min(100%, 480px);
  min-height: 100dvh;
  margin-inline: auto;
  overflow: clip;
  background: var(--page);
}

.sticky-stack {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--page);
}

.brand-row {
  height: var(--brand-row-height);
  min-height: var(--brand-row-height);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand-logo {
  width: 116px;
  height: auto;
  object-fit: contain;
}

@media (prefers-color-scheme: dark) {
  .brand-logo {
    filter: brightness(0) invert(1);
  }
}

.points-status {
  min-height: 40px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-muted);
  font-size: 13px;
  line-height: 1;
}

.points-status .icon {
  width: 18px;
  color: var(--accent-strong);
}

.points-status strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.mobile-hero {
  position: relative;
  min-height: 126px;
  padding: 20px 16px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  color: #f6f9ff;
  background:
    radial-gradient(circle at 88% 14%, rgb(49 194 199 / 0.22), transparent 28%),
    linear-gradient(145deg, #061b46 0%, var(--navy) 72%, #0b3869 100%);
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}

.mobile-hero::before {
  content: "";
  position: absolute;
  right: -72px;
  bottom: -104px;
  width: 250px;
  height: 220px;
  opacity: 0.28;
  background: repeating-radial-gradient(
    ellipse at center,
    transparent 0 10px,
    rgb(159 236 232 / 0.42) 11px 12px,
    transparent 13px 21px
  );
  transform: rotate(-10deg) scale(1);
  animation: ripple-breathe 7s ease-in-out infinite alternate;
}

.mobile-hero > * {
  position: relative;
  z-index: 1;
}

.mobile-hero h1 {
  max-width: 9em;
  margin: 0;
  color: #ffffff;
  font-size: clamp(28px, 8.4vw, 36px);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.mobile-hero > div > p {
  max-width: 24em;
  margin: 10px 0 0;
  color: #d6e1f4;
  font-size: 13px;
  line-height: 1.55;
}

.catalog-count {
  min-width: 54px;
  margin: 0 0 2px;
  text-align: right;
}

.catalog-count strong,
.catalog-count span {
  display: block;
}

.catalog-count strong {
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.catalog-count span {
  margin-top: 5px;
  color: #b9c9e3;
  font-size: 11px;
}

.sticky-controls {
  padding: 12px 0 9px;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.search-field {
  min-height: 48px;
  margin-inline: 16px;
  padding: 0 8px 0 13px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: 0 4px 16px rgb(27 53 96 / 0.05);
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-field > .icon {
  width: 20px;
  color: var(--subtle);
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  font-size: 16px;
}

.search-field input::placeholder {
  color: var(--subtle);
  opacity: 1;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.icon-button:active {
  transform: scale(0.96);
  background: var(--surface-muted);
}

.icon-button .icon {
  width: 20px;
}

.category-strip {
  margin-top: 9px;
  padding: 0 16px 2px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-button {
  min-height: 44px;
  padding: 0 14px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms ease, color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.category-button[aria-pressed="true"] {
  color: #ffffff;
  border-color: var(--navy);
  background: var(--navy);
}

.category-button:active {
  transform: scale(0.97);
}

.catalog-section {
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

.catalog-heading {
  margin-bottom: 12px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.catalog-heading h2,
.catalog-heading p {
  margin: 0;
}

.catalog-heading h2 {
  color: var(--ink);
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.catalog-heading > div p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.result-count {
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.product-grid {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
}

.product-card {
  min-width: 0;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 320ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms),
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms);
}

.product-card.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.product-card-button {
  width: 100%;
  height: 100%;
  min-height: 264px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(27 53 96 / 0.07);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.product-card-button:active {
  transform: scale(0.985);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 4px 14px rgb(27 53 96 / 0.09);
}

.product-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  flex: none;
  display: block;
  overflow: hidden;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
}

.product-card-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 280ms ease, transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.product-card-image.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.product-card-image.is-error {
  opacity: 1;
  background: var(--surface-muted);
  transform: none;
}

.product-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #ffffff;
  border-radius: 999px;
  background: rgb(7 28 70 / 0.88);
  box-shadow: 0 5px 14px rgb(3 17 47 / 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 760;
}

.product-card-badge svg {
  width: 14px;
  height: 14px;
}

.product-card-copy {
  width: 100%;
  min-height: 111px;
  padding: 10px 10px 11px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.product-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.product-card-meta span:last-child {
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

.product-card-title {
  min-height: 39px;
  margin: 7px 0 9px;
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: -0.015em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.product-card-points {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.product-card-state {
  min-height: 26px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.product-card-state .icon {
  width: 15px;
}

.empty-state {
  min-height: 330px;
  padding: 52px 22px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.empty-state .empty-icon {
  width: 34px;
  color: var(--accent-strong);
}

.empty-state h3 {
  margin: 15px 0 6px;
  color: var(--ink);
  font-size: 18px;
}

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

.empty-state button {
  min-height: 44px;
  margin-top: 20px;
  padding: 0 18px;
  color: #ffffff;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

.product-sheet {
  width: min(100%, 480px);
  max-width: 480px;
  height: fit-content;
  max-height: min(92dvh, 840px);
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  border: 0;
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 60px rgb(3 17 47 / 0.28);
}

.product-sheet::backdrop {
  background: rgb(3 16 42 / 0.64);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.product-sheet[open] {
  animation: sheet-in 230ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-layout {
  max-height: min(92dvh, 840px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.sheet-header {
  min-height: 58px;
  padding: 8px 10px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.sheet-header-copy {
  min-width: 0;
}

.sheet-header-copy p,
.sheet-header-copy h2 {
  margin: 0;
}

.sheet-header-copy p {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.sheet-header-copy h2 {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-product-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1.18;
  object-fit: contain;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
}

.sheet-content {
  padding: 18px 16px 26px;
}

.sheet-product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}

.sheet-product-meta span:last-child {
  color: var(--subtle);
}

.sheet-title {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 820;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.sheet-lead {
  margin: 10px 0 0;
  color: var(--accent-strong);
  font-size: 16px;
  line-height: 1.55;
}

.sheet-tagline {
  margin: 18px 0;
  padding: 14px 15px;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--surface-soft);
  font-size: 17px;
  font-weight: 720;
  line-height: 1.5;
}

.story-details {
  border-top: 1px solid var(--line);
}

.story-details:last-child {
  border-bottom: 1px solid var(--line);
}

.story-details summary {
  min-height: 50px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
  cursor: pointer;
  list-style: none;
}

.story-details summary::-webkit-details-marker {
  display: none;
}

.story-details summary::after {
  content: "+";
  color: var(--accent-strong);
  font-size: 21px;
  font-weight: 500;
}

.story-details[open] summary::after {
  content: "−";
}

.story-details p {
  margin: -2px 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.sheet-action {
  min-height: 76px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(124px, auto);
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sheet-action-label {
  min-width: 0;
}

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

.sheet-action-label span {
  color: var(--muted);
  font-size: 12px;
}

.sheet-action-label strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease;
}

.primary-button {
  color: #ffffff;
  border: 1px solid var(--navy);
  background: var(--navy);
}

.primary-button:active,
.secondary-button:active {
  transform: scale(0.98);
}

.primary-button:disabled {
  color: var(--subtle);
  border-color: var(--line);
  background: var(--surface-muted);
  cursor: not-allowed;
}

.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}

.confirm-content {
  padding: 22px 16px 28px;
}

.confirm-product {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.confirm-product img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #f7f8fa;
}

.confirm-product h3,
.confirm-product p {
  margin: 0;
}

.confirm-product h3 {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.confirm-product p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.balance-summary {
  margin: 20px 0 0;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-muted);
}

.balance-summary > div {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.balance-summary > div + div {
  border-top: 1px solid var(--line);
}

.balance-summary dt {
  color: var(--muted);
  font-size: 13px;
}

.balance-summary dd {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.demo-note,
.balance-warning {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.demo-note {
  color: var(--muted);
}

.balance-warning {
  color: var(--danger);
  font-weight: 700;
}

.confirm-actions {
  min-height: 76px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  width: max-content;
  max-width: min(calc(100vw - 32px), 448px);
  padding: 11px 15px;
  color: #ffffff;
  border-radius: var(--radius-control);
  background: #0a234f;
  box-shadow: 0 12px 34px rgb(0 0 0 / 0.24);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
}

.noscript-message {
  margin: 20px 16px;
  padding: 14px;
  color: var(--danger);
  border: 1px solid currentColor;
  border-radius: var(--radius-control);
  background: var(--surface);
}

.icon,
.icon svg {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ripple-breathe {
  from {
    opacity: 0.2;
    transform: rotate(-10deg) scale(0.98);
  }
  to {
    opacity: 0.34;
    transform: rotate(-10deg) scale(1.04);
  }
}

@media (max-width: 359px) {
  .brand-row {
    padding-inline: 12px;
  }

  .brand-logo {
    width: 102px;
  }

  .points-status {
    padding-inline: 9px;
    font-size: 12px;
  }

  .mobile-hero {
    padding-inline: 12px;
  }

  .search-field {
    margin-inline: 12px;
  }

  .category-strip,
  .catalog-section {
    padding-inline: 12px;
  }

  .category-strip {
    scroll-padding-inline: 12px;
  }

  .product-grid {
    gap: 8px;
  }

  .product-card-button {
    min-height: 244px;
  }

  .product-card-copy {
    min-height: 105px;
    padding-inline: 9px;
  }

  .product-card-title {
    font-size: 14px;
  }

  .product-card-points {
    font-size: 13px;
  }
}

@media (min-width: 600px) {
  .app-shell {
    box-shadow: 0 0 70px rgb(13 32 69 / 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .product-card {
    opacity: 1;
    transform: none;
  }

  .product-card-image {
    opacity: 1;
    transform: none;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .sticky-controls,
  .sheet-action {
    background: var(--page);
  }

  .product-sheet::backdrop {
    background: rgb(3 16 42 / 0.72);
  }
}
