/* Ad notification panel — blurred backdrop + timed auto-dismiss */
.ad-notify {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
  visibility: hidden;
}

.ad-notify.is-open {
  pointer-events: auto;
  visibility: visible;
}

.ad-notify-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 26, 0.38);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ad-notify.is-visible .ad-notify-backdrop {
  opacity: 1;
}

/* Animated gold border frame */
.ad-notify-panel-wrap {
  --ad-notify-border: 2.5px;
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(88vh, 560px);
  padding: var(--ad-notify-border);
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  background: rgba(234, 179, 8, 0.22);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.22),
    0 0 28px rgba(234, 179, 8, 0.18);
  opacity: 0;
  transform: translateY(28px) scale(0.92);
  transition:
    opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.ad-notify-panel-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg,
    transparent 0deg 248deg,
    rgba(234, 179, 8, 0.15) 268deg,
    #CA8A04 292deg,
    #EAB308 312deg,
    #FDE047 328deg,
    #FACC15 344deg,
    rgba(234, 179, 8, 0.2) 360deg
  );
  animation: ad-notify-border-spin 2.6s linear infinite;
  pointer-events: none;
}

.ad-notify.is-visible .ad-notify-panel-wrap {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: ad-notify-panel-enter 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ad-notify.is-leaving .ad-notify-panel-wrap {
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition-duration: 0.34s;
  animation: none;
}

.ad-notify-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: calc(min(88vh, 560px) - (var(--ad-notify-border) * 2));
  overflow: visible;
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.ad-notify.is-leaving .ad-notify-backdrop {
  opacity: 0;
  transition-duration: 0.34s;
}

.ad-notify-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--dark-3);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ad-notify-close svg {
  width: 18px;
  height: 18px;
}

.ad-notify-close:hover {
  background: var(--white);
  color: var(--dark);
  transform: scale(1.06);
}

.ad-notify-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ad-notify-top {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 58px);
  pointer-events: none;
}

.ad-notify-top > * {
  pointer-events: auto;
}

.ad-notify-badge {
  position: static;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--dark);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 55%, var(--secondary) 100%);
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.35);
}

.ad-notify-lang {
  position: relative;
  flex-shrink: 0;
  contain: layout style;
}

.ad-notify-lang .lang-switcher-btn {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  min-width: 54px;
  padding: 0 10px;
  font-family: system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--dark);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.ad-notify-lang .lang-switcher-current {
  font-family: inherit;
  line-height: 1;
}

.ad-notify-lang .lang-switcher-chevron {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
}

.ad-notify-lang .lang-switcher-btn:hover,
.ad-notify-lang.lang-switcher.is-open .lang-switcher-btn {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--white);
}

.ad-notify-lang .lang-switcher-menu {
  position: absolute;
  top: calc(100% + 5px);
  inset-inline-start: 0;
  inset-inline-end: auto;
  width: max-content;
  min-width: 106px;
  margin: 0;
  padding: 4px;
  z-index: 6;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.ad-notify-lang .lang-switcher-option {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.ad-notify-lang.lang-switcher.is-open .lang-switcher-chevron {
  transform: rotate(180deg);
}

html[dir="ltr"] .ad-notify-lang .lang-switcher-menu {
  inset-inline-start: 0;
  inset-inline-end: auto;
}

.ad-notify-visual {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(145deg, #111827 0%, #1f2937 42%, #374151 100%);
}

.ad-notify-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.02);
}

.ad-notify-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(10, 15, 26, 0.55) 100%);
  pointer-events: none;
}

.ad-notify-content {
  position: relative;
  z-index: 4;
  padding: 18px 20px 20px;
}

.ad-notify-title {
  margin: 0 0 8px;
  font-size: clamp(1.05rem, 2.8vw, 1.28rem);
  font-weight: 800;
  line-height: 1.45;
  color: var(--dark);
}

.ad-notify-desc {
  margin: 0 0 16px;
  font-size: clamp(0.88rem, 2.4vw, 0.98rem);
  font-weight: 600;
  line-height: 1.7;
  color: var(--gray);
}

.ad-notify-foot {
  display: flex;
  align-items: center;
}

.ad-notify-cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--dark);
  cursor: pointer;
  background: var(--gradient);
  box-shadow: 0 8px 22px rgba(234, 179, 8, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ad-notify-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(234, 179, 8, 0.4);
}

.ad-notify-cta:focus-visible {
  outline: 2px solid var(--primary-dark);
  outline-offset: 3px;
}

@keyframes ad-notify-border-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes ad-notify-panel-enter {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.92);
  }
  68% {
    opacity: 1;
    transform: translateY(-4px) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.ad-notify-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .ad-notify {
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .ad-notify-backdrop {
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    backdrop-filter: blur(10px) saturate(1.1);
    background: rgba(10, 15, 26, 0.28);
  }

  .ad-notify-panel-wrap {
    width: min(420px, 100%);
    max-height: min(92vh, 640px);
  }

  .ad-notify-panel {
    max-height: min(92vh, 640px);
  }

  .ad-notify.is-visible .ad-notify-panel-wrap {
    animation: ad-notify-panel-enter-mobile 0.58s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .ad-notify-content {
    padding: 16px 18px 18px;
  }

  .ad-notify-close {
    top: 10px;
    inset-inline-end: 10px;
    width: 34px;
    height: 34px;
  }

  .ad-notify-top {
    top: 10px;
    inset-inline-start: 10px;
    gap: 6px;
  }

  .ad-notify-badge {
    font-size: 11px;
    padding: 5px 10px;
  }
}

@keyframes ad-notify-panel-enter-mobile {
  0% {
    opacity: 0;
    transform: translateY(100%) scale(0.98);
  }
  72% {
    opacity: 1;
    transform: translateY(-6px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ad-notify-backdrop,
  .ad-notify-panel-wrap,
  .ad-notify-panel,
  .ad-notify-close,
  .ad-notify-cta {
    transition: none;
  }

  .ad-notify-panel-wrap::before {
    animation: none;
    background: linear-gradient(135deg, #CA8A04, #EAB308, #FDE047);
  }

  .ad-notify.is-visible .ad-notify-panel-wrap {
    animation: none;
  }
}
