.ye-card[hidden] {
  display: none !important;
}

.ye-card {
  --ye-accent: #a73e10;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1040;
  box-sizing: border-box;
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: radial-gradient(ellipse at top left, #ffd38d 0%, transparent 52%),
              radial-gradient(ellipse at bottom right, #ffbc94 0%, transparent 57%),
              linear-gradient(135deg, #fff1ce, #fff7e9 55%, #ffe3c5);
  color: #182331;
  border: 1px solid #d49a62;
  border-top: 4px solid var(--ye-accent);
  border-radius: 16px;
  box-shadow: 0 18px 72px #15202c40, 0 2px 8px #15202c1a;
  font: 400 1rem/1.55 Verdana, sans-serif;
  text-align: center;
  overflow-wrap: anywhere;
}

.ye-card .ye-offer {
  margin: 0;
  padding-inline: 1.5rem;
  color: var(--ye-accent);
  font: 700 .82rem/1.4 Verdana, sans-serif;
}

.ye-card h2 {
  margin: .8rem 0;
  color: inherit;
  font: 700 clamp(1.35rem, 3vw, 1.85rem)/1.2 Verdana, sans-serif;
  text-transform: none;
  text-wrap: balance;
}

.ye-card .ye-body {
  margin: 0;
  color: inherit;
  font: inherit;
  white-space: pre-line;
}

.ye-card .ye-action {
  display: block;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  margin: 1.35rem auto .75rem;
  padding: .8rem 1.35rem;
  border-radius: 7px;
  background: var(--ye-accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.ye-card .ye-action:hover { background: #85320d; }

.ye-card small {
  display: block;
  color: #475661;
  font-size: .8rem;
  line-height: 1.45;
}

.ye-card .ye-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #263744;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.ye-card .ye-close:hover { background: #f3f4f5; }
.ye-card :focus-visible { outline: 3px solid #176bae; outline-offset: 2px; }

/* The existing popup controls the lifetime of its decorative sibling. */
.ye-night-sky { display: none; }
.ye-card:not([hidden]) + .ye-night-sky {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1039;
  overflow: hidden;
  pointer-events: none;
  background: rgba(10, 14, 33, .68);
}

/* Stagger four volleys across the viewport. Each burst fades before its next launch. */
@media (prefers-reduced-motion: no-preference) {
  .ye-night-sky .ye-burst {
    position: absolute;
    display: block;
    left: var(--x);
    top: var(--y);
    width: clamp(9rem, 27vw, 24rem);
    aspect-ratio: 1;
    opacity: 0;
    background: center / contain no-repeat url("ye-firework-star-v2.svg");
    filter: hue-rotate(var(--hue));
    animation: ye-v2-burst 3s ease-out var(--delay) 4 both;
  }
  @keyframes ye-v2-burst {
    0% { opacity: 0; transform: translate(-50%, -42%) scale(.08); }
    9% { opacity: 1; transform: translate(-50%, -50%) scale(.45); }
    32% { opacity: 1; transform: translate(-50%, -50%) scale(.88); }
    60% { opacity: .98; }
    80%, 100% { opacity: 0; transform: translate(-50%, -41%) scale(1.08); }
  }
  .ye-night-sky .ye-burst:nth-child(1) { --x: 15%; --y: 19%; --delay: 0s; --hue: 0deg; }
  .ye-night-sky .ye-burst:nth-child(2) { --x: 85%; --y: 21%; --delay: 0.4s; --hue: 34deg; }
  .ye-night-sky .ye-burst:nth-child(3) { --x: 9%; --y: 72%; --delay: 0.8s; --hue: 105deg; }
  .ye-night-sky .ye-burst:nth-child(4) { --x: 89%; --y: 79%; --delay: 1.2s; --hue: 210deg; }
  .ye-night-sky .ye-burst:nth-child(5) { --x: 32%; --y: 10%; --delay: 1.6s; --hue: 315deg; }
  .ye-night-sky .ye-burst:nth-child(6) { --x: 59%; --y: 91%; --delay: 2s; --hue: 25deg; }
  .ye-night-sky .ye-burst:nth-child(7) { --x: 23%; --y: 89%; --delay: 2.4s; --hue: 145deg; }
  .ye-night-sky .ye-burst:nth-child(8) { --x: 71%; --y: 8%; --delay: 2.8s; --hue: 275deg; }
}

.ye-card .ye-christmas {
  display: block;
  width: clamp(6rem, 20vw, 9.375rem);
  height: auto;
  max-width: calc(100% - 3rem);
  margin: -.5rem auto .65rem;
  pointer-events: none;
}
@media (max-height: 520px) {
  .ye-card .ye-christmas { width: 5rem; }
}

.ye-card .ye-christmas { position: relative; aspect-ratio: 150 / 76; }
.ye-christmas img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .ye-tree { transform-origin: 33% 88%; animation: ye-tree-sway 3.5s ease-in-out 4; }
  .ye-santa-hat { transform-origin: 62% 78%; animation: ye-hat-hop 2.8s ease-in-out 5; }
  @keyframes ye-tree-sway {
    0%, 50%, 100% { transform: rotate(0); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
  }
  @keyframes ye-hat-hop {
    0%, 68%, 100% { transform: translateY(0) rotate(0); }
    28% { transform: translateY(-12%) rotate(-7deg); }
    52% { transform: translateY(-2%) rotate(3deg); }
  }
}
