/* === Cinematic Preloader (The Arena) === */
#cinematic-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  /* Sfumato base: centro grigio chiaro, bordi neri */
  background: radial-gradient(ellipse 80% 60% at 50% 45%, #1a1a1a 0%, #0d0d0d 50%, #000 100%);
  overflow: hidden;
  opacity: 1;
  pointer-events: all;
}

#cinematic-preloader.is-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

/* Glow rosso brand al centro + sfumatura aggiuntiva */
.cp-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 45%, rgba(237,28,36,0.15) 0%, rgba(237,28,36,0.03) 50%, transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.cp-grain {
  position: absolute;
  inset: -20%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  opacity: .18;
  mix-blend-mode: overlay;
  animation: cp-grain 2.2s steps(2) infinite;
  transform: translateZ(0);
}

@keyframes cp-grain {
  0% { transform: translate(0,0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 2%); }
  100% { transform: translate(0,0); }
}

/* Vignettatura: bordi più scuri, non copre il centro */
.cp-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 75% at 50% 45%, transparent 45%, rgba(0,0,0,0.5) 80%, rgba(0,0,0,0.85) 100%);
  pointer-events: none;
}

/* Scan lines cinematografiche - sottili come nell'immagine */
.cp-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.12) 2px,
    rgba(0,0,0,0.12) 4px
  );
  pointer-events: none;
  opacity: 0.5;
}

/* Cornice tipo schermo cinema */
.cp-frame {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 60px 15px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Light leak rosso brand - angoli con sfumatura visibile */
.cp-lightleak {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(237,28,36,0.12) 0%, transparent 55%),
    radial-gradient(ellipse 45% 30% at 10% 90%, rgba(237,28,36,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.cp-center {
  position: relative;
  text-align: center;
  padding: 24px;
  width: min(720px, 92vw);
}

/* Effetto Netflix: logo scala dal centro, più lento e cinematografico */
.cp-logo {
  width: min(520px, 86vw);
  height: auto;
  opacity: 0;
  transform: scale(0.7);
  filter: blur(4px) drop-shadow(0 0 20px rgba(237, 28, 36, 0.3));
  animation: cp-logo-netflix 3200ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cp-logo-netflix {
  0%   { opacity: 0; transform: scale(0.7); filter: blur(6px) drop-shadow(0 0 30px rgba(237,28,36,0.1)); }
  40%  { opacity: 1; transform: scale(1.02); filter: blur(0) drop-shadow(0 0 50px rgba(237,28,36,0.4)); }
  70%  { transform: scale(0.98); filter: blur(0) drop-shadow(0 0 35px rgba(237,28,36,0.25)); }
  100% { opacity: 1; transform: scale(1); filter: blur(0) drop-shadow(0 10px 40px rgba(237,28,36,0.2)); }
}

.cp-subtitle {
  margin-top: 16px;
  color: rgba(255,255,255,0.9);
  font: 500 13px/1.2 var(--font-sans, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif);
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: 0;
  animation: cp-fade-in 900ms ease forwards;
  animation-delay: 500ms;
}

@keyframes cp-fade-in {
  to { opacity: 1; }
}

.cp-progress {
  margin: 18px auto 0;
  width: min(420px, 78vw);
  height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  overflow: hidden;
}

/* Barra: fill controllato via JS, una sola volta, sync con caricamento */
.cp-bar {
  display: block;
  width: 0%;
  height: 100%;
  background: #ed1c24;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(237, 28, 36, 0.6);
  transition: width 120ms ease-out;
}

/* Accessibilità: riduci movimento */
@media (prefers-reduced-motion: reduce) {
  .cp-logo, .cp-subtitle, .cp-grain {
    animation: none !important;
  }
  .cp-logo { opacity: 1; transform: scale(1); filter: drop-shadow(0 10px 40px rgba(237,28,36,0.2)); }
  .cp-subtitle { opacity: 1; }
}
