/* End screen v2, built from Figma "End screen" (file CmD5wuS76aqLyzzpSVK2J5, node 2057:2022).
   Numbers are Figma pixels on the 2752 x 1548 frame times --u, like title-v2.css. The tv-btn buttons come from there. */
#s-finale { --u: calc(100cqw / 2752); --tv-gold: var(--brand-orange, #fcb24f); background: #000; overflow: hidden; }
#s-finale .ev-art { position: absolute; left: 0; top: 0; width: calc(2752 * var(--u)); height: calc(1548 * var(--u)); pointer-events: none;
  transform-origin: 0 0; scale: var(--cover, 1); translate: calc((1 - var(--cover, 1)) * 50cqw) calc((1 - var(--cover, 1)) * 50cqh); }
.ev-art > * { position: absolute; }
/* deep space: the Figma picture under a blue multiply, darkened towards the top (Figma "Background", 2057:1866) */
.ev-space { inset: 0; background: linear-gradient(rgba(0,0,0,.45), transparent 48%), linear-gradient(rgba(59,133,237,.5), rgba(59,133,237,.5)), url("figma/end/space.webp") center / cover;
  background-blend-mode: normal, multiply, normal; }
/* a few brighter stars that twinkle on top */
.ev-stars { inset: 0; opacity: 0;
  background: radial-gradient(circle at 18% 22%, #fff 0 .08cqw, transparent .3cqw), radial-gradient(circle at 33% 64%, #9fd0ff 0 .07cqw, transparent .28cqw),
    radial-gradient(circle at 52% 14%, #fff 0 .09cqw, transparent .34cqw), radial-gradient(circle at 68% 58%, #bfe0ff 0 .07cqw, transparent .3cqw),
    radial-gradient(circle at 84% 30%, #fff 0 .08cqw, transparent .3cqw), radial-gradient(circle at 44% 82%, #fff 0 .06cqw, transparent .26cqw),
    radial-gradient(circle at 76% 84%, #9fd0ff 0 .07cqw, transparent .28cqw), radial-gradient(circle at 25% 44%, #fff 0 .06cqw, transparent .24cqw); }
.ev-rocks { left: 0; top: calc(6 * var(--u)); width: calc(2752 * var(--u)); height: calc(1536 * var(--u)); object-fit: cover; image-rendering: pixelated; }

/* "Key Message" panel */
.ev-box { position: absolute; z-index: 2; left: 50%; top: 50%; translate: -50% -50%; width: calc(1370 * var(--u));
  display: flex; flex-direction: column; align-items: center; gap: calc(71.153 * var(--u));
  padding: calc(60.988 * var(--u)) calc(132.141 * var(--u)); box-sizing: border-box;
  background: rgba(0, 0, 0, .75); border: calc(5.082 * var(--u)) solid #fff; border-radius: calc(10.165 * var(--u)); color: #fff; text-align: center; }
.ev-h { margin: 0; font: 300 calc(91.482 * var(--u)) / 1.15 'ivyora-display', Georgia, serif; letter-spacing: 0; text-shadow: none; outline: none; }
.ev-p { margin: calc(20.329 * var(--u) - 71.153 * var(--u)) 0 0; font: 400 calc(40.659 * var(--u)) / 1.4 var(--font-body); }
.ev-actions { display: flex; gap: calc(30.494 * var(--u)); padding-top: calc(15.247 * var(--u)); }
#s-finale .tv-btn { width: auto; height: calc(111.812 * var(--u)); box-sizing: border-box; padding: 0 calc(50.824 * var(--u));
  border-width: calc(5.082 * var(--u)); border-radius: calc(10.165 * var(--u)); font-size: calc(40.659 * var(--u)); letter-spacing: calc(1.6264 * var(--u));
  filter: drop-shadow(0 calc(10.165 * var(--u)) 0 #000); }

/* the animation (game.js adds .play once Mr Average's finale is over): space eases in, the rocks drift in from
   the edges and keep floating, the stars twinkle, then the panel, heading, line and buttons rise in turn */
#s-finale .ev-art > *, #s-finale .ev-box, #s-finale .ev-box > * { opacity: 0; }
#s-finale.play .ev-space { animation: evSpace 9s ease-out both; }
#s-finale.play .ev-stars { animation: evIn 1s 1.4s both, evTwinkle 2.6s 2.4s ease-in-out infinite alternate; }
#s-finale.play .ev-rocks { animation: evRocks 2.2s cubic-bezier(.2, .8, .2, 1) both, evFloat 7s 2.2s ease-in-out infinite alternate; }
#s-finale.play .ev-box { animation: evBox .7s 1.1s cubic-bezier(.2, .9, .3, 1.2) both; }
#s-finale.play .ev-h { animation: evRise .7s 1.5s ease-out both; }
#s-finale.play .ev-p { animation: evRise .7s 1.9s ease-out both; }
#s-finale.play .ev-actions { animation: evRise .6s 2.3s ease-out both; }
@keyframes evSpace { from { opacity: 0; transform: scale(1.15); } to { opacity: 1; transform: none; } }
@keyframes evRocks { from { opacity: 0; transform: scale(1.3); } to { opacity: 1; transform: none; } }
@keyframes evFloat { from { opacity: 1; transform: none; } to { opacity: 1; transform: scale(1.02) translateY(-.4%); } }
@keyframes evIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes evTwinkle { from { opacity: 1; } to { opacity: .25; } }
@keyframes evBox { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes evRise { from { opacity: 0; transform: translateY(calc(30 * var(--u))); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  #s-finale.play .ev-art > *, #s-finale.play .ev-box, #s-finale.play .ev-box > * { animation: evIn .4s both !important; }
}
/* phones upright: a wider panel */
@media (max-aspect-ratio: 1/1) { #s-finale { --u: calc(100cqw / 1500); } #s-finale .ev-art { --u: calc(100cqw / 2752); } .ev-box { width: 90cqw; } }
/* the leaderboard button is focused so Enter works; a lighter gold shows it instead of the browser's ring */
#s-finale .tv-btn:focus-visible { outline: none; background-color: rgba(255, 255, 255, .12); }
#s-finale .tv-btn-primary:focus-visible { background-color: #ffc46e; border-color: #ffc46e; }

/* 3 Dec: the panel uses the same type sizes as the rest of the game (the planet-complete card), not the large Figma scale */
#s-finale .ev-box { width: min(90%, 36em); gap: 1em; padding: 1.6em 2.2em; border-width: 2px; border-radius: 4px; font-size: clamp(13px, 1.1cqw, 26px); }
#s-finale .ev-h { font-size: 2.4em; }
#s-finale .ev-p { margin-top: -.4em; font-size: 1em; }
#s-finale .ev-actions { gap: .8em; padding-top: .3em; }
#s-finale .tv-btn { height: auto; padding: .75em 1.3em; border-width: 2px; border-radius: 4px; font-size: 1em; letter-spacing: .04em; filter: drop-shadow(0 4px 0 #000); }
