:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --gold: #b45309;
  --gold-soft: #fffbeb;
  --ok: #027a48;
  --err: #b42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 20px;
  min-height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.2px;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
  display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 900;
}
.nav { display: flex; align-items: center; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 14.5px; font-weight: 600; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); }
/* 登录态插槽：避免两个链接/按钮贴在一起，并保证按钮白字不被 .nav a 覆盖 */
#nav-session { display: flex; align-items: center; gap: 14px; }
.nav a.btn, .nav a.btn:hover { color: #fff; text-decoration: none; }

.balance-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid #fde68a; border-radius: 999px;
  padding: 5px 12px; font-size: 13.5px; font-weight: 700;
  white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 11px; cursor: pointer;
  background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 700; font-family: inherit;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: #f9fafb; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 9px; }

/* ---------- hero ---------- */
.hero {
  padding: 64px 0 44px;
  background:
    radial-gradient(900px 340px at 12% -12%, #eef2ff 0%, rgba(238, 242, 255, 0) 70%),
    radial-gradient(700px 300px at 96% 0%, #fdf4ff 0%, rgba(253, 244, 255, 0) 70%);
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 44px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 {
  margin: 0 0 16px; font-size: clamp(31px, 4.4vw, 46px); line-height: 1.14; letter-spacing: -1.2px;
}
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { margin: 0 0 26px; color: var(--muted); font-size: 17px; max-width: 520px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { margin-top: 14px; font-size: 13px; color: var(--muted); }

.credit-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 28px;
}
.credit-card .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.credit-card .amount { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; margin: 4px 0 2px; }
.credit-card .amount span { font-size: 18px; color: var(--muted); font-weight: 700; }
.credit-card ul { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 11px; }
.credit-card li { display: flex; gap: 10px; font-size: 14.5px; color: var(--muted); }
.credit-card li b { color: var(--text); font-weight: 700; }
.credit-card .tick { color: var(--ok); font-weight: 900; }

/* ---------- sections ---------- */
.section { padding: 52px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-head h2 { margin: 0; font-size: 26px; letter-spacing: -.6px; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.step .num {
  width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; margin-bottom: 14px;
}
.step h3 { margin: 0 0 6px; font-size: 16.5px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- products ---------- */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.product-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(16, 24, 40, .1); }
.thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  font-size: 42px; font-weight: 900; color: #fff; letter-spacing: -1px;
}
.thumb.indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.thumb.teal { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.thumb.amber { background: linear-gradient(135deg, #f59e0b, #b45309); }
.thumb.rose { background: linear-gradient(135deg, #fb7185, #be123c); }
.thumb.violet { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.thumb.slate { background: linear-gradient(135deg, #64748b, #1e293b); }
.product-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-body h3 { margin: 0; font-size: 16px; }
.product-body .tagline { color: var(--muted); font-size: 13.5px; }
.product-body .price-row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; }
.price { font-size: 18px; font-weight: 800; }
.stock { font-size: 12.5px; color: var(--muted); }

/* ---------- forms ---------- */
.auth-shell { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 48px 20px; }
.auth-card {
  width: min(460px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); padding: 34px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.5px; }
.auth-card .sub { margin: 0 0 24px; color: var(--muted); font-size: 14.5px; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13.5px; font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 0 13px;
  border: 1px solid #d0d5dd; border-radius: 11px;
  font-size: 15.5px; font-family: inherit; color: var(--text); background: #fff;
}
.field textarea { padding: 11px 13px; min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid rgba(79, 70, 229, .16); border-color: var(--brand);
}
.hint { font-size: 12.5px; color: var(--muted); }
.form-msg { min-height: 20px; font-size: 14px; font-weight: 600; margin: 4px 0 12px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.auth-alt { margin: 18px 0 0; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- account ---------- */
.page-head { padding: 38px 0 8px; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.7px; }
.page-head p { margin: 0; color: var(--muted); }

.account-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 20px; padding: 22px 0 56px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card .card-sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.balance-box { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.balance-box .big { font-size: 38px; font-weight: 800; letter-spacing: -1.4px; }
.balance-box .unit { color: var(--muted); font-weight: 700; font-size: 14px; }

.invite-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.invite-row input {
  flex: 1 1 240px; min-height: 44px; padding: 0 12px;
  border: 1px dashed #c7d2fe; border-radius: 10px; background: #f8faff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; color: #3730a3;
}
.code-chip {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 8px; padding: 3px 9px; font-size: 14px; font-weight: 700;
  letter-spacing: .5px;
}

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f9fafb; color: #475467; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 22px; white-space: normal; }

.stack { display: grid; gap: 20px; padding-top: 4px; }
.full-span { grid-column: 1 / -1; }

.status-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #fef3c7; color: #92400e;
}
.status-badge.paid { background: #d1fae5; color: #065f46; }

/* ---------- product detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 30px; padding: 34px 0 60px; }
/* 关键：aspect-ratio 的 grid 项默认会被拉伸到行高，从而用高度反推宽度把列撑爆。
   这里禁止拉伸并允许收缩。 */
.detail-grid > * { min-width: 0; }
.detail-media { aspect-ratio: 4 / 3; border-radius: 18px; display: grid; place-items: center; color: #fff; font-size: 84px; font-weight: 900; align-self: start; }
.detail-body h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.8px; }
.detail-body .tagline { color: var(--muted); margin: 0 0 18px; }
.detail-body .desc { color: #344054; margin: 0 0 22px; }
.buy-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.qty-input { width: 84px; min-height: 44px; border: 1px solid #d0d5dd; border-radius: 10px; text-align: center; font-size: 15px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 30px 0; margin-top: 30px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #101828; color: #fff; padding: 11px 18px; border-radius: 11px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.skeleton { background: linear-gradient(90deg, #f2f4f7 25%, #e9ecf1 37%, #f2f4f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius); min-height: 240px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; gap: 22px; }
  .nav { gap: 14px; }
}
@media (max-width: 620px) {
  .product-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 30px; }
  .auth-card { padding: 24px; }
  .nav a.hide-sm { display: none; }
  .site-header .wrap { min-height: 58px; }
}
