/* Card motion and cinema effects on the game's own objects. Reads tokens.css only.
     cine-by  the "by @name" picker credit at a Cinerama panel's foot (web/js/ui/cinerama.js)
     fx-      card motion helpers (web/js/ui/cine-fx.js): sheen, Monolith ground glow + dust, Drop landing shadows,
              face-down backs, the chain card's sprocket strip
     ldr-     film-leader countdown and the slim picking ring (web/js/ui/leader.js)
     rv-      the round-start reveal: curtain and notes (web/js/ui/reveal.js)
     dpx-     the deal popup's picture (web/js/ui/deal-fx.js)
     tv-marquee / tv-bulbs  the TV lobby marquee title with chasing bulbs (web/js/screens/tv.js)
   Only transform and opacity animate (the static blurs and gradients never change). Everything decorative is off under
   prefers-reduced-motion; the JS side skips its Web Animations there too (fx/prefs.js effectsOn). */

/* ---------- Picker credit ---------- */
.cine-by {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; margin-top: 2px;
  width: 0; min-width: 100%; /* never widens its grid column: it takes the panel width and ellipsizes */
  padding: 2px 6px 2px 2px; border-radius: var(--radius-pill); background: rgba(13, 20, 36, .22);
  font: 800 10.5px/1.1 var(--font-body); color: inherit; white-space: nowrap;
}
.cine-by > span:last-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cine-by .avatar.xs { width: 16px; height: 16px; font-size: 8px; letter-spacing: 0; box-shadow: 0 0 0 1px rgba(255, 244, 234, .5); } /* picker credit only; names elsewhere size theirs to the text (app.css) */
.tv-trio .cine-by, .tv-screen .cine-by { font-size: .62em; padding: .15em .5em .15em .15em; gap: .35em; }
.tv-screen .cine-by .avatar.xs { width: 1.5em; height: 1.5em; font-size: .7em; }

/* ---------- Light sweep across a card face (decorate() adds <i class="fx-sheen"> and removes it at the end) ---------- */
.fx-sheen { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 1; }
.fx-sheen::before {
  content: ""; position: absolute; top: -25%; bottom: -25%; left: -60%; width: 45%;
  background: linear-gradient(100deg, rgba(255, 250, 240, 0), rgba(255, 250, 240, .5) 50%, rgba(255, 250, 240, 0));
  animation: fx-sheen 760ms cubic-bezier(.4, 0, .2, 1) both; animation-delay: inherit;
}
.fx-sheen.fast::before { animation-duration: 440ms; }
.fx-sheen.big::before { width: 62%; background: linear-gradient(100deg, rgba(255, 250, 240, 0), rgba(255, 252, 245, .8) 50%, rgba(255, 250, 240, 0)); animation-duration: 900ms; }
@keyframes fx-sheen { from { transform: translateX(0) skewX(-14deg); } to { transform: translateX(470%) skewX(-14deg); } }

/* ---------- Monolith: the horizon clips the rising cards; a ground glow and a puff of dust at their base ---------- */
/* Clip only BELOW the horizon (the cards rise out of it). Sides and top stay open for the tilted panels and the active ring:
   overflow-clip-margin is ignored by Safari, so overflow: clip sliced the cards flat on iPhone. */
.cine.fx-mono { position: relative; clip-path: inset(-60px -60px -14px -60px); }
.cine.fx-mono::after {
  content: ""; position: absolute; z-index: 2; left: -4%; right: -4%; bottom: -4px; height: 10px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 246, 228, .95), rgba(242, 178, 51, .45) 55%, rgba(242, 178, 51, 0));
  animation: fx-ground 1700ms cubic-bezier(.2, .7, .3, 1) both;
}
.cine.fx-mono::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; pointer-events: none;
  background:
    radial-gradient(4px 3px at 12% 80%, rgba(236, 230, 216, .7), transparent),
    radial-gradient(3px 3px at 27% 60%, rgba(236, 230, 216, .55), transparent),
    radial-gradient(5px 4px at 44% 85%, rgba(236, 230, 216, .6), transparent),
    radial-gradient(3px 3px at 58% 55%, rgba(236, 230, 216, .5), transparent),
    radial-gradient(4px 3px at 73% 78%, rgba(236, 230, 216, .65), transparent),
    radial-gradient(3px 3px at 90% 62%, rgba(236, 230, 216, .5), transparent);
  animation: fx-dust 1600ms ease-out both;
}
@keyframes fx-ground { 0% { opacity: 0; transform: scaleX(.25); } 22% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1.04); } }
@keyframes fx-dust { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* ---------- Drop & spin: nothing spins past the sides; landing shadows tighten under each card ---------- */
.cine.fx-drop { position: relative; overflow-x: clip; margin-inline: -16px; padding-inline: 16px; } /* clip at the gutter, not the cards */
.cine.fx-drop::before {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: -9px; height: 14px; pointer-events: none;
  background:
    radial-gradient(14% 50% at 15% 50%, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0)),
    radial-gradient(16% 50% at 50% 50%, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0)),
    radial-gradient(14% 50% at 85% 50%, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
  animation: fx-shadow 1150ms ease-out both;
}
@keyframes fx-shadow { 0% { opacity: 0; transform: scaleX(1.7); } 55% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1); } }

/* ---------- Face-down card (the reveal): the dim back, a big "?", film fields kept in place but hidden ---------- */
.cine-panel.fx-back { --face: var(--dim); --edgec: #0c1a2c; --ink: var(--dim-text); }
.cine-panel.fx-back > .film, .cine-panel.fx-back > .year, .cine-panel.fx-back > .cine-by { visibility: hidden; }
.cine-panel.fx-back::before {
  content: "?"; position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
  font: 700 2.4em/1 var(--font-display); color: var(--dim-text);
  background: repeating-linear-gradient(135deg, rgba(143, 211, 228, .07) 0 6px, rgba(143, 211, 228, 0) 6px 14px);
}

/* ---------- The chain card's sprocket strip: advances one hole per link (cine-fx.js chainTick) ---------- */
.core-chain-card { position: relative; overflow-x: clip; }
.core-chain-card::before {
  content: ""; position: absolute; top: 7px; left: -14px; right: 0; height: 5px; pointer-events: none; opacity: .75;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 7px, rgba(0, 0, 0, 0) 7px 14px);
}
.core-chain-card.fx-tick::before { animation: fx-tick 260ms steps(3, end); }
@keyframes fx-tick { from { transform: translateX(0); } to { transform: translateX(14px); } }

/* ---------- Film leader (countdown) ---------- */
.ldr { position: relative; width: min(80vw, 320px); aspect-ratio: 4 / 3; margin: var(--s5) auto; --sw: var(--cyan); }
.ldr[data-n="2"] { --sw: var(--red); }
.ldr[data-n="1"] { --sw: var(--gold); }
.ldr.big { width: min(30em, 70vw); }
.ldr.small { width: min(52vw, 210px); margin: var(--s3) auto; }
.ldr.small .ldr-num b { font-size: clamp(3.5rem, 18vw, 5rem); }
.ip-rv { width: 100%; max-width: 420px; margin-top: var(--s4); }
.ldr-frame {
  position: absolute; inset: 0; border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #26365a 0%, #141d33 60%, #0a1020 100%);
  box-shadow: 0 var(--edge) 0 #0a1020, 0 14px 30px rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 244, 234, .08);
}
/* Sprocket holes down both sides: the leader is a strip of film. */
.ldr-frame::before, .ldr-frame::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 7%; z-index: 2;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 6%, rgba(236, 230, 216, .16) 6% 12%) center / 46% 100% no-repeat, #0a1020;
}
.ldr-frame::before { left: 0; }
.ldr-frame::after { right: 0; }
.ldr-disc { position: absolute; top: 50%; left: 50%; height: 84%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden; background: #1a2644; }
/* The wipe: a fixed trail that ends in a bright hand at 12 o'clock; the whole disc of it rotates. */
.ldr-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(0, 0, 0, 0) 0 55%, color-mix(in srgb, var(--sw) 18%, transparent) 80%, color-mix(in srgb, var(--sw) 55%, transparent) 99.2%, var(--cream) 99.2% 100%);
}
.ldr-rings, .ldr-cross { position: absolute; inset: 0; pointer-events: none; }
.ldr-rings::before, .ldr-rings::after { content: ""; position: absolute; border-radius: 50%; border: 3px solid rgba(255, 244, 234, .85); }
.ldr-rings::before { inset: 5%; }
.ldr-rings::after { inset: 17%; border-width: 2px; border-color: rgba(255, 244, 234, .55); }
.ldr-cross::before, .ldr-cross::after { content: ""; position: absolute; background: rgba(255, 244, 234, .5); }
.ldr-cross::before { left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); }
.ldr-cross::after { top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-1px); }
.ldr-grain {
  position: absolute; inset: -8%; z-index: 3; opacity: .14; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: ldr-grain 600ms steps(1) infinite;
}
.ldr-flicker { position: absolute; inset: 0; z-index: 3; background: rgba(255, 244, 234, .07); pointer-events: none; animation: ldr-flicker 1100ms steps(1) infinite; }
.ldr-num { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; margin: 0; pointer-events: none; }
.ldr-num b { display: block; font: 700 clamp(5rem, 30vw, 8.5rem)/1 var(--font-display); color: var(--cream); text-shadow: 0 6px 0 var(--red-edge), 0 0 28px rgba(0, 0, 0, .6); }
.ldr.big .ldr-num b { font-size: 11em; }
.ldr[data-n="go"] .ldr-sweep { opacity: 0; }
.ldr[data-n="go"] .ldr-num b { color: var(--gold); text-shadow: 0 6px 0 var(--gold-edge), 0 0 40px rgba(242, 178, 51, .55); font-size: clamp(4rem, 22vw, 6.5rem); }
.ldr.big[data-n="go"] .ldr-num b { font-size: 8em; }
@keyframes ldr-grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-5%, 4%); } 50% { transform: translate(5%, -3%); } 75% { transform: translate(-3%, -5%); } }
@keyframes ldr-flicker { 0% { opacity: .2; } 18% { opacity: .9; } 22% { opacity: .35; } 55% { opacity: .7; } 61% { opacity: .1; } 80% { opacity: .55; } }
.ldr-over { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(13, 20, 36, .94); cursor: pointer; animation: fade-in 200ms ease-out; }

/* The slim picking ring (60 s): ticks, a hand going once round, the seconds. */
.ldr-pick { position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%; background: var(--bg-inset); box-shadow: inset 0 0 0 2px var(--line-strong); --sw: var(--gold); }
.ldr-pick.low { --sw: var(--danger); }
.ldr-pick-ticks {
  position: absolute; inset: 4px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(167, 175, 194, .7) 0 2deg, rgba(0, 0, 0, 0) 2deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 67%); mask: radial-gradient(circle, transparent 66%, #000 67%);
}
.ldr-pick-hand { position: absolute; inset: 0; border-radius: 50%; }
.ldr-pick-hand::before { content: ""; position: absolute; left: calc(50% - 1.5px); top: 4px; width: 3px; height: 9px; border-radius: 2px; background: var(--sw); box-shadow: 0 0 8px var(--sw); }
.ldr-pick-num { position: absolute; inset: 0; display: grid; place-items: center; font: 700 1.05rem/1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.ldr-pick.low .ldr-pick-num { color: var(--danger); }
.tv-screen .ldr-pick { width: 3.4em; height: 3.4em; }
.tv-screen .ldr-pick-num { font-size: 1.1em; }

/* ---------- Round reveal: curtain and notes ---------- */
.rv { position: relative; overflow-x: clip; margin-inline: -16px; padding-inline: 16px; }
.rv .cine.fx-drop { margin-inline: 0; padding-inline: 0; } /* .rv already clips at the gutter */
.rv.running { cursor: pointer; }
.rv-curtain { position: absolute; inset: -10px 14px; z-index: 6; display: flex; pointer-events: none; }
.rv-curtain i {
  flex: 1; will-change: transform;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 82%, rgba(0, 0, 0, .3)),
    repeating-linear-gradient(90deg, #5a0f26 0 6px, #8a1b39 12px, #a8244a 16px, #8a1b39 20px, #5a0f26 26px);
}
.rv-curtain .l { transform-origin: left center; border-radius: 0 0 14px 0; }
.rv-curtain .r { transform-origin: right center; border-radius: 0 0 0 14px; }
.rv-notes { text-align: center; transition: opacity 400ms ease-out; }
.rv-notes.rv-wait { opacity: 0; }
.tv-screen .rv-note, .tv-screen .rv-hard { font-size: .9em; }

/* ---------- Deal popup picture ---------- */
.dpx { position: relative; height: 124px; margin-top: calc(var(--s2) * -1); display: grid; place-items: end center; padding-bottom: 6px; perspective: 520px; cursor: pointer; }
.dpx-light {
  position: absolute; left: 50%; top: -24px; width: 230px; height: 150px; translate: -50% 0; pointer-events: none;
  background: radial-gradient(ellipse 50% 32% at 50% 92%, rgba(255, 244, 234, .35), rgba(255, 244, 234, 0)),
    linear-gradient(180deg, rgba(255, 244, 234, .02), rgba(255, 244, 234, .2));
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%);
  animation: dpx-light 700ms ease-out both;
}
.dpx-hand { position: relative; display: flex; align-items: flex-end; justify-content: center; }
.dpx-card {
  display: grid; place-items: center; width: 56px; height: 78px; border-radius: 9px; padding: 4px;
  font: 800 9.5px/1.1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; text-align: center;
  background: var(--face); color: var(--ink); box-shadow: 0 4px 0 var(--edgec), 0 10px 18px rgba(0, 0, 0, .4);
}
.dpx-card.c0 { --face: var(--dim); --edgec: #0c1a2c; --ink: var(--dim-text); font: 700 22px/1 var(--font-display); }
.dpx-card.c1 { --face: var(--p1); --edgec: var(--p1-edge); --ink: var(--p1-ink); }
.dpx-card.c2 { --face: var(--p2); --edgec: var(--p2-edge); --ink: var(--p2-ink); width: 66px; height: 92px; font-size: 10.5px; }
.dpx-card.c3 { --face: var(--p3); --edgec: var(--p3-edge); --ink: var(--p3-ink); }
/* Start + End: dealt in from above, landing fanned in your hand. */
.dpx.endsPicker .dpx-card.c1 { rotate: -9deg; translate: -4px 2px; animation: dpx-deal 860ms cubic-bezier(.2, .8, .3, 1) both; }
.dpx.endsPicker .dpx-card.c3 { rotate: 9deg; translate: 4px 2px; animation: dpx-deal 860ms 170ms cubic-bezier(.2, .8, .3, 1) both; }
/* The Trick Shot: spins in alone and stops facing you. */
.dpx.trickPicker .dpx-card.c2 { animation: dpx-spin 1300ms cubic-bezier(.22, .7, .25, 1) both; }
.dpx.trickPicker .dpx-light { animation: dpx-light 700ms ease-out both, dpx-bright 900ms 900ms ease-out both; }
/* Waiting: three face-down cards under a projector beam that flickers gently; dust drifts through it. */
.dpx.waiting .dpx-card:nth-child(1) { rotate: -8deg; translate: 6px 4px; }
.dpx.waiting .dpx-card:nth-child(3) { rotate: 8deg; translate: -6px 4px; }
.dpx.waiting .dpx-light { left: 18%; top: -30px; width: 260px; rotate: -24deg; transform-origin: 50% 0; animation: dpx-light 700ms ease-out both, dpx-flicker 2400ms 700ms steps(1) infinite; }
.dpx-dust {
  position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background: radial-gradient(1.5px 1.5px at 30% 30%, #fff4ea, transparent), radial-gradient(1px 1px at 46% 52%, #fff4ea, transparent),
    radial-gradient(1.5px 1.5px at 58% 22%, #fff4ea, transparent), radial-gradient(1px 1px at 40% 70%, #fff4ea, transparent);
  animation: dpx-dust 7s linear infinite;
}
.dpx.still *, .dpx.still *::before { animation: none !important; }
@keyframes dpx-light { from { opacity: 0; } }
@keyframes dpx-bright { 50% { opacity: 1; } 60% { opacity: .7; } to { opacity: 1; } }
@keyframes dpx-deal { from { opacity: 0; transform: translate(150px, -170px) rotate(320deg) rotateY(180deg) scale(.6); } 60% { opacity: 1; } }
@keyframes dpx-spin {
  from { opacity: 0; transform: translateY(-150px) rotateY(-900deg) scale(.55); }
  25% { opacity: 1; }
  72% { transform: translateY(5px) rotateY(12deg) scale(1.06); }
  86% { transform: translateY(-3px) rotateY(-4deg) scale(.99); }
}
@keyframes dpx-flicker { 0% { opacity: .85; } 12% { opacity: .6; } 16% { opacity: .9; } 48% { opacity: .75; } 52% { opacity: .95; } 80% { opacity: .7; } }
@keyframes dpx-dust { from { transform: translate(0, 0); } 50% { transform: translate(8px, -6px); } to { transform: translate(0, 0); } }

/* ---------- TV lobby marquee: the title framed by bulbs that chase (two interleaved sets swap brightness) ---------- */
.tv-marquee {
  position: relative; display: inline-block; padding: .9em 1.4em; border-radius: .6em;
  background: linear-gradient(180deg, #1f2a46, #141d33); box-shadow: 0 .3em 0 #0a1020, inset 0 0 0 .12em var(--gold-edge);
}
.tv-marquee .tv-h1 { margin: 0; }
.tv-bulbs { position: absolute; left: .7em; right: .7em; height: .5em; }
.tv-bulbs.top { top: .2em; }
.tv-bulbs.bottom { bottom: .2em; }
.tv-bulbs i { position: absolute; inset: 0; background: radial-gradient(circle, #fff3c9 0 .13em, rgba(242, 178, 51, .55) .17em, rgba(242, 178, 51, 0) .25em) 0 50% / 1.2em 100% repeat-x; }
.tv-bulbs i + i { left: .6em; opacity: .3; }
.tv-bulbs i:first-child { animation: tv-chase 900ms steps(1) infinite; }
.tv-bulbs i + i { animation: tv-chase 900ms steps(1) infinite reverse; }
@keyframes tv-chase { 0% { opacity: 1; } 50% { opacity: .3; } }

@media (prefers-reduced-motion: reduce) {
  .fx-sheen, .cine.fx-mono::before, .cine.fx-mono::after, .cine.fx-drop::before, .ldr-grain, .ldr-flicker, .dpx-dust { display: none; }
  .core-chain-card.fx-tick::before, .dpx *, .tv-bulbs i { animation: none !important; }
  .tv-bulbs i + i { opacity: 1; }
}

/* ---------- /fx-cards preview (web/js/screens/fx-cards.js) ---------- */
.fxp { padding-bottom: var(--s10); }
.fxp-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.fxp.tv { --col: 1100px; max-width: 1100px; }
.fxp-list { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: var(--s6); }
.fxp-item .h3 { display: flex; align-items: center; gap: var(--s2); }
.fxp-n { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 14px; background: var(--gold); color: var(--text-inverse); font: 700 var(--fs-sm)/1 var(--font-display); }
.fxp-stage { position: relative; margin-top: var(--s3); min-height: 220px; padding: var(--s5) var(--s3); border-radius: var(--radius); background: var(--bg-raised); border: 1px solid var(--line); display: grid; align-content: center; }
.fxp-phone { max-width: 390px; }
.fxp-tv.tv-screen { min-height: 0; aspect-ratio: 16 / 9; font-size: clamp(9px, 1.35vw, 16px); padding: 1.4em 2em; }
.fxp-row { display: flex; align-items: center; gap: var(--s3); justify-content: center; }
.fxp-dialog.dialog { position: relative; left: auto; top: auto; transform: none; margin: 0 auto; animation: none; }
.fxp .tv-marquee { justify-self: center; }
