/* ═══ finale.css — the two endings: TRIUMPH (May Day from the Mausoleum tribune) · THE FALL (the funeral that isn't yours) ═══
   .finale[data-outcome="won|fell"] fills its parent (position:absolute; inset:0 — give the host `position:relative/fixed`).
   Composition + slow zoom only; the app writes the words into .fin-text.  Transform/opacity animation; reduced motion = still frame.
   Era vars (eras.css) tint the sky/red/gold. */
.finale { position: absolute; inset: 0; overflow: hidden; background: var(--night, #09090d); isolation: isolate; color: var(--paper, #e9dfc4); }
.finale .fin-art { position: absolute; inset: -3%; transform-origin: 50% 62%; }
.finale .fin-art svg { width: 100%; height: 100%; display: block; }
@media (min-aspect-ratio: 4/5) { .finale .fin-art { left: 0; right: 0; margin: 0 auto; width: calc(100dvh * .98); -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); } }
.finale .fin-shade { position: absolute; inset: 0; pointer-events: none; z-index: 2; background: linear-gradient(180deg, rgba(0,0,0,.35), transparent 22%, transparent 52%, rgba(0,0,0,.82) 100%); }
.finale .fin-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 0 6vw calc(5vh + env(safe-area-inset-bottom)); text-align: center; font-family: Georgia, 'Times New Roman', serif; text-shadow: 0 2px 12px #000; }
.finale::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: calc(var(--grain, .35) * .55); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

/* slow zoom: in on triumph, out on the fall — the leader gets smaller */
.finale[data-outcome="won"] .fin-art { animation: fin-in 26s ease-out forwards; }
.finale[data-outcome="fell"] .fin-art { animation: fin-out 26s ease-out forwards; filter: saturate(.35) contrast(1.05); }
@keyframes fin-in { from { transform: scale(1); } to { transform: scale(1.1) translateY(-1.5%); } }
@keyframes fin-out { from { transform: scale(1.12); } to { transform: scale(1); } }

/* TRIUMPH: waving banners, rising doves */
.finale .flag { transform-box: fill-box; transform-origin: 0 50%; animation: fin-wave 2.8s ease-in-out infinite alternate; }
.finale .flag.b { animation-duration: 3.4s; animation-delay: -1.2s; }
@keyframes fin-wave { from { transform: skewY(-5deg) scaleX(1); } to { transform: skewY(5deg) scaleX(.93); } }
.finale .dove { opacity: 0; animation: fin-dove var(--dur, 9s) ease-out infinite; animation-delay: var(--dl, 0s); }
@keyframes fin-dove { 0% { transform: translate(0, 120px) scale(.7); opacity: 0; } 12% { opacity: 1; } 100% { transform: translate(var(--dx, 0), -560px) scale(1.15); opacity: 0; } }
.finale .dove .wing { transform-box: fill-box; transform-origin: 50% 100%; animation: fin-flap .5s ease-in-out infinite alternate; }
@keyframes fin-flap { from { transform: scaleY(1); } to { transform: scaleY(.5); } }

/* THE FALL: drooping crape, falling snow */
.finale .drape { transform-box: fill-box; transform-origin: 0 0; animation: fin-drape 5s ease-in-out infinite alternate; }
.finale .drape.b { animation-delay: -2s; }
@keyframes fin-drape { from { transform: skewY(-1.5deg); } to { transform: skewY(1.5deg); } }
.finale .fsnow { opacity: 0; animation: fin-snow linear infinite; animation-duration: var(--dur, 8s); animation-delay: var(--dl, 0s); }
@keyframes fin-snow { 0% { transform: translate(0, -12px); opacity: 0; } 10% { opacity: .8; } 100% { transform: translate(var(--dx, 10px), 860px); opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  .finale .fin-art, .finale .flag, .finale .dove, .finale .dove .wing, .finale .drape, .finale .fsnow { animation: none; }
  .finale .dove { opacity: .85; transform: translate(0, -160px); } .finale .fsnow { opacity: .6; }
  .finale[data-outcome="won"] .fin-art { transform: scale(1.04); }
}
