:root {
  --buy-bg: #fff8fb;
  --buy-surface: rgba(255, 255, 255, 0.88);
  --buy-text: #1f1a2b;
  --buy-muted: #756f86;
  --buy-primary: #f24b7c;
  --buy-primary-strong: #ef4c80;
  --buy-line: rgba(245, 181, 205, 0.34);
  --buy-shadow: 0 18px 42px rgba(243, 187, 208, 0.16);
}

body.unified-page .header {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0 22px;
  backdrop-filter: blur(18px);
  background: rgba(255,255,255,.86);
  box-shadow: 0 10px 30px rgba(255, 73, 138, 0.08);
  border-bottom: 1px solid rgba(255, 73, 138, 0.08);
}

body.unified-page .brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(24px, 3vw, 36px);
  color: #ff2f7a;
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.04em;
}

body.unified-page .brand-mark { font-size: 0.9em; }
body.unified-page .header-actions { display: flex; align-items: center; gap: 12px; }

body.unified-page .header-icon-btn,
body.unified-page .header-avatar-btn {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 10px 24px rgba(34, 19, 30, 0.08);
}

body.unified-page .header-menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 15px;
}

body.unified-page .header-menu-btn span {
  display: block;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: #35313b;
}

body.unified-page .header-icon { font-size: 24px; }

body.unified-page .header-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ff2f7a;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(255, 47, 122, 0.3);
}

body.unified-page .header-avatar-btn {
  background: linear-gradient(135deg, #ff5f96, #ff2f7a);
  padding: 3px;
}

body.unified-page .header-avatar-face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #121018;
  color: #fff;
  font-size: 24px;
}

.buy-back-link {
  border: none;
  text-decoration: none;
  color: #ff2b7a;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(255, 43, 122, 0.08);
  font: inherit;
  font-weight: 800;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 1.8rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.buy-back-link:hover {
  color: #ff166c;
}

@media (max-width: 720px) {
  body.unified-page .header { height: 78px; padding: 0 16px; }

  .buy-back-link {
    width: 48px;
    height: 48px;
    font-size: 1.55rem;
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--buy-text);
  background:
    radial-gradient(circle at top center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.82) 24%, transparent 56%),
    linear-gradient(180deg, #fff7fb 0%, #fff3f8 48%, #fff8fb 100%);
}

body {
  padding-bottom: 0;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 16px;
  background: rgba(255, 248, 251, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--buy-primary-strong);
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-icon,
.topbar-avatar {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 10px 24px rgba(221, 132, 166, 0.16);
  font-size: 1.45rem;
}

.topbar-avatar {
  border: 3px solid var(--buy-primary);
}

.badge-btn {
  position: relative;
}

.count-badge {
  position: absolute;
  top: -2px;
  right: -1px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--buy-primary);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.buy-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px 124px;
  overscroll-behavior-y: contain;
}

.page-intro {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  row-gap: 2px;
}

.page-intro h2 {
  margin: 0;
}

.page-intro p {
  width: 100%;
  margin: 0;
  padding-left: 74px;
  line-height: 1.25;
}

.page-intro h2,
.history-header h3 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  letter-spacing: -0.03em;
}

@media (max-width: 720px) {
  .page-intro {
    gap: 14px;
    row-gap: 2px;
  }

  .page-intro p {
    padding-left: 62px;
  }

  .buy-page {
    padding-bottom: 108px;
  }
}

.page-intro p,
.history-header p,
.action-copy small,
.hint-card p {
  margin: 8px 0 0;
  color: var(--buy-muted);
  line-height: 1.6;
}

.balance-grid,
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.balance-card,
.history-card,
.hint-card {
  background: var(--buy-surface);
  border: 1px solid var(--buy-line);
  border-radius: 32px;
  box-shadow: var(--buy-shadow);
  backdrop-filter: blur(14px);
}

.balance-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 0;
  padding: 23px 22px;
}

.actionable {
  cursor: pointer;
}

.balance-icon,
.action-icon {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 2rem;
}

.balance-icon.pink {
  background: rgba(255, 90, 151, 0.12);
  color: #ff2f7d;
}

.balance-icon.rose {
  background: rgba(255, 92, 131, 0.12);
  color: #ff4073;
}

.balance-copy {
  display: grid;
  min-width: 0;
  width: 100%;
  align-self: center;
}

.credits-summary-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.credits-summary-card {
  align-items: center;
}

.credits-uses {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  margin-top: -1px;
  white-space: nowrap;
}

.credit-use {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: #4c4760;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.credit-use-icon {
  display: inline-grid;
  place-items: center;
  width: 14px;
  font-size: 0.86rem;
}

.credit-use-icon.whatsapp {
  color: #21c45d;
}

.credit-use-icon.unlock {
  color: #ff2f7a;
}

.credit-use-icon.boost {
  color: #ff5f3d;
}

.credit-use-icon.star {
  color: #f6b619;
}

.credit-use-label {
  color: #46415c;
}

.credit-use-separator {
  color: #ff4e83;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.credits-summary-copy {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  row-gap: 5px;
}

.points-summary-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.points-summary-copy {
  grid-template-rows: auto auto auto;
  row-gap: 9px;
}

.points-summary-inline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.points-next-reward {
  color: var(--buy-primary-strong);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.2;
}

.points-summary-inline .points-progress-meta::before {
  content: "\2022";
  color: #ff4e83;
  font-size: 0.78rem;
  font-weight: 900;
  margin-right: 8px;
}

.points-progress-meta {
  display: flex;
  align-items: center;
  color: #403a55;
  font-size: 0.86rem;
  font-weight: 800;
  margin-top: 0;
}

.points-remaining-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #5d5870;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: -3px;
}

.points-progress {
  position: relative;
  width: min(100%, 540px);
  height: 13px;
  margin-top: 0;
  border-radius: 999px;
  background: rgba(249, 220, 232, 0.95);
  overflow: hidden;
}

.points-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff1f71, #ff4f94);
  box-shadow: 0 6px 18px rgba(255, 43, 122, 0.18);
  min-width: 32px;
}

.credits-summary-value {
  font-size: clamp(2.08rem, 3.15vw, 2.85rem);
  line-height: 1;
  color: var(--buy-text);
  font-weight: 900;
  margin: 0;
}

.credits-summary-label {
  color: var(--buy-primary-strong);
  font-size: 0.88rem;
  font-weight: 900;
}

.credits-summary-card .balance-icon,
.points-summary-card .balance-icon {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: rgba(250, 235, 241, 0.92);
  flex-shrink: 0;
  align-self: center;
}

.points-summary-card .balance-icon {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  font-size: 1.85rem;
}

.points-summary-value {
  font-size: clamp(1.95rem, 2.8vw, 2.7rem);
  line-height: 1;
  color: var(--buy-primary);
  font-weight: 900;
  margin: 0;
}

.points-summary-label {
  color: #231f33;
  font-size: clamp(0.92rem, 1.72vw, 1rem);
  font-weight: 900;
}

.credits-summary-copy,
.points-summary-copy {
  min-height: 100%;
  justify-content: flex-start;
}

.credits-summary-caption {
  font-size: 0.82rem;
  line-height: 1.2;
  color: var(--buy-muted);
  margin: 0;
}

.points-summary-head strong span {
  color: var(--buy-primary-strong);
}

.points-progress-meta strong {
  color: var(--buy-primary-strong);
}

.points-next-reward::before {
  content: "🍿";
  margin-right: 8px;
}

.points-remaining-prefix {
  color: #5b566d;
}

.points-remaining-value {
  color: var(--buy-primary-strong);
  font-size: 1.08rem;
  font-weight: 900;
}

.balance-arrow {
  color: var(--buy-primary-strong);
  font-size: 2rem;
  align-self: center;
  justify-self: end;
  margin-right: 0;
}

.action-card {
  border: none;
  border-radius: 28px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  box-shadow: var(--buy-shadow);
}

.action-copy {
  display: flex;
  flex-direction: column;
}

.action-copy strong {
  font-size: 1.25rem;
}

.primary-action {
  background: linear-gradient(135deg, var(--buy-primary), var(--buy-primary-strong));
  color: #fff;
}

.primary-action .action-copy small {
  color: rgba(255,255,255,0.85);
}

.secondary-action {
  background: var(--buy-surface);
  border: 1px solid var(--buy-line);
  color: var(--buy-primary-strong);
}

.action-icon.solid {
  background: rgba(255,255,255,0.95);
  color: var(--buy-primary-strong);
}

.action-icon.outline {
  background: rgba(255, 59, 133, 0.08);
  color: var(--buy-primary-strong);
  border: 2px solid rgba(255, 59, 133, 0.18);
}

.history-card {
  margin-top: 18px;
  padding: 22px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.history-link {
  border: none;
  background: none;
  color: var(--buy-primary-strong);
  font-weight: 800;
  font-size: 1rem;
}

.history-wrapper {
  margin-top: 18px;
}

.history-list {
  display: grid;
  gap: 0;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(225, 220, 235, 0.76);
  background: rgba(255,255,255,0.74);
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(225, 220, 235, 0.72);
}

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

.history-item-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 59, 133, 0.1);
  color: var(--buy-primary-strong);
  font-size: 1.35rem;
}

.history-main strong,
.history-main small,
.history-side strong,
.history-side small {
  display: block;
}

.history-main strong {
  font-size: 1.05rem;
}

.history-main small,
.history-side small {
  margin-top: 4px;
  color: var(--buy-muted);
}

.history-side {
  text-align: right;
}

.history-delta.positive {
  color: #22b455;
}

.history-delta.negative {
  color: #ff3c62;
}

.history-row-arrow {
  color: #9a96ad;
  font-size: 1.8rem;
}

.history-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 18px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(225, 220, 235, 0.76);
  background: rgba(255,255,255,0.74);
}

.history-tabs button {
  border: none;
  background: transparent;
  padding: 18px 12px;
  color: var(--buy-muted);
  font-weight: 800;
}

.history-tabs button.active {
  background: linear-gradient(180deg, rgba(255, 241, 247, 0.96), rgba(255,255,255,0.96));
  color: var(--buy-primary-strong);
}

.hint-card {
  margin-top: 18px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.hint-pill {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 59, 133, 0.1);
  display: grid;
  place-items: center;
  color: var(--buy-primary-strong);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal:not(.hidden) {
  display: flex;
}

#openpayModal {
  display: none;
}

#openpayModal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(21, 17, 29, 0.76);
}

.modal-content {
  position: relative;
  z-index: 2;
}

.panel-modal {
  width: min(92vw, 680px);
  padding: 28px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 56px rgba(0,0,0,0.24);
  max-height: calc(100vh - 70px);
  overflow-y: auto;
}

.panel-modal h2 {
  margin: 0 0 8px;
}

.panel-modal p {
  margin: 0 0 18px;
  color: var(--buy-muted);
  line-height: 1.6;
}

.close {
  position: absolute;
  top: 16px;
  right: 18px;
  border: none;
  background: none;
  font-size: 1.6rem;
  cursor: pointer;
}

.close.dark {
  color: var(--buy-text);
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.package-card,
.reward-card {
  border: 1px solid rgba(255, 120, 168, 0.16);
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 12px 26px rgba(224, 140, 171, 0.14);
}

.package-card {
  background: linear-gradient(135deg, #ff4d90, #e81d71);
  color: #fff;
}

.reward-card {
  background: rgba(255,255,255,0.92);
  color: var(--buy-text);
}

.package-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.reward-card.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.35);
}

.package-card strong,
.reward-card strong {
  display: block;
  font-size: 1.15rem;
}

.package-card span,
.reward-card span,
.reward-card small {
  display: block;
  margin-top: 6px;
}

.package-price {
  font-size: 1.85rem;
  font-weight: 900;
}

.payment-form {
  display: grid;
  gap: 14px;
}

.payment-form input {
  width: 100%;
  border: 1px solid rgba(213, 207, 223, 0.9);
  border-radius: 16px;
  background: rgba(255,255,255,0.86);
  color: var(--buy-text);
  padding: 15px 16px;
  font: inherit;
}

.payment-form input:focus {
  outline: none;
  border-color: var(--buy-primary);
  box-shadow: 0 0 0 4px rgba(255, 59, 133, 0.1);
}

.payment-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.submit-payment-btn {
  border: none;
  padding: 16px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--buy-primary), var(--buy-primary-strong));
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
}

.pay-status {
  min-height: 20px;
  margin: 0;
  color: var(--buy-muted);
  text-align: center;
}

.loading .packages-grid,
.loading .history-list {
  opacity: 0.45;
  filter: blur(1px);
}

.pulse {
  animation: pulseScale 0.3s ease;
}

@keyframes pulseScale {
  0% { transform: scale(1); }
  50% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .balance-grid,
  .action-grid,
  .packages-grid {
    grid-template-columns: 1fr;
  }

  .points-summary-head {
    flex-wrap: wrap;
    gap: 4px 8px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .buy-page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .buy-page {
    padding-top: 8px;
  }

  .page-intro {
    gap: 10px;
    row-gap: 0;
    margin-bottom: 4px;
  }

  .page-intro h2 {
    font-size: clamp(1.55rem, 8vw, 2.2rem);
    line-height: 1.02;
  }

  .page-intro p {
    padding-left: 56px;
    margin-top: 2px;
    font-size: 0.82rem;
    line-height: 1.34;
  }

  .topbar-icon,
  .topbar-avatar {
    width: 48px;
    height: 48px;
  }

  .balance-card {
    gap: 12px;
    min-height: auto;
    padding: 16px 16px;
  }

  .balance-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    font-size: 1.55rem;
  }

  .credits-summary-copy {
    justify-content: flex-start;
  }

  .credits-summary-top {
    gap: 8px;
  }

  .credit-use {
    min-height: 20px;
    padding: 0;
    font-size: 0.72rem;
    gap: 3px;
  }

  .credits-uses {
    gap: 6px 7px;
    flex-wrap: wrap;
    white-space: normal;
    margin-top: 4px;
    line-height: 1.15;
  }

  .credit-use-icon {
    width: 12px;
    font-size: 0.78rem;
  }

  .credit-use-separator {
    font-size: 0.6rem;
  }

  .credits-summary-value {
    font-size: clamp(1.9rem, 10vw, 2.55rem);
  }

  .credits-summary-label {
    font-size: 0.78rem;
  }

  .credits-summary-caption {
    font-size: 0.74rem;
  }

  .credits-summary-card .balance-icon {
    width: 82px;
    height: 82px;
    border-radius: 22px;
  }

  .credits-summary-copy {
    row-gap: 4px;
  }

  .points-summary-inline {
    gap: 8px;
    flex-wrap: wrap;
    white-space: normal;
  }

  .points-next-reward {
    font-size: 0.82rem;
  }

  .points-progress-meta {
    font-size: 0.82rem;
    margin-top: 2px;
  }

  .points-summary-inline .points-progress-meta::before {
    margin-right: 8px;
  }

  .points-remaining-copy {
    gap: 6px;
    font-size: 0.86rem;
  }

  .points-progress {
    height: 10px;
  }

  .balance-card,
  .history-card {
    border-radius: 26px;
  }

  .history-card {
    padding: 16px 16px;
  }

  .history-header {
    align-items: flex-end;
    gap: 10px;
  }

  .history-header h3 {
    font-size: clamp(1.15rem, 7vw, 1.8rem);
    line-height: 1.02;
  }

  .history-header p {
    margin-top: 4px;
    font-size: 0.78rem;
    line-height: 1.28;
  }

  .history-link {
    font-size: 0.82rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .history-wrapper {
    margin-top: 12px;
  }

  .history-list {
    border-radius: 20px;
  }

  .history-item {
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 8px;
    padding: 8px 10px;
  }

  .history-item-icon {
    width: 34px;
    height: 34px;
    font-size: 0.88rem;
  }

  .history-main strong {
    font-size: 0.86rem;
    line-height: 1.05;
  }

  .history-main small,
  .history-side small,
  .history-side strong {
    font-size: 0.72rem;
  }

  .history-main small,
  .history-side small {
    margin-top: 1px;
    line-height: 1.14;
  }

  .history-side,
  .history-row-arrow {
    grid-column: 2;
  }

  .history-side {
    margin-top: 3px;
  }

  .history-row-arrow {
    justify-self: end;
    margin-top: -4px;
    font-size: 1.2rem;
    line-height: 1;
  }

  .history-tabs {
    margin-top: 14px;
    border-radius: 18px;
  }

  .history-tabs button {
    padding: 14px 8px;
    font-size: 0.82rem;
  }

  .payment-row {
    grid-template-columns: 1fr 1fr;
  }
}
