:root{
  --color-bg:#f5f3fb;
  --color-dark:#1e1b4b;
  --color-primary:#6d28d9;
  --color-primary-hover:#5b21b6;
  --color-accent:#06b6d4;
  --color-text:#1e1b4b;
  --color-muted:#6b7280;
  --color-border:#ddd6fe;
  --color-success:#16a34a;
  --color-gold:#b45309;
  --color-gold-light:#fcd34d;
  --color-green:#16a34a;
  --color-blue:#2563eb;
  --color-pink:#db2777;
  --color-purple:#7c3aed;
}
*{box-sizing:border-box}
body{margin:0;background:var(--color-bg);color:var(--color-text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
a{-webkit-tap-highlight-color:transparent}

/* Topbar matching Account / Refer & Earn */
.purchase-header{
  height:68px;
  padding:0 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#fff;
  border-bottom:1px solid var(--color-border);
}
.purchase-header-inner{
  width:100%;
  max-width:900px;
  margin:auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.purchase-back{
  width:44px;
  height:44px;
  flex-shrink:0;
  border-radius:50%;
  background:#f5f3fb;
  color:var(--color-dark);
  text-decoration:none;
  display:flex;
  align-items:center;
  justify-content:center;
}
.purchase-back svg{width:22px;height:22px;stroke-width:2}
.purchase-title{
  margin:0;
  color:var(--color-dark);
  font-size:18px;
  font-weight:900;
  letter-spacing:-.02em;
}

/* Page */
.purchase-page{max-width:760px;margin:0 auto;padding:20px 16px 80px}
.purchase-intro{padding:22px 20px;text-align:center;background:#fff;border:1px solid var(--color-border);border-radius:22px;margin-top:20px;box-shadow:0 8px 24px -8px rgba(30,27,75,.08)}
.purchase-icon{width:56px;height:56px;margin:0 auto 12px;display:grid;place-items:center;border-radius:18px;background:#f0fdf4;color:var(--color-success);font-size:26px;font-weight:900}
.purchase-intro h1{margin:0;font-size:23px;letter-spacing:-.3px}
.purchase-intro p{margin:8px 0 0;color:var(--color-muted);font-size:13px;line-height:1.6}

/* List */
.purchase-list{display:grid;gap:12px;margin-top:18px}

/* Item card */
.purchase-item{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:16px;
  background:#fff;
  border:1px solid var(--color-border);
  border-radius:20px;
  box-shadow:0 8px 24px -8px rgba(30,27,75,.08);
}
.purchase-item img{
  width:72px;
  height:72px;
  flex:0 0 72px;
  object-fit:cover;
  border-radius:16px;
  background:#f5f3ff;
}
.purchase-item-content{min-width:0;flex:1;display:flex;flex-direction:column;gap:10px}
.purchase-item h2{margin:0;font-size:15px;font-weight:900;color:var(--color-dark);overflow-wrap:anywhere}
.purchase-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.type-pill{font-size:10px;font-weight:800;padding:3px 8px;border-radius:999px;text-transform:uppercase;letter-spacing:.02em;white-space:nowrap}
.type-free{background:#dcfce7;color:var(--color-green)}
.type-paid{background:#eff6ff;color:var(--color-blue)}
.type-physical{background:#fef3c7;color:var(--color-gold)}
.purchase-meta{margin:0;color:var(--color-muted);font-size:12px;line-height:1.5}
.status-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.purchase-status{display:inline-block;padding:4px 9px;border-radius:999px;font-size:11px;font-weight:800;white-space:nowrap}
.status-pending{background:#fff7ed;color:#9a3412}
.status-approved{background:#dcfce7;color:var(--color-success)}
.status-available{background:#dcfce7;color:var(--color-success)}
.status-rejected{background:#fee2e2;color:#b91c1c}

/* Download action button */
.purchase-action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  margin-top:4px;
  padding:0 16px;
  border-radius:12px;
  background:linear-gradient(135deg,#6d28d9,#5b21b6);
  color:#fff;
  text-decoration:none;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  border:0;
  box-shadow:0 10px 20px -6px rgba(109,40,217,.35);
}
.purchase-action.disabled{
  background:#e2e8f0;
  color:#6b7280;
  cursor:not-allowed;
  box-shadow:none;
}
.purchase-action.lottie-btn{padding-left:10px}

/* Lottie animation inside button */
.purchase-action .btn-lottie{
  width:35px;
  height:35px;
  flex-shrink:0;
}

/* Empty state */
.purchase-empty{
  padding:28px 20px;
  text-align:center;
  background:#fff;
  border:1px solid var(--color-border);
  border-radius:20px;
  color:var(--color-muted);
  font-size:14px;
  line-height:1.6;
}
.empty-lottie{
  width:80px;
  height:80px;
  margin:0 auto 16px;
}

/* Secondary link */
.purchase-secondary-link{
  display:block;
  margin:18px auto;
  text-align:center;
  color:var(--color-primary);
  font-size:13px;
  font-weight:800;
  text-decoration:none;
}

/* Order Tracking Modal */
.purchase-tracking-modal{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;padding:20px;padding-bottom:calc(20px + env(safe-area-inset-bottom))}
.purchase-tracking-modal[hidden]{display:none}
.purchase-tracking-overlay{position:absolute;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}
.purchase-tracking-card{position:relative;width:100%;max-width:420px;max-height:85vh;overflow-y:auto;padding:24px;background:#fff;border-radius:20px;border:1px solid var(--color-border);box-shadow:0 24px 60px rgba(30,27,75,.28)}
.tracking-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.tracking-header h2{margin:0;font-size:19px}
.tracking-close{width:36px;height:36px;border:0;border-radius:10px;background:#f1f5f9;cursor:pointer;font-size:22px;line-height:1;color:var(--color-muted)}
.tracking-close:active{background:#e2e8f0}
.tracking-meta{display:flex;justify-content:space-between;flex-wrap:wrap;gap:6px;padding:12px 14px;border-radius:11px;background:#f8fafc;font-size:12px;margin-bottom:18px}
.tracking-meta strong{color:var(--color-dark)}
.tracking-steps{display:grid;gap:14px;list-style:none;padding:0;margin:0}
.tracking-step{display:flex;align-items:flex-start;gap:12px;opacity:.4}
.tracking-step.done,.tracking-step.active{opacity:1}
.step-dot{width:12px;height:12px;flex:0 0 12px;border-radius:50%;background:#cbd5e1;margin-top:5px}
.tracking-step.done .step-dot{background:#16a34a}
.tracking-step.active .step-dot{background:var(--color-primary);box-shadow:0 0 0 4px rgba(109,40,217,.15)}
.tracking-step div strong{display:block;font-size:13px;color:var(--color-dark)}
.tracking-step div small{color:var(--color-muted);font-size:11px}
.tracking-demo-note{margin:16px 0 0;text-align:center;color:var(--color-muted);font-size:11px;line-height:1.5}

/* Responsive */
@media(max-width:420px){
  .purchase-item{align-items:flex-start}
  .purchase-item img{width:62px;height:62px;flex-basis:62px}
  .purchase-intro h1{font-size:20px}
  .purchase-page{padding:16px 14px 80px}
}