/* ==========================================================================
   Motor de Camadas — V1 (GCs/Tarjas), V2 (Selos/Marcas) — Fase 1
   A camada é um container 16:9 relativo ao quadro do vídeo; as dimensões
   usam cqw/cqh para escalar igual em celular, desktop e Smart TV.
   ========================================================================== */
.overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  container-type: size;
  overflow: hidden;
  --ov-safe-x: 3.5cqw;
  --ov-safe-y: 3.5cqh;
}

/* Quando o player exibe vídeo vertical (Shorts 9:16) no desktop horizontal,
   o container de camadas centraliza-se sobre a coluna real do vídeo */
@media (min-width: 769px) and (orientation: landscape) {
  .player-wrapper.has-vertical-video .overlay-layer {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    height: 100%;
    width: auto;
    aspect-ratio: 9 / 16;
  }
}

.ov-item {
  --ov-accent: #d4af37;
  --ov-bg-alpha: 0.55;
  --ov-user-scale: 1;
  --ov-rot: 0deg;
  position: absolute;
  max-width: calc(100cqw - 2 * var(--ov-safe-x));
  opacity: 0;
  scale: var(--ov-user-scale, 1);
  rotate: var(--ov-rot, 0deg);
  transform: translate(var(--ov-tx, 0), var(--ov-ty, 0));
  transform-origin: center center;
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(.2, .8, .2, 1), scale 0.4s cubic-bezier(.2, .8, .2, 1), rotate 0.3s ease;
  will-change: opacity, transform, scale, rotate;
}
.ov-item.is-in { opacity: 1; }

/* --- Efeitos de Pulsação Contínua (Breathe / Glow) --- */
.ov-pulse-breathe {
  animation: ov-breathe var(--ov-pulse-dur, 1.8s) ease-in-out infinite;
}
@keyframes ov-breathe {
  0%, 100% { scale: var(--ov-user-scale, 1); }
  50% { scale: calc(var(--ov-user-scale, 1) * 1.08); }
}

.ov-pulse-glow {
  animation: ov-glow var(--ov-pulse-dur, 1.8s) ease-in-out infinite;
}
@keyframes ov-glow {
  0%, 100% {
    filter: drop-shadow(0 0 2px var(--ov-accent));
    box-shadow: 0 0 4px var(--ov-accent);
  }
  50% {
    filter: drop-shadow(0 0 16px var(--ov-accent));
    box-shadow: 0 0 20px var(--ov-accent);
  }
}

/* --- Modo Letreiro / Ticker (Texto em Rolagem Contínua) --- */
.ov-ticker-wrap {
  overflow: hidden;
  position: relative;
  display: block;
  max-width: 100%;
}
.ov-ticker-wrap.is-vert {
  height: 1.5em;
  line-height: 1.5em;
}
.ov-ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}
.ov-ticker-horiz-rtl .ov-ticker-track {
  animation-name: ov-ticker-rtl;
  animation-duration: var(--ov-ticker-dur, 12s);
}
.ov-ticker-horiz-ltr .ov-ticker-track {
  animation-name: ov-ticker-ltr;
  animation-duration: var(--ov-ticker-dur, 12s);
}
.ov-ticker-vert-btt .ov-ticker-track {
  display: flex;
  flex-direction: column;
  animation-name: ov-ticker-btt;
  animation-duration: var(--ov-ticker-dur, 6s);
}
.ov-ticker-vert-ttb .ov-ticker-track {
  display: flex;
  flex-direction: column;
  animation-name: ov-ticker-ttb;
  animation-duration: var(--ov-ticker-dur, 6s);
}

@keyframes ov-ticker-rtl {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}
@keyframes ov-ticker-ltr {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes ov-ticker-btt {
  0% { transform: translateY(100%); }
  100% { transform: translateY(-100%); }
}
@keyframes ov-ticker-ttb {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* --- 9 âncoras --- */
.ov-anchor-tl { top: var(--ov-safe-y); left: var(--ov-safe-x); transform-origin: top left; }
.ov-anchor-tc { top: var(--ov-safe-y); left: 50%; --ov-tx: -50%; transform-origin: top center; }
.ov-anchor-tr { top: var(--ov-safe-y); right: var(--ov-safe-x); transform-origin: top right; }
.ov-anchor-ml { top: 50%; left: var(--ov-safe-x); --ov-ty: -50%; transform-origin: center left; }
.ov-anchor-c  { top: 50%; left: 50%; --ov-tx: -50%; --ov-ty: -50%; transform-origin: center center; }
.ov-anchor-mr { top: 50%; right: var(--ov-safe-x); --ov-ty: -50%; transform-origin: center right; }
.ov-anchor-bl { bottom: var(--ov-safe-y); left: var(--ov-safe-x); transform-origin: bottom left; }
.ov-anchor-bc { bottom: var(--ov-safe-y); left: var(--ov-safe-x); right: var(--ov-safe-x); max-width: none; display: flex; justify-content: center; transform-origin: bottom center; }
.ov-anchor-br { bottom: var(--ov-safe-y); right: var(--ov-safe-x); transform-origin: bottom right; }

/* Posição livre (arraste no preview): % relativa ao quadro */
.ov-free { --ov-tx: 0; --ov-ty: 0; transform-origin: top left; }

/* --- Animações de entrada e saída (transições NLE profissionais) --- */
.ov-anim-fade {
  transition: opacity 0.45s ease;
}
.ov-anim-fade:not(.is-in) {
  opacity: 0;
}

.ov-anim-slide {
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), scale 0.45s ease;
}
.ov-anim-slide:not(.is-in) {
  opacity: 0;
  transform: translate(calc(var(--ov-tx, 0px) - 3.5cqmin), var(--ov-ty, 0));
}

.ov-anim-pop {
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), scale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ov-anim-pop:not(.is-in) {
  opacity: 0;
  scale: calc(var(--ov-user-scale, 1) * 0.8);
}

.ov-anim-cut {
  transition: none !important;
}
.ov-anim-cut:not(.is-in) {
  opacity: 0;
  display: none;
}

/* --- V1: GC / Terço inferior (2 linhas, elástico, glassmorphism) --- */
.ov-card {
  display: inline-flex;
  flex-direction: column;
  gap: 0.5cqmin;
  max-width: 100%;
  padding: 1.5cqmin 2.8cqmin;
  background: rgba(10, 8, 14, var(--ov-bg-alpha));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-left: 0.6cqmin solid var(--ov-accent);
  border-radius: 1.1cqmin;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  color: #fff;
}
.ov-line1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 2.8cqmin, 36px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.ov-line2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  font-size: clamp(10px, 2cqmin, 26px);
  line-height: 1.2;
  opacity: 0.85;
  overflow-wrap: anywhere;
}

/* --- V2: Selo de texto (pílula) / imagem --- */
.ov-pill {
  display: inline-flex;
  align-items: center;
  gap: 1cqmin;
  padding: 1cqmin 2.2cqmin;
  background: rgba(10, 8, 14, var(--ov-bg-alpha));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: clamp(1px, 0.25cqmin, 3px) solid var(--ov-accent);
  border-radius: 999px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: clamp(10px, 2.2cqmin, 26px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ov-image {
  display: block;
  max-width: 22cqmin;
  max-height: 14cqmin;
  object-fit: contain;
}

@media (prefers-reduced-motion: reduce) {
  .ov-item { transition: opacity 0.2s linear; }
  .ov-anim-slide:not(.is-in) { transform: translate(var(--ov-tx, 0), var(--ov-ty, 0)); }
}

/* --- V1: Tarja (faixa de largura total, avisos/rodapé/topo) --- */
.ov-band {
  box-sizing: border-box;
  width: calc(100cqw - 2 * var(--ov-safe-x));
  display: flex;
  flex-direction: column;
  gap: 0.3cqmin;
  padding: 1.2cqmin 2.8cqmin;
  background: linear-gradient(90deg, rgba(10, 8, 14, var(--ov-bg-alpha)), rgba(10, 8, 14, calc(var(--ov-bg-alpha) * 0.55)));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 0.5cqmin solid var(--ov-accent);
  border-radius: 0.8cqmin;
  color: #fff;
}

/* --- V2: Badge AO VIVO (ponto pulsante) --- */
.ov-pill.ov-live {
  display: inline-flex;
  align-items: center;
  gap: 1cqmin;
  background: rgba(190, 18, 36, calc(var(--ov-bg-alpha) + 0.35));
  border-color: transparent;
}
.ov-live-dot {
  width: 1.1cqmin;
  height: 1.1cqmin;
  min-width: 6px;
  min-height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px #fff;
  animation: ov-pulse 1.4s ease-in-out infinite;
}
@keyframes ov-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.15); } }

/* --- V2: Selo de classificação indicativa --- */
.ov-class {
  display: grid;
  place-items: center;
  min-width: 4.4cqmin;
  height: 4.4cqmin;
  padding: 0 0.8cqmin;
  border-radius: 0.6cqmin;
  background: var(--ov-accent);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: clamp(11px, 2.4cqmin, 30px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* --- V2: Animações Cênicas Nativas (Fase 4 - < 5 KB sem bibliotecas pesadas) --- */
.ov-scenic { pointer-events: none; }

/* 1. Cortina / Pano de Teatro */
.ov-curtain-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2.2cqmin;
  padding: 1.2cqmin 3cqmin;
  background: rgba(14, 10, 16, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 1.2cqmin;
  box-shadow: 0 1cqmin 3cqmin rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.ov-curtain-l, .ov-curtain-r {
  width: 3.2cqmin;
  height: 4.5cqmin;
  background: linear-gradient(135deg, #7f1d1d, #991b1b, #450a0a);
  border-radius: 0.5cqmin;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
  animation: ov-curtain-wave 2.2s ease-in-out infinite alternate;
}
.ov-curtain-r { animation-delay: -1.1s; }
@keyframes ov-curtain-wave {
  0% { transform: scaleX(0.9) skewY(-2deg); }
  100% { transform: scaleX(1.1) skewY(2deg); }
}
.ov-curtain-label { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: clamp(11px, 3cqmin, 28px); color: #e6c65c; letter-spacing: 2px; }

/* 2. REC Pulsante ao vivo */
.ov-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 1.2cqmin;
  padding: 1cqmin 2.4cqmin;
  background: rgba(15, 12, 18, 0.88);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: clamp(11px, 2.8cqmin, 30px);
  color: #fff;
  letter-spacing: 1.5px;
  box-shadow: 0 0 2cqmin rgba(239, 68, 68, 0.35);
}
.ov-rec-dot {
  width: 1.6cqmin; height: 1.6cqmin; min-width: 8px; min-height: 8px;
  border-radius: 50%; background: #ef4444;
  box-shadow: 0 0 12px #ef4444;
  animation: ov-rec-blink 1s ease-in-out infinite;
}
@keyframes ov-rec-blink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.2; transform: scale(0.8); } }
.ov-rec-time { font-size: 0.8em; color: #fca5a5; font-weight: 500; }

/* 3. Palmas / Aplausos cênicos */
.ov-applause-pill {
  display: inline-flex;
  align-items: center;
  gap: 1.2cqmin;
  padding: 1cqmin 2.4cqmin;
  background: rgba(212, 175, 55, 0.18);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1.5px solid #e6c65c;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: clamp(11px, 2.8cqmin, 30px);
  color: #fff;
  box-shadow: 0 0.8cqmin 2.5cqmin rgba(212, 175, 55, 0.35);
  animation: ov-app-bounce 1.5s ease-in-out infinite alternate;
}
@keyframes ov-app-bounce { 0% { transform: translateY(0); } 100% { transform: translateY(-0.5cqmin); } }

/* 4. Contagem Regressiva Animada */
.ov-countdown-box {
  display: flex;
  align-items: center;
  gap: 1.5cqmin;
  padding: 1cqmin 2.5cqmin;
  background: rgba(10, 8, 14, 0.92);
  border: 2px solid var(--ov-accent);
  border-radius: 1.2cqmin;
  box-shadow: 0 1cqmin 3cqmin rgba(0,0,0,0.8);
}
.ov-cd-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: clamp(16px, 5cqmin, 64px);
  color: #e6c65c;
  line-height: 1;
  animation: ov-cd-pulse 1s cubic-bezier(.2,.8,.2,1) infinite;
}
@keyframes ov-cd-pulse { 0% { transform: scale(1.3); opacity: 0.4; } 50% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.9); opacity: 0.8; } }
.ov-cd-sub { font-family: 'Outfit', sans-serif; font-size: clamp(9px, 2cqmin, 22px); font-weight: 600; color: #fff; letter-spacing: 1px; }

/* 5. Máscaras do Teatro (Drama / Comédia) */
.ov-masks-badge {
  display: inline-flex;
  align-items: center;
  gap: 1.2cqmin;
  padding: 1cqmin 2.2cqmin;
  background: rgba(20, 14, 30, 0.85);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-left: 0.5cqmin solid #a855f7;
  border-radius: 0.8cqmin;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: clamp(11px, 2.5cqmin, 28px);
}
.ov-mask-ico { font-size: 1.3em; filter: drop-shadow(0 0 6px #c084fc); }

@media (prefers-reduced-motion: reduce) { .ov-live-dot, .ov-curtain-l, .ov-curtain-r, .ov-rec-dot, .ov-applause-pill, .ov-cd-num { animation: none; } }


/* --- Transição de Cortina de Teatro em Tela Cheia (Fase 5) --- */
.ov-scenic-curtain {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.ov-curtain-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
}

.ov-curtain-left, .ov-curtain-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 52%;
  height: 100%;
  background: 
    repeating-linear-gradient(90deg, 
      #450a0a 0, #7f1d1d 3%, #991b1b 6%, #450a0a 9%),
    linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.8) 100%);
  background-blend-mode: multiply;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
  transition: transform 1.4s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform;
}

.ov-curtain-left {
  left: 0;
  border-right: 3px solid rgba(212, 175, 55, 0.6);
  transform: translateX(-100%);
}

.ov-curtain-right {
  right: 0;
  border-left: 3px solid rgba(212, 175, 55, 0.6);
  transform: translateX(100%);
}

/* Estado de Cortina Aberta ou Fechando */
.ov-scenic-curtain.curtain-closed .ov-curtain-left,
.ov-scenic-curtain.curtain-closing .ov-curtain-left {
  transform: translateX(0);
}

.ov-scenic-curtain.curtain-closed .ov-curtain-right,
.ov-scenic-curtain.curtain-closing .ov-curtain-right {
  transform: translateX(0);
}

.ov-curtain-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8cqw;
  padding: 1cqw 2.5cqw;
  background: rgba(10, 6, 12, 0.85);
  border: 2px solid #d4af37;
  border-radius: 1cqw;
  box-shadow: 0 0 30px rgba(0,0,0,0.9), 0 0 15px rgba(212, 175, 55, 0.4);
  z-index: 10;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.ov-scenic-curtain.curtain-closed .ov-curtain-banner {
  opacity: 1;
}

.ov-curtain-banner-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: clamp(14px, 3cqw, 36px);
  color: #f6e05e;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.ov-curtain-banner-sub {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(10px, 1.5cqw, 18px);
  color: #e2e8f0;
  letter-spacing: 1px;
}
