/* ============================================================
   Brainflood - the picture house (home hero tagline screen)

   A little movie theater: a NOW SHOWING marquee, velvet drapes,
   and an Academy-ratio screen running old cartoon title cards.
   Between cards the regulars play a short gag: one at a time in
   the first reel (iris out, bouncing ball, lamp blowout, film
   slip, flood...), together in the second (a toast, a spotlight,
   a debate, a buzzer race, a duet, a curtain call, a conga line).
   The player
   is js/cinema.js; the taglines are the data-hooks attribute on
   [data-bf-cinema] in index.html (the one copy of the list).

   The house is scenery, like an album cover: it ignores the site
   theme on purpose, so every colour it paints is pinned here.
   The characters are the generated art in img/brainy, used as
   is (never redrawn), so they look exactly like everywhere else.

   Sizes inside the screen are in cqi (percent of the screen's
   width), so the whole picture scales as one piece from a phone
   to a desktop.
   ============================================================ */

@property --cin-r { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --cin-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --cin-x { syntax: '<percentage>'; inherits: false; initial-value: 50%; }
@property --cin-y { syntax: '<percentage>'; inherits: false; initial-value: 50%; }

.bf-cinema {
    --cin-ink: #2b1a10;
    --cin-cream: #f9efd8;
    --cin-ray-a: #f4dca6;
    --cin-ray-b: #dcae62;
    --cin-black: #0d0907;
    --cin-wood: #3b2416;
    --cin-wood-deep: #1f130b;
    --cin-brass: #c8913a;
    --cin-brass-hi: #f0c76c;
    --cin-velvet: #8e2a20;
    --cin-velvet-hi: #b8473a;
    --cin-velvet-deep: #4c120d;
    --cin-bulb: #ffd88a;
    --cin-tide: #3a6284;
    --cin-tide-mid: #6e93b5;
    --cin-tide-hi: #a3bfd6;
    --cin-leader: #cdbf9f;

    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    container-type: inline-size;
    user-select: none;
}

/* ---------- marquee ---------- */
.bf-cin-marquee {
    position: relative;
    z-index: 3;
    width: 58%;
    margin: 0 auto -1.2cqi;
    padding: 2.3cqi 0 2.1cqi;
    background: linear-gradient(var(--cin-wood), var(--cin-wood-deep));
    border: 0.7cqi solid var(--cin-brass);
    border-radius: 2.4cqi 2.4cqi 0.8cqi 0.8cqi;
    box-shadow: 0 0.8cqi 2cqi rgba(0, 0, 0, 0.35), inset 0 0 0 0.35cqi rgba(0, 0, 0, 0.45);
    text-align: center;
}
.bf-cin-marquee-word {
    display: block;
    font-family: 'Anton', 'Impact', sans-serif;
    font-size: 5.6cqi;
    line-height: 1;
    letter-spacing: 0.16em;
    text-indent: 0.16em;
    text-transform: uppercase;
    color: var(--cin-cream);
    text-shadow: 0 0 1.4cqi rgba(255, 216, 138, 0.55);
}
/* Two rows of bulbs, top and bottom edge. Each row is two layers of
   dots offset by half a step; swapping their opacity is the chase. */
.bf-cin-marquee::before,
.bf-cin-marquee::after,
.bf-cin-bulbs::before,
.bf-cin-bulbs::after {
    content: '';
    position: absolute;
    left: 2.2cqi;
    right: 2.2cqi;
    height: 1.6cqi;
    background: radial-gradient(circle, var(--cin-bulb) 0 34%, rgba(255, 216, 138, 0.35) 46%, transparent 62%) 0 0 / 3.2cqi 1.6cqi repeat-x;
    animation: bf-cin-chase 0.9s steps(1, end) infinite;
}
.bf-cin-bulbs { position: absolute; inset: 0; pointer-events: none; }
.bf-cin-marquee::before { top: 0.15cqi; }
.bf-cin-marquee::after { bottom: 0.15cqi; animation-delay: -0.45s; }
.bf-cin-bulbs::before,
.bf-cin-bulbs::after { background-position: 1.6cqi 0; animation-delay: -0.45s; }
.bf-cin-bulbs::before { top: 0.15cqi; }
.bf-cin-bulbs::after { bottom: 0.15cqi; animation-delay: 0s; }
@keyframes bf-cin-chase { 0% { opacity: 1; } 50% { opacity: 0.18; } }

/* ---------- the house: proscenium, drapes, stage ---------- */
.bf-cin-house {
    position: relative;
    z-index: 2;
    padding: 6.2cqi 7.5cqi 0;
    background:
        radial-gradient(120% 70% at 50% 0%, rgba(240, 199, 108, 0.16), transparent 60%),
        linear-gradient(var(--cin-wood) 0%, var(--cin-wood-deep) 100%);
    border-radius: 42cqi 42cqi 2.5cqi 2.5cqi / 9cqi 9cqi 2.5cqi 2.5cqi;
    box-shadow:
        inset 0 0 0 0.6cqi var(--cin-brass),
        inset 0 0 0 1.3cqi var(--cin-wood-deep),
        0 2.4cqi 5cqi rgba(0, 0, 0, 0.32);
}
/* Valance: a velvet pelmet with scalloped hem and a brass fringe. */
.bf-cin-valance {
    position: absolute;
    z-index: 4;
    top: 1.3cqi;
    left: 4.5cqi;
    right: 4.5cqi;
    height: 7.4cqi;
    border-radius: 30cqi 30cqi 0 0 / 6cqi 6cqi 0 0;
    background:
        radial-gradient(circle at 50% 0, var(--cin-velvet) 0 2.9cqi, transparent 3cqi) 0 4.3cqi / 6cqi 3cqi repeat-x,
        repeating-linear-gradient(90deg, var(--cin-velvet-deep) 0 0.6cqi, var(--cin-velvet) 1.6cqi 4.4cqi, var(--cin-velvet-hi) 5.2cqi, var(--cin-velvet) 6cqi) 0 0 / 100% 4.4cqi no-repeat;
    filter: drop-shadow(0 0.7cqi 0 var(--cin-brass)) drop-shadow(0 1cqi 1.2cqi rgba(0, 0, 0, 0.45));
}
.bf-cin-drape {
    position: absolute;
    z-index: 3;
    top: 4cqi;
    bottom: 3.6cqi;
    width: 11cqi;
    background: repeating-linear-gradient(90deg, var(--cin-velvet-deep) 0 0.5cqi, var(--cin-velvet) 1.4cqi 2.6cqi, var(--cin-velvet-hi) 3.2cqi, var(--cin-velvet) 3.8cqi, var(--cin-velvet-deep) 4.6cqi);
    box-shadow: 0 0 2cqi rgba(0, 0, 0, 0.5);
}
/* Tied back: narrow at the tassel, flared at the floor. */
.bf-cin-drape--l { left: 1.3cqi; clip-path: polygon(0 0, 100% 0, 100% 10%, 62% 52%, 54% 60%, 72% 80%, 100% 100%, 0 100%); }
.bf-cin-drape--r { right: 1.3cqi; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 28% 80%, 46% 60%, 38% 52%, 0 10%); }
.bf-cin-drape::after {
    content: '';
    position: absolute;
    top: 55%;
    width: 7cqi;
    height: 2.2cqi;
    border-radius: 1.1cqi;
    background: linear-gradient(var(--cin-brass-hi), var(--cin-brass));
    box-shadow: 0 0.4cqi 0.6cqi rgba(0, 0, 0, 0.4);
}
.bf-cin-drape--l::after { left: 1.5cqi; transform: rotate(-12deg); }
.bf-cin-drape--r::after { right: 1.5cqi; transform: rotate(12deg); }

.bf-cin-stage {
    position: relative;
    z-index: 2;
    height: 4.2cqi;
    margin: 0 -7.5cqi;
    border-radius: 0 0 2.5cqi 2.5cqi;
    background: linear-gradient(var(--cin-brass) 0 0.6cqi, var(--cin-wood) 0.6cqi, var(--cin-wood-deep));
}
/* Footlights along the lip of the stage. */
.bf-cin-stage::after {
    content: '';
    position: absolute;
    left: 12cqi;
    right: 12cqi;
    top: 1.4cqi;
    height: 1.4cqi;
    background: radial-gradient(circle, var(--cin-bulb) 0 30%, rgba(255, 216, 138, 0.3) 45%, transparent 60%) 0 0 / 5cqi 1.4cqi repeat-x;
}

/* ---------- the screen ---------- */
.bf-cin-screen {
    position: relative;
    z-index: 1;
    aspect-ratio: 1.375;
    overflow: hidden;
    border-radius: 1.2cqi;
    background: var(--cin-black);
    box-shadow: 0 0 0 0.5cqi #000, 0 0 3cqi rgba(255, 226, 160, 0.18);
    container-type: inline-size;
    isolation: isolate;
}
/* Gate weave: the whole frame drifts a hair, the way film does in a
   tired projector. On its own wrapper so a gag can still move the film. */
.bf-cin-weave {
    position: absolute;
    inset: 0;
    animation: bf-cin-weave 1.6s steps(1, end) infinite;
}
@keyframes bf-cin-weave {
    0% { transform: translate(0, 0); }
    20% { transform: translate(0.12cqi, -0.1cqi); }
    40% { transform: translate(-0.08cqi, 0.14cqi); }
    60% { transform: translate(0.05cqi, 0.06cqi); }
    80% { transform: translate(-0.12cqi, -0.05cqi); }
}
.bf-cin-film,
.bf-cin-cards {
    position: absolute;
    inset: 0;
}
.bf-cin-cards { z-index: 1; perspective: 160cqi; }

/* ---------- a title card ---------- */
.bf-cin-card {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    background: var(--cin-ray-b);
}
.bf-cin-rays {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 170cqi;
    height: 170cqi;
    margin: -85cqi 0 0 -85cqi;
    background: repeating-conic-gradient(from 0deg, var(--cin-ray-a) 0deg 7.5deg, var(--cin-ray-b) 7.5deg 15deg);
    animation: bf-cin-spin 90s linear infinite;
}
@keyframes bf-cin-spin { to { transform: rotate(360deg); } }
.bf-cin-panel {
    position: absolute;
    inset: 15% 7% 16%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3cqi 3.5cqi;
    text-align: center;
    background: var(--cin-cream);
    border: 0.8cqi solid var(--cin-ink);
    border-radius: 3.2cqi;
    box-shadow:
        inset 0 0 0 1.1cqi var(--cin-cream),
        inset 0 0 0 1.45cqi var(--cin-ink),
        0 1.3cqi 0 rgba(43, 26, 16, 0.35);
}
/* Corner pips, the little ornaments every old title card had. */
.bf-cin-panel::before,
.bf-cin-panel::after {
    content: '';
    position: absolute;
    top: 2.4cqi;
    width: 1.6cqi;
    height: 1.6cqi;
    background: var(--cin-ink);
    transform: rotate(45deg);
}
.bf-cin-panel::before { left: 2.4cqi; }
.bf-cin-panel::after { right: 2.4cqi; }
.bf-cin-line {
    margin: 0;
    font-family: 'Alfa Slab One', 'Rockwell', 'Georgia', serif;
    font-weight: 400;
    font-size: 5.3cqi;
    line-height: 1.14;
    letter-spacing: 0.01em;
    color: var(--cin-ink);
    text-wrap: balance;
}
.bf-cin-line + .bf-cin-line { margin-top: 0.6cqi; }
.bf-cin-w { display: inline-block; }
/* ---------- the projector: grain, flicker, scratches, vignette ---------- */
.bf-cin-grain,
.bf-cin-flicker,
.bf-cin-scratch,
.bf-cin-vignette,
.bf-cin-cue {
    position: absolute;
    pointer-events: none;
    z-index: 20;
}
.bf-cin-grain {
    inset: -50%;
    opacity: 0.24;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .07 0 0 0 0 .04 0 0 0 1.6 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 180px 180px;
    animation: bf-cin-grain 0.42s steps(1, end) infinite;
}
@keyframes bf-cin-grain {
    0% { transform: translate(0, 0); }
    17% { transform: translate(-7%, 4%); }
    33% { transform: translate(5%, -6%); }
    50% { transform: translate(-3%, -9%); }
    67% { transform: translate(8%, 7%); }
    83% { transform: translate(-9%, -2%); }
}
.bf-cin-flicker {
    inset: 0;
    background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 244, 214, 0.5), rgba(255, 244, 214, 0) 70%);
    mix-blend-mode: soft-light;
    animation: bf-cin-flicker 0.36s steps(1, end) infinite;
}
@keyframes bf-cin-flicker {
    0% { opacity: 0.55; }
    25% { opacity: 0.38; }
    50% { opacity: 0.62; }
    75% { opacity: 0.44; }
}
/* Two scratches and a fleck of dust that hop about, mostly hidden. Each
   layer is drawn at the middle of the screen and moved by a length (a
   percentage does nothing on a full-size background); 80cqi parks it off
   screen. */
.bf-cin-scratch {
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0 49.85%, rgba(255, 248, 228, 0.35) 49.85% 50.1%, transparent 50.1%) 0 0 / 100% 100% no-repeat,
        linear-gradient(90deg, transparent 0 49.9%, rgba(20, 12, 8, 0.4) 49.9% 50.1%, transparent 50.1%) 0 0 / 100% 100% no-repeat,
        radial-gradient(circle, rgba(20, 12, 8, 0.6) 0 0.5cqi, transparent 0.65cqi) 0 0 / 100% 100% no-repeat;
    animation: bf-cin-scratch 2.7s steps(1, end) infinite;
}
@keyframes bf-cin-scratch {
    0% { background-position: -29cqi 0, 80cqi 0, -18cqi -22cqi; opacity: 0.9; }
    9% { background-position: -31cqi 0, 80cqi 0, 80cqi 0; opacity: 0.9; }
    18% { opacity: 0; }
    41% { background-position: 80cqi 0, -14cqi 0, 80cqi 0; opacity: 0.8; }
    48% { background-position: 80cqi 0, -13cqi 0, 21cqi 9cqi; opacity: 0.8; }
    55% { opacity: 0; }
    77% { background-position: 24cqi 0, 80cqi 0, 80cqi 0; opacity: 0.6; }
    82% { opacity: 0; }
}
.bf-cin-vignette {
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(13, 9, 7, 0.28) 78%, rgba(13, 9, 7, 0.62) 100%);
    box-shadow: inset 0 0 4cqi rgba(13, 9, 7, 0.5);
}
/* The reel-change cue: a little dot that winks in the top corner
   just before the next card, as it did for the projectionist. */
.bf-cin-cue {
    top: 6%;
    right: 6%;
    width: 4.6cqi;
    height: 4.6cqi;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(250, 244, 226, 0.95) 0 42%, rgba(250, 244, 226, 0.6) 50%, transparent 62%);
    opacity: 0;
}
.bf-cinema.is-cue .bf-cin-cue { animation: bf-cin-cue 0.7s steps(1, end) both; }
@keyframes bf-cin-cue { 0% { opacity: 0.9; } 18% { opacity: 0; } 40% { opacity: 0.9; } 58% { opacity: 0; } }

/* ---------- curtain call (on load) ---------- */
.bf-cin-curtain {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 30;
    width: 51%;
    background: repeating-linear-gradient(90deg, var(--cin-velvet-deep) 0 0.6cqi, var(--cin-velvet) 1.8cqi 3.4cqi, var(--cin-velvet-hi) 4.2cqi, var(--cin-velvet) 5cqi, var(--cin-velvet-deep) 6cqi);
    animation: 1.25s cubic-bezier(0.6, 0, 0.3, 1) 0.35s both;
}
.bf-cin-curtain--l { left: 0; animation-name: bf-cin-open-l; box-shadow: 1cqi 0 2cqi rgba(0, 0, 0, 0.5); }
.bf-cin-curtain--r { right: 0; animation-name: bf-cin-open-r; box-shadow: -1cqi 0 2cqi rgba(0, 0, 0, 0.5); }
@keyframes bf-cin-open-l { to { transform: translateX(-102%); visibility: hidden; } }
@keyframes bf-cin-open-r { to { transform: translateX(102%); visibility: hidden; } }

/* ============================================================
   THE GAGS. js/cinema.js sets data-gag on .bf-cin-film, the
   length in --gag-ms, marks the leaving card .is-out and the
   arriving card .is-in, and shows the character (.is-on).
   Everything below is timed in percent of --gag-ms.
   ============================================================ */
.bf-cin-film[data-gag] { --gag: var(--gag-ms, 2400ms); }
.bf-cin-film[data-gag] .bf-cin-card.is-out { z-index: 1; }
.bf-cin-film[data-gag] .bf-cin-card.is-in { z-index: 2; }
.bf-cin-film[data-gag] .bf-cin-card.is-in,
.bf-cin-film[data-gag] .bf-cin-card.is-out,
.bf-cin-film[data-gag] .bf-cin-actor.is-on,
.bf-cin-film[data-gag] .bf-cin-fx > * {
    animation-duration: var(--gag);
    animation-fill-mode: both;
    animation-timing-function: linear;
}

.bf-cin-actor {
    position: absolute;
    z-index: 8;
    display: none;
    bottom: -1cqi;
    left: 0;
    height: 42cqi;
    pointer-events: none;
}
.bf-cin-actor.is-on { display: block; }
.bf-cin-actor img { display: block; height: 100%; width: auto; max-width: none; }
.bf-cin-actor.is-mirrored img { transform: scaleX(-1); }
.bf-cin-fx > * { position: absolute; display: none; pointer-events: none; }

/* A card that only swaps at the dark moment of a gag. */
@keyframes bf-cin-hide-at-mid { 0%, 49.9% { visibility: visible; } 50%, 100% { visibility: hidden; } }
@keyframes bf-cin-show-at-mid { 0%, 49.9% { visibility: hidden; } 50%, 100% { visibility: visible; } }

/* ---- the cut: a plain splice, used when a character is not loaded yet ---- */
.bf-cin-film[data-gag="cut"] .is-out { animation-name: bf-cin-hide-at-mid; }
.bf-cin-film[data-gag="cut"] .is-in { animation-name: bf-cin-show-at-mid; }
.bf-cin-film[data-gag="cut"] .bf-cin-flash { display: block; inset: 0; z-index: 9; background: #fff6df; animation-name: bf-cin-splice; }
@keyframes bf-cin-splice { 0%, 44% { opacity: 0; } 46% { opacity: 0.9; } 54% { opacity: 0.2; } 60%, 100% { opacity: 0; } }

/* ---- 1. iris out, iris in: Brainy waves goodbye ---- */
.bf-cin-film[data-gag="iris"] { animation: bf-cin-iris var(--gag) both; }
@keyframes bf-cin-iris {
    0%, 30% { clip-path: circle(95cqi at 47% 63%); animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.6); }
    46%, 55% { clip-path: circle(17cqi at 47% 63%); animation-timing-function: ease-in; }
    63% { clip-path: circle(0 at 47% 63%); }
    68% { clip-path: circle(0 at 50% 50%); animation-timing-function: ease-out; }
    100% { clip-path: circle(95cqi at 50% 50%); }
}
.bf-cin-film[data-gag="iris"] .bf-cin-actor.is-on { left: 50%; height: 52cqi; bottom: -4cqi; animation-name: bf-cin-iris-actor; }
@keyframes bf-cin-iris-actor {
    0% { transform: translate(-50%, 105%); animation-timing-function: cubic-bezier(0.3, 1.5, 0.6, 1); }
    16% { transform: translate(-50%, 0); }
    21%, 30% { transform: translate(-50%, 0) rotate(-3deg); }
    26% { transform: translate(-50%, -2%) rotate(3deg); }
    31%, 63% { transform: translate(-50%, 0); opacity: 1; }
    63.1%, 100% { opacity: 0; }
}
.bf-cin-film[data-gag="iris"] .is-out { animation-name: bf-cin-iris-out; }
.bf-cin-film[data-gag="iris"] .is-in { animation-name: bf-cin-iris-in; }
@keyframes bf-cin-iris-out { 0%, 63% { visibility: visible; } 63.1%, 100% { visibility: hidden; } }
@keyframes bf-cin-iris-in { 0%, 63% { visibility: hidden; } 63.1%, 100% { visibility: visible; } }

/* ---- 2. Keg walks across and wipes the new card on behind him ---- */
.bf-cin-film[data-gag="wipe"] .bf-cin-actor.is-on {
    height: 52cqi;
    bottom: -2cqi;
    animation-name: bf-cin-wipe-walk, bf-cin-waddle;
    animation-duration: var(--gag), 0.34s;
    animation-timing-function: linear, steps(1, end);
    animation-iteration-count: 1, infinite;
}
@keyframes bf-cin-wipe-walk { from { translate: 100cqi 0; } to { translate: -80cqi 0; } }
@keyframes bf-cin-waddle { 0% { rotate: -4deg; transform: translateY(0); } 50% { rotate: 4deg; transform: translateY(-1.2cqi); } }
.bf-cin-film[data-gag="wipe"] .is-in { animation-name: bf-cin-wipe-reveal; }
@keyframes bf-cin-wipe-reveal {
    0%, 20.8% { clip-path: inset(0 0 0 100%); }
    76.4%, 100% { clip-path: inset(0 0 0 0); }
}

/* ---- 3. follow the bouncing ball: Thumper leads the sing-along ---- */
.bf-cin-film[data-gag="ball"] .is-out { animation-name: bf-cin-ball-out; }
@keyframes bf-cin-ball-out { 0% { opacity: 1; } 5% { opacity: 0.5; } 7% { opacity: 0.9; } 12%, 100% { opacity: 0; } }
.bf-cin-film[data-gag="ball"] .is-in { animation-name: bf-cin-ball-in; }
@keyframes bf-cin-ball-in { 0%, 9% { opacity: 0; } 13%, 100% { opacity: 1; } }
/* The words wait for the ball; the script sets each word's delay. */
.bf-cin-film[data-gag="ball"] .is-in .bf-cin-w { opacity: 0; animation: bf-cin-word 0.32s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes bf-cin-word {
    0% { opacity: 0; transform: translateY(-1.4cqi) scale(0.6); }
    50% { opacity: 1; transform: translateY(0.4cqi) scale(1.12, 0.9); }
    100% { opacity: 1; transform: none; }
}
.bf-cin-film[data-gag="ball"] .bf-cin-actor.is-on { left: -3cqi; height: 38cqi; animation-name: bf-cin-ball-actor; }
@keyframes bf-cin-ball-actor {
    0% { transform: translate(-100%, 20%); }
    5% { transform: translate(-50%, -18%); }
    10% { transform: translate(0, 0); }
    12% { transform: translate(0, 0) scale(1.06, 0.92); }
    14%, 86% { transform: translate(0, 0); }
    92% { transform: translate(-40%, -14%); }
    100% { transform: translate(-110%, 20%); }
}
.bf-cin-film[data-gag="ball"] .bf-cin-ball {
    display: block;
    z-index: 9;
    left: 0;
    top: 0;
    width: 3.6cqi;
    height: 3.6cqi;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fffaf0, var(--cin-cream) 40%, #d9b874);
    box-shadow: 0 0 0 0.45cqi var(--cin-ink);
    animation: none;
}

/* ---- 4. the lamp blows; Eddie Sun lights the room back up ---- */
.bf-cin-film[data-gag="lamp"] .bf-cin-dark {
    display: block;
    inset: 0;
    z-index: 7;
    background: var(--cin-black);
    -webkit-mask-image: radial-gradient(circle at 50% 44%, transparent calc(var(--cin-r) - 14cqi), #000 var(--cin-r));
    mask-image: radial-gradient(circle at 50% 44%, transparent calc(var(--cin-r) - 14cqi), #000 var(--cin-r));
    animation-name: bf-cin-lamp-dark;
}
@keyframes bf-cin-lamp-dark {
    0% { opacity: 0; --cin-r: 0px; }
    6% { opacity: 0.55; }
    8% { opacity: 0.1; }
    13% { opacity: 0.8; }
    15% { opacity: 0.3; }
    22%, 40% { opacity: 1; --cin-r: 0px; animation-timing-function: ease-in; }
    82% { opacity: 1; --cin-r: 140cqi; }
    100% { opacity: 0; --cin-r: 140cqi; }
}
.bf-cin-film[data-gag="lamp"] .is-out { animation-name: bf-cin-lamp-out; }
.bf-cin-film[data-gag="lamp"] .is-in { animation-name: bf-cin-lamp-in; }
@keyframes bf-cin-lamp-out { 0%, 29% { visibility: visible; } 30%, 100% { visibility: hidden; } }
@keyframes bf-cin-lamp-in { 0%, 29% { visibility: hidden; } 30%, 100% { visibility: visible; } }
.bf-cin-film[data-gag="lamp"] .bf-cin-actor.is-on {
    left: 50%;
    top: 7%;
    bottom: auto;
    height: 50cqi;
    filter: drop-shadow(0 0 3cqi rgba(255, 214, 110, 0.9));
    animation-name: bf-cin-lamp-actor;
}
@keyframes bf-cin-lamp-actor {
    0%, 24% { transform: translateX(-50%) scale(0); opacity: 0; }
    25% { opacity: 1; }
    31% { transform: translateX(-50%) scale(1.15); }
    35%, 70% { transform: translateX(-50%) scale(1); }
    72% { transform: translateX(-50%) translateY(2%) scale(1.04, 0.94); }
    84% { transform: translateX(-50%) translateY(-120%) scale(0.85, 1.1); opacity: 1; }
    85%, 100% { opacity: 0; }
}

/* ---- 5. the film slips the gate; Phoney is up to something ---- */
.bf-cin-film[data-gag="slip"] .bf-cin-actor.is-on {
    left: 0;
    height: 36cqi;
    bottom: -1.5cqi;
    animation-name: bf-cin-sneak, bf-cin-tiptoe;
    animation-duration: var(--gag), 0.3s;
    animation-timing-function: linear, steps(1, end);
    animation-iteration-count: 1, infinite;
}
@keyframes bf-cin-sneak {
    0% { translate: -40cqi 0; scale: 1; }
    40% { translate: 26cqi 0; scale: 1; }
    46% { translate: 26cqi -6cqi; scale: 1.12; }
    52%, 60% { translate: 26cqi 0; scale: 1; }
    66% { translate: 34cqi 0; scale: 1.25 0.9; }
    80%, 100% { translate: 130cqi 0; scale: 1.4 0.85; }
}
@keyframes bf-cin-tiptoe { 0% { rotate: -6deg; transform: translateY(0); } 50% { rotate: 5deg; transform: translateY(-1.6cqi); } }
.bf-cin-film[data-gag="slip"] .is-out { animation-name: bf-cin-slip-out; }
.bf-cin-film[data-gag="slip"] .is-in { animation-name: bf-cin-slip-in; }
@keyframes bf-cin-slip-out {
    0%, 44% { transform: translateY(0); }
    56% { transform: translateY(calc(-100% - 7cqi)); }
    100% { transform: translateY(calc(-100% - 7cqi)); }
}
@keyframes bf-cin-slip-in {
    0%, 44% { transform: translateY(calc(100% + 7cqi)); }
    56% { transform: translateY(-3cqi); }
    60% { transform: translateY(1.5cqi); }
    63%, 100% { transform: translateY(0); }
}

/* ---- 6. whip pan: Miguel zips through ---- */
.bf-cin-film[data-gag="whip"] .bf-cin-actor.is-on { left: 0; height: 40cqi; animation-name: bf-cin-zip; }
@keyframes bf-cin-zip {
    0% { translate: 110cqi 0; rotate: 0deg; scale: 1.3 0.9; animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
    20% { translate: 50cqi 0; rotate: -10deg; scale: 1; }
    26% { translate: 52cqi 0; rotate: 4deg; }
    30%, 48% { translate: 52cqi 0; rotate: 0deg; scale: 1; animation-timing-function: ease-in; }
    52% { translate: 56cqi 0; scale: 0.92 1.06; }
    66%, 100% { translate: -80cqi 0; scale: 1.5 0.85; }
}
.bf-cin-film[data-gag="whip"] .bf-cin-puff {
    display: block;
    z-index: 7;
    left: 58cqi;
    bottom: 0;
    width: 26cqi;
    height: 9cqi;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(249, 239, 216, 0.95) 0 40%, rgba(249, 239, 216, 0) 70%);
    animation-name: bf-cin-puff;
}
@keyframes bf-cin-puff {
    0%, 17% { opacity: 0; transform: scale(0.3); }
    22% { opacity: 1; transform: scale(1); }
    36%, 100% { opacity: 0; transform: scale(1.5) translateY(-2cqi); }
}
.bf-cin-film[data-gag="whip"] .bf-cin-speed {
    display: block;
    inset: 0;
    z-index: 6;
    background: repeating-linear-gradient(180deg, transparent 0 5cqi, rgba(43, 26, 16, 0.22) 5cqi 5.5cqi, transparent 5.5cqi 9cqi, rgba(249, 239, 216, 0.5) 9cqi 9.4cqi);
    animation-name: bf-cin-speed;
}
@keyframes bf-cin-speed { 0%, 49% { opacity: 0; } 54%, 68% { opacity: 1; } 74%, 100% { opacity: 0; } }
.bf-cin-film[data-gag="whip"] .is-out { animation-name: bf-cin-whip-out; }
.bf-cin-film[data-gag="whip"] .is-in { animation-name: bf-cin-whip-in; }
@keyframes bf-cin-whip-out {
    0%, 52% { transform: none; }
    64%, 100% { transform: translateX(-120%) skewX(14deg); }
}
@keyframes bf-cin-whip-in {
    0%, 52% { transform: translateX(120%) skewX(14deg); animation-timing-function: cubic-bezier(0.3, 0.9, 0.5, 1); }
    66% { transform: translateX(-4%) skewX(-4deg); }
    72% { transform: translateX(1.5%); }
    76%, 100% { transform: none; }
}

/* ---- 7. the countdown leader: Grampy has seen many reels ---- */
.bf-cin-film[data-gag="leader"] .bf-cin-leader {
    display: block;
    inset: 0;
    z-index: 5;
    background:
        linear-gradient(transparent calc(50% - 0.25cqi), rgba(43, 26, 16, 0.55) calc(50% - 0.25cqi) calc(50% + 0.25cqi), transparent 0),
        linear-gradient(90deg, transparent calc(50% - 0.25cqi), rgba(43, 26, 16, 0.55) calc(50% - 0.25cqi) calc(50% + 0.25cqi), transparent 0),
        radial-gradient(circle at 50% 50%, transparent 0 22cqi, rgba(43, 26, 16, 0.7) 22cqi 22.7cqi, transparent 22.7cqi 27cqi, rgba(43, 26, 16, 0.7) 27cqi 27.7cqi, transparent 27.7cqi),
        var(--cin-leader);
    animation-name: bf-cin-leader;
}
@keyframes bf-cin-leader {
    0%, 4% { opacity: 0; }
    5% { opacity: 1; filter: brightness(1.4); }
    6% { opacity: 0.4; }
    8%, 68% { opacity: 1; filter: none; }
    69% { opacity: 1; filter: brightness(2.2); }
    72%, 100% { opacity: 0; }
}
.bf-cin-sweep {
    position: absolute;
    inset: 0;
    background: conic-gradient(from 0deg at 50% 50%, rgba(43, 26, 16, 0.32) 0 var(--cin-a), transparent var(--cin-a));
    animation: bf-cin-sweep calc(var(--gag) * 0.2) linear calc(var(--gag) * 0.08) 3 both;
}
@keyframes bf-cin-sweep { from { --cin-a: 0deg; } to { --cin-a: 360deg; } }
.bf-cin-num {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: 'Anton', 'Impact', sans-serif;
    font-size: 34cqi;
    line-height: 1;
    color: var(--cin-ink);
    opacity: 0;
    animation: bf-cin-num calc(var(--gag) * 0.2) steps(1, end) forwards;
}
.bf-cin-num:nth-child(2) { animation-delay: calc(var(--gag) * 0.08); }
.bf-cin-num:nth-child(3) { animation-delay: calc(var(--gag) * 0.28); }
.bf-cin-num:nth-child(4) { animation-delay: calc(var(--gag) * 0.48); }
@keyframes bf-cin-num { 0% { opacity: 1; } 96%, 100% { opacity: 0; } }
.bf-cin-film[data-gag="leader"] .is-out { animation-name: bf-cin-leader-out; }
.bf-cin-film[data-gag="leader"] .is-in { animation-name: bf-cin-leader-in; }
@keyframes bf-cin-leader-out { 0%, 7% { visibility: visible; } 8%, 100% { visibility: hidden; } }
@keyframes bf-cin-leader-in { 0%, 69% { visibility: hidden; } 70%, 100% { visibility: visible; } }
.bf-cin-film[data-gag="leader"] .bf-cin-actor.is-on {
    left: auto;
    right: -3cqi;
    height: 52cqi;
    bottom: -3cqi;
    animation-name: bf-cin-shuffle, bf-cin-totter;
    animation-duration: var(--gag), 0.5s;
    animation-timing-function: linear, steps(1, end);
    animation-iteration-count: 1, infinite;
}
@keyframes bf-cin-shuffle {
    0% { translate: 60cqi 0; }
    18%, 68% { translate: 0 0; }
    86%, 100% { translate: 60cqi 0; }
}
@keyframes bf-cin-totter { 0% { rotate: -2deg; } 50% { rotate: 2deg; } }

/* ---- 8. the flood: Puddles rides the tide in and out ---- */
.bf-cin-film[data-gag="flood"] .bf-cin-water {
    display: block;
    left: -2%;
    right: -2%;
    top: 100%;
    height: 112%;
    z-index: 6;
    background:
        radial-gradient(circle at 50% 0, transparent 0 2.2cqi, rgba(163, 191, 214, 0.45) 2.2cqi 2.7cqi, transparent 2.7cqi) 3cqi 22cqi / 9cqi 16cqi repeat,
        radial-gradient(circle at 50% 0, transparent 0 1.8cqi, rgba(249, 239, 216, 0.25) 1.8cqi 2.2cqi, transparent 2.2cqi) 0 30cqi / 7cqi 16cqi repeat,
        linear-gradient(var(--cin-tide-mid), var(--cin-tide) 40%);
    animation-name: bf-cin-tide;
    animation-timing-function: ease-in-out;
}
/* The crest: the logo's own scalloped waves, cream keyline on top. */
.bf-cin-water::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -4.4cqi;
    height: 5cqi;
    background:
        radial-gradient(circle at 50% 100%, var(--cin-tide-mid) 0 3.4cqi, var(--cin-cream) 3.4cqi 4.1cqi, transparent 4.1cqi) 0 0 / 8cqi 5cqi repeat-x;
    animation: bf-cin-surf 0.8s linear infinite;
}
.bf-cin-water::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 6cqi;
    height: 3cqi;
    background: radial-gradient(circle at 50% 0, transparent 0 2.2cqi, var(--cin-tide-hi) 2.2cqi 2.8cqi, transparent 2.8cqi) 0 0 / 7cqi 3cqi repeat-x;
    opacity: 0.8;
    animation: bf-cin-surf 1.3s linear infinite reverse;
}
@keyframes bf-cin-surf { to { background-position: 8cqi 0; } }
@keyframes bf-cin-tide {
    0% { transform: translateY(0); }
    42% { transform: translateY(-104%); }
    58% { transform: translateY(-104%); }
    100% { transform: translateY(0); }
}
.bf-cin-film[data-gag="flood"] .is-out { animation-name: bf-cin-hide-at-mid; }
.bf-cin-film[data-gag="flood"] .is-in { animation-name: bf-cin-show-at-mid; }
/* Puddles rides inside the water layer (the script moves him there). */
.bf-cin-film[data-gag="flood"] .bf-cin-water .bf-cin-actor.is-on {
    left: 30%;
    bottom: calc(100% - 2.5cqi);
    height: 24cqi;
    animation: bf-cin-bob 0.9s ease-in-out infinite;
}
@keyframes bf-cin-bob {
    0%, 100% { rotate: -6deg; translate: 0 0; }
    50% { rotate: 6deg; translate: 3cqi -1.4cqi; }
}

/* ---- 9. Gus's belly rumbles the card right off the screen ---- */
.bf-cin-film[data-gag="rumble"] .bf-cin-actor.is-on { left: 1cqi; height: 44cqi; animation-name: bf-cin-gus; }
@keyframes bf-cin-gus {
    0% { transform: translateY(105%); animation-timing-function: cubic-bezier(0.3, 1.4, 0.6, 1); }
    14%, 66% { transform: translateY(0); }
    70% { transform: translateY(-4%); animation-timing-function: ease-in; }
    82%, 100% { transform: translateY(105%); }
}
.bf-cin-film[data-gag="rumble"] .bf-cin-cards { animation: bf-cin-quake var(--gag) steps(1, end) both; }
@keyframes bf-cin-quake {
    0%, 18% { transform: none; }
    20% { transform: translate(0.8cqi, -0.5cqi) rotate(0.4deg); }
    23% { transform: translate(-0.9cqi, 0.4cqi) rotate(-0.5deg); }
    26% { transform: translate(0.6cqi, 0.7cqi); }
    29% { transform: translate(-0.7cqi, -0.6cqi) rotate(0.5deg); }
    32% { transform: translate(1cqi, 0.2cqi); }
    35% { transform: translate(-0.8cqi, 0.5cqi) rotate(-0.4deg); }
    38% { transform: translate(0.5cqi, -0.7cqi); }
    41%, 100% { transform: none; }
}
.bf-cin-film[data-gag="rumble"] .is-out { transform-origin: 0 100%; animation-name: bf-cin-topple; }
@keyframes bf-cin-topple {
    0%, 40% { transform: none; animation-timing-function: ease-in; }
    46% { transform: rotate(6deg); animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.4); }
    62%, 100% { transform: translateY(130%) rotate(22deg); }
}
.bf-cin-film[data-gag="rumble"] .is-in { transform-origin: 50% 100%; animation-name: bf-cin-drop; }
@keyframes bf-cin-drop {
    0%, 56% { transform: translateY(-115%); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
    68% { transform: translateY(0) scale(1.05, 0.9); animation-timing-function: ease-out; }
    74% { transform: translateY(-5%) scale(0.97, 1.04); animation-timing-function: ease-in; }
    80% { transform: translateY(0) scale(1.02, 0.97); }
    85%, 100% { transform: none; }
}

/* ---- 10. Al Manac turns the page ---- */
.bf-cin-film[data-gag="page"] .bf-cin-card.is-out { z-index: 3; transform-origin: 0 50%; backface-visibility: hidden; animation-name: bf-cin-turn; }
@keyframes bf-cin-turn {
    0%, 28% { transform: none; filter: none; animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); }
    50% { transform: rotateY(-80deg) skewY(-3deg); filter: brightness(0.75); }
    68%, 100% { transform: rotateY(-180deg); filter: brightness(0.6); }
}
.bf-cin-film[data-gag="page"] .bf-cin-actor.is-on { left: auto; right: -1cqi; height: 42cqi; animation-name: bf-cin-al; }
@keyframes bf-cin-al {
    0% { translate: 50cqi 0; rotate: 8deg; }
    14% { translate: 0 0; rotate: -3deg; }
    18%, 64% { translate: 0 0; rotate: 0deg; }
    22% { translate: 0 -1.5cqi; }
    68% { translate: -2cqi -1.5cqi; rotate: -4deg; }
    82%, 100% { translate: 55cqi 0; rotate: 8deg; }
}

/* ============================================================
   THE SECOND REEL: the regulars share the screen.

   Shared parts: each scene sets --swap (the moment, as a fraction
   of the scene, when the new card is on top; the old card under
   it just stops showing) and, when it has one, --pow-at (when the
   starburst word pops). A cast member is .bf-cin-actor--<gag>-<n>.
   ============================================================ */
.bf-cin-film:is([data-gag="toast"], [data-gag="caught"], [data-gag="debate"], [data-gag="buzzer"],
                [data-gag="nap"], [data-gag="duet"], [data-gag="bow"]) .bf-cin-card.is-in {
    animation: bf-cin-held calc(var(--gag) * var(--swap, 0.5)) linear;
}
@keyframes bf-cin-held { 0%, 100% { visibility: hidden; } }

/* The starburst: an ink star, a bulb-gold star inside it, a word. */
.bf-cin-pow {
    z-index: 11;
    left: 50%;
    top: 30%;
    width: 26cqi;
    height: 17cqi;
    margin: -8.5cqi 0 0 -13cqi;
    place-items: center;
    isolation: isolate;
    font-family: 'Anton', 'Impact', sans-serif;
    font-size: 6cqi;
    line-height: 1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cin-ink);
}
.bf-cin-pow::before,
.bf-cin-pow::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    clip-path: polygon(50% 0, 60% 24%, 86% 6%, 77% 36%, 100% 44%, 78% 58%, 92% 92%, 62% 76%, 50% 100%, 38% 76%, 8% 92%, 22% 58%, 0 44%, 23% 36%, 14% 6%, 40% 24%);
}
.bf-cin-pow::before { background: var(--cin-ink); }
.bf-cin-pow::after { inset: 1.1cqi 1.5cqi; background: var(--cin-bulb); }
.bf-cin-film:is([data-gag="toast"], [data-gag="caught"], [data-gag="buzzer"]) .bf-cin-pow {
    display: grid;
    animation: bf-cin-pop calc(var(--gag) * 0.34) linear calc(var(--gag) * var(--pow-at, 0.4)) both;
}
@keyframes bf-cin-pop {
    0% { transform: scale(0) rotate(-24deg); opacity: 1; animation-timing-function: cubic-bezier(0.3, 1.6, 0.6, 1); }
    18% { transform: scale(1.2) rotate(6deg); }
    30% { transform: scale(0.94) rotate(-2deg); }
    40%, 76% { transform: scale(1) rotate(0deg); opacity: 1; }
    100% { transform: scale(1.12) rotate(3deg); opacity: 0; }
}

/* A speech bubble rides on its actor (the script puts it there). */
.bf-cin-say {
    position: absolute;
    z-index: 1;
    display: none;
    bottom: 86%;
    left: 44%;
    padding: 2.2cqi 3.6cqi;
    white-space: nowrap;
    font-family: 'Alfa Slab One', 'Rockwell', 'Georgia', serif;
    font-size: 4.6cqi;
    line-height: 1;
    color: var(--cin-ink);
    background: var(--cin-cream);
    border: 0.6cqi solid var(--cin-ink);
    border-radius: 50%;
    box-shadow: 0 0.8cqi 0 rgba(43, 26, 16, 0.3);
}
.bf-cin-say::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 24%;
    width: 3.2cqi;
    height: 3.2cqi;
    margin-top: -1.5cqi;
    background: var(--cin-cream);
    border-right: 0.6cqi solid var(--cin-ink);
    border-bottom: 0.6cqi solid var(--cin-ink);
    transform: rotate(40deg) skewX(-14deg);
}

/* ---- 11. Keg and Brainy clink pints; the card changes in the splash ---- */
.bf-cin-film[data-gag="toast"] { --swap: 0.4; --pow-at: 0.33; }
.bf-cin-film[data-gag="toast"] .bf-cin-actor.is-on { bottom: -2cqi; transform-origin: 50% 100%; }
.bf-cin-film[data-gag="toast"] .bf-cin-actor--toast-1.is-on { left: 2cqi; height: 40cqi; animation-name: bf-cin-toast-l; }
.bf-cin-film[data-gag="toast"] .bf-cin-actor--toast-2.is-on { left: auto; right: 3cqi; height: 42cqi; animation-name: bf-cin-toast-r; }
@keyframes bf-cin-toast-l {
    0% { translate: -70cqi 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 1.3, 0.6, 1); }
    18% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in-out; }
    28% { translate: -3cqi 0; rotate: -7deg; animation-timing-function: cubic-bezier(0.7, 0, 1, 0.5); }
    34% { translate: 4cqi 0; rotate: 6deg; animation-timing-function: ease-out; }
    42% { translate: 0 0; rotate: 0deg; }
    54% { translate: 0 -1.5cqi; }
    62%, 74% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in; }
    100% { translate: -75cqi 0; rotate: -5deg; }
}
@keyframes bf-cin-toast-r {
    0% { translate: 70cqi 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 1.3, 0.6, 1); }
    20% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in-out; }
    28% { translate: 3cqi 0; rotate: 7deg; animation-timing-function: cubic-bezier(0.7, 0, 1, 0.5); }
    34% { translate: -4cqi 0; rotate: -6deg; animation-timing-function: ease-out; }
    42% { translate: 0 0; rotate: 0deg; }
    58% { translate: 0 -1.5cqi; }
    66%, 76% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in; }
    100% { translate: 75cqi 0; rotate: 5deg; }
}
.bf-cin-film[data-gag="toast"] .bf-cin-pow { top: 20%; }
/* The foam goes everywhere, which is when the card changes. */
.bf-cin-film[data-gag="toast"] .bf-cin-flash {
    display: block;
    inset: 0;
    z-index: 9;
    background:
        radial-gradient(circle at 34% 18%, #fffaf0 0 2cqi, transparent 2.3cqi),
        radial-gradient(circle at 66% 14%, #fffaf0 0 1.6cqi, transparent 1.9cqi),
        radial-gradient(circle at 58% 36%, #fffaf0 0 1.2cqi, transparent 1.5cqi),
        radial-gradient(circle at 50% 22%, #fffaf0 0 10cqi, rgba(255, 246, 223, 0.9) 18cqi, rgba(255, 246, 223, 0.6) 44cqi, rgba(255, 246, 223, 0) 80cqi);
    transform-origin: 50% 22%;
    animation-name: bf-cin-foam;
}
@keyframes bf-cin-foam {
    0%, 33% { opacity: 0; transform: scale(0.2); animation-timing-function: ease-out; }
    39% { opacity: 1; transform: scale(1); }
    44% { opacity: 0.9; transform: scale(1.15); animation-timing-function: ease-in; }
    58%, 100% { opacity: 0; transform: scale(1.3); }
}

/* ---- 12. the house lights go down; a spotlight catches Phoney ---- */
.bf-cin-film[data-gag="caught"] { --swap: 0.5; --pow-at: 0.43; }
.bf-cin-film[data-gag="caught"] .bf-cin-spot {
    display: block;
    inset: 0;
    z-index: 9;
    background: rgba(13, 9, 7, 0.97);
    -webkit-mask-image: radial-gradient(circle at var(--cin-x) var(--cin-y), transparent calc(var(--cin-r) - 1.2cqi), #000 var(--cin-r));
    mask-image: radial-gradient(circle at var(--cin-x) var(--cin-y), transparent calc(var(--cin-r) - 1.2cqi), #000 var(--cin-r));
    animation-name: bf-cin-hunt;
}
@keyframes bf-cin-hunt {
    0% { opacity: 0; --cin-r: 15cqi; --cin-x: 76%; --cin-y: 34%; }
    8% { opacity: 1; --cin-x: 76%; --cin-y: 34%; animation-timing-function: ease-in-out; }
    19% { --cin-x: 22%; --cin-y: 30%; animation-timing-function: ease-in-out; }
    30% { --cin-x: 72%; --cin-y: 60%; animation-timing-function: ease-in-out; }
    39% { --cin-x: 18%; --cin-y: 74%; --cin-r: 15cqi; animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1); }
    43% { --cin-x: 43%; --cin-y: 78%; --cin-r: 12cqi; }
    54% { opacity: 1; --cin-x: 43%; --cin-y: 78%; --cin-r: 12cqi; animation-timing-function: ease-in; }
    72% { opacity: 1; --cin-x: 50%; --cin-y: 60%; --cin-r: 130cqi; }
    82%, 100% { opacity: 0; --cin-x: 50%; --cin-y: 60%; --cin-r: 130cqi; }
}
.bf-cin-film[data-gag="caught"] .bf-cin-actor--caught-1.is-on {
    height: 30cqi;
    bottom: -1cqi;
    animation-name: bf-cin-caught, bf-cin-tiptoe;
    animation-duration: var(--gag), 0.3s;
    animation-timing-function: linear, steps(1, end);
    animation-iteration-count: 1, infinite;
}
@keyframes bf-cin-caught {
    0% { translate: -30cqi 0; scale: 1; }
    42% { translate: 32cqi 0; scale: 1; animation-timing-function: cubic-bezier(0.3, 1.5, 0.6, 1); }
    46% { translate: 32cqi -9cqi; scale: 0.88 1.15; animation-timing-function: ease-in; }
    50%, 58% { translate: 32cqi 0; scale: 1; }
    62% { translate: 35cqi 0; scale: 1.15 0.88; animation-timing-function: ease-in; }
    72%, 100% { translate: -60cqi 0; scale: 1.4 0.85; }
}
.bf-cin-film[data-gag="caught"] .bf-cin-actor--caught-2.is-on { left: auto; right: -2cqi; height: 38cqi; bottom: -2cqi; animation-name: bf-cin-sleuth; }
@keyframes bf-cin-sleuth {
    0%, 50% { translate: 60cqi 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 1.4, 0.6, 1); }
    57% { translate: 0 0; }
    64% { rotate: -5deg; }
    68% { rotate: 2deg; }
    72%, 84% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in; }
    100% { translate: 60cqi 0; rotate: 0deg; }
}
.bf-cin-film[data-gag="caught"] .bf-cin-pow { left: 57%; top: 64%; width: 13cqi; height: 13cqi; margin: -6.5cqi 0 0 -6.5cqi; font-size: 7cqi; animation-duration: calc(var(--gag) * 0.24); }

/* ---- 13. Gus is sure. Al is sure too. Al's bubble wins ---- */
.bf-cin-film[data-gag="debate"] { --swap: 0.66; }
.bf-cin-film[data-gag="debate"] .bf-cin-actor--debate-1.is-on { left: 1cqi; height: 38cqi; bottom: -2cqi; transform-origin: 50% 100%; animation-name: bf-cin-gus-sure; }
@keyframes bf-cin-gus-sure {
    0% { translate: 0 105%; scale: 1; opacity: 1; animation-timing-function: cubic-bezier(0.3, 1.4, 0.6, 1); }
    11% { translate: 0 0; }
    18% { scale: 1.06 0.94; }
    22% { scale: 0.97 1.04; }
    26% { scale: 1.05 0.95; }
    30%, 44% { translate: 0 0; scale: 1; animation-timing-function: ease-in; }
    52%, 64% { translate: 0 8%; scale: 0.94 0.9; opacity: 1; }
    64.1%, 100% { translate: 0 8%; scale: 0.94 0.9; opacity: 0; }
}
.bf-cin-film[data-gag="debate"] .bf-cin-actor--debate-2.is-on { left: auto; right: -1cqi; height: 40cqi; bottom: -2cqi; animation-name: bf-cin-al-sure; }
@keyframes bf-cin-al-sure {
    0% { translate: 55cqi 0; animation-timing-function: cubic-bezier(0.3, 1.3, 0.6, 1); }
    13%, 36% { translate: 0 0; animation-timing-function: ease-out; }
    42%, 100% { translate: -4cqi 0; }
}
.bf-cin-film[data-gag="debate"] .bf-cin-actor--debate-2.is-on img { animation: bf-cin-al-gone var(--gag) linear both; }
@keyframes bf-cin-al-gone { 0%, 64% { opacity: 1; } 64.1%, 100% { opacity: 0; } }
.bf-cin-film[data-gag="debate"] .bf-cin-say { display: block; transform-origin: 20% 120%; }
.bf-cin-film[data-gag="debate"] .bf-cin-actor--debate-1 .bf-cin-say { animation: bf-cin-say-gus var(--gag) linear both; }
@keyframes bf-cin-say-gus {
    0%, 13% { transform: scale(0); animation-timing-function: cubic-bezier(0.3, 1.7, 0.6, 1); }
    18%, 42% { transform: scale(1); animation-timing-function: ease-in; }
    44% { transform: scale(1.08, 0.86); }
    49%, 100% { transform: scale(0) rotate(-30deg); }
}
.bf-cin-film[data-gag="debate"] .bf-cin-actor--debate-2 .bf-cin-say {
    left: auto;
    right: 46%;
    transform-origin: 50% 50%;
    animation: bf-cin-say-al var(--gag) linear both;
}
.bf-cin-film[data-gag="debate"] .bf-cin-actor--debate-2 .bf-cin-say::after { left: auto; right: 24%; transform: rotate(50deg) skewX(14deg); }
@keyframes bf-cin-say-al {
    0%, 36% { transform: scale(0); color: var(--cin-ink); animation-timing-function: cubic-bezier(0.3, 1.7, 0.6, 1); }
    41%, 52% { transform: scale(1); color: var(--cin-ink); animation-timing-function: ease-in; }
    54% { transform: scale(1.1); color: transparent; animation-timing-function: cubic-bezier(0.6, 0, 1, 0.6); }
    66% { transform: scale(16); color: transparent; opacity: 1; }
    90%, 100% { transform: scale(16); color: transparent; opacity: 0; }
}

/* ---- 14. Miguel beats Eddie to the buzzer; the sun goes out of Eddie ---- */
.bf-cin-film[data-gag="buzzer"] { --swap: 0.46; --pow-at: 0.4; }
.bf-cin-film[data-gag="buzzer"] .bf-cin-buzzer {
    display: block;
    z-index: 7;
    left: 41cqi;
    bottom: -0.5cqi;
    width: 18cqi;
    height: 7cqi;
    border-radius: 1.2cqi 1.2cqi 0 0;
    background: linear-gradient(var(--cin-brass-hi) 0 0.8cqi, var(--cin-wood) 0.8cqi, var(--cin-wood-deep));
    box-shadow: 0 0 0 0.5cqi var(--cin-ink);
    animation-name: bf-cin-buzzer-in;
}
@keyframes bf-cin-buzzer-in {
    0% { transform: translateY(130%); animation-timing-function: cubic-bezier(0.3, 1.4, 0.6, 1); }
    10%, 86% { transform: none; animation-timing-function: ease-in; }
    100% { transform: translateY(130%); }
}
/* The dome: pressed flat for a beat, and it lights up. */
.bf-cin-buzzer::before {
    content: '';
    position: absolute;
    left: 2.5cqi;
    right: 2.5cqi;
    bottom: 100%;
    height: 6.5cqi;
    border-radius: 50% 50% 0.6cqi 0.6cqi / 100% 100% 0.6cqi 0.6cqi;
    background: radial-gradient(circle at 35% 30%, #ff9c86, #d8452f 45%, var(--cin-velvet));
    box-shadow: 0 0 0 0.5cqi var(--cin-ink);
    transform-origin: 50% 100%;
    animation: inherit;
    animation-name: bf-cin-dome;
}
@keyframes bf-cin-dome {
    0%, 40% { transform: none; filter: none; }
    41.5% { transform: scaleY(0.45); filter: brightness(1.5); box-shadow: 0 0 0 0.5cqi var(--cin-ink), 0 0 5cqi 1cqi #ffb08a; }
    48% { transform: none; filter: brightness(1.4); box-shadow: 0 0 0 0.5cqi var(--cin-ink), 0 0 5cqi 1cqi #ffb08a; }
    62%, 100% { transform: none; filter: none; box-shadow: 0 0 0 0.5cqi var(--cin-ink); }
}
.bf-cin-film[data-gag="buzzer"] .bf-cin-actor--buzzer-1.is-on { height: 26cqi; bottom: -1cqi; transform-origin: 50% 100%; animation-name: bf-cin-miguel-buzz; }
@keyframes bf-cin-miguel-buzz {
    0%, 14% { translate: -30cqi 0; scale: 1; animation-timing-function: cubic-bezier(0.2, 0.8, 0.4, 1); }
    24% { translate: 13cqi 0; }
    30% { translate: 13cqi 0; scale: 1; animation-timing-function: ease-in; }
    36% { translate: 13cqi 0; scale: 1.12 0.82; animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
    39% { translate: 26cqi -20cqi; scale: 0.9 1.12; animation-timing-function: ease-in; }
    41.5% { translate: 38cqi -11cqi; scale: 1.2 0.8; }
    45% { translate: 38cqi -11cqi; scale: 1; }
    50% { translate: 38cqi -19cqi; animation-timing-function: ease-in; }
    55% { translate: 38cqi -11cqi; scale: 1.1 0.9; }
    60% { translate: 38cqi -18cqi; scale: 1; animation-timing-function: ease-in; }
    65%, 76% { translate: 38cqi -11cqi; scale: 1; }
    82% { translate: 30cqi -20cqi; animation-timing-function: ease-in; }
    88%, 100% { translate: -40cqi 0; }
}
.bf-cin-film[data-gag="buzzer"] .bf-cin-actor--buzzer-2.is-on { left: auto; right: -3cqi; height: 40cqi; bottom: -2cqi; transform-origin: 50% 100%; animation-name: bf-cin-eddie-late; }
@keyframes bf-cin-eddie-late {
    0% { translate: 55cqi 0; rotate: 0deg; filter: drop-shadow(0 0 2.2cqi rgba(255, 214, 110, 0.85)); animation-timing-function: cubic-bezier(0.3, 1.2, 0.6, 1); }
    14%, 33% { translate: 0 0; rotate: 0deg; filter: drop-shadow(0 0 2.2cqi rgba(255, 214, 110, 0.85)); animation-timing-function: ease-in-out; }
    37% { translate: 2cqi 0; rotate: 4deg; animation-timing-function: cubic-bezier(0.6, 0, 1, 0.6); }
    42% { translate: -13cqi 0; rotate: -10deg; filter: drop-shadow(0 0 2.2cqi rgba(255, 214, 110, 0.85)); }
    46% { translate: -12cqi 0; rotate: -6deg; filter: drop-shadow(0 0 0 rgba(255, 214, 110, 0)) brightness(0.55) saturate(0.35); }
    54%, 78% { translate: -6cqi 3cqi; rotate: 9deg; filter: brightness(0.55) saturate(0.35); animation-timing-function: ease-in; }
    100% { translate: 55cqi 4cqi; rotate: 12deg; filter: brightness(0.55) saturate(0.35); }
}
.bf-cin-film[data-gag="buzzer"] .bf-cin-pow { top: 30%; }
.bf-cin-film[data-gag="buzzer"] .bf-cin-flash { display: block; inset: 0; z-index: 9; background: radial-gradient(circle at 50% 80%, #fff6df, rgba(255, 176, 138, 0.75) 40%, rgba(255, 176, 138, 0.35)); animation-name: bf-cin-zap; }
@keyframes bf-cin-zap { 0%, 41% { opacity: 0; } 43% { opacity: 0.95; } 45% { opacity: 0.4; } 46.5% { opacity: 0.85; } 54%, 100% { opacity: 0; } }

/* ---- 15. Grampy nods off; the bulb on his stick lights the room ---- */
.bf-cin-film[data-gag="nap"] { --swap: 0.59; }
.bf-cin-film[data-gag="nap"] .bf-cin-actor--nap-1.is-on {
    left: 27cqi;
    height: 50cqi;
    bottom: -3cqi;
    transform-origin: 50% 100%;
    animation-name: bf-cin-nap, bf-cin-totter;
    animation-duration: var(--gag), 0.5s;
    animation-timing-function: linear, steps(1, end);
    animation-iteration-count: 1, infinite;
}
@keyframes bf-cin-nap {
    0% { translate: -70cqi 0; scale: 1; }
    18% { translate: 0 0; scale: 1; animation-timing-function: ease-in-out; }
    26% { scale: 1.03 0.97; animation-timing-function: ease-in-out; }
    34% { scale: 0.98 1.02; animation-timing-function: ease-in-out; }
    42% { scale: 1.03 0.97; animation-timing-function: ease-in-out; }
    50% { scale: 0.98 1.02; }
    55% { translate: 0 0; scale: 1; animation-timing-function: cubic-bezier(0.3, 1.6, 0.6, 1); }
    58% { translate: 0 -4cqi; scale: 0.95 1.06; }
    62%, 80% { translate: 0 0; scale: 1; animation-timing-function: ease-in; }
    100% { translate: -75cqi 0; scale: 1; }
}
.bf-cin-film[data-gag="nap"] .bf-cin-dark { display: block; inset: 0; z-index: 7; background: var(--cin-black); animation-name: bf-cin-dim; }
@keyframes bf-cin-dim { 0%, 16% { opacity: 0; } 28%, 54% { opacity: 0.6; } 58%, 100% { opacity: 0; } }
.bf-cin-zzz { left: 62cqi; top: 44%; z-index: 9; width: 1px; height: 1px; }
.bf-cin-film[data-gag="nap"] .bf-cin-zzz { display: block; }
.bf-cin-zzz > span {
    position: absolute;
    left: calc(var(--i) * 2.5cqi);
    top: 0;
    font-family: 'Anton', 'Impact', sans-serif;
    font-size: calc(6cqi + var(--i) * 2cqi);
    line-height: 1;
    color: var(--cin-cream);
    -webkit-text-stroke: 0.5cqi var(--cin-ink);
    paint-order: stroke fill;
    opacity: 0;
    animation: bf-cin-z calc(var(--gag) * 0.18) ease-out calc(var(--gag) * (0.22 + var(--i) * 0.1)) both;
}
@keyframes bf-cin-z {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translate(8cqi, -16cqi) scale(1.2) rotate(-14deg); }
}
/* The bulb: it glows, then fills the screen with light. */
.bf-cin-film[data-gag="nap"] .bf-cin-glow {
    display: block;
    z-index: 9;
    left: 32cqi;
    top: 37.5cqi;
    width: 8cqi;
    height: 8cqi;
    margin: -4cqi 0 0 -4cqi;
    border-radius: 50%;
    background: radial-gradient(circle, #fffbea 0 22%, var(--cin-bulb) 42%, rgba(255, 216, 138, 0.5) 56%, rgba(255, 216, 138, 0) 70%);
    animation-name: bf-cin-bulb;
}
@keyframes bf-cin-bulb {
    0%, 53% { opacity: 0; transform: scale(0.3); }
    55% { opacity: 1; transform: scale(1.3); }
    56.5% { opacity: 0.6; transform: scale(1); animation-timing-function: cubic-bezier(0.6, 0, 1, 0.6); }
    60% { opacity: 1; transform: scale(36); }
    80%, 100% { opacity: 0; transform: scale(36); }
}

/* ---- 16. Thumper and Brainy sing a duet; a heart irises out on them ---- */
.bf-cin-film[data-gag="duet"] {
    --swap: 0.63;
    --heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5C5 16 2 12.6 2 8.6 2 5.5 4.4 3 7.4 3c1.9 0 3.6 1 4.6 2.6C13 4 14.7 3 16.6 3 19.6 3 22 5.5 22 8.6c0 4-3 7.4-10 12.9z'/%3E%3C/svg%3E");
    -webkit-mask: var(--heart) 50% 70% / 480cqi 480cqi no-repeat;
    mask: var(--heart) 50% 70% / 480cqi 480cqi no-repeat;
    animation: bf-cin-heart var(--gag) both;
}
@keyframes bf-cin-heart {
    0%, 38% { -webkit-mask-size: 480cqi 480cqi; mask-size: 480cqi 480cqi; animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.6); }
    50%, 55% { -webkit-mask-size: 44cqi 44cqi; mask-size: 44cqi 44cqi; animation-timing-function: ease-in; }
    61%, 65% { -webkit-mask-size: 0 0; mask-size: 0 0; animation-timing-function: ease-out; }
    100% { -webkit-mask-size: 480cqi 480cqi; mask-size: 480cqi 480cqi; }
}
.bf-cin-film[data-gag="duet"] .bf-cin-actor.is-on { height: 40cqi; bottom: -2cqi; transform-origin: 50% 100%; }
.bf-cin-film[data-gag="duet"] .bf-cin-actor--duet-1.is-on { left: 3cqi; animation-name: bf-cin-duet-l; }
.bf-cin-film[data-gag="duet"] .bf-cin-actor--duet-2.is-on { left: auto; right: 0; animation-name: bf-cin-duet-r; }
@keyframes bf-cin-duet-l {
    0% { translate: -60cqi 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 1.3, 0.6, 1); }
    12% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in-out; }
    22% { rotate: -5deg; animation-timing-function: ease-in-out; }
    32% { rotate: 4deg; animation-timing-function: ease-in-out; }
    42% { rotate: -5deg; animation-timing-function: ease-in-out; }
    52%, 61% { translate: 2cqi 0; rotate: 5deg; opacity: 1; }
    61.1%, 100% { opacity: 0; }
}
@keyframes bf-cin-duet-r {
    0%, 4% { translate: 60cqi 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 1.3, 0.6, 1); }
    16% { translate: 0 0; rotate: 0deg; animation-timing-function: ease-in-out; }
    26% { rotate: 5deg; animation-timing-function: ease-in-out; }
    36% { rotate: -4deg; animation-timing-function: ease-in-out; }
    46% { rotate: 5deg; animation-timing-function: ease-in-out; }
    55%, 61% { translate: -2cqi 0; rotate: -5deg; opacity: 1; }
    61.1%, 100% { opacity: 0; }
}
.bf-cin-notes { inset: 0; z-index: 9; }
.bf-cin-film[data-gag="duet"] .bf-cin-notes { display: block; }
.bf-cin-notes > span {
    position: absolute;
    left: calc(30cqi + var(--i) * 6.6cqi);
    top: 52%;
    width: 5.4cqi;
    height: 5.4cqi;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2.5v12a4 4 0 1 0 2.4 3.6V7.4h7.6V2.5z' fill='%232b1a10'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0;
    animation: bf-cin-note calc(var(--gag) * 0.3) ease-out calc(var(--gag) * (0.12 + var(--i) * 0.055)) both;
}
.bf-cin-notes > span:nth-child(even) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5C5 16 2 12.6 2 8.6 2 5.5 4.4 3 7.4 3c1.9 0 3.6 1 4.6 2.6C13 4 14.7 3 16.6 3 19.6 3 22 5.5 22 8.6c0 4-3 7.4-10 12.9z' fill='%23b8473a' stroke='%232b1a10' stroke-width='1.6'/%3E%3C/svg%3E");
}
@keyframes bf-cin-note {
    0% { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(-10deg); }
    20% { opacity: 1; }
    50% { transform: translate(2.5cqi, -14cqi) scale(1) rotate(10deg); }
    100% { opacity: 0; transform: translate(-2cqi, -30cqi) scale(1.1) rotate(-8deg); }
}

/* ---- 17. curtain call: Brainy bows at the front of the curtain ---- */
.bf-cin-film[data-gag="bow"] { --swap: 0.5; }
.bf-cin-film[data-gag="bow"] .bf-cin-drop { display: block; inset: 0; z-index: 9; }
.bf-cin-drop::before,
.bf-cin-drop::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 51%;
    background:
        radial-gradient(circle at 50% 0, var(--cin-brass) 0 1cqi, transparent 1.2cqi) 0 100% / 4cqi 2.4cqi repeat-x,
        repeating-linear-gradient(90deg, var(--cin-velvet-deep) 0 0.6cqi, var(--cin-velvet) 1.8cqi 3.4cqi, var(--cin-velvet-hi) 4.2cqi, var(--cin-velvet) 5cqi, var(--cin-velvet-deep) 6cqi);
    animation: inherit;
}
.bf-cin-drop::before { left: 0; box-shadow: 1cqi 0 2cqi rgba(0, 0, 0, 0.5); animation-name: bf-cin-drop-l; }
.bf-cin-drop::after { right: 0; box-shadow: -1cqi 0 2cqi rgba(0, 0, 0, 0.5); animation-name: bf-cin-drop-r; }
@keyframes bf-cin-drop-l {
    0%, 8% { transform: translateX(-102%); animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1); }
    32%, 66% { transform: none; animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1); }
    92%, 100% { transform: translateX(-102%); }
}
@keyframes bf-cin-drop-r {
    0%, 8% { transform: translateX(102%); animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1); }
    32%, 66% { transform: none; animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1); }
    92%, 100% { transform: translateX(102%); }
}
.bf-cin-film[data-gag="bow"] .bf-cin-actor--bow-1.is-on { z-index: 10; left: 50%; height: 46cqi; bottom: -3cqi; animation-name: bf-cin-bow; }
@keyframes bf-cin-bow {
    0%, 6% { translate: calc(-50% + 70cqi) 0; animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
    26% { translate: -50% 0; }
    40% { translate: -50% 0; animation-timing-function: ease-out; }
    44% { translate: -50% -1.5cqi; }
    48% { translate: -50% 0; animation-timing-function: ease-out; }
    52% { translate: -50% -1.5cqi; }
    56%, 60% { translate: -50% 0; animation-timing-function: cubic-bezier(0.6, 0, 1, 0.5); }
    68%, 100% { translate: calc(-50% - 80cqi) 0; }
}
/* Roses from the crowd, thrown from either side, land at his boots. */
.bf-cin-roses { inset: 0; z-index: 11; }
.bf-cin-film[data-gag="bow"] .bf-cin-roses { display: block; }
.bf-cin-roses > span {
    position: absolute;
    left: 0;
    top: 0;
    width: 12cqi;
    height: 12cqi;
    margin: -6cqi 0 0 -6cqi;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 11 L13 23' stroke='%233f6b35' stroke-width='1.8' stroke-linecap='round'/%3E%3Cpath d='M12.6 17c2-2.6 4.6-2.8 5.6-2-1.2 2.2-3.4 3-5.6 2z' fill='%235c8f47' stroke='%232b1a10' stroke-width='.8'/%3E%3Ccircle cx='11.5' cy='7' r='5.2' fill='%23b8473a' stroke='%232b1a10' stroke-width='1.2'/%3E%3Cpath d='M9 6.5c1-2 4-2 5 .5M10 8.5c1 1 3 1 3.6-.6' fill='none' stroke='%234c120d' stroke-width='1'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0;
    animation: bf-cin-rose-1 calc(var(--gag) * 0.2) linear calc(var(--gag) * (0.34 + var(--i) * 0.06)) both;
}
.bf-cin-roses > span:nth-child(2) { animation-name: bf-cin-rose-2; }
.bf-cin-roses > span:nth-child(3) { animation-name: bf-cin-rose-3; }
@keyframes bf-cin-rose-1 {
    0% { opacity: 1; transform: translate(-8cqi, 50cqi) rotate(0deg); animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
    50% { transform: translate(18cqi, 20cqi) rotate(200deg); animation-timing-function: cubic-bezier(0.6, 0, 1, 0.6); }
    85% { opacity: 1; transform: translate(36cqi, 62cqi) rotate(380deg); }
    100% { opacity: 0; transform: translate(36cqi, 62cqi) rotate(380deg); }
}
@keyframes bf-cin-rose-2 {
    0% { opacity: 1; transform: translate(102cqi, 46cqi) rotate(0deg); animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
    50% { transform: translate(78cqi, 16cqi) rotate(-220deg); animation-timing-function: cubic-bezier(0.6, 0, 1, 0.6); }
    85% { opacity: 1; transform: translate(58cqi, 63cqi) rotate(-370deg); }
    100% { opacity: 0; transform: translate(58cqi, 63cqi) rotate(-370deg); }
}
@keyframes bf-cin-rose-3 {
    0% { opacity: 1; transform: translate(10cqi, 74cqi) rotate(0deg); animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
    50% { transform: translate(30cqi, 30cqi) rotate(160deg); animation-timing-function: cubic-bezier(0.6, 0, 1, 0.6); }
    85% { opacity: 1; transform: translate(45cqi, 64cqi) rotate(350deg); }
    100% { opacity: 0; transform: translate(45cqi, 64cqi) rotate(350deg); }
}

/* ---- 18. the whole family in a conga line; Puddles is late ---- */
.bf-cin-film[data-gag="conga"] .bf-cin-actor.is-on {
    left: 0;
    height: 24cqi;
    bottom: -1cqi;
    animation-name: bf-cin-conga, bf-cin-conga-hop;
    animation-duration: var(--gag), 0.44s;
    animation-timing-function: linear, ease-in-out;
    animation-iteration-count: 1, infinite;
    animation-delay: 0s, calc(var(--i) * -0.11s);
}
.bf-cin-film[data-gag="conga"] .bf-cin-actor--conga-1.is-on,
.bf-cin-film[data-gag="conga"] .bf-cin-actor--conga-8.is-on { height: 27cqi; }
.bf-cin-film[data-gag="conga"] .bf-cin-actor--conga-2.is-on { height: 22cqi; }
.bf-cin-film[data-gag="conga"] .bf-cin-actor--conga-10.is-on { --gap: 22cqi; height: 17cqi; animation-duration: var(--gag), 0.24s; }
@keyframes bf-cin-conga {
    from { translate: calc(102cqi + var(--i) * 25cqi + var(--gap, 0cqi)) 0; }
    to { translate: calc(102cqi + var(--i) * 25cqi + var(--gap, 0cqi) - 410cqi) 0; }
}
@keyframes bf-cin-conga-hop {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-2.2cqi) rotate(5deg); }
}
/* Brainy leads, and the new card follows him in. */
.bf-cin-film[data-gag="conga"] .is-in { animation-name: bf-cin-conga-reveal; }
@keyframes bf-cin-conga-reveal {
    0%, 4% { clip-path: inset(0 0 0 100%); }
    28.5%, 100% { clip-path: inset(0 0 0 0); }
}

/* The house lights stay where they are when nobody is looking: the
   tab is hidden or the screen has scrolled away. */
html.bf-anim-paused .bf-cinema *,
html.bf-anim-paused .bf-cinema *::before,
html.bf-anim-paused .bf-cinema *::after,
.bf-cinema.bf-anim-rest *,
.bf-cinema.bf-anim-rest *::before,
.bf-cinema.bf-anim-rest *::after { animation-play-state: paused !important; }

/* Reduced motion: a still screen. The curtains are open, the film
   does not flicker or drift, and the script just changes the card. */
@media (prefers-reduced-motion: reduce) {
    .bf-cinema *,
    .bf-cinema *::before,
    .bf-cinema *::after { animation: none !important; }
    .bf-cin-curtain { display: none; }
    .bf-cin-flicker { opacity: 0.5; }
    .bf-cin-scratch { display: none; }
}
