.deal-chests {
  transition: transform 450ms ease-in, opacity 450ms ease-in;
}

.deal.offering .deal-chests {
  transform: translateY(30%);
  opacity: 0;
  pointer-events: none;
}

.deal-dragon {
  position: absolute;
  inset: 0 76px;
  z-index: 2;
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
}

.deal.offering .deal-dragon {
  visibility: visible;
}

.deal-dragon-art {
  position: relative;
  z-index: -1;
  font-size: min(46cqh, 96cqw);
  line-height: 1;
  margin-bottom: -0.34em;
  filter: drop-shadow(0 0 14px rgba(222, 65, 245, 0.65));
  opacity: 0;
}

.deal-empress-crop {
  width: 1em;
  height: 1.2em;
  --empress-top: calc(-0.3em * 0.18);
  border-radius: 46% 46% 8% 8%;
  -webkit-mask-image: linear-gradient(#000 72%, transparent);
  mask-image: linear-gradient(#000 72%, transparent);
}

.deal.offering .deal-dragon-art {
  animation: offer-dragon-rise var(--rise, 1000ms) cubic-bezier(0.2, 1.2, 0.4, 1) forwards,
    dragon-bob 1600ms var(--rise, 1000ms) ease-in-out infinite alternate;
}

.deal-dragon-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  opacity: 0;
}

.deal.offering .deal-dragon-scroll {
  animation: offer-scroll-in calc(var(--rise, 1000ms) * 0.6) calc(var(--rise, 1000ms) * 0.4) cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

.deal-dragon-ribbon {
  position: relative;
  z-index: 1;
  padding: 4px 26px 5px;
  font-size: min(7cqh, 13cqw);
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
  background-color: var(--red);
  background-image: var(--gold-bevel), linear-gradient(180deg, #c44be9, var(--red) 50%, #3c095a);
  -webkit-background-clip: text, border-box;
  background-clip: text, border-box;
  clip-path: polygon(0 0, 100% 0, 92% 50%, 100% 100%, 0 100%, 8% 50%);
}

.deal-dragon-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 1.5em;
  margin-top: -4px;
  padding: 4px 6px 2px;
  border-radius: 0 0 14px 14px;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 8px 18px rgba(0, 0, 0, 0.6), inset 0 0 16px rgba(80, 140, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 45%),
    linear-gradient(180deg, #2440c0, #0a0e4a);
  color: #fff;
  font-family: var(--display);
  font-size: min(13cqh, 22cqw);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 #000, 0 0 14px rgba(120, 180, 255, 0.9);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.deal-dragon.boosted .deal-dragon-x {
  animation: offer-powered 900ms ease-out;
}

.deal-flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.deal-flash.high {
  justify-content: flex-start;
  padding-top: 2%;
}

.deal-flash.show {
  visibility: visible;
  animation: deal-flash 2400ms ease forwards;
}

.deal-flash::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -2;
  width: 130%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 220, 250, 0.9), rgba(255, 90, 210, 0.45) 22%, transparent 50%),
    repeating-conic-gradient(rgba(255, 120, 230, 0.45) 0 5deg, transparent 5deg 14deg);
  -webkit-mask-image: radial-gradient(circle, #000 15%, transparent 62%);
  mask-image: radial-gradient(circle, #000 15%, transparent 62%);
}

.deal-flash.show::before {
  animation: rays 5s linear infinite;
}

.deal-flash-name {
  width: min-content;
  max-width: 100%;
  font-size: clamp(2.8rem, 16vw, 4rem);
  font-weight: 900;
  line-height: 0.95;
  text-align: center;
  filter: drop-shadow(0 2px 0 var(--gold-deep)) drop-shadow(0 4px 0 #6a0016) drop-shadow(0 0 14px rgba(255, 106, 0, 0.9));
}

.deal-flash.show .deal-flash-name {
  animation: flash-name 600ms cubic-bezier(0.2, 1.6, 0.4, 1);
}

.deal-flash-detail {
  color: #fff;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 0 #000, 0 0 10px rgba(255, 90, 210, 0.9);
}

.deal-bolts {
  position: absolute;
  inset: 0;
  z-index: -1;
  filter: drop-shadow(0 0 3px #fff6a0) drop-shadow(0 0 8px #ffd000);
}

.deal-bolt {
  position: absolute;
  left: 30px;
  top: 50%;
  width: calc(50% - 30px);
  height: 56px;
  margin-top: 8px;
  background: #fffbd0;
  clip-path: polygon(0 45%, 18% 15%, 30% 55%, 48% 5%, 60% 60%, 80% 20%, 100% 50%, 100% 60%, 80% 32%, 60% 74%, 48% 18%, 30% 68%, 18% 27%, 0 57%);
}

.deal-flash.show .deal-bolt {
  animation: bolt-flicker 160ms steps(2) infinite;
}

.deal-bolt.right {
  left: auto;
  right: 30px;
  transform: scaleX(-1);
}

.deal-flash.show .deal-bolt.right {
  animation-delay: -80ms;
}

.deal-board.boosted .deal-pill {
  animation: pill-flash 700ms ease calc(var(--i, 0) * 45ms) both;
}

.deal-mine-gems {
  display: flex;
  gap: 3px;
}

.deal-mine-gems:empty {
  display: none;
}

.boost-gem {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url("../art/ui/boost-crystal.webp") center / contain no-repeat;
}

.deal-capsule-boost {
  position: fixed;
  z-index: 47;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  pointer-events: none;
}
.deal-capsule-boost-aura {
  position: absolute;
  inset: 0;
  background: url("../art/ui/capsule-boost.webp") 0 0 / 400% 100% no-repeat;
  animation: capsule-boost-burst 300ms steps(1, end) both;
}
.deal-capsule-boost-crystal {
  position: absolute;
  left: 19px;
  top: 19px;
  width: 72px;
  height: 72px;
  animation: capsule-crystal-emerge 1800ms ease-out both;
  filter: drop-shadow(0 0 8px var(--neon-pink));
}
.deal-capsule-boost-label {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  color: var(--text);
  font-family: var(--display);
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: 0.05em;
  text-align: center;
  -webkit-text-stroke: 3px #3a074b;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #3a074b, 0 0 5px #3a074b;
}
.deal-capsule-boost.departing .deal-capsule-boost-aura {
  animation: none;
  background-position: 100% 0;
}
.deal-capsule-boost.departing .deal-capsule-boost-crystal,
.deal-capsule-boost.departing .deal-capsule-boost-label { visibility: hidden; }
@keyframes capsule-boost-burst {
  0% { background-position: 0% 0; }
  50% { background-position: 33.333333% 0; }
  100% { background-position: 66.666667% 0; }
}
@keyframes capsule-crystal-emerge {
  0% { opacity: 0; transform: scale(0.2); }
  20% { opacity: 1; transform: scale(1.08); }
  40%, 80% { opacity: 1; transform: scale(0.96); }
  60%, 100% { opacity: 1; transform: scale(1.06); }
}
.fly-gem.capsule-flight {
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
}
.fly-gem.capsule-flight::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(255, 80, 214, 0.65), #ffd3ef);
  transform: rotate(var(--gem-trail-angle)) translate(-100%, -50%);
  transform-origin: 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .deal-capsule-boost,
  .fly-gem.capsule-flight { display: none; }
}

.fly-gem {
  position: fixed;
  z-index: 46;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
}

.float-text.deal-boost {
  color: #ff8ae4;
  font-size: 1rem;
}

.deal-bottom {
  flex: none;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.deal.offering .deal-prompt {
  align-self: center;
  padding-inline: 10px;
  border: 1px solid var(--gold-deep);
  border-radius: 4px;
  background: var(--bg-deep);
  text-shadow: 0 1px 0 #000;
}

.deal-offer {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(180deg, #0d6a6a, #06302e);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 0 24px rgba(66, 230, 200, 0.3);
}

.deal-offer.show {
  display: flex;
  animation: offer-in 400ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.deal-offer-sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 6px;
}

.deal-offer-part {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.deal-offer-part strong {
  color: #fff;
  font-size: 1rem;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.deal-offer-amount {
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 1px 0 var(--gold-deep)) drop-shadow(0 2px 1px #000);
}

.deal-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}

.deal-yes,
.deal-no,
.reward-collect {
  flex: 1;
  min-height: 56px;
  padding-inline: 8px;
  border-radius: 14px;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 4px 0 rgba(0, 0, 0, 0.6);
  color: #fff;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.deal-yes {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 50%),
    linear-gradient(180deg, var(--go-light), var(--go) 60%, var(--go-dark));
}

.deal-no {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 50%),
    linear-gradient(180deg, #ff4a5e, var(--red) 60%, #6a0016);
}

.deal-offer.final-choice {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 40%),
    linear-gradient(180deg, #4b1578, #1c0836);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 0 24px rgba(228, 108, 255, 0.35);
}

.deal-offer.final-choice .deal-offer-sum {
  display: none;
}

.deal-offer.final-choice .deal-no {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 50%),
    linear-gradient(180deg, #4a96ff, #1b48c4 60%, #0d2066);
}

.reward-collect {
  display: none;
  flex: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent 50%),
    linear-gradient(180deg, var(--gold-light), var(--gold) 50%, var(--gold-dark));
  color: #3a1a00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.reward-collect.show {
  display: block;
}

.deal-scroll {
  position: absolute;
  left: 50%;
  top: 56%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 34px;
  border: 3px solid var(--gold);
  border-left-width: 10px;
  border-right-width: 10px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(255, 211, 77, 0.12) 10px 12px),
    linear-gradient(180deg, #b0102a, #6a0016);
  box-shadow: 0 0 0 3px #6a0016, 0 10px 30px rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

.deal.intro .deal-scroll {
  animation: deal-scroll 2100ms ease forwards;
}

.deal-scroll-count {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 #000;
}

.deal-scroll-count .chest {
  width: 44px;
  height: 34px;
}

.deal-scroll-text {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.deal.intro .deal-chest {
  animation: chest-drop 450ms cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
  animation-delay: calc(300ms + var(--i) * 25ms);
}

.deal.intro .deal-pill {
  animation: pill-in 400ms ease-out backwards;
  animation-delay: calc(200ms + var(--i) * 20ms);
}

