:root {
  color-scheme: light dark;
  --bg: #faf8f3;
  --bg-elev: #f1ece4;
  --bg-card: #fffdf8;
  --border: #e3dacf;
  --border-strong: #d4c9ba;
  --text: #17130f;
  --text-dim: #6f675d;
  --text-muted: #8a8177;
  --accent: #b85c38;
  --accent-hover: #9f4c2d;
  --accent-soft: rgba(184, 92, 56, .12);
  --nav-h: 64px;
  --radius: 12px;
  --radius-lg: 18px;

  --surface: var(--bg-card);
  --ink: var(--text);
  --muted: var(--text-dim);
  --line: var(--border);
  --soft: var(--bg-elev);
  --green: #26705a;
  --blue: #1677d2;
  --shadow: 0 20px 60px rgba(28, 25, 21, .09);
}

html.dark {
  --bg: #191714;
  --bg-elev: #2a2722;
  --bg-card: #211f1b;
  --border: #3b352d;
  --border-strong: #4a4238;
  --text: #fffaf0;
  --text-dim: #b8afa3;
  --text-muted: #8f8579;
  --accent: #d97757;
  --accent-hover: #f09a72;
  --accent-soft: rgba(217, 119, 87, .14);
  --surface: var(--bg-card);
  --ink: var(--text);
  --muted: var(--text-dim);
  --line: var(--border);
  --soft: color-mix(in srgb, var(--bg-elev) 85%, transparent);
  --green: #73b99f;
  --blue: #69aef0;
  --shadow: 0 20px 60px rgba(0, 0, 0, .24);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Public Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(700px circle at 18% -8%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(720px circle at 84% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 58%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.container { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
}

.topbar .inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  min-width: 216px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  color: var(--text);
}

.brand-mark {
  width: 58px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--bg-card);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--accent) 18%, transparent);
}
.brand-mark .ai { color: var(--accent); }

.brand small {
  display: block;
  margin-top: 1px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 620;
}

.menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.menu a {
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 650;
  transition: .18s ease;
}

.menu a:hover,
.menu a.cur {
  color: var(--text);
  background: var(--bg-elev);
}

.actions {
  min-width: 216px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.icon-btn,
.btn {
  border-radius: 8px;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-elev);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn {
  height: 36px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  color: var(--bg);
  opacity: .88;
}

.menu-wrap {
  position: relative;
}

.dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 42px;
  min-width: 154px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 22px 70px -42px rgba(0, 0, 0, .6);
}

.dropdown.open {
  display: block;
  animation: menuIn .16s ease both;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.dropdown button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  background: transparent;
  color: var(--text-dim);
  font: 650 13px/1 "Public Sans", Inter, system-ui, sans-serif;
  cursor: pointer;
  text-align: left;
}

.dropdown button:hover,
.dropdown button.active {
  background: var(--bg-elev);
  color: var(--text);
}

.mobile-toggle { display: none; }

.intro {
  max-width: 1180px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: 56px;
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 80px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 750;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font: 600 clamp(36px, 5vw, 64px)/1.08 Georgia, "Songti SC", serif;
  letter-spacing: 0;
}

.intro > p:last-child {
  max-width: none;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.account-strip {
  min-height: 54px;
  margin: 28px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: color-mix(in srgb, var(--surface) 52%, transparent);
}

.account-strip > div {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.account-strip strong {
  white-space: nowrap;
}

.account-strip #account-note { color: var(--muted); white-space: nowrap; }
.account-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.account-strip.is-ready .account-dot { background: var(--green); }
.account-strip.is-error .account-dot { background: var(--accent); }

.account-actions { flex: 0 0 auto; }
.account-actions a,
.account-actions button {
  min-height: 34px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.account-actions a { display: inline-flex; align-items: center; }

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 52px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 34px;
}

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

.section-heading > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-heading span {
  color: var(--accent);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.section-heading p { margin: 0; color: var(--muted); }
.section-heading.compact { margin-bottom: 20px; }

.product-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 7px;
  background: var(--soft);
}

.product-tab {
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}

.product-tab.is-selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .08);
}

.plan-list { border-top: 1px solid var(--line); }
.plan-option {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 80px;
  gap: 16px;
  align-items: center;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease, padding .2s ease;
}

.plan-option:hover {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  padding-left: 19px;
}

.plan-option.is-selected {
  background: var(--surface);
  box-shadow: inset 3px 0 var(--accent);
}

.plan-name { font-weight: 800; }
.plan-copy { color: var(--muted); overflow-wrap: anywhere; }
.plan-option strong { text-align: right; font-size: 18px; }
.plan-benchmark-note {
  margin: 12px 14px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.payment-panel {
  min-height: 530px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 92px;
}

.channel-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--soft);
  border-radius: 7px;
}

.channel {
  min-height: 42px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.channel.is-selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(0,0,0,.08);
}

.channel i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
}

.wechat-dot { background: var(--green); }
.alipay-dot { background: var(--blue); }
.summary { margin: 25px 0; }

.summary div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 750; }

.primary-action,
.secondary-action,
.cancel-action {
  width: 100%;
  min-height: 48px;
  border-radius: 6px;
  font-weight: 750;
  cursor: pointer;
}

.primary-action {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
}

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

.cancel-action {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  background: transparent;
  color: var(--accent);
}

.order-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

button:disabled { opacity: .5; cursor: wait; }
.plan-option.sold-out:disabled { opacity: .68; cursor: not-allowed; }
.plan-option.sold-out:hover { padding-left: 14px; background: transparent; }

.fine-print,
.exact-note,
.warning {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.test-mode-note {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.status-line {
  display: flex;
  justify-content: space-between;
  margin: 24px 0 8px;
  font-weight: 700;
}

.status-line time {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.amount-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 0;
  border-block: 1px solid var(--line);
}

.amount-block span { color: var(--muted); }
.amount-block strong {
  font: 700 32px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.qr-frame {
  width: min(240px, 100%);
  aspect-ratio: 1;
  margin: 22px auto 12px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.delivery { margin-top: 24px; }
.delivery-kicker { color: var(--green); font-weight: 750; }
.delivery output {
  display: block;
  margin: 18px 0;
  padding: 14px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: center;
  font: 700 clamp(14px, 3.3vw, 19px)/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.redeem-link {
  display: block;
  margin-top: 12px;
  text-align: center;
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.panel-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-message.is-error { color: #c74b31; }

.steps {
  border-top: 1px solid var(--line);
  margin-top: 72px;
  padding-top: 34px;
}

.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.steps li {
  border-top: 3px solid var(--ink);
  padding-top: 18px;
}

.steps strong,
.steps span { display: block; }
.steps span { color: var(--muted); margin-top: 8px; }

footer {
  min-height: 78px;
  padding: 20px max(24px, calc((100% - 1180px) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

@media (max-width: 900px) {
  .menu {
    display: none;
  }

  .menu.is-open {
    width: 100%;
    position: absolute;
    left: 0;
    top: var(--nav-h);
    z-index: 49;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 16px;
  }

  .menu.is-open a {
    width: 100%;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .actions { min-width: auto; }
}

@media (max-width: 820px) {
  .intro { width: min(100% - 32px, 680px); }
  .main, main { width: min(100% - 32px, 680px); padding-top: 42px; }
  .topbar .inner { gap: 12px; }
  .brand { min-width: 0; }
  .account-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .account-strip > div:first-child { align-items: flex-start; flex-wrap: wrap; }
  .account-strip strong,
  .account-strip #account-note { white-space: normal; }

  .checkout-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .payment-panel { position: static; min-height: 0; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .plan-option { grid-template-columns: 74px minmax(0,1fr) 62px; padding-inline: 8px; }
  .steps ol { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 640px) {
  .container, .main, main { width: min(100% - 32px, 1240px); }
  .brand small,
  .actions .btn:not(.btn-primary) { display: none; }
  .hero { padding-top: 36px; }
}

@media (prefers-reduced-motion: no-preference) {
  .intro,
  .plans,
  .payment-panel { animation: enter .55s ease both; }

  .plans { animation-delay: .08s; }
  .payment-panel { animation-delay: .16s; }

  @keyframes enter {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
