:root {
  color-scheme: dark;
  font-family: Nunito, "Arial Rounded MT Bold", Arial, sans-serif;
  --green: #5dff32;
  --green-deep: #148b32;
  --gold: #ffce36;
  --pink: #ff49b8;
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }

body {
  color: white;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 16, 79, .48), transparent 46%),
    radial-gradient(ellipse at 2% 65%, rgba(172, 27, 42, .42), transparent 44%),
    radial-gradient(ellipse at 100% 58%, rgba(153, 25, 36, .42), transparent 42%),
    linear-gradient(110deg, #240622 0%, #3c0732 48%, #2d0818 100%);
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }

button { font: inherit; }

.store-page { min-height: 100svh; padding-bottom: max(10px, env(safe-area-inset-bottom)); }

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 1.05fr) minmax(220px, .65fr) minmax(390px, 1.55fr) 78px;
  align-items: center;
  gap: 16px;
  min-height: clamp(94px, 11.1vh, 132px);
  padding: 8px 1.55vw 4px;
}

.balance-pill {
  height: clamp(42px, 5.7vw, 68px);
  max-width: 580px;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 22px);
  padding: 0 clamp(13px, 2vw, 28px) 0 12px;
  color: #a8ff65;
  border: 2px solid #341073;
  border-radius: 50px;
  background: linear-gradient(100deg, #287e29 0%, #34832b 28%, #26218b 71%, #4c0b92 100%);
  box-shadow: 0 2px 3px #ffbb24, inset 0 1px 8px #ffffff26, 0 0 8px #090013;
  font-family: "Roboto Condensed", Arial, sans-serif;
  font-size: clamp(20px, 2.25vw, 39px);
  line-height: 1;
  text-shadow: 0 2px 2px #062014, 1px 1px 0 #111;
  white-space: nowrap;
}

.cash-icon { font-size: 1.28em; filter: drop-shadow(0 2px 2px #14310d); transform: rotate(-11deg); }
.coin-icon { font-size: 1.12em; filter: drop-shadow(0 2px 2px #3b2403); }
.divider { width: 1px; height: 55%; background: #d1a93766; }
.coin-total { color: #e5bf51; }

.rebate-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff7c2;
  font-family: Georgia, serif;
  font-size: clamp(25px, 3vw, 51px);
  font-style: italic;
  font-weight: 900;
  line-height: .8;
  letter-spacing: -2px;
  filter: drop-shadow(0 3px 0 #9d3005) drop-shadow(0 0 4px #ff9c0a);
  transform: rotate(-2deg);
  white-space: nowrap;
}
.rebate-mark sup { font-family: Arial, sans-serif; font-size: .31em; letter-spacing: 0; vertical-align: super; color: #ffcf25; }
.rebate-mark b { color: #ffe34a; font-size: 1.04em; }

.event-track { min-width: 0; align-self: center; }
.event-caption {
  margin-bottom: 7px;
  color: #54fff1;
  font-family: "Roboto Condensed", Arial, sans-serif;
  font-size: clamp(15px, 1.55vw, 27px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 2px #072328;
  white-space: nowrap;
}
.track { display: flex; align-items: center; justify-content: space-between; position: relative; max-width: 570px; margin: 0 auto; }
.track::before { content: ""; position: absolute; top: 50%; left: 2%; right: 2%; height: 6px; transform: translateY(-50%); background: #2eb63a; border: 2px solid #3d228c; box-shadow: 0 1px 2px #090216; }
.track i {
  z-index: 1;
  display: grid;
  place-items: center;
  width: clamp(34px, 4.1vw, 57px);
  aspect-ratio: 1;
  border: 4px solid #5342bd;
  border-radius: 50%;
  color: white;
  background: linear-gradient(#fb707a, #db3d4f);
  box-shadow: 0 1px 2px #100524, inset 0 2px 2px #ffaaa5;
  font-family: Arial, sans-serif;
  font-size: clamp(31px, 3.6vw, 48px);
  font-style: normal;
  font-weight: 400;
  line-height: .75;
}

.round-close, .modal-close {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: white;
  background: radial-gradient(circle at 32% 25%, #be7cff 0%, #7534e9 48%, #3110a1 84%);
  border: 4px solid #ffd640;
  box-shadow: 0 0 0 3px #4a25b6, inset 0 2px 4px #fff9, 0 2px 8px #11061b;
  cursor: pointer;
  text-shadow: 0 2px 2px #34217a;
}
.round-close { width: clamp(54px, 5vw, 82px); aspect-ratio: 1; justify-self: end; }
.round-close span { margin-top: -7px; font-family: Arial, sans-serif; font-size: clamp(56px, 5vw, 82px); font-weight: 500; line-height: .8; }
.round-close:active, .modal-close:active { transform: scale(.95); }

.offers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: clamp(8px, 1.2vw, 18px) clamp(8px, 1.6vw, 29px);
  padding: 0 1.35vw 1.2vw;
}
.offer-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: clamp(10px, 1.5vw, 24px);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, filter .16s ease;
}
.offer-card img { display: block; width: 100%; height: auto; aspect-ratio: 1.02 / 1; object-fit: fill; }
.offer-card:hover { transform: translateY(-3px) scale(1.012); filter: brightness(1.08); }
.offer-card:active { transform: scale(.975); }
.offer-card:focus-visible { outline: 3px solid white; outline-offset: -8px; }

.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 26px 18px;
  background: #08020ccc;
  backdrop-filter: blur(1.5px);
}
.payment-modal {
  position: relative;
  width: min(82vw, 1020px);
  min-height: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px clamp(28px, 5vw, 74px) 25px;
  border: 6px solid #e8a912;
  border-radius: 20px;
  background: linear-gradient(130deg, #5020cb 0%, #3223cb 50%, #401cd5 100%);
  box-shadow: 0 0 0 3px #b94b2e, inset 0 3px 0 #fff2a4a8, inset 0 -6px 16px #1d0878, 0 9px 24px #06000a;
}
.payment-modal::before, .payment-modal::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 24px;
  border-color: #ffdb42;
  border-style: solid;
  filter: drop-shadow(0 2px 2px #c24b28);
}
.payment-modal::before { top: -8px; right: 26px; border-width: 5px 5px 0 0; border-radius: 0 18px 0 0; }
.payment-modal::after { right: -8px; bottom: 16px; border-width: 0 5px 5px 0; border-radius: 0 0 18px 0; }
.modal-close {
  position: absolute;
  z-index: 2;
  top: -17px;
  right: -14px;
  width: 58px;
  aspect-ratio: 1;
  font: 48px/1 Arial, sans-serif;
}
.modal-heading {
  margin: 0 35px 17px;
  color: #fff178;
  font-family: "Roboto Condensed", Impact, sans-serif;
  font-size: clamp(28px, 3.4vw, 49px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 4px 0 #a4510f, 0 6px 2px #130a54;
}
.payment-content {
  width: 100%;
  min-height: 350px;
  padding: 13px 20px 18px;
  border: 2px solid #261179;
  border-radius: 14px;
  background: linear-gradient(#100487 0 43%, #08065c 43% 100%);
  box-shadow: inset 0 2px 7px #07002e;
}
.rewards-summary {
  min-height: 137px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 74px);
  padding: 0 5px 7px;
}
.reward-stat { min-width: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: "Roboto Condensed", Arial, sans-serif; text-shadow: 0 2px 2px #09002f; }
.reward-stat > span { display: block; height: 74px; font-family: Arial, sans-serif; font-size: 59px; line-height: 1.1; filter: drop-shadow(0 2px 2px #090027); }
.reward-stat strong { color: white; font-size: clamp(25px, 3vw, 40px); font-weight: 900; line-height: 1; white-space: nowrap; }
.cash-stat { gap: 0; color: var(--green); }
.cash-stat > span { transform: rotate(-11deg); }
.cash-stat strong { color: var(--green); }
.free-tag { margin-top: -22px; z-index: 1; color: white; font-size: 22px; font-style: italic; line-height: 1; text-shadow: 0 2px 2px black; }
.coin-stat > span { filter: drop-shadow(0 2px 2px #4b2d00); }
.lucky-stat > span { font-size: 62px; }

.method-options { min-height: 153px; display: flex; justify-content: center; align-items: center; gap: 17px; }
.method-option {
  position: relative;
  min-width: 208px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 13px;
  border: 2px solid #d638fa;
  border-radius: 18px;
  color: white;
  background: radial-gradient(ellipse at 48% 32%, #7513c1, #300092 77%);
  box-shadow: inset 0 0 13px #fc36f25c, 0 0 6px #e230fc45;
  cursor: pointer;
  transition: box-shadow .16s ease, filter .16s ease, transform .16s ease;
  text-decoration: none;
}
.method-option strong { font-size: clamp(17px, 1.8vw, 25px); font-weight: 900; white-space: nowrap; }
.method-option span { color: #4dff41; font-size: clamp(15px, 1.6vw, 21px); font-weight: 900; white-space: nowrap; }
.method-option span i { margin-left: 8px; color: #4aff3d; font-style: normal; }
.method-option.selected {
  border-color: #ffb638;
  background: radial-gradient(ellipse at 50% 25%, #bc1a6a, #85044f 76%);
  box-shadow: 0 0 0 3px #f244db, 0 0 11px 4px #ffad24, inset 0 0 13px #ffd02878;
}
.selected-check { position: absolute; right: -4px; bottom: -5px; display: none; color: #75ff39; font-size: 42px; line-height: .8; -webkit-text-stroke: 2px #14541c; filter: drop-shadow(0 2px 1px #151040); }
.method-option.selected .selected-check { display: block; }
.method-option:active { transform: scale(.97); }
.total-price { margin-top: 1px; color: var(--green); font-family: "Roboto Condensed", Arial, sans-serif; font-size: 34px; font-weight: 900; line-height: 1; text-align: center; text-shadow: 0 2px 2px #101042; }
.confirm-button {
  min-width: 325px;
  min-height: 72px;
  margin-top: 20px;
  padding: 8px 32px 12px;
  border: 3px solid #4ec852;
  border-radius: 40px;
  color: white;
  background: linear-gradient(#adff52 0%, #57d72e 42%, #159231 100%);
  box-shadow: inset 0 3px 4px #fff6, inset 0 -4px 3px #06551c, 0 3px 0 #063c8e, 0 5px 5px #0b0049;
  font-family: "Roboto Condensed", Arial, sans-serif;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 1px #153b12, 1px 1px 0 #111;
  cursor: pointer;
}
.confirm-button:hover { filter: brightness(1.08); }
.confirm-button:active { transform: translateY(2px); box-shadow: inset 0 3px 4px #fff6, inset 0 -3px 2px #06551c, 0 1px 0 #063c8e; }

.reward-buddy {
  position: fixed;
  z-index: 11;
  left: max(calc(50% - 670px), 2%);
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 235px;
  height: 360px;
  pointer-events: none;
  filter: drop-shadow(0 4px 3px #080313);
}
.speech {
  position: absolute;
  top: 0;
  left: -10px;
  width: 230px;
  padding: 15px 12px 20px;
  transform: rotate(-16deg);
  border: 4px solid #ed71fd;
  border-radius: 22px;
  color: #17111b;
  background: white;
  box-shadow: 0 0 7px #fca9ff, inset 0 0 0 2px #e8e8e8;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.12;
  text-align: center;
}
.speech::after { content: ""; position: absolute; right: 33px; bottom: -21px; width: 26px; height: 26px; transform: rotate(30deg); border-right: 4px solid #ed71fd; border-bottom: 4px solid #ed71fd; background: white; }
.buddy-face { position: absolute; left: 2px; bottom: 83px; z-index: 1; font-size: 148px; line-height: 1; }
.buddy-crown { position: absolute; z-index: 2; left: 63px; bottom: 225px; color: #ffd32c; font-size: 81px; line-height: 1; transform: rotate(-13deg); text-shadow: 0 2px 2px #c64c15; }
.buddy-body { position: absolute; left: 44px; bottom: 16px; z-index: 0; font-size: 112px; line-height: 1; }
.buddy-wand { position: absolute; left: -8px; bottom: 104px; z-index: 3; font-size: 54px; transform: rotate(-25deg); }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 30px);
  padding: 12px 20px;
  transform: translate(-50%, 15px);
  border: 1px solid #f9d552;
  border-radius: 30px;
  color: #fff7c8;
  background: #241064ef;
  box-shadow: 0 4px 20px #080017;
  font-size: 15px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  white-space: nowrap;
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) and (min-width: 651px) {
  .topbar { grid-template-columns: minmax(240px, 1fr) minmax(180px, .7fr) minmax(280px, 1.4fr) 60px; gap: 9px; }
  .event-caption { font-size: 15px; }
  .payment-modal { width: min(88vw, 850px); min-height: 490px; }
  .payment-content { min-height: 310px; }
  .rewards-summary { min-height: 115px; }
  .method-options { min-height: 130px; }
  .reward-buddy { transform: scale(.78); transform-origin: left bottom; }
}

@media (max-width: 650px) {
  .store-page { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .topbar {
    grid-template-columns: minmax(0, 1fr) 48px;
    grid-template-areas: "balance close" "mark event";
    gap: 5px 9px;
    min-height: 108px;
    padding: max(7px, env(safe-area-inset-top)) 10px 5px;
  }
  .balance-pill { grid-area: balance; width: max-content; max-width: 100%; height: 42px; gap: 8px; padding: 0 12px 0 8px; font-size: clamp(20px, 6vw, 25px); }
  .cash-icon { font-size: 1.17em; }
  .coin-icon { font-size: 1.02em; }
  .round-close { grid-area: close; width: 43px; border-width: 3px; }
  .round-close span { margin-top: -4px; font-size: 46px; }
  .rebate-mark { grid-area: mark; align-items: flex-start; padding-left: 4px; font-size: 24px; letter-spacing: -1px; }
  .event-track { grid-area: event; min-width: 0; }
  .event-caption { margin-bottom: 4px; font-size: clamp(9px, 2.3vw, 12px); letter-spacing: -.2px; }
  .track { gap: 2px; }
  .track::before { height: 4px; border-width: 1px; }
  .track i { width: clamp(23px, 7vw, 30px); border-width: 2px; font-size: 27px; }
  .offers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 6px; padding: 0 5px 8px; }
  .offer-card { border-radius: 10px; }
  .offer-card img { aspect-ratio: 1.02 / 1; }

  .modal-backdrop { align-items: center; padding: max(20px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom)); }
  .payment-modal {
    width: 100%;
    min-height: 0;
    padding: 24px 12px 17px;
    border-width: 4px;
    border-radius: 17px;
  }
  .modal-close { top: -13px; right: -9px; width: 45px; border-width: 3px; font-size: 38px; }
  .modal-heading { margin: 0 27px 14px 10px; font-size: clamp(23px, 6.2vw, 34px); letter-spacing: .5px; }
  .payment-content { min-height: 0; padding: 8px 7px 14px; border-radius: 11px; background: linear-gradient(#100487 0 40%, #08065c 40% 100%); }
  .rewards-summary { min-height: 108px; gap: clamp(12px, 5vw, 25px); padding: 0 0 5px; }
  .reward-stat { min-width: 0; }
  .reward-stat > span { height: 53px; font-size: 43px; }
  .reward-stat strong { font-size: clamp(20px, 5.6vw, 28px); }
  .free-tag { margin-top: -15px; font-size: 15px; }
  .lucky-stat > span { font-size: 46px; }
  .method-options { min-height: 127px; gap: 8px; }
  .method-option { width: 50%; min-width: 0; min-height: 89px; padding: 8px 4px; gap: 8px; border-radius: 13px; }
  .method-option strong { font-size: clamp(13px, 3.7vw, 18px); }
  .method-option span { font-size: clamp(12px, 3.3vw, 16px); }
  .method-option span i { margin-left: 3px; }
  .selected-check { font-size: 32px; }
  .total-price { margin-top: 0; font-size: 29px; }
  .confirm-button { width: min(82%, 320px); min-width: 0; min-height: 58px; margin-top: 16px; font-size: 28px; }
  .reward-buddy { display: none; }
}

@media (max-width: 370px) {
  .topbar { grid-template-columns: minmax(0, 1fr) 40px; gap: 3px 5px; }
  .balance-pill { gap: 6px; padding-right: 8px; font-size: 19px; }
  .round-close { width: 37px; }
  .round-close span { font-size: 40px; }
  .event-caption { font-size: 9px; }
  .track i { width: 22px; font-size: 24px; }
  .method-option strong { font-size: 12px; }
  .method-option span { font-size: 11px; }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 1000px) {
  .store-page { padding-bottom: 2px; }
  .topbar {
    grid-template-columns: minmax(0, 1.05fr) minmax(88px, .55fr) minmax(0, 1.45fr) 38px;
    gap: 4px 7px;
    min-height: 54px;
    padding: 3px 8px 2px;
  }
  .balance-pill {
    width: 100%;
    max-width: none;
    height: 36px;
    gap: clamp(4px, .8vw, 8px);
    padding: 0 8px 0 6px;
    font-size: clamp(13px, 2.55vw, 22px);
  }
  .cash-icon { font-size: 1.1em; }
  .coin-icon { font-size: 1em; }
  .rebate-mark { font-size: clamp(20px, 2.6vw, 27px); letter-spacing: -1px; }
  .event-caption { margin-bottom: 3px; font-size: clamp(9px, 1.65vw, 15px); }
  .track { gap: 2px; }
  .track::before { height: 4px; border-width: 1px; }
  .track i { width: clamp(22px, 3.2vw, 30px); border-width: 2px; font-size: clamp(20px, 2.5vw, 27px); }
  .round-close { width: 35px; border-width: 2px; }
  .round-close span { margin-top: -3px; font-size: 38px; }

  .offers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px 5px;
    padding: 0 6px 2px;
  }
  .offer-card { border-radius: 8px; }
  .offer-card img { width: 100%; height: clamp(112px, 40svh, 165px); aspect-ratio: auto; object-fit: fill; }

  .modal-backdrop { padding: 7px 10px; }
  .payment-modal { width: min(82vw, 850px); min-height: 0; padding: 9px 26px 10px; border-width: 4px; border-radius: 14px; }
  .modal-close { top: -11px; right: -9px; width: 42px; border-width: 3px; font-size: 35px; }
  .modal-heading { margin: 0 27px 6px 8px; font-size: clamp(21px, 3vw, 32px); letter-spacing: .5px; }
  .payment-content { min-height: 0; padding: 4px 12px 7px; border-radius: 10px; background: linear-gradient(#100487 0 39%, #08065c 39% 100%); }
  .rewards-summary { min-height: 66px; gap: clamp(18px, 4vw, 48px); padding: 0 0 4px; }
  .reward-stat > span { height: 37px; font-size: 34px; }
  .reward-stat strong { font-size: clamp(19px, 2.7vw, 27px); }
  .free-tag { margin-top: -11px; font-size: 14px; }
  .lucky-stat > span { font-size: 37px; }
  .method-options { min-height: 65px; gap: 10px; }
  .method-option { min-width: 168px; min-height: 55px; gap: 3px; padding: 5px 9px; border-radius: 11px; }
  .method-option strong { font-size: clamp(14px, 1.75vw, 18px); }
  .method-option span { font-size: clamp(12px, 1.5vw, 16px); }
  .selected-check { font-size: 31px; }
  .total-price { margin-top: 0; font-size: 24px; }
  .confirm-button { min-width: 240px; min-height: 44px; margin-top: 8px; padding: 5px 22px 7px; font-size: 24px; }
  .reward-buddy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
