.main:has(.referral-program) {
  max-width: 1060px;
}

.referral-program {
  display: grid;
  gap: 22px;
  max-width: 100%;
  color: #17233b;
}

.ref-program-hero,
.ref-rewards-panel,
.ref-link-card,
.ref-zalo-card,
.ref-steps,
.ref-terms {
  border: 1px solid #f0dfd2;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(55, 39, 25, .07);
}

.ref-program-hero {
  position: relative;
  display: grid;
  grid-template-columns: 57% 43%;
  min-height: 278px;
  overflow: hidden;
  background: linear-gradient(115deg, #fffdfb 0%, #fff7f0 61%, #ffeddc 100%);
}

.ref-program-hero::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, #ff7321, #ffbd63);
}

.ref-program-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 34px 18px 34px 42px;
}

.ref-program-kicker,
.ref-link-copy > small,
.ref-zalo-copy small {
  display: inline-block;
  color: #e9560b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.ref-program-kicker {
  padding: 6px 10px;
  border: 1px solid #ffd5b3;
  border-radius: 999px;
  background: #fff5eb;
}

.ref-program-copy h1 {
  max-width: 520px;
  margin: 12px 0 10px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.12;
  letter-spacing: -1.4px;
}

.ref-program-copy h1 em {
  color: #f45711;
  font-style: normal;
}

.ref-program-copy p {
  max-width: 470px;
  margin: 0;
  color: #65748c;
  font-size: 14px;
  line-height: 1.65;
}

.ref-program-date {
  display: inline-block;
  margin-top: 17px;
  padding: 8px 11px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(73, 45, 25, .06);
  color: #53647d;
  font-size: 11px;
  font-weight: 700;
}

.ref-program-art {
  position: relative;
  min-height: 278px;
  overflow: hidden;
}

.ref-program-art img {
  position: absolute;
  z-index: 3;
  right: 32px;
  bottom: -34px;
  width: 245px;
  height: 235px;
  object-fit: contain;
  filter: drop-shadow(0 17px 13px rgba(147, 67, 5, .17));
  transform: rotate(-3deg);
}

.ref-program-orbit {
  position: absolute;
  border: 1px solid rgba(255, 122, 29, .14);
  border-radius: 50%;
}

.orbit-one {
  top: 21px;
  right: 68px;
  width: 193px;
  height: 193px;
  box-shadow: 0 0 0 21px rgba(255, 144, 47, .045);
}

.orbit-two {
  right: -91px;
  bottom: -99px;
  width: 285px;
  height: 285px;
}

.ref-person,
.ref-coin {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.ref-person {
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 7px 14px rgba(39, 40, 48, .14);
}

.ref-person-one {
  top: 41px;
  left: 35px;
  width: 52px;
  height: 52px;
  background: #075b59;
}

.ref-person-one::before,
.ref-person-one::after {
  position: absolute;
  left: 50%;
  content: "";
  background: #fff;
  transform: translateX(-50%);
}

.ref-person-one::before {
  top: 12px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.ref-person-one::after {
  bottom: 10px;
  width: 25px;
  height: 13px;
  border-radius: 14px 14px 7px 7px;
}

.ref-person-two {
  top: 82px;
  left: 76px;
  width: 32px;
  height: 32px;
  background: #fff;
  color: #ee590d;
  font-size: 21px;
}

.ref-coin {
  width: 34px;
  height: 34px;
  border: 3px solid #fff3a5;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd55e, #f49a05);
  box-shadow: 0 4px 10px rgba(161, 95, 0, .17);
  color: #fff6c2;
  font-size: 17px;
}

.ref-coin-one {
  right: 27px;
  top: 42px;
}

.ref-coin-two {
  left: 88px;
  bottom: 40px;
  transform: rotate(-14deg);
}

.ref-rewards-panel,
.ref-steps,
.ref-terms {
  padding: 25px;
}

.ref-rewards-panel {
  position: relative;
  overflow: hidden;
  border-color: #f4cdae;
  box-shadow: 0 11px 26px rgba(200, 93, 18, .11), inset 0 0 0 1px rgba(255, 255, 255, .7);
}

.ref-rewards-panel > :not(.ref-reward-trace) {
  position: relative;
  z-index: 1;
}

.ref-reward-trace {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 145, 49, .58);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), 0 0 14px rgba(255, 132, 41, .14);
  pointer-events: none;
}

.ref-reward-trace i {
  position: absolute;
  display: block;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, rgba(255, 191, 100, .75), #fff 50%, rgba(255, 191, 100, .75), transparent);
  box-shadow: 0 0 10px rgba(255, 121, 24, .82);
}

.ref-reward-trace i:nth-child(1),
.ref-reward-trace i:nth-child(3) {
  width: 145px;
  height: 2px;
}

.ref-reward-trace i:nth-child(1) {
  top: -1px;
  animation: ref-trace-right 4.1s linear infinite;
}

.ref-reward-trace i:nth-child(2),
.ref-reward-trace i:nth-child(4) {
  width: 2px;
  height: 95px;
  background: linear-gradient(180deg, transparent, rgba(255, 191, 100, .75), #fff 50%, rgba(255, 191, 100, .75), transparent);
}

.ref-reward-trace i:nth-child(2) {
  top: -95px;
  right: -1px;
  animation: ref-trace-down 4.1s linear infinite -1.02s;
}

.ref-reward-trace i:nth-child(3) {
  right: -145px;
  bottom: -1px;
  animation: ref-trace-left 4.1s linear infinite -2.04s;
}

.ref-reward-trace i:nth-child(4) {
  bottom: -95px;
  left: -1px;
  animation: ref-trace-up 4.1s linear infinite -3.06s;
}

@keyframes ref-trace-right {
  from { left: -145px; }
  to { left: calc(100% + 145px); }
}

@keyframes ref-trace-down {
  from { top: -95px; }
  to { top: calc(100% + 95px); }
}

@keyframes ref-trace-left {
  from { right: -145px; }
  to { right: calc(100% + 145px); }
}

@keyframes ref-trace-up {
  from { bottom: -95px; }
  to { bottom: calc(100% + 95px); }
}

.ref-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ref-section-heading > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: #fff0e4;
  color: #ef5a0e;
  font-size: 10px;
  font-weight: 800;
}

.ref-section-heading h2,
.ref-link-copy h2,
.ref-zalo-copy h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.35px;
}

.ref-section-heading p,
.ref-link-copy p,
.ref-zalo-copy p {
  margin: 4px 0 0;
  color: #748198;
  font-size: 13px;
  line-height: 1.55;
}

.ref-rewards-grid {
  display: grid;
  grid-template-columns: 31% 1fr;
  gap: 14px;
  margin-top: 20px;
}

.ref-hot-reward {
  position: relative;
  min-height: 244px;
  padding: 25px;
  overflow: hidden;
  border: 1px solid #ffaf84;
  border-radius: 18px;
  background: linear-gradient(145deg, #ff5b18, #ff7c2b);
  color: #fff;
}

.ref-hot-reward::after {
  position: absolute;
  right: -25px;
  bottom: -45px;
  width: 132px;
  height: 132px;
  border: 15px solid rgba(255, 255, 255, .11);
  border-radius: 50%;
  content: "";
}

.ref-card-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .18);
  color: #ffefb7;
}

.ref-hot-reward > small {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.ref-hot-reward h3 {
  margin: 5px 0 8px;
  font-size: 29px;
  line-height: 1.1;
}

.ref-hot-reward h3 em {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-style: normal;
}

.ref-hot-reward p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.ref-hot-reward > div {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.ref-hot-reward > div b {
  margin-right: 4px;
  color: #c9ffdc;
}

.ref-tier-reward {
  padding: 19px;
  border: 1px solid #f0e2d8;
  border-radius: 18px;
  background: #fffcfa;
}

.ref-tier-title {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ref-tier-title > span {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 11px;
  background: #fff0e4;
  color: #f15c12;
}

.ref-tier-title small {
  color: #ee5a0e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
}

.ref-tier-title h3 {
  margin: 3px 0 0;
  font-size: 17px;
}

.ref-tier-condition {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 13px 0 0;
  padding: 8px 10px;
  border: 1px solid #f3dfc9;
  border-radius: 10px;
  background: #fff8f1;
  color: #69778c;
  font-size: 11px;
  line-height: 1.45;
}

.ref-tier-condition span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ddf7e8;
  color: #169357;
  font-size: 10px;
  font-weight: 800;
}

.ref-tier-condition b {
  color: #e7550d;
}

.ref-tier-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.ref-tier {
  min-height: 128px;
  padding: 12px 9px;
  border: 1px solid #e4ebef;
  border-radius: 13px;
  background: #fff;
  text-align: center;
}

.ref-tier > b,
.ref-tier > span,
.ref-tier > small {
  display: block;
}

.ref-tier > b {
  font-size: 15px;
}

.ref-tier > span {
  min-height: 28px;
  margin-top: 5px;
  color: #728096;
  font-size: 11px;
  line-height: 1.35;
}

.ref-tier > strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 28px;
  line-height: 1;
}

.ref-tier > small {
  color: #748197;
  font-size: 9px;
  line-height: 1.35;
}

.ref-tier.mint { border-color: #b7e8cf; }
.ref-tier.mint > b, .ref-tier.mint > strong { color: #159d59; }
.ref-tier.amber { border-color: #f7d484; }
.ref-tier.amber > b, .ref-tier.amber > strong { color: #e58a08; }
.ref-tier.coral { border-color: #ffc0ad; }
.ref-tier.coral > b, .ref-tier.coral > strong { color: #ed5924; }
.ref-tier.violet { border-color: #d5c8fb; }
.ref-tier.violet > b, .ref-tier.violet > strong { color: #6a48cd; }

.ref-link-card {
  display: grid;
  grid-template-columns: auto 1fr minmax(310px, 43%);
  align-items: center;
  gap: 15px;
  padding: 20px 24px;
}

.ref-link-icon,
.ref-zalo-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px;
  background: #fff0e4;
  color: #ef5a0e;
  font-size: 23px;
  font-weight: 800;
}

.ref-link-copy > small {
  margin-bottom: 4px;
}

.ref-link-control {
  display: flex;
  gap: 8px;
}

.ref-link-control input {
  min-width: 0;
  width: 100%;
  padding: 12px;
  border: 1px solid #dfe4ea;
  border-radius: 12px;
  background: #fafbfc;
  color: #637188;
  font: 11px inherit;
}

.referral-program .referral-copy {
  position: relative;
  flex: 0 0 auto;
  min-height: 43px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: #ff5a0b;
  box-shadow: 0 6px 12px rgba(242, 83, 11, .2);
  color: #fff;
  font: 700 12px inherit;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.referral-program .referral-copy:hover {
  background: #ff711e;
  box-shadow: 0 9px 17px rgba(242, 83, 11, .3);
  transform: translateY(-1px);
}

.referral-program .referral-copy:active {
  transform: scale(.96);
}

.referral-program .referral-copy.copy-pop {
  animation: referral-copy-pop .68s ease both;
}

@keyframes referral-copy-pop {
  0% { transform: scale(1); box-shadow: 0 6px 12px rgba(242, 83, 11, .2); }
  35% { transform: scale(1.07); background: #ff9b37; box-shadow: 0 0 0 7px rgba(255, 160, 58, .19), 0 9px 18px rgba(242, 83, 11, .3); }
  100% { transform: scale(1); box-shadow: 0 6px 12px rgba(242, 83, 11, .2); }
}

.ref-zalo-card {
  display: grid;
  grid-template-columns: 1fr 300px;
  overflow: hidden;
  background: linear-gradient(100deg, #fff 0%, #f7fcff 100%);
}

.ref-zalo-copy {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 25px 28px;
}

.ref-zalo-icon {
  flex: 0 0 auto;
  background: #eaf5ff;
  color: #3977df;
}

.ref-zalo-copy code {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-top: 13px;
  padding: 10px 12px;
  border: 1px solid #c9e8d4;
  border-radius: 10px;
  background: #f2fff6;
  color: #17884d;
  font: 700 13px "Be Vietnam Pro", sans-serif;
}

.ref-zalo-note {
  display: block;
  margin-top: 9px;
  color: #748198;
  font-size: 11px;
}

.ref-zalo-phone {
  align-self: end;
  min-height: 181px;
  overflow: hidden;
  border: 1px solid #f2ddcd;
  border-radius: 18px;
  background: #fff8f1;
  box-shadow: 0 10px 20px rgba(126, 69, 24, .1);
}

.ref-zalo-phone-head {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 58px;
  margin: 0;
  padding: 10px 13px;
  background: linear-gradient(115deg, #f85b16, #ff8a32);
  color: #f9fbff;
}

.ref-zalo-group-mark {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .86);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(143, 55, 7, .2);
  color: #f25a12;
  font-size: 17px;
  font-weight: 800;
}

.ref-zalo-phone-head b,
.ref-zalo-phone-head small {
  display: block;
}

.ref-zalo-phone-head b {
  overflow: hidden;
  max-width: 215px;
  color: #fff;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-zalo-phone-head b i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 5px 1px 0;
  border-radius: 2px;
  background: #ffe46a;
  transform: rotate(45deg);
}

.ref-zalo-phone-head small {
  margin-top: 2px;
  color: #fff4e8;
  font-size: 9px;
  line-height: 1.2;
}

.ref-zalo-phone-head small em {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 3px -1px 5px;
  border: 1px solid #fff4e8;
  border-radius: 50%;
  font-style: normal;
}

.ref-zalo-chat {
  padding: 13px 14px 15px;
  background: linear-gradient(180deg, #fffaf5, #fff5eb);
}

.ref-zalo-chat p {
  display: inline-block;
  margin: 0 0 9px 44px;
  padding: 8px 11px;
  border-radius: 12px 12px 4px;
  background: #fff0df;
  color: #d9570d;
  font-size: 12px;
  font-weight: 700;
}

.ref-zalo-chat span {
  display: block;
  padding: 10px 11px;
  border: 1px solid #e4eaf2;
  border-radius: 11px;
  background: #fff;
  color: #596982;
  font-size: 10px;
  line-height: 1.45;
}

.ref-steps-grid,
.ref-terms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.ref-steps-grid article {
  position: relative;
  min-height: 125px;
  padding: 17px 17px 15px 56px;
  border: 1px solid #e9e6e2;
  border-radius: 16px;
  background: #fffdfb;
}

.ref-steps-grid article > b {
  position: absolute;
  top: 17px;
  left: 16px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #fff0e4;
  color: #ed5b10;
  font-size: 12px;
}

.ref-steps-grid h3 {
  margin: 4px 0 7px;
  font-size: 14px;
}

.ref-steps-grid p {
  margin: 0;
  color: #748197;
  font-size: 11px;
  line-height: 1.5;
}

.ref-terms {
  background: linear-gradient(140deg, #fff 0%, #fff9f4 100%);
}

.ref-terms-grid p {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  min-height: 78px;
  margin: 0;
  padding: 14px;
  border: 1px solid #f0e3d9;
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  color: #596980;
  font-size: 11px;
  line-height: 1.55;
}

.ref-terms-grid b {
  color: #ec5a0f;
  font-size: 12px;
}

@media (max-width: 820px) {
  .ref-program-hero { grid-template-columns: 1fr 37%; }
  .ref-program-copy { padding-left: 28px; }
  .ref-program-art img { right: -21px; width: 235px; }
  .ref-rewards-grid { grid-template-columns: 1fr; }
  .ref-hot-reward { min-height: 190px; }
  .ref-link-card { grid-template-columns: auto 1fr; }
  .ref-link-control { grid-column: 1 / -1; }
  .ref-zalo-card { grid-template-columns: 1fr 248px; }
}

@media (max-width: 620px) {
  .referral-program { gap: 16px; }
  .ref-program-hero { grid-template-columns: 1fr; min-height: 0; }
  .ref-program-copy { padding: 22px 18px 20px; }
  .ref-program-copy h1 { margin-top: 10px; font-size: 28px; }
  .ref-program-copy p { font-size: 13px; line-height: 1.5; }
  /* Decorative artwork is intentionally omitted on phones so the hero keeps
     a compact, predictable height and the campaign copy stays readable. */
  .ref-program-art { display: none; }
  .orbit-one { top: 2px; right: 40px; width: 150px; height: 150px; }
  .ref-person-one { left: 46px; top: 38px; }
  .ref-person-two { left: 87px; top: 80px; }
  .ref-rewards-panel, .ref-steps, .ref-terms { padding: 19px 15px; }
  .ref-tier-reward { padding: 14px; }
  .ref-tier-grid { grid-template-columns: 1fr 1fr; }
  .ref-tier { min-height: 118px; }
  .ref-link-card { grid-template-columns: auto 1fr; padding: 18px; }
  .ref-link-control { flex-direction: column; }
  .referral-program .referral-copy { min-height: 43px; }
  .ref-zalo-card { grid-template-columns: 1fr; }
  .ref-zalo-copy { padding: 20px; }
  .ref-zalo-phone { width: 235px; min-height: 155px; justify-self: center; }
  .ref-steps-grid, .ref-terms-grid { grid-template-columns: 1fr; }
  .ref-steps-grid article { min-height: 95px; }
}
