:root {
  --primary: #1a2b4a;
  --primary-light: #2d4a7a;
  --accent: #c9a96e;
  --accent-light: #e0c99a;
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC',
    'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  padding-bottom: 80px;
}

/* Page transitions */
.page-enter {
  animation: pageSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.page-exit {
  animation: pageSlideOut 0.2s ease-in forwards;
}

@keyframes pageSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pageSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-30px); }
}

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

.fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* Benefits card styles */
.benefit-card {
  border-radius: 16px;
  padding: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 160px;
}

.benefit-card:active {
  transform: scale(0.98);
}

.benefit-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.benefit-card::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.benefit-card .card-content {
  position: relative;
  z-index: 1;
}

/* Card detail hero */
.card-hero {
  border-radius: 0 0 24px 24px;
  padding: 60px 24px 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.card-hero::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -40%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

/* Bottom tab bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  cursor: pointer;
  transition: color 0.2s;
  color: var(--text-light);
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  font-size: 10px;
}

.tab-item.active {
  color: var(--primary);
}

.tab-item.active svg {
  color: var(--primary);
}

/* Nav bar */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-bar .back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text);
  border: none;
  background: none;
  padding: 8px;
  margin: -8px;
  font-size: 14px;
}

.nav-bar .title {
  font-size: 17px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Product card */
.product-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid rgba(0,0,0,0.04);
}

.product-card:active {
  transform: scale(0.98);
}

.product-img {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #f0f4f8, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 2rem;
}

/* Tag styles */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.tag-hot {
  background: #fef2f2;
  color: #ef4444;
}

.tag-sale {
  background: #fff7ed;
  color: #f97316;
}

.tag-limit {
  background: #f0f9ff;
  color: #0ea5e9;
}

.tag-vip {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.9);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Amount display */
.amount-large {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
}

.amount-large .symbol {
  font-size: 18px;
  font-weight: 500;
  margin-right: 2px;
}

/* Section styles */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

/* Action sheet */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.overlay.active {
  opacity: 1;
  pointer-events: all;
}

.action-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 201;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 80vh;
  overflow-y: auto;
}

.action-sheet.active {
  transform: translateX(-50%) translateY(0);
}

/* Checkout sheet */
.checkout-sheet { max-height: 92vh; }
.checkout-handle { width: 36px; height: 4px; background: #e2e8f0; border-radius: 2px; margin: 12px auto 0; }
.checkout-section-title { font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.checkout-card-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: #fff;
  cursor: pointer; transition: border-color 0.18s, background 0.18s; margin-bottom: 8px;
}
.checkout-card-item:active { transform: scale(0.99); }
.checkout-card-item.selected { border-color: var(--primary); background: #f4f7ff; }
.checkout-radio {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.checkout-card-item.selected .checkout-radio {
  border-color: var(--primary); background: var(--primary);
}
.checkout-card-badge { font-size: 10px; padding: 2px 7px; background: var(--primary); color: #fff; border-radius: 20px; margin-left: 6px; }
.checkout-card-badge.secondary { background: #e2e8f0; color: var(--text-muted); }
.checkout-amount-input {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; background: #f8fafc;
  border: 2px solid var(--border); border-radius: 12px;
  transition: border-color 0.2s;
}
.checkout-amount-input:focus-within { border-color: var(--primary); }
.checkout-amount-input span { font-size: 22px; font-weight: 700; color: var(--text); }
.checkout-amount-input input {
  flex: 1; font-size: 26px; font-weight: 700;
  border: none; outline: none; background: none; color: var(--text);
  min-width: 0;
}
.checkout-quick-amounts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.checkout-quick-amt {
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: #fff;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.checkout-quick-amt.selected, .checkout-quick-amt:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }
.checkout-agreement {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 16px; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 10px;
}
.checkout-agreement input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--warning); margin-top: 1px; flex-shrink: 0; }
.checkout-agreement-text { font-size: 12px; color: #78350f; line-height: 1.6; }
.checkout-agreement-text a { color: #d97706; text-decoration: underline; }
.checkout-pay-btn {
  width: 100%; padding: 16px; border-radius: 14px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 700; color: #fff; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--primary), #3a6bc9);
  transition: opacity 0.2s, transform 0.1s; margin-top: 4px;
}
.checkout-pay-btn:active { transform: scale(0.98); }
.checkout-pay-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.checkout-pay-btn.alipay-btn { background: linear-gradient(135deg, #0d5cbf, #1677FF); }
.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.sheet-overlay.active { opacity: 1; pointer-events: all; }

/* Category pill */
.category-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s;
  padding: 4px;
}

.category-pill:active {
  transform: scale(0.95);
}

.category-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: box-shadow 0.2s;
}

.category-pill.active .category-icon {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Transaction item */
.transaction-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.transaction-item:last-child {
  border-bottom: none;
}

/* Convert option card */
.convert-option {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.convert-option:active,
.convert-option.selected {
  border-color: var(--primary);
  background: #f0f4ff;
}

/* Button */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:active {
  transform: scale(0.98);
  background: var(--primary-light);
}

.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn-accent {
  background: var(--accent);
}

.btn-accent:active {
  background: var(--accent-light);
}

/* Horizontal scroll card list */
.card-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  scrollbar-width: none;
}

.card-scroll::-webkit-scrollbar {
  display: none;
}

.card-scroll > .benefit-card {
  flex: 0 0 85%;
  scroll-snap-align: start;
}

/* Success animation */
@keyframes checkmark {
  0% { stroke-dashoffset: 50; }
  100% { stroke-dashoffset: 0; }
}

.success-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-check svg {
  stroke-dasharray: 50;
  animation: checkmark 0.5s ease-in-out 0.2s forwards;
  stroke-dashoffset: 50;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}

/* Skeleton loading */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-active {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.badge-expired {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.search-bar:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 43, 74, 0.1);
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
}

.search-bar input::placeholder {
  color: var(--text-light);
}
