:root {
  --exit-cream: #f7f2e7;
  --exit-paper: #fffaf1;
  --exit-ink: #2b2419;
  --exit-muted: #746858;
  --exit-terracotta: #c1694f;
  --exit-terracotta-dark: #984b37;
  --exit-gold: #b08a4e;
}

.exit-popup[hidden] { display: none; }

.exit-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 20, 14, .54);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .28s ease;
}

.exit-popup.is-open { opacity: 1; }

.exit-popup__panel {
  position: relative;
  width: min(100%, 520px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(193, 105, 79, .15), transparent 35%),
    var(--exit-paper);
  box-shadow: 0 28px 80px rgba(23, 17, 11, .38), 0 0 54px rgba(193, 105, 79, .12);
  color: var(--exit-ink);
  padding: clamp(26px, 6vw, 42px);
  transform: translateY(18px) scale(.97);
  transition: transform .38s cubic-bezier(.22, .68, .16, 1);
}

.exit-popup.is-open .exit-popup__panel { transform: translateY(0) scale(1); }

.exit-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(43, 36, 25, .12);
  border-radius: 50%;
  background: rgba(255, 255, 255, .65);
  color: var(--exit-muted);
  cursor: pointer;
  font: 400 1.2rem/1 sans-serif;
  transition: transform .22s ease, background .22s ease, color .22s ease;
}

.exit-popup__close:hover {
  transform: rotate(8deg) scale(1.06);
  background: #fff;
  color: var(--exit-terracotta-dark);
}

.exit-popup__eyebrow {
  margin: 0 0 10px;
  color: var(--exit-terracotta-dark);
  font: 700 .72rem/1.3 "Manrope", "Poppins", sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.exit-popup__title {
  max-width: 430px;
  margin: 0 36px 12px 0;
  color: var(--exit-ink);
  font: 500 clamp(1.75rem, 5vw, 2.35rem)/1.08 "Fraunces", "Playfair Display", Georgia, serif;
  letter-spacing: -.025em;
}

.exit-popup__text {
  margin: 0 0 24px;
  color: var(--exit-muted);
  font: 400 .95rem/1.65 "Manrope", "Poppins", sans-serif;
}

.exit-popup__actions { display: grid; gap: 10px; }

.exit-popup__action {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 17px;
  border: 1px solid rgba(43, 36, 25, .14);
  border-radius: 15px;
  color: var(--exit-ink);
  text-decoration: none;
  font: 700 .87rem/1.3 "Manrope", "Poppins", sans-serif;
  transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease, background .24s ease;
}

.exit-popup__action::after {
  content: "→";
  color: var(--exit-terracotta);
  font-size: 1.08rem;
  transition: transform .24s ease;
}

.exit-popup__action:hover {
  transform: translateY(-2px);
  border-color: rgba(193, 105, 79, .45);
  box-shadow: 0 12px 28px rgba(43, 36, 25, .11);
}

.exit-popup__action:hover::after { transform: translateX(4px); }

.exit-popup__action--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--exit-terracotta), var(--exit-terracotta-dark));
  box-shadow: 0 13px 28px rgba(156, 78, 57, .26);
  color: #fff;
}

.exit-popup__action--primary::after { color: #fff1df; }
.exit-popup__action--primary:hover { box-shadow: 0 16px 34px rgba(156, 78, 57, .4); }

.exit-popup__action--quiet {
  min-height: 42px;
  justify-content: center;
  border-color: transparent;
  color: var(--exit-muted);
  font-weight: 600;
}

.exit-popup__action--quiet::after { display: none; }
.exit-popup__action--quiet:hover { box-shadow: none; background: rgba(193, 105, 79, .07); }

body.exit-popup-lock { overflow: hidden; }

@media (max-width: 540px) {
  .exit-popup { align-items: end; padding: 10px; }
  .exit-popup__panel { border-radius: 24px 24px 18px 18px; padding: 30px 22px 22px; }
  .exit-popup__title { font-size: 1.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .exit-popup, .exit-popup__panel, .exit-popup__action, .exit-popup__action::after { transition: none; }
}
