/* Arranque: splash encima; la carta se arma debajo. Sin capas fantasma al terminar. */

html.kinlig-booting {
  overflow: hidden;
  --km-boot-bg: #0e293c;
  --km-boot-spin: #f8f8f8;
}

#kinlig-boot-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: var(--km-boot-bg, #0e293c);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

html.kinlig-splash-off #kinlig-boot-splash {
  opacity: 0;
  pointer-events: none;
}

#kinlig-boot-splash[hidden],
html.kinlig-ready #kinlig-boot-splash {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Mismo patrón que Watati (fakeLoader spinner1 / kinlig-boot-spin en index.html) */
#kinlig-boot-splash .kinlig-boot-spin {
  position: relative;
  width: 50px;
  height: 50px;
}

#kinlig-boot-splash .kinlig-boot-spin-a,
#kinlig-boot-splash .kinlig-boot-spin-b {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50% !important;
  background: var(--km-boot-spin, #f8f8f8);
  opacity: 0.6;
  animation: kinligBootBounce 2s infinite ease-in-out;
}

#kinlig-boot-splash .kinlig-boot-spin-b {
  animation-delay: -1s !important;
}

@keyframes kinligBootBounce {
  0%, 100% { transform: scale(0); }
  50% { transform: scale(1); }
}

.km-promo {
  position: fixed;
  inset: 0;
  z-index: 2147483645;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #000;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.km-promo.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

#km-carta-promos[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.km-promo-shell {
  position: relative;
  width: min(100%, 28rem);
  height: 100%;
}

.km-promo-shell::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 7.5rem;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.42));
}

.km-promo-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #111;
  overflow: hidden;
}

.km-promo-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 0;
  transition: opacity 0.62s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

.km-promo-layer.is-on {
  opacity: 1;
  z-index: 1;
}

.km-promo-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.km-promo-x {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  left: auto;
  bottom: auto;
  z-index: 2;
  width: 40px;
  height: 40px;
  margin: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.km-promo-x span,
.km-promo-x span::before {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.km-promo-x span::before {
  content: '';
  inset: 0;
  transform: rotate(90deg);
}

.km-promo-close {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 10px));
  z-index: 2;
  width: auto;
  max-width: 220px;
  height: 48px;
  margin: 0 auto;
  padding: 0 1.25rem;
  border: 0;
  background: #111;
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.km-promo-close.has-img {
  height: auto;
  max-width: min(220px, calc(100% - 40px));
  max-height: 72px;
  padding: 0;
  background: transparent;
  line-height: 0;
}

.km-promo-close.has-img img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72px;
  object-fit: contain;
}

.km-promo-close.has-img .km-promo-close-lab {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.km-promo-dots {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(78px, calc(env(safe-area-inset-bottom, 0px) + 70px));
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.km-promo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.km-promo-dot.is-on {
  background: #fff;
}

@media (prefers-reduced-motion: reduce) {
  #kinlig-boot-splash,
  .km-promo {
    transition-duration: 0.01ms;
  }
  .km-promo-layer {
    transition: none;
  }
  #kinlig-boot-splash .kinlig-boot-spin-a,
  #kinlig-boot-splash .kinlig-boot-spin-b {
    animation: none;
    opacity: 0.85;
    transform: scale(0.72);
  }
}
