.chart-reward {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 12px) 20px calc(var(--safe-bottom) + 20px);
  background: radial-gradient(circle at 50% 46%, rgba(46, 96, 230, 0.55), rgba(24, 10, 70, 0.84) 42%, rgba(8, 4, 26, 0.9) 72%);
  overflow: hidden;
}

.chart-reward.show {
  display: flex;
  animation: chart-reward-in 300ms ease-out both;
}

.chart-reward.leaving {
  pointer-events: none;
  animation: chart-reward-out 420ms ease-in forwards;
}

.chart-reward.dimming {
  pointer-events: none;
}

.chart-reward.dimming::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #04021a;
  animation: chart-dim 420ms ease-in both;
}

.chart-reward .pearl-open-rays {
  top: 46%;
  opacity: 0.5;
}

.chart-reward-title {
  font-family: var(--display);
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: 0.05em;
  white-space: nowrap;
  background-image: var(--gold-bevel);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 var(--gold-deep)) drop-shadow(0 0 12px rgba(255, 79, 216, 0.75));
  animation: chart-title-in 420ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.chart-reward-lead {
  color: var(--text);
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-shadow: 0 1px 0 #000;
}

.chart-reward-prize {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 22px;
  min-height: 190px;
  max-width: 100%;
}

.chart-reward-prize::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260px;
  height: 260px;
  margin: -130px 0 0 -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 190, 255, 0.75) 0, rgba(70, 120, 255, 0.35) 34%, transparent 66%);
  animation: chart-glow 2.4s ease-in-out infinite alternate;
  pointer-events: none;
}

.chart-reward-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  animation: chart-prize-pop 520ms cubic-bezier(0.2, 1.6, 0.4, 1) 260ms both;
}

.chart-reward-item.planet + .chart-reward-item.planet {
  animation-delay: 420ms;
}

.chart-reward-coins {
  width: 150px;
  height: 150px;
  background: url("../art/offers/coin-stacks.webp") 100% 0 / 300% 200% no-repeat;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

.chart-reward-prize.claimed .chart-reward-coins {
  animation: chart-coins-give 360ms ease-out;
}

.chart-reward-amount {
  max-width: 100%;
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 2.25rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

.chart-reward-item .pearl.chart-reward-planet {
  width: 116px;
  height: 116px;
  font-size: 116px;
  animation: planet-float 1600ms ease-in-out infinite;
}

.chart-reward-name {
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

.chart-reward .pearl-collect {
  width: min(240px, 100%);
  margin-top: 8px;
}

.chart-reward.ready .pearl-collect {
  visibility: visible;
  animation: chart-claim-in 260ms ease-out both;
}

@keyframes chart-reward-in {
  from { opacity: 0; transform: scale(1.04); }
}

@keyframes chart-reward-out {
  to { opacity: 0; }
}

@keyframes chart-dim {
  from { opacity: 0; }
}

@keyframes chart-title-in {
  from { opacity: 0; transform: scale(0.5); }
}

@keyframes chart-prize-pop {
  from { opacity: 0; transform: scale(0.2); }
}

@keyframes chart-claim-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes chart-coins-give {
  40% { transform: scale(1.12); filter: brightness(1.35) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
}

@keyframes chart-glow {
  to { transform: scale(1.08); opacity: 0.8; }
}

@media (max-height: 700px) {
  .chart-reward { gap: 6px; }
  .chart-reward-prize { min-height: 160px; }
  .chart-reward-coins { width: 124px; height: 124px; }
  .chart-reward-item .pearl.chart-reward-planet { width: 96px; height: 96px; font-size: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .chart-reward.show,
  .chart-reward-title,
  .chart-reward-item,
  .chart-reward-prize::before,
  .chart-reward-prize.claimed .chart-reward-coins,
  .chart-reward-item .pearl.chart-reward-planet,
  .chart-reward.ready .pearl-collect,
  .chart-reward.dimming::after {
    animation: none;
  }
}

.pearl-open.lights-up::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #04021a;
  pointer-events: none;
  animation: chamber-lights 900ms ease-in forwards;
}

.pearl-open.lights-up .pearl-open-stage {
  animation: chamber-planet-drop 560ms cubic-bezier(0.2, 1.4, 0.4, 1) 850ms both;
}

.pearl-open.lights-up .pearl-open-title {
  animation: chart-claim-in 300ms ease-out 900ms both;
}

.pearl-open.lights-up.burst::after {
  animation: none;
  opacity: 0;
}

.pearl-open.lights-up.burst .pearl-open-stage,
.pearl-open.lights-up.burst .pearl-open-title {
  animation: none;
}

@keyframes chamber-lights {
  0% { opacity: 1; }
  35% { opacity: 0.55; }
  45% { opacity: 0.8; }
  60% { opacity: 0.35; }
  100% { opacity: 0; }
}

@keyframes chamber-planet-drop {
  from { opacity: 0; transform: translateY(-60px) scale(0.6); }
}
