html:has(.reward-popup[open]),
html:has(.reward-popup[open]) body {
  overflow: hidden;
  overscroll-behavior: none;
}

html:has(.reward-popup[open]) {
  scrollbar-gutter: stable;
}

.reward-popup {
  --reward-navy: #172d61;
  --reward-gold: #d9a757;
  --reward-panel-bottom: clamp(17px, 5vw, 24px);
  --reward-cta-overhang: clamp(23px, 6.5vw, 30px);
  width: min(445px, calc(100% - 20px));
  max-width: none;
  max-height: calc(100% - 16px);
  max-height: calc(100dvh - 16px);
  margin: auto;
  padding: 0 7px calc(var(--reward-cta-overhang) + 17px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  background: transparent;
  color: var(--reward-navy);
  color-scheme: light;
}

.reward-popup[open] {
  animation: reward-popup-in .25s ease-out both;
}

.reward-popup::backdrop {
  background: #040d23be;
  touch-action: none;
}

.reward-popup-art {
  position: relative;
  z-index: 1;
  height: clamp(136px, 32dvh, 240px);
  margin-bottom: -30px;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse 42% 65% at center 75%, #b0dbff80, transparent);
  mask-image: linear-gradient(180deg, #000 81%, transparent 100%);
}

.reward-popup-art img {
  position: relative;
  top: 0;
  width: clamp(244px, 93%, 405px);
  height: auto;
  margin-inline: auto;
  filter: drop-shadow(0 0 11px #b9dfff9c);
}

.reward-popup-panel {
  position: relative;
  z-index: 2;
  isolation: isolate;
  display: grid;
  gap: clamp(14px, 4vw, 22px);
  padding: 18px clamp(8px, 3.3vw, 16px) var(--reward-panel-bottom);
  border: 2px solid var(--reward-gold);
  border-radius: 24px;
  background:
    linear-gradient(135deg, #385ca0 25px, #edcf86 25px 27px, transparent 28px),
    linear-gradient(315deg, #385ca0 25px, #edcf86 25px 27px, transparent 28px),
    radial-gradient(ellipse at 50% 8%, #fff 18%, #fff8e9 74%, #f5eacb);
  box-shadow: 0 0 0 1px #374974, inset 0 0 0 3px #fff9e8, 0 9px 0 #0e214f;
}

.reward-popup-panel::before {
  position: absolute;
  z-index: -1;
  inset: 7px;
  border: 1px solid #c89d526d;
  border-radius: 17px;
  content: "";
  pointer-events: none;
}

.reward-popup-panel form {
  position: absolute;
  z-index: 3;
  inset-block-start: 6px;
  inset-inline-end: 6px;
  margin: 0;
}

.reward-popup-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0 0 3px;
  border: 1px solid #f3d795;
  border-radius: 50%;
  background: #203c75;
  color: #fff;
  box-shadow: 0 2px 6px #15244847;
  font-size: 28px;
  line-height: 1;
}

.reward-popup h2 {
  position: relative;
  z-index: 2;
  justify-self: center;
  max-width: calc(100% - 66px);
  margin: -40px 0 0;
  color: #ae4a0e;
  font-size: clamp(22px, 6vw, 35px);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
  transform: rotate(-4deg);
  -webkit-text-stroke: 5px #fff4dc;
  paint-order: stroke fill;
  filter: drop-shadow(0 2px 0 #b87b32) drop-shadow(0 3px 5px #422c2459);
}

.reward-popup:lang(ja) h2 {
  max-width: calc(100% - 48px);
  margin-block-start: -48px;
  font-size: clamp(29px, 9.3vw, 50px);
  letter-spacing: .015em;
  white-space: nowrap;
  transform: translateX(-22px) rotate(-4deg);
  -webkit-text-stroke-width: 6px;
}

.reward-popup h2 em {
  color: #bb2b25;
  font-style: normal;
}

.reward-popup-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(5px, 2vw, 10px);
  direction: ltr;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reward-popup-tile {
  --tile-glow: #ffdc87;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #bd9252;
  border-radius: 9px;
  background: #fcf7e9;
  box-shadow: 0 3px 6px #223b6e24;
  text-align: center;
}

.reward-popup-quiz {
  --tile-glow: #a1d5ff;
  border-color: #6d86b7;
}

.reward-popup-prize {
  --tile-glow: #ffc0c0;
}

.reward-popup-visual {
  display: grid;
  place-items: center;
  height: clamp(60px, 22vw, 110px);
  background:
    repeating-conic-gradient(from 15deg at 50% 80%, #fff5 0deg 5deg, transparent 5deg 35deg),
    radial-gradient(ellipse at center 78%, #fff5d5, var(--tile-glow) 90%);
  border-bottom: 1px solid #c5a16b7a;
}

.reward-popup-visual img {
  width: 92%;
  height: 100%;
  max-height: 106px;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px #472d2342);
}

.reward-popup-coins .reward-popup-visual {
  grid-template-rows: minmax(0, 1fr);
}

.reward-popup-coins img {
  width: 105%;
  max-width: 105%;
  height: auto;
}

.reward-popup-quiz .bonus-mystery {
  width: 63%;
  max-width: 71px;
  border-width: 1px;
  box-shadow: inset 0 0 0 2px #fce7b975, 0 4px 8px #28417249;
}

.reward-popup-quiz .bonus-mystery span {
  font-size: clamp(27px, 10vw, 44px);
}

.reward-popup-tile p {
  display: grid;
  align-content: center;
  gap: 3px;
  margin: 0;
  padding: 7px 3px 8px;
  color: #31466e;
  font-size: clamp(10px, 2.75vw, 12px);
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.reward-popup-tile strong {
  color: #192e61;
  font-size: clamp(12px, 3.25vw, 15px);
  font-weight: 900;
}

.reward-popup-coins strong {
  color: #8b450c;
  font-size: clamp(15px, 4vw, 22px);
}

.reward-popup-cta {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 15px);
  width: min(95%, 356px);
  min-height: clamp(64px, 17vw, 74px);
  margin-block-end: calc(-1 * (var(--reward-panel-bottom) + var(--reward-cta-overhang)));
  padding: 7px clamp(11px, 4vw, 22px) 9px;
  border: 2px solid #edcb83;
  border-radius: 35px;
  background: linear-gradient(#3d6fb3, #244780 52%, #132e62);
  color: #fffdf7;
  box-shadow: inset 0 0 0 1px #fff5d76b, 0 4px 0 #ad772d, 0 7px 13px #203b5c40;
  text-align: start;
  text-decoration: none;
}

.reward-popup[open] .reward-popup-cta {
  animation: preorder-pulse 2.9s ease-in-out infinite;
}

.reward-popup-cta:hover {
  filter: brightness(1.13);
}

.reward-popup-cta img {
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  object-fit: contain;
}

.reward-popup-cta .store-apple-mark {
  filter: brightness(0) invert(1);
}

.reward-popup-cta strong,
.reward-popup-cta small {
  display: block;
  line-height: 1.15;
}

.reward-popup-cta strong { font-size: clamp(20px, 6vw, 26px); }
.reward-popup-cta small { font-size: clamp(12px, 3.6vw, 16px); font-weight: 700; }
.reward-popup-cta b { color: #ffde98; font-size: 24px; }

@keyframes reward-popup-in {
  from { opacity: 0; transform: translateY(8px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 500px) {
  .reward-popup-panel form { inset-block-start: -22px; }
  .reward-popup:lang(ja) h2 { transform: translateX(-8px) rotate(-4deg); }
}

@media (max-width: 360px) {
  .reward-popup-panel form { inset-inline-end: -4px; }
}

@media (max-height: 475px) {
  .reward-popup-art { height: 100px; }
  .reward-popup-panel { gap: 11px; }
  .reward-popup-visual { height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  .reward-popup[open], .reward-popup[open] .reward-popup-cta { animation: none; }
}

.reward-countdown {
  display: grid;
  gap: 6px;
}

.reward-countdown-message {
  margin: 0;
  color: #264777;
  font-size: clamp(12px, 3.3vw, 14px);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-wrap: balance;
}

.reward-countdown-clock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: min(100%, 224px);
  margin-inline: auto;
  direction: ltr;
}

.reward-countdown-separator {
  color: #21427d;
  font-size: 27px;
  font-weight: 900;
  line-height: 1;
}

.reward-countdown-unit {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 3px 2px 4px;
  border: 1px solid #c4954d;
  border-radius: 7px;
  background: linear-gradient(#fff 48%, #f4e5bf 49%, #fff7e5 54%, #f9eed4);
  box-shadow: 0 2px 0 #d2ac6d;
  color: #21427d;
  line-height: 1.05;
}

.reward-countdown-unit strong {
  font-size: clamp(20px, 6.5vw, 28px);
  font-variant-numeric: tabular-nums;
}

.reward-countdown-unit small {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
