/* 星尘积分商城 —— 深空紫主题，纯原生 CSS，无外部依赖 */
:root {
  --bg: #0b0618;
  --bg-2: #140b2b;
  --panel: rgba(28, 18, 52, 0.72);
  --panel-solid: #1a1032;
  --line: rgba(178, 140, 255, 0.18);
  --line-strong: rgba(178, 140, 255, 0.36);
  --text: #f3ecff;
  --muted: #a795c8;
  --gold: #ffd166;
  --gold-deep: #ff9f43;
  --violet: #b28cff;
  --cyan: #57e3d8;
  --rose: #ff6b9d;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px rgba(6, 2, 18, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 700px at 12% -10%, #241044 0%, transparent 60%),
    radial-gradient(900px 600px at 92% 0%, #10203f 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 45%, #0a0516 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.55;
}
.glow-a {
  width: 420px; height: 420px;
  top: -120px; left: -100px;
  background: radial-gradient(circle, rgba(178, 140, 255, 0.55), transparent 70%);
}
.glow-b {
  width: 520px; height: 520px;
  top: 180px; right: -180px;
  background: radial-gradient(circle, rgba(87, 227, 216, 0.28), transparent 70%);
}

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

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(11, 6, 24, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--gold), var(--gold-deep));
  color: #2a1500;
  font-size: 20px;
  box-shadow: 0 8px 24px rgba(255, 159, 67, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: 0.02em; }
.brand-text em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.wallet {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(28, 18, 52, 0.6);
}
.wallet-num { display: flex; flex-direction: column; line-height: 1.15; }
.wallet-label { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.wallet-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  transition: color 0.2s ease, transform 0.2s ease;
}
.wallet-value.bump { transform: scale(1.12); color: var(--cyan); }
.wallet-side { display: flex; align-items: center; gap: 10px; }

.tier {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.tier.tier-silver { color: #d7e3ff; border-color: rgba(215, 227, 255, 0.45); }
.tier.tier-gold { color: var(--gold); border-color: rgba(255, 209, 102, 0.5); }
.tier.tier-diamond { color: var(--cyan); border-color: rgba(87, 227, 216, 0.55); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #2a1500;
  box-shadow: 0 10px 28px rgba(255, 159, 67, 0.28);
}
.btn-primary:hover { box-shadow: 0 14px 34px rgba(255, 159, 67, 0.42); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--violet); background: rgba(178, 140, 255, 0.12); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) clamp(16px, 4vw, 48px) clamp(24px, 4vw, 48px);
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--violet);
}
.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5.2vw, 60px);
  line-height: 1.14;
  letter-spacing: -0.02em;
}
.hl {
  background: linear-gradient(120deg, var(--gold) 10%, var(--gold-deep) 60%, var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  margin: 20px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 16px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(18px, 4vw, 44px);
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }

.hero-card {
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(38, 24, 70, 0.86), rgba(20, 11, 43, 0.72));
  box-shadow: var(--shadow);
}
.hero-card h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: 0.06em; }
.task-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.task-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  font-size: 14px;
}
.task-list li.done { border-color: rgba(87, 227, 216, 0.4); background: rgba(87, 227, 216, 0.08); }
.task-list .task-name { color: var(--text); }
.task-list .task-reward {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.task-list li.done .task-reward { color: var(--cyan); }
.hero-card-foot {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 筛选 ---------- */
.filters {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 48px) 0;
}
.filters-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.filters-head h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.01em; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 16px;
}
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-selected="true"] {
  background: linear-gradient(135deg, rgba(178, 140, 255, 0.28), rgba(87, 227, 216, 0.18));
  border-color: var(--violet);
  color: var(--text);
  font-weight: 600;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.search { flex: 1 1 260px; display: block; }
.search input,
.sort select {
  width: 100%;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.search input::placeholder { color: rgba(167, 149, 200, 0.7); }
.search input:focus,
.sort select:focus {
  outline: none;
  border-color: var(--violet);
  background: rgba(178, 140, 255, 0.1);
}
.sort { flex: 0 1 200px; }
.sort select { cursor: pointer; }

/* ---------- 商品网格 ---------- */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 48px) 0;
}

.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(34, 21, 64, 0.9), rgba(18, 10, 38, 0.78));
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 20px 46px rgba(6, 2, 18, 0.6);
}
.card.sold-out { opacity: 0.66; }
.card.sold-out:hover { transform: none; }

.card-thumb {
  position: relative;
  display: grid;
  place-items: center;
  height: 132px;
  font-size: 52px;
  background: linear-gradient(150deg, rgba(178, 140, 255, 0.22), rgba(87, 227, 216, 0.12));
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px 120px at 50% 120%, rgba(255, 209, 102, 0.25), transparent 70%);
  pointer-events: none;
}
.card-tags {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; gap: 6px;
}
.tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(11, 6, 24, 0.72);
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.tag.tag-hot { color: var(--rose); border-color: rgba(255, 107, 157, 0.5); }
.tag.tag-limited { color: var(--gold); border-color: rgba(255, 209, 102, 0.5); }

.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px; flex: 1; }
.card-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }
.card-desc { margin: 0; font-size: 13px; color: var(--muted); flex: 1; }

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.stock { font-variant-numeric: tabular-nums; }
.stock.low { color: var(--rose); }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.price small { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); }
.card .btn { flex: 0 0 auto; }

.empty {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px);
  color: var(--muted);
  text-align: center;
}

/* ---------- 兑换记录 ---------- */
.records {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 48px) 0;
}
.records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.records-head h2 { margin: 0; font-size: clamp(20px, 2.6vw, 26px); }
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  background: rgba(20, 11, 43, 0.6);
}
.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 520px;
}
.records-table th,
.records-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.records-table th {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
}
.records-table td:nth-child(3) { color: var(--gold); font-variant-numeric: tabular-nums; }
.records-table tbody tr:last-child td { border-bottom: 0; }
.records-empty td { text-align: center; color: var(--muted); padding: 26px 16px; }
.badge-ok {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--cyan);
  border: 1px solid rgba(87, 227, 216, 0.45);
  background: rgba(87, 227, 216, 0.1);
}

/* ---------- 规则 ---------- */
.rules {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 48px) 0;
}
.rules h2 { margin: 0 0 20px; font-size: clamp(20px, 2.6vw, 26px); }
.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.rule {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(28, 18, 52, 0.6);
}
.rule-icon {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--violet);
  border: 1px solid var(--line-strong);
  background: rgba(178, 140, 255, 0.12);
  margin-bottom: 12px;
}
.rule h3 { margin: 0 0 8px; font-size: 15px; }
.rule p { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- 页脚 ---------- */
.footer {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: clamp(48px, 7vw, 88px) auto 0;
  padding: 28px clamp(16px, 4vw, 48px) 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.footer-brand { margin: 0 0 8px; color: var(--text); font-size: 14px; font-weight: 600; }
.footer-note { margin: 0 0 8px; max-width: 70ch; }
.footer-meta { margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 60;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(26, 16, 50, 0.96);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: min(90vw, 480px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 157, 0.6); color: #ffd7e6; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 2, 18, 0.72);
  backdrop-filter: blur(6px);
}
.modal-card {
  position: relative;
  width: min(420px, 100%);
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: linear-gradient(165deg, #241447, #150c2d);
  box-shadow: var(--shadow);
  animation: pop 0.18s ease;
}
@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-card h2 { margin: 0 0 10px; font-size: 18px; }
.modal-body { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-card { order: 2; }
  .hero-stats { margin-top: 28px; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand-text em { display: none; }
  .wallet { width: 100%; justify-content: space-between; padding: 8px 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-thumb { height: 104px; font-size: 40px; }
  .card-body { padding: 12px; gap: 6px; }
  .card-title { font-size: 14px; }
  .card-desc { font-size: 12px; }
  .price { font-size: 17px; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .card-foot .btn { width: 100%; }
  .toolbar .sort { flex: 1 1 100%; }
  .records-table { min-width: 460px; font-size: 13px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
