:root {
  --s37-envelope-red: #d6332f;
  --s37-envelope-dark-red: #a91f20;
  --s37-envelope-gold: #ffd888;
}

.s37-envelope-overlay {
  --s37-envelope-stage-width: min(100vw, calc(100dvh * 750 / 1334));
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
  isolation: isolate;
}

.s37-envelope-overlay[hidden] {
  display: none;
}

.s37-envelope-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--s37-envelope-stage-width);
  transform: translateX(-50%);
  z-index: -2;
  background: rgba(7, 8, 12, 0.63);
  backdrop-filter: blur(5px);
}

.s37-envelope-overlay::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: -3;
  width: var(--s37-envelope-stage-width);
  transform: translateX(-50%);
  box-shadow: 0 0 0 100vmax #343945;
}

.s37-envelope-rain {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--s37-envelope-stage-width);
  height: 100%;
  transform: translateX(-50%);
  pointer-events: none;
}

.s37-envelope-stage {
  position: relative;
  width: var(--s37-envelope-stage-width);
  height: 100dvh;
  min-height: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.s37-envelope-card {
  position: relative;
  width: calc(var(--s37-envelope-stage-width) * 0.5066667);
  aspect-ratio: 560 / 750;
  pointer-events: auto;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.32));
  transform-origin: 50% 65%;
}

.s37-envelope-card__art,
.s37-envelope-card__result-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.s37-envelope-card__result-art {
  display: none;
}

.s37-envelope-card.is-claimed .s37-envelope-card__art {
  display: none;
}

.s37-envelope-card.is-claimed .s37-envelope-card__result-art {
  display: block;
}

.s37-envelope-title {
  position: absolute;
  z-index: 4;
  top: 7.86%;
  left: 50%;
  width: 89.74%;
  max-width: none;
  transform: translateX(-50%);
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #fcdc99;
  font-size: calc(var(--s37-envelope-stage-width) * 0.0373333);
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-shadow: none;
}

.s37-envelope-card.is-claimed .s37-envelope-title {
  top: calc(var(--s37-envelope-stage-width) * -0.1493333);
  width: 100%;
  max-width: 100%;
  min-height: calc(var(--s37-envelope-stage-width) * 0.0933333);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(8, 8, 9, 0.88);
  padding: calc(var(--s37-envelope-stage-width) * 0.0213333) calc(var(--s37-envelope-stage-width) * 0.0266667);
  color: #fff;
  font-size: calc(var(--s37-envelope-stage-width) * 0.032);
  font-weight: 400;
  line-height: 1.15;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  text-shadow: none;
}

.s37-envelope-open {
  position: absolute;
  z-index: 5;
  top: 60.76%;
  left: 50%;
  width: calc(var(--s37-envelope-stage-width) * 0.1733333);
  height: calc(var(--s37-envelope-stage-width) * 0.1733333);
  transform: translateX(-50%);
  border: 0;
  border-radius: 50%;
  background: linear-gradient(#ffe8a3, #f7c886, #f2924e);
  color: #a56720;
  box-shadow: 0 1px 2px #3f1a1a;
  cursor: pointer;
  font: inherit;
  font-size: calc(var(--s37-envelope-stage-width) * 0.0476667);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  animation: s37-envelope-heartbeat 2.1s ease-in-out infinite;
}

.s37-envelope-open:disabled {
  cursor: wait;
  opacity: 0.88;
}

.s37-envelope-close {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: calc(var(--s37-envelope-stage-width) * -0.12);
  width: calc(var(--s37-envelope-stage-width) * 0.08);
  height: calc(var(--s37-envelope-stage-width) * 0.08);
  transform: translateX(-50%);
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.s37-envelope-close img {
  display: block;
  width: 100%;
  height: 100%;
}

.s37-envelope-burst {
  position: absolute;
  z-index: 9;
  top: calc(50% - var(--s37-envelope-stage-width) * 0.8266667);
  left: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--s37-envelope-stage-width);
  height: calc(var(--s37-envelope-stage-width) * 1.2666667);
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
}

.s37-envelope-burst img {
  display: block;
  width: calc(var(--s37-envelope-stage-width) * 1.24);
  max-width: none;
  transform: scale(1.4);
}

.s37-envelope-card.is-bursting .s37-envelope-burst {
  display: flex;
}

.s37-envelope-result {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
}

.s37-envelope-card.is-claimed .s37-envelope-open {
  display: none;
}

.s37-envelope-card.is-claimed .s37-envelope-result {
  display: block;
}

.s37-envelope-result__paper {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #b22625;
  text-align: center;
  box-shadow: none;
}

.s37-envelope-result__label {
  position: absolute;
  top: 2%;
  left: 0;
  right: 0;
  display: block;
  width: 100%;
  margin: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #7a4c11;
  font-size: calc(var(--s37-envelope-stage-width) * 0.032);
  line-height: 1;
}

.s37-envelope-result__value {
  position: absolute;
  top: 21.4%;
  left: 0;
  right: 0;
  display: block;
  margin: 0;
  font-size: calc(var(--s37-envelope-stage-width) * 0.072);
  font-weight: 400;
  line-height: 1;
}

.s37-envelope-result__message {
  position: absolute;
  top: 53%;
  bottom: 4%;
  left: 8%;
  right: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #fcdc99;
  font-size: calc(var(--s37-envelope-stage-width) * 0.032);
  line-height: 1.2;
  text-align: center;
}

.s37-envelope-card.is-opening {
  animation: none;
}

.s37-envelope-card.is-opening::after {
  content: "";
  position: absolute;
  z-index: 8;
  top: 51.5%;
  left: 50%;
  width: calc(var(--s37-envelope-stage-width) * 0.032);
  height: calc(var(--s37-envelope-stage-width) * 0.032);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(247, 174, 255, 0.28);
  border-top-color: #d96ee9;
  border-radius: 50%;
  animation: s37-envelope-spin 0.72s linear infinite;
}

.s37-envelope-card.is-error .s37-envelope-open {
  animation: none;
}

.s37-envelope-error {
  position: absolute;
  z-index: 7;
  top: calc(100% + 12px);
  left: 50%;
  width: min(82vw, 270px);
  transform: translateX(-50%);
  color: #ffe7df;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.s37-envelope-important {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.s37-envelope-important__popup {
  position: relative;
  width: min(82vw, 306px);
  outline: 0;
  border-radius: 7px;
  background: #fff;
  color: #333;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
  text-align: center;
}

.s37-envelope-important__popup .ui-dialog__main {
  overflow: hidden;
  border-radius: inherit;
}

.s37-envelope-important__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  box-sizing: border-box;
  padding: 15px 18px 8px;
  color: #dd3d3d;
  font-size: 16px;
  font-weight: 700;
}

.s37-envelope-important__icon {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
  font: 800 14px/1 Arial, Helvetica, sans-serif;
}

.s37-envelope-important__popup .ui-dialog__content {
  padding: 8px 22px 20px;
}

.s37-envelope-important__popup .ui-dialog__message {
  color: #555;
  font-size: 13px;
  line-height: 1.55;
}

.s37-envelope-important__popup .ui-dialog__footer {
  border-top: 1px solid #ededed;
  padding: 12px 16px;
}

.s37-envelope-important__popup .ui-dialog__confirm {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  background: var(--skin__primary, #079b88);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.s37-envelope-important__popup .ui-dialog__confirm:disabled {
  opacity: 0.58;
  cursor: wait;
}

.s37-envelope-important__close {
  position: absolute;
  top: calc(100% + 17px);
  left: 50%;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(21, 21, 22, 0.82);
  color: #fff;
  padding: 0;
  font: 300 25px/27px Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.s37-promo-badge {
  position: absolute !important;
  z-index: 5 !important;
  top: 0 !important;
  right: auto !important;
  left: 50% !important;
  display: block !important;
  width: max-content !important;
  min-width: 17.27px !important;
  max-width: none !important;
  height: 15.11px !important;
  box-sizing: border-box !important;
  border: 0 !important;
  border-radius: 7.02px 7.02px 7.02px 0 !important;
  background: var(--badge-bg-color, #e85555) !important;
  color: #fff !important;
  padding: 0 4.32px !important;
  font: 400 9.72px/15.11px -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI", Arial, Roboto, sans-serif !important;
  text-align: center !important;
  white-space: nowrap !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

.s37-promo-badge > .ui-badge__content {
  position: relative !important;
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  height: 15.11px !important;
  padding: 0 !important;
  margin: 0 !important;
  color: inherit !important;
  font: inherit !important;
  line-height: 15.11px !important;
  text-align: center !important;
}

.s37-promo-badge--tasks {
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  transform: translate(50%, -50%) !important;
}

.s37-promo-badge--cashback {
  top: 2px !important;
  right: 3px !important;
  left: auto !important;
  transform: none !important;
}

.s37-promo-badge--roulette {
  top: 6px !important;
  right: 6px !important;
  left: auto !important;
  transform: none !important;
}

@keyframes s37-envelope-heartbeat {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.3); }
}

@keyframes s37-envelope-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .s37-envelope-open,
  .s37-envelope-card.is-opening {
    animation: none;
  }
}
