/* ═══════════════════════════════════════════════════════════════════════
   CAPITOL — finale.css              (#6  Finale cinematic)
   Visuals for each step of the end-of-game sequence; pair with finale.js (markup per step).
   The game keeps driving the reveal (it appends one .fin-step per step to #finale). Each scene
   is absolutely positioned and the previous one fades out automatically — no JS needed.
   Gavel strike → newsreel montage scroll → flag lowers in the storm → flag rises at dawn →
   verdict ledger → fade to THE HILL.   transform/opacity only; reduced-motion = quick fades.
   ═══════════════════════════════════════════════════════════════════════ */

#finale { z-index: 100; padding: 0; justify-content: flex-start; background: #04050b; display: block; overflow: hidden; }
#finale::before, #finale::after { content: ""; position: absolute; left: 0; right: 0; height: 5.5vh; background: #000; z-index: 20; pointer-events: none; }
#finale::before { top: 0; } #finale::after { bottom: 0; }
.fin-step { position: absolute; inset: 0; display: block; }
.fin-step *, .fin-step *::before, .fin-step *::after { box-sizing: border-box; }
.fin-step:not(:last-child) { animation: step-out .9s ease forwards; pointer-events: none; }
@keyframes step-out { to { opacity: 0; transform: scale(1.04); visibility: hidden; } }
.fin-scene { position: absolute; inset: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8vh 18px; animation: scene-in 1s ease both; font-family: Georgia, 'Times New Roman', serif; color: #f3ebd6; }
@keyframes scene-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; } }
.fin-scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .55) 100%); }
.fin-line { position: absolute; left: 0; right: 0; bottom: 14vh; z-index: 6; padding: 0 22px; font: italic 20px/1.35 Georgia, serif; text-shadow: 0 2px 14px #000; animation: line-in 1.2s 1s ease both; }
.fin-line2 { position: absolute; left: 0; right: 0; bottom: 8.4vh; z-index: 6; padding: 0 26px; font: italic 14px/1.4 Georgia, serif; color: #cdbf9d; animation: line-in 1.2s 2.6s ease both; }
@keyframes line-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; } }
.fin-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff3d0; animation: fin-tw 3s ease-in-out infinite; }
@keyframes fin-tw { 0%, 100% { opacity: .2; } 50% { opacity: .95; } }

/* ── 1 · gavel ── */
.s-gavel { background: radial-gradient(ellipse at 50% 45%, #1a2150, #05060f 70%); }
.fin-flash { position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash .5s 1.06s ease-out both; z-index: 5; }
@keyframes flash { 0% { opacity: 0; } 12% { opacity: .55; } 100% { opacity: 0; } }
.gavel-stage { position: relative; width: 220px; height: 190px; animation: shake .5s 1.06s ease-out both; }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-5px, 4px); } 35% { transform: translate(4px, -3px); } 60% { transform: translate(-2px, 2px); } }
.gavel { width: 100%; height: 100%; overflow: visible; }
.gv-arm { transform-box: view-box; transform-origin: 158px 128px; animation: strike 1.25s .55s cubic-bezier(.5, 0, .75, 1) both; transform: rotate(48deg); }
@keyframes strike { 0% { transform: rotate(48deg); } 38% { transform: rotate(0deg); } 52% { transform: rotate(11deg); } 66% { transform: rotate(0deg); } 100% { transform: rotate(0deg); } }
.fin-ring { position: absolute; left: 42px; bottom: 6px; width: 40px; height: 14px; margin-left: 0; border-radius: 50%; border: 3px solid rgba(255, 212, 121, .85); opacity: 0; animation: ring 1.1s 1.06s ease-out both; }
.fin-ring.r2 { animation-delay: 1.22s; border-color: rgba(255, 255, 255, .6); }
@keyframes ring { from { transform: scale(.4); opacity: .95; } to { transform: scale(15, 11); opacity: 0; } }
.fin-title { margin-top: 28px; font: 900 clamp(48px, 15vw, 78px)/1 Georgia, serif; letter-spacing: .05em; background: linear-gradient(180deg, #fff6cf, #ffd479 50%, #f0a03a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #7a1d2c) drop-shadow(0 10px 22px rgba(0, 0, 0, .6)); animation: slam .55s 1.06s cubic-bezier(.2, 1.1, .3, 1) both; }
@keyframes slam { from { transform: scale(2.4); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1); opacity: 1; } }
.fin-sub { margin-top: 14px; font: 700 11px/1 sans-serif; letter-spacing: .5em; padding-left: .5em; color: #b9c0e6; animation: line-in 1s 1.9s ease both; }

/* ── 2 · newsreel montage ── */
.s-reel { background: radial-gradient(ellipse at 50% 40%, #2a2216, #0a0805 75%); padding: 7vh 0; justify-content: flex-start; }
.reel-bug { position: absolute; z-index: 8; left: 22px; top: 8vh; font: 700 9px/1 sans-serif; letter-spacing: .3em; color: rgba(255, 236, 190, .75); }
.reel-bug i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #e23b2e; animation: fin-rec 1s steps(1) infinite; }
@keyframes fin-rec { 50% { opacity: .15; } }
.reel-frame { position: relative; width: min(86vw, 380px); height: 72vh; margin-top: 4vh; overflow: hidden; z-index: 2;
  -webkit-mask: linear-gradient(180deg, transparent 0, #000 9%, #000 88%, transparent 100%); mask: linear-gradient(180deg, transparent 0, #000 9%, #000 88%, transparent 100%); }
.reel-track { display: flex; flex-direction: column; gap: 16px; padding: 3vh 8px 20vh; animation: reel-scroll calc(var(--n) * .62s + 1.6s) .6s linear both; will-change: transform; }
@keyframes reel-scroll { from { transform: translateY(0); } to { transform: translateY(calc(var(--shift) * -1)); } }
.paper-card { width: 100%; padding: 14px 16px; border-radius: 3px; font-family: Georgia, serif; color: #1b1810; text-align: left; transform: rotate(var(--r, -1.2deg));
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .32  0 0 0 0 .12  0 0 0 .55 -.12'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>"), linear-gradient(180deg, #f7edcd, #e8d8a8);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .6), inset 0 0 22px rgba(140, 95, 30, .35); animation: reel-in .9s calc(var(--i) * .62s + .2s) cubic-bezier(.12, .8, .2, 1) both; }
@keyframes reel-in { from { transform: rotate(calc(var(--r) + 540deg)) scale(.05) translateY(30px); opacity: 0; } to { transform: rotate(var(--r)) scale(1); opacity: 1; } }
.paper-card .pc-mast { font: 700 8.5px/1 Georgia, serif; letter-spacing: .38em; color: #6c6044; border-bottom: 1px solid rgba(27, 24, 16, .45); padding-bottom: 6px; margin-bottom: 9px; }
.paper-card .pc-text { font: 900 21px/1.12 Georgia, serif; text-transform: uppercase; text-wrap: balance; }
.paper-card .pc-date { margin-top: 8px; font: italic 11px/1 Georgia, serif; color: #6c6044; }
.reel-grain { position: absolute; inset: -50%; z-index: 7; pointer-events: none; opacity: .26; mix-blend-mode: overlay; animation: fin-grain .6s steps(1) infinite;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
@keyframes fin-grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); } 40% { transform: translate(5%, -7%); } 60% { transform: translate(-3%, -3%); } 80% { transform: translate(7%, 5%); } }
.reel-flick { position: absolute; inset: 0; z-index: 7; background: #000; opacity: 0; pointer-events: none; animation: fin-flick .22s steps(1) infinite; }
@keyframes fin-flick { 0% { opacity: 0; } 25% { opacity: .08; } 50% { opacity: .02; } 75% { opacity: .1; } }
.spr { position: absolute; z-index: 7; top: -12px; bottom: -12px; width: 12px; opacity: .17; animation: fin-spr .5s linear infinite; background: repeating-linear-gradient(180deg, transparent 0 10px, #e9dfc0 10px 22px, transparent 22px 34px); }
.spr.l { left: 5px; } .spr.r { right: 5px; }
@keyframes fin-spr { to { transform: translateY(34px); } }
.reel-cap { position: absolute; z-index: 8; left: 0; right: 0; bottom: 9vh; font: italic 700 19px/1.3 Georgia, serif; color: #f3e6c0; text-shadow: 0 2px 12px #000; animation: line-in 1s calc(var(--n) * .62s + 1.2s) ease both; }

/* ── 3 · storm ── */
.s-storm { background: linear-gradient(180deg, #05070f 0%, #101a36 55%, #1b2447 100%); }
.cloud-bank { position: absolute; left: -20%; right: -20%; top: -8%; height: 46%; opacity: .9; animation: cloud-drift 18s ease-in-out infinite alternate;
  background: radial-gradient(ellipse at 20% 40%, #0a0e1d 0 38%, transparent 62%), radial-gradient(ellipse at 55% 30%, #131a33 0 40%, transparent 64%), radial-gradient(ellipse at 85% 50%, #0b1024 0 38%, transparent 62%); }
@keyframes cloud-drift { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
.lightning { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 12%, #fff, rgba(190, 210, 255, .5) 40%, transparent 70%); opacity: 0; animation: lightning 6s 1s steps(1) infinite; z-index: 3; }
@keyframes lightning { 0%, 100% { opacity: 0; } 3% { opacity: .9; } 5% { opacity: .1; } 7% { opacity: .75; } 11% { opacity: 0; } 55% { opacity: 0; } 57% { opacity: .55; } 60% { opacity: 0; } }
.bolt { position: absolute; top: 4%; z-index: 4; width: 34px; opacity: 0; filter: drop-shadow(0 0 12px #cfe0ff); } .bolt.b1 { left: 26%; animation: bolt 6s 1s steps(1) infinite; } .bolt.b2 { left: 66%; top: 8%; width: 24px; animation: bolt 6s 3.5s steps(1) infinite; }
@keyframes bolt { 0%, 100% { opacity: 0; } 3% { opacity: 1; } 6% { opacity: 0; } 7% { opacity: .9; } 10% { opacity: 0; } }
.fin-capitol { position: absolute; left: 50%; bottom: 8.5vh; width: min(150vw, 640px); transform: translateX(-50%); z-index: 2; }
.fin-win { animation: fin-win 5s steps(1) infinite; } .fin-win.w1 { animation-duration: 7s; animation-delay: -2s; } .fin-win.w2 { animation-duration: 9s; animation-delay: -5s; }
@keyframes fin-win { 0%, 100% { opacity: 1; } 40% { opacity: .3; } 46% { opacity: 1; } 78% { opacity: .5; } 82% { opacity: 1; } }
.rain { position: absolute; z-index: 5; top: -40%; left: -20%; width: 140%; height: 200%; pointer-events: none; opacity: .8; background: repeating-linear-gradient(100deg, transparent 0 14px, rgba(190, 210, 255, .14) 14px 15.5px); animation: rain .45s linear infinite; }
.rain.r2 { opacity: .5; background: repeating-linear-gradient(100deg, transparent 0 26px, rgba(190, 210, 255, .18) 26px 27.5px); animation-duration: .32s; }
@keyframes rain { to { transform: translate(-30px, 60px); } }
.fin-pole { position: absolute; z-index: 4; left: 50%; bottom: calc(8.5vh + 4px); margin-left: min(25vw, 104px); width: 62px; height: min(44vh, 300px); }
.pole-line { position: absolute; left: 0; bottom: 0; top: 0; width: 3px; background: linear-gradient(90deg, #8a7c58, #d9c58d); box-shadow: 0 0 6px rgba(0, 0, 0, .6); } .pole-line::before { content: ""; position: absolute; left: -2px; top: -5px; width: 7px; height: 7px; border-radius: 50%; background: #ffd479; }
.fin-flag { position: absolute; left: 3px; top: 4px; transform-origin: 0 0; will-change: transform; }
.fin-flag svg { display: block; } .fl-s { animation: fl-rip 1.8s ease-in-out infinite alternate; } @keyframes fl-rip { from { transform: translateY(-1px); } to { transform: translateY(1px); } }
.fin-flag.lower { animation: flag-down 4.6s .9s cubic-bezier(.45, .05, .4, 1) forwards; }
.fin-flag.raise { transform: translateY(calc(min(44vh, 300px) * .46)); animation: flag-up 3.4s 1.2s cubic-bezier(.3, .1, .2, 1) forwards; }
@keyframes flag-down { to { transform: translateY(calc(min(44vh, 300px) * .46)); } }
@keyframes flag-up { to { transform: translateY(0); } }

/* ── 4 · dawn ── */
.s-dawn { background: #070a16; }
.dawn-sky { position: absolute; inset: 0; background: linear-gradient(180deg, #1d2a5e 0%, #7c3f78 38%, #e0645f 62%, #ffb15a 80%, #ffe08a 100%); animation: dawn-rise 4.5s ease-out both; }
@keyframes dawn-rise { from { opacity: 0; } to { opacity: 1; } }
.dawn-sun { position: absolute; left: 50%; bottom: 20vh; width: 210px; height: 210px; margin-left: -105px; border-radius: 50%; background: radial-gradient(circle, #fff6cf 0 26%, rgba(255, 214, 122, .85) 38%, rgba(255, 150, 80, 0) 70%); animation: sun-up 5s .3s cubic-bezier(.2, .7, .2, 1) both; transform: translateY(26vh); }
@keyframes sun-up { to { transform: translateY(-4vh); } }
.s-dawn .fin-capitol { bottom: 6vh; } .s-dawn .fin-pole { bottom: calc(6vh + 4px); }
.fig-stand, .fig-walk { position: absolute; z-index: 5; bottom: calc(6vh - 2px); }
.fig-stand { left: 44%; } .fig-walk { left: 22%; animation: walk-in 1.8s .9s ease-out both; }
@keyframes walk-in { from { transform: translateX(-60px); opacity: 0; } to { transform: none; opacity: 1; } }
.fin-line.dl { bottom: auto; top: 13vh; }
.s-dawn .fin-line2 { bottom: auto; top: calc(13vh + 40px); }
.s-storm .fin-line { bottom: auto; top: 14vh; }
.s-storm::before, .s-dawn::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8.8vh; z-index: 3; background: linear-gradient(#070a14, #03040a); }
.s-dawn::before { height: 6.3vh; }
.s-dawn::after { background: radial-gradient(ellipse at 50% 60%, transparent 50%, rgba(8, 5, 25, .5)); }

/* ── 5 · verdict ledger ── */
.s-verdicts { background: radial-gradient(ellipse at 50% 30%, #1a1f46, #070914 75%); justify-content: center; gap: 18px; }
.fs-kicker { font: 700 10.5px/1 sans-serif; letter-spacing: .34em; color: #ffd479; animation: line-in .8s ease both; }
.fin-verdicts { width: min(86vw, 380px); display: flex; flex-direction: column; gap: 12px; }
.verdict { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, #1a2040, #10142a); border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .45); animation: verdict-in .7s calc(var(--i) * .45s + .35s) cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes verdict-in { from { transform: translateX(-30px) rotate(-3deg); opacity: 0; } to { opacity: 1; } }
.verdict.leaked { border-color: rgba(238, 75, 82, .45); }
.verdict .seal { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; font: 900 20px/1 sans-serif; font-style: normal; color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), 0 4px 10px rgba(0, 0, 0, .5); animation: seal-pop .5s calc(var(--i) * .45s + .8s) cubic-bezier(.3, 1.6, .4, 1) both; }
@keyframes seal-pop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1); } }
.seal.safe { background: radial-gradient(circle at 35% 30%, #5ed59a, #1f8a5a); } .seal.out { background: radial-gradient(circle at 35% 30%, #ff7076, #a5202a); } .seal.own { background: radial-gradient(circle at 35% 30%, #ffe08a, #b8861c); color: #4a3406; }
.verdict .vd-name { font: 700 16px/1.2 Georgia, serif; color: #f3ebd6; } .verdict .vd-line { margin-top: 4px; font: italic 12.5px/1.4 Georgia, serif; color: #a2abc8; }

/* ── 6 · fade to THE HILL ── */
.s-end { background: #030409; animation-duration: 1.6s; }
.end-glow { position: absolute; left: 50%; top: 40%; width: 120vw; height: 120vw; margin: -60vw 0 0 -60vw; border-radius: 50%; background: radial-gradient(circle, rgba(255, 190, 90, .28), transparent 62%); animation: glow-in 3s .4s ease both; }
@keyframes glow-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; } }
.end-the { position: relative; font: 700 20px/1 Georgia, serif; letter-spacing: .7em; padding-left: .7em; color: #ffe8b0; animation: line-in 1.4s .6s ease both; }
.end-hill { position: relative; margin-top: 6px; font: 900 clamp(82px, 27vw, 130px)/.9 Georgia, serif; letter-spacing: .02em; background: linear-gradient(180deg, #fff6cf, #ffd479 48%, #f0a03a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 #7a1d2c) drop-shadow(0 14px 30px rgba(0, 0, 0, .7)); animation: hill-in 2s .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes hill-in { from { opacity: 0; transform: scale(1.18); } to { opacity: 1; } }
.fin-quote { position: relative; margin: 34px 14px 0; max-width: 340px; font: italic 19px/1.4 Georgia, serif; color: #f3ebd6; animation: line-in 1.4s 2.6s ease both; }
.s-end .btn { position: relative; margin-top: 26px; max-width: 340px; width: 100%; animation: line-in 1s 3.4s ease both; background: linear-gradient(180deg, #ffe08a, #e8a021); color: #2a1a04; border: 0; box-shadow: 0 6px 0 #7a1d2c, 0 14px 24px rgba(0, 0, 0, .5); font-weight: 800; letter-spacing: .1em; }
.s-end .btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #7a1d2c; }
.fe-note { position: relative; margin-top: 16px; font: 700 10px/1 sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #6f7894; animation: line-in 1s 3.8s ease both; }

@media (prefers-reduced-motion: reduce) {
  .fin-scene, .fin-line, .fin-line2, .fin-title, .fin-sub, .paper-card, .verdict, .verdict .seal, .end-hill, .end-the, .end-glow, .fin-quote, .s-end .btn, .fe-note, .dawn-sky, .fin-flash, .fs-kicker { animation: none !important; opacity: 1 !important; transform: none !important; }
  .gv-arm, .gavel-stage, .fin-ring, .lightning, .bolt, .rain, .cloud-bank, .reel-grain, .reel-flick, .spr, .fin-win, .fl-s { animation: none !important; }
  .gv-arm { transform: none; } .reel-track { animation: none; } .fin-flag.lower, .fin-flag.raise { animation: none; }
  .fin-step:not(:last-child) { animation: none; display: none; }
}
