/* Cinemáticas animadas (cómics con "cine": true). Solo se animan transform y opacity; grano, trama y viñeteado
   son capas estáticas (el grano se mueve a saltos con transform). */

.comic.cine { background: #07090d; }
.cine-stage { position: relative; min-height: 0; overflow: hidden; }
.cine-host { position: absolute; inset: 0; }
.cine-page { height: 100%; }
.cine-page.p3 .cp:first-child { grid-column: 1 / 3; }

/* ---------- viñeta ---------- */
.cp { position: relative; overflow: hidden; background: #07090d; box-shadow: 0 0 0 3px #f4efe2; container-type: size; }
.cp-mask, .cp-unmask, .cp-zoom, .cp-chars, .cp-text, .cp-fx, .cp-flash { position: absolute; inset: 0; }
.cp-mask { overflow: hidden; }
/* Sin will-change fijo: GSAP (force3D "auto") sube cada capa a la GPU solo mientras se anima y la libera al acabar.
   Lo llevan solo el grano (se mueve sin parar a saltos: steps() no pasa a 3D), lo efímero y las piezas del rig. */
.cp-layer { position: absolute; left: -8%; top: -8%; width: 116%; height: 116%; object-fit: cover; }
.cp-frame { position: absolute; inset: 0; border: 5px solid var(--ink); pointer-events: none; }
.cp-fx { pointer-events: none; }
.fx-vignette { background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 55%, rgba(6, 3, 12, 0.62) 100%); }
.fx-halftone {
  background-image: radial-gradient(rgba(14, 8, 24, 0.34) 1.15px, transparent 1.75px); background-size: 6px 6px;
  -webkit-mask-image: linear-gradient(125deg, transparent 35%, #000 92%); mask-image: linear-gradient(125deg, transparent 35%, #000 92%);
}
.fx-grain { inset: -40px; opacity: 0.38; background-size: 96px 96px; will-change: transform; }
.cp-speed { position: absolute; inset: 0; width: 100%; height: 100%; fill: #0b0a10; will-change: transform, opacity; pointer-events: none; }
.cp-flash { background: #fffdf4; will-change: opacity; }

/* ---------- personajes rig (public/js/rig.js) ---------- */
.rig { position: absolute; aspect-ratio: 4 / 5; pointer-events: none; }
.rig-in, .rig-head { position: absolute; inset: 0; }
.rig-l { position: absolute; overflow: visible; }
.rig-back, .rig-body, .rig-head, .rig-lids, .rig-mouth { will-change: transform; }
.rig.flip .rig-in { transform: scaleX(-1); }
.cp .rig { transform: translateX(-50%); }
.rig-img { position: absolute; transform: translateX(-50%); }
.rig-img.flip { transform: translateX(-50%) scaleX(-1); }

/* ---------- globos (heredan el estilo .bubble del cómic y del tema de cada juego) ---------- */
.cine .bubble { opacity: 1; animation: none; z-index: 1; }
.cine .bubble.caption { font-size: 19px; } /* ≥ 18 px en el iPad (el rótulo del cómic viejo va a 17) */
.cine .bubble i { font-style: normal; opacity: 0; }
.cine .bubble i.on, .cine .bubble.typed i { opacity: 1; }
/* Cola automática: apunta a la cabeza del que habla (la coloca layout() en cine.js). */
.cine .bubble.speech.tail-auto::after { content: ''; position: absolute; bottom: -22px; left: var(--tx, 26px); right: auto; width: 0; height: 0; border: 12px solid transparent; border-top: 18px solid #111; }
.cine .bubble.speech.tail-auto.tail-up::after { bottom: auto; top: -22px; border-top: 12px solid transparent; border-bottom: 18px solid #111; }
.cine .bubble .who { font-size: 15px; } /* la etiqueta va en su propia línea: crecer 2 px no solapa nada */
/* línea por teléfono o radio (line.via): borde en zigzag con clip-path (sin filtros); el borde se vuelve acento mientras habla */
.cine .bubble.bubble[class*="via-"] {
  --zz: polygon(0% 0, 8.33% 6px, 16.67% 0, 25% 6px, 33.33% 0, 41.67% 6px, 50% 0, 58.33% 6px, 66.67% 0, 75% 6px, 83.33% 0, 91.67% 6px, 100% 0, calc(100% - 6px) 25%, 100% 50%, calc(100% - 6px) 75%, 100% 100%, 91.67% calc(100% - 6px), 83.33% 100%, 75% calc(100% - 6px), 66.67% 100%, 58.33% calc(100% - 6px), 50% 100%, 41.67% calc(100% - 6px), 33.33% 100%, 25% calc(100% - 6px), 16.67% 100%, 8.33% calc(100% - 6px), 0% 100%, 6px 75%, 0 50%, 6px 25%);
  border: 0; border-radius: 0; background: #111; clip-path: var(--zz); padding: 14px 20px;
}
.cine .bubble.bubble[class*="via-"]::before { content: ''; position: absolute; inset: 3px; z-index: -1; background: #fff; clip-path: var(--zz); }
.cine .bubble.caption[class*="via-"]::before { background: #f4d35e; }
.cine .bubble.bubble[class*="via-"]::after { display: none; }
.cine .bubble.bubble[class*="via-"].speaking { background: var(--accent); box-shadow: none; }
.cine .bubble.thought { border-radius: 40% / 50%; border-style: dotted; border-width: 4px; padding: 12px 30px; }
.cine .bubble.thought::after { content: ''; position: absolute; bottom: -18px; left: 30px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #111; box-shadow: -14px 12px 0 -3px #fff, -14px 12px 0 0 #111; }
.cine .bubble.thought.tail-right::after { left: auto; right: 30px; box-shadow: 14px 12px 0 -3px #fff, 14px 12px 0 0 #111; }

/* onomatopeyas: tamaño relativo a la viñeta */
.cono {
  position: absolute; z-index: 2; pointer-events: none; white-space: nowrap;
  font: 900 64px/1 Impact, 'Arial Black', 'Avenir Next Condensed', sans-serif; font-size: calc(var(--s, 1) * 16cqh);
  color: #ffd23f; letter-spacing: 0.02em; -webkit-text-stroke: 0.07em #111; paint-order: stroke fill;
  text-shadow: 0.05em 0.07em 0 #111;
}

/* ---------- «Listo», cuenta atrás y barra ---------- */
.cine-card {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 40px; text-align: center; background: radial-gradient(ellipse at 50% 40%, #1d2436 0%, #07090d 72%);
}
.cine-card .kicker { margin: 0; color: var(--accent); font: 700 20px var(--font-title); letter-spacing: 0.22em; text-transform: uppercase; }
.cine-card h1 { font-size: 46px; max-width: 900px; }
.cine-card p { color: var(--muted); }
.cine-ready { display: flex; gap: 14px; }
.cine-ready span { padding: 8px 18px; border-radius: 99px; border: 3px solid var(--ink); background: var(--panel2); font-weight: 700; }
.cine-ready span.on { background: var(--good); color: var(--ink); }
.cine-count {
  position: absolute; z-index: 4; left: 50%; top: 50%; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  font: 800 112px/1 var(--font-title); color: var(--accent); background: rgba(5, 7, 12, 0.8); border: 5px solid var(--accent);
}
.comic.cine .comic-bar { gap: 16px; }
.cine-status { margin-right: auto; color: var(--muted); font-weight: 700; }
.comic.cine .comic-bar .btn.primary.skip { background: var(--panel2); color: var(--text); }
