@keyframes popup-in {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(.98);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes icon-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -4px, 0);
  }
}

@keyframes glow-pulse {
  0%,
  100% {
    opacity: .45;
  }

  50% {
    opacity: .72;
  }
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: backdrop-in .18s ease-out;
}

.popup-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(26, 115, 232, .08), transparent 28%),
    rgba(32, 36, 41, .42);
  backdrop-filter: blur(10px);
  animation: backdrop-in .22s ease-out;
}

.popup-card {
  position: relative;
  width: min(100%, 440px);
  max-height: calc(100vh - 32px);
  animation: popup-in .3s cubic-bezier(.2, 0, 0, 1);
}

.popup-glow {
  position: absolute;
  inset: -8px;
  z-index: 0;
  border-radius: 24px;
  background: radial-gradient(circle at top, var(--popup-glow), transparent 68%);
  filter: blur(18px);
  animation: glow-pulse 2.8s ease-in-out infinite;
}

.popup-panel {
  position: relative;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 253, .98));
  box-shadow: 0 18px 48px rgba(60, 64, 67, .16);
}

.popup-topbar {
  height: 5px;
  background: linear-gradient(90deg, var(--popup-accent), rgba(255, 255, 255, .92));
}

.popup-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(248, 250, 253, .96);
  color: #5f6368;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .12);
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
  cursor: pointer;
}

.popup-close-button:hover {
  background: rgba(234, 67, 53, .10);
  color: #c5221f;
  transform: translateY(-1px);
}

.popup-close-button:focus-visible,
.popup-copy-button:focus-visible,
.popup-primary-button:focus-visible {
  outline: 2px solid var(--popup-accent);
  outline-offset: 2px;
}

.popup-close-button svg,
.popup-copy-button svg,
.popup-icon-mark svg,
.popup-message-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popup-body {
  flex: 1;
  padding: 28px 24px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 99, 104, .34) transparent;
}

.popup-body::-webkit-scrollbar {
  width: 6px;
}

.popup-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(95, 99, 104, .28);
}

.popup-body::-webkit-scrollbar-thumb:hover {
  background: rgba(95, 99, 104, .44);
}

.popup-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.popup-icon-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--popup-accent-surface), rgba(255, 255, 255, .92));
  box-shadow: inset 0 0 0 1px var(--popup-accent-border);
}

.popup-icon-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: var(--popup-accent-strong);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 1px 2px rgba(60, 64, 67, .10);
}

.popup-icon-bounce {
  animation: icon-float 2.2s ease-in-out infinite;
}

.popup-badge {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--popup-accent-surface);
  color: var(--popup-accent-strong);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.popup-title {
  margin: 14px 0 0;
  max-width: 18ch;
  color: #202124;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.popup-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 220px;
  margin: 18px auto 6px;
}

.popup-divider span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--popup-accent-border), transparent);
}

.popup-divider i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--popup-accent);
  opacity: .7;
}

.popup-section {
  margin-top: 20px;
}

.popup-section-label {
  margin: 0;
  color: #5f6368;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: none;
}

.popup-coupon-card,
.popup-message-card,
.popup-callout-card {
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(218, 220, 224, .92);
}

.popup-coupon-card {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
}

.popup-coupon-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--popup-accent-surface-soft), transparent 52%);
  pointer-events: none;
}

.popup-coupon-ticket::before,
.popup-coupon-ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 999px;
  background: #f8fafd;
  box-shadow: inset 0 0 0 1px rgba(218, 220, 224, .8);
}

.popup-coupon-ticket::before {
  left: -7px;
}

.popup-coupon-ticket::after {
  right: -7px;
}

.popup-coupon-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.popup-coupon-code {
  flex: 1;
  display: block;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #202124;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  word-break: break-word;
}

.popup-copy-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--popup-accent-surface);
  color: var(--popup-accent-strong);
  box-shadow: inset 0 0 0 1px var(--popup-accent-border);
  transition: transform .18s ease, background-color .18s ease, color .18s ease;
  cursor: pointer;
}

.popup-copy-label {
  display: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
}

.popup-copy-button:hover {
  transform: translateY(-1px);
  background: var(--popup-accent-surface-soft);
}

.popup-copy-feedback {
  position: relative;
  z-index: 1;
  min-height: 18px;
  margin: 10px 0 0;
  color: #5f6368;
  font-size: 12px;
  text-align: center;
}

.popup-message-card,
.popup-callout-card {
  padding: 16px;
}

.popup-text-card {
  margin-top: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(218, 220, 224, .92);
}

.popup-text-scroll {
  max-height: 180px;
  padding: 16px 18px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 99, 104, .3) transparent;
}

.popup-text-scroll::-webkit-scrollbar {
  width: 6px;
}

.popup-text-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(95, 99, 104, .26);
}

.popup-text-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(95, 99, 104, .42);
}

.popup-callout-card {
  display: grid;
  gap: 6px;
}

.popup-message-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.popup-message-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--popup-accent-strong);
  background: var(--popup-accent-surface);
}

.popup-message,
.popup-message-copy {
  margin: 0;
  color: #3c4043;
  font-size: 14px;
  line-height: 1.58;
  font-weight: 400;
  letter-spacing: -.005em;
  text-wrap: pretty;
}

.popup-text-block {
  max-width: 100%;
  color: inherit;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.popup-text-block br + br {
  display: block;
  content: "";
  margin-top: 10px;
}

.popup-text-block-center {
  text-align: center;
}

.popup-text-block-long {
  max-width: 100%;
}

.popup-section > .popup-text-block {
  margin-top: 14px;
}

.popup-callout-card .popup-message-copy,
.popup-callout-card .popup-text-block {
  line-height: 1.46;
}

.popup-message-card .popup-text-block,
.popup-callout-card .popup-text-block,
.popup-message-copy > .popup-text-block {
  margin-top: 0;
  margin-inline: 0;
}

.popup-message-copy {
  min-width: 0;
}

.popup-message-copy > .popup-text-block {
  max-height: 188px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 99, 104, .3) transparent;
}

.popup-message-copy > .popup-text-block::-webkit-scrollbar {
  width: 6px;
}

.popup-message-copy > .popup-text-block::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(95, 99, 104, .26);
}

.popup-message-copy > .popup-text-block::-webkit-scrollbar-thumb:hover {
  background: rgba(95, 99, 104, .42);
}

.popup-primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--popup-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px var(--popup-glow);
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}

.popup-primary-button:hover {
  transform: translateY(-1px);
  background: var(--popup-accent-strong);
}

.popup-primary-button:active,
.popup-copy-button:active,
.popup-close-button:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .popup-overlay {
    padding: 10px;
  }

  .popup-card {
    max-height: calc(100vh - 24px);
  }

  .popup-panel {
    border-radius: 16px;
  }

  .popup-topbar {
    height: 4px;
  }

  .popup-close-button {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
  }

  .popup-close-button svg {
    width: 18px;
    height: 18px;
  }

  .popup-body {
    padding: 20px 16px 16px;
  }

  .popup-icon-shell {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }

  .popup-icon-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .popup-badge {
    min-height: 28px;
    margin-top: 12px;
    padding: 0 12px;
    font-size: 11px;
  }

  .popup-title {
    margin-top: 12px;
    font-size: 21px;
    line-height: 1.2;
  }

  .popup-divider {
    max-width: 180px;
    margin: 14px auto 4px;
  }

  .popup-section {
    margin-top: 16px;
  }

  .popup-coupon-card,
  .popup-message-card,
  .popup-callout-card,
  .popup-text-card {
    border-radius: 14px;
  }

  .popup-coupon-card {
    padding: 14px 14px 12px;
  }

  .popup-coupon-row {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
  }

  .popup-coupon-code {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 17px;
    letter-spacing: .05em;
  }

  .popup-copy-button {
    gap: 8px;
    width: 100%;
    height: 42px;
    border-radius: 12px;
    font-size: 13px;
  }

  .popup-copy-label {
    display: inline;
    font-size: 12px;
  }

  .popup-copy-feedback {
    margin-top: 8px;
    font-size: 11px;
  }

  .popup-text-card {
    margin-top: 12px;
  }

  .popup-text-scroll,
  .popup-message-copy > .popup-text-block {
    max-height: 148px;
    padding: 14px 14px;
  }

  .popup-message-card,
  .popup-callout-card {
    padding: 14px;
  }

  .popup-message-card {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
  }

  .popup-message-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .popup-message,
  .popup-message-copy {
    font-size: 13px;
    line-height: 1.5;
  }

  .popup-primary-button {
    min-height: 44px;
    margin-top: 18px;
    font-size: 13px;
  }

  .popup-text-block-long {
    max-width: 100%;
  }
}

@media (max-width: 400px) {
  .popup-overlay {
    padding: 8px;
  }

  .popup-body {
    padding: 18px 14px 14px;
  }

  .popup-title {
    font-size: 20px;
  }

  .popup-coupon-code {
    font-size: 16px;
  }

  .popup-text-scroll,
  .popup-message-copy > .popup-text-block {
    max-height: 132px;
    padding: 12px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .popup-card,
  .popup-backdrop,
  .popup-overlay,
  .popup-icon-bounce,
  .popup-glow,
  .popup-close-button,
  .popup-copy-button,
  .popup-primary-button {
    animation: none !important;
    transition: none !important;
  }
}
