*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0f1a;
  --card: #141b2d;
  --border: #243049;
  --text: #e8edf7;
  --muted: #8b9bb8;
  --accent: #7c5cff;
  --accent-glow: rgba(124, 92, 255, 0.35);
  --success: #22c55e;
  --warning: #f59e0b;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.stars {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1px 1px at 20% 30%, #fff8, transparent),
    radial-gradient(1px 1px at 60% 70%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, #fff5, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff4, transparent),
    linear-gradient(180deg, #0b0f1a 0%, #12182a 100%);
  z-index: -1;
}

.header {
  border-bottom: 1px solid var(--border);
  background: rgba(20, 27, 45, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 40px;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
}

.brand p {
  font-size: 13px;
  color: var(--muted);
}

.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero h2 {
  font-size: 28px;
  margin-bottom: 12px;
}

.hero p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

.hero strong {
  color: #a78bfa;
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(124, 92, 255, 0.15);
  border-color: #3d4f75;
}

.product-emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.product-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.product-card .desc {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
  margin-bottom: 16px;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price {
  font-size: 22px;
  font-weight: 700;
  color: #c4b5fd;
}

.price span {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.btn-buy {
  border: none;
  background: linear-gradient(135deg, #7c5cff, #5b8def);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn-buy:hover {
  opacity: 0.9;
}

.btn-buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.integration {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.integration h3 {
  margin-bottom: 20px;
  font-size: 18px;
}

.flow {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.flow-step {
  display: flex;
  gap: 12px;
  flex: 1;
  min-width: 160px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 14px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.flow-step strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.flow-step p {
  font-size: 12px;
  color: var(--muted);
}

.flow-arrow {
  color: var(--muted);
  padding-top: 18px;
  font-size: 18px;
}

code {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.webhook-panel {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.webhook-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

#webhook-data {
  background: #0a0e18;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: #94a3b8;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 80px;
}

.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Return page */
.return-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.return-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
}

.return-card .icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.return-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.return-card .sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.order-detail {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  font-size: 13px;
  margin-bottom: 20px;
}

.order-detail div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.order-detail div:last-child {
  border-bottom: none;
}

.order-detail .label {
  color: var(--muted);
}

.status-paid {
  color: var(--success);
  font-weight: 600;
}

.status-pending {
  color: var(--warning);
}

.loading-state .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.back-link {
  margin-top: 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .flow-arrow {
    display: none;
  }
}
