/* Results ceremony: every player walks on (last place first), the winner lands last, awards are
   stamped on, then the night's best drawings roll beside a "play again?" bar. */
body[data-phase="final"] #view { display:flex; padding:0; }
.final-show-stage {
  position:relative; width:100%; max-width:1600px; height:100%; min-height:540px; margin:0 auto;
  padding:3vh 4vw 2.4vh; box-sizing:border-box; display:flex; flex-direction:column; gap:1.8vh;
  direction:rtl; isolation:isolate; overflow:hidden; color:var(--lab-ink,#373d42); font-family:'Cairo',sans-serif;
}
.final-show-title { margin:0; text-align:center; font:900 clamp(28px,5.4vh,66px)/1.15 'Cairo',sans-serif; color:var(--lab-ink,#373d42); }
.final-show-title::after { content:''; display:block; width:min(30vw,340px); height:5px; margin:.5vh auto 0; border-bottom:3px solid #b4864d80; border-radius:50%; transform:rotate(-1.5deg); }

.final-show-body { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 0fr; gap:0; transition:grid-template-columns .7s cubic-bezier(.3,.8,.3,1), gap .7s; }
.final-show-stage[data-act="encore"] .final-show-body:has(.final-show-moments) { grid-template-columns:minmax(0,1.75fr) minmax(0,1fr); gap:2.6vw; }

.final-show-lineup { min-width:0; min-height:0; display:grid; grid-template-columns:minmax(0,.82fr) minmax(0,1.6fr); gap:2.2vw; }
.final-show-stage[data-count="1"] .final-show-lineup { grid-template-columns:minmax(0,42%); justify-content:center; }
.final-show-others { min-width:0; min-height:0; display:grid; grid-template-columns:repeat(var(--final-columns,3),minmax(0,1fr)); grid-template-rows:repeat(var(--final-rows,1),minmax(0,1fr)); gap:1.8vh 1.3vw; }

.final-show-player { position:relative; min-width:0; min-height:0; container-type:size; }
.final-show-card {
  position:relative; width:100%; height:100%; box-sizing:border-box; padding:5cqh 5cqw 4cqh;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2cqh;
  background:var(--lab-card,#fffdf5); border:1.5px solid #66685b; border-bottom:max(5px,2.4cqh) solid var(--player-color);
  border-radius:9px 13px 8px 12px / 12px 8px 14px 7px; box-shadow:4px 5px 0 #77684f19;
  opacity:0; transform:translateY(9vh) rotate(-6deg) scale(.7);
}
.final-show-player:nth-child(odd) .final-show-card { rotate:-.8deg; }
.final-show-player:nth-child(even) .final-show-card { rotate:.9deg; }
.final-show-player.is-in .final-show-card { animation:final-show-pop .55s cubic-bezier(.2,1.35,.4,1) both; }
.final-show-avatar { width:min(52cqw,44cqh); height:auto; aspect-ratio:1; box-sizing:border-box; object-fit:cover; background:#fffdf7; border:max(3px,1.4cqh) solid var(--player-color); border-radius:16% 20% 15% 19%; box-shadow:3px 4px 0 #77684f20; }
.final-show-rank { position:absolute; top:3cqh; inset-inline-start:4cqw; min-width:1.9em; box-sizing:border-box; padding:0 .35em; text-align:center; font:900 clamp(14px,9cqh,38px)/1.7 'Cairo',sans-serif; color:#41483e; background:#fff9e6; border:2px solid var(--player-color); border-radius:45% 49% 43% 48%; }
.final-show-text { min-width:0; max-width:100%; display:flex; flex-direction:column; align-items:center; gap:1.5cqh; }
.final-show-name { margin:0; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font:900 clamp(15px,min(10cqh,15cqw),46px)/1.5 'Cairo',sans-serif; color:var(--lab-ink,#373d42); }
.final-show-score { margin:0; font:800 clamp(13px,min(7cqh,10cqw),30px)/1.2 'Cairo',sans-serif; color:#a36252; white-space:nowrap; }
.final-show-award { margin:0; max-width:100%; display:flex; align-items:center; gap:.25em; padding:.1em .5em; box-sizing:border-box; font:800 clamp(11px,min(6.4cqh,8cqw),26px)/1.5 'Cairo',sans-serif; color:#4e5648; background:#fcf0cd; border:1.5px dashed #a18b5e; border-radius:999px; opacity:0; transform:scale(.4) rotate(-9deg); }
.final-show-award-medal { height:1.35em; width:auto; flex:none; }
.final-show-award-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.final-show-player.has-award .final-show-award { animation:final-show-stamp .45s cubic-bezier(.2,1.5,.4,1) both; }

/* Three rows of small cards (8–10 players): tighter spacing, same portrait-over-name layout. */
.final-show-others[data-rows="3"] { gap:1.2vh .9vw; }
.final-show-others[data-rows="3"] .final-show-card { padding:4cqh 4cqw 3cqh; gap:1cqh; }
.final-show-others[data-rows="3"] .final-show-text { gap:0; }
.final-show-others[data-rows="3"] .final-show-avatar { width:min(48cqw,40cqh); }
.final-show-others[data-rows="3"] .final-show-rank { top:3cqh; inset-inline-start:3cqw; font-size:clamp(13px,12cqh,24px); line-height:1.5; }
.final-show-others[data-rows="3"] .final-show-name { font-size:clamp(15px,12cqh,28px); line-height:1.35; }
.final-show-others[data-rows="3"] .final-show-score { font-size:clamp(13px,9cqh,20px); }
.final-show-others[data-rows="3"] .final-show-award { font-size:clamp(11px,8.5cqh,18px); line-height:1.3; padding:0 .55em; }

/* The champion's place is an empty frame until the very end. */
.final-show-player.is-winner:not(.is-in)::before { content:'؟'; position:absolute; inset:0; display:grid; place-items:center; font:900 clamp(70px,22vh,220px)/1 'Cairo',sans-serif; color:#b4864d66; border:3px dashed #a69b82; border-radius:14px 18px 12px 16px; }
.final-show-stage[data-act="drumroll"] .final-show-player.is-winner:not(.is-in)::before { animation:final-show-drumroll .16s linear infinite alternate; }
.final-show-player.is-winner .final-show-card { border-width:2.5px; border-bottom-width:max(8px,2.4cqh); background:#fffaea; box-shadow:7px 9px 0 #77684f26; }
.final-show-player.is-winner.is-in .final-show-card { animation:final-show-slam .7s cubic-bezier(.2,1.5,.35,1) both; }
.final-show-player.is-winner .final-show-avatar { width:min(62cqw,46cqh); }
.final-show-player.is-winner .final-show-rank { position:static; order:-1; min-width:0; padding:0 1em; font-size:clamp(18px,6cqh,40px); color:#fffdf5; background:#9b7040; border-color:#7b572e; border-radius:6px 10px 5px 9px; rotate:-3deg; }
.final-show-player.is-winner .final-show-name { font-size:clamp(22px,min(9cqh,17cqw),64px); }
.final-show-player.is-winner .final-show-score { font-size:clamp(16px,5.4cqh,38px); }
.final-show-player.is-winner .final-show-award { font-size:clamp(14px,min(4.4cqh,8cqw),30px); }
.final-show-confetti { position:absolute; inset:0; pointer-events:none; z-index:3; }
.final-show-confetti-piece { position:absolute; left:50%; top:38%; width:1.5vmin; height:.9vmin; background:var(--c); border-radius:2px; opacity:0; }
.final-show-player.is-winner.is-in .final-show-confetti-piece { animation:final-show-burst 1.9s var(--delay,0ms) cubic-bezier(.12,.7,.3,1) both; }

/* Encore: the best drawings of the night. */
.final-show-moments { min-width:0; min-height:0; overflow:hidden; box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1.2vh; padding:2vh 1.6vw; text-align:center; background:var(--lab-card,#fffdf5); border:1.5px solid #66685b; border-radius:8px 13px 9px 12px / 12px 8px 14px 7px; box-shadow:4px 5px 0 #77684f19; rotate:1.1deg; opacity:0; visibility:hidden; transition:opacity .5s .35s; }
.final-show-stage[data-act="encore"] .final-show-moments { opacity:1; visibility:visible; }
.final-show-moments-title { margin:0; font:900 clamp(18px,3.2vh,38px)/1.2 'Cairo',sans-serif; color:var(--lab-accent,#9b7040); }
.final-show-moments .final-show-moment-frame { width:min(100%,44vh); max-width:100%; aspect-ratio:1; flex:none; padding:0; box-sizing:border-box; border:8px solid #fffdf7; border-radius:3px 7px 4px 6px; outline:1.5px solid #66685b; background:#fffdf7; box-shadow:5px 7px 0 #77684f1c; rotate:-1.6deg; }
.final-show-moment-frame canvas { width:100%; height:100%; display:block; border-radius:0; }
.final-show-moment-prompt { margin:0; max-width:100%; font:900 clamp(18px,3.3vh,40px)/1.25 'Cairo',sans-serif; overflow-wrap:anywhere; }
.final-show-moment-artist { margin:0; font:700 clamp(14px,2.2vh,26px)/1.2 'Cairo',sans-serif; color:var(--lab-accent,#9b7040); }
.final-show-moment-lie { margin:0; max-width:100%; padding:.2em .8em; box-sizing:border-box; font:700 clamp(14px,2.2vh,26px)/1.35 'Cairo',sans-serif; background:#f4e5df; border-radius:5px 9px 4px 8px; overflow-wrap:anywhere; }
.final-show-moments.is-turning > :not(.final-show-moments-title) { animation:final-show-turn .45s ease-out both; }

/* "Play again?" bar: a seat lights up for every player who asks on their phone. */
.final-show-rematch { align-self:center; max-width:64%; box-sizing:border-box; display:flex; align-items:center; justify-content:center; gap:2.4vw; padding:1.4vh 2.4vw; background:#f7e6b2; border:2px solid #66685b; border-radius:8px 13px 9px 12px / 12px 8px 14px 7px; box-shadow:4px 5px 0 #77684f19; opacity:0; transform:translateY(3vh); transition:opacity .5s, transform .5s cubic-bezier(.2,1.2,.4,1); }
.final-show-stage[data-act="encore"] .final-show-rematch { opacity:1; transform:none; }
.final-show-rematch-copy { flex:none; text-align:start; }
.final-show-rematch-call { margin:0; font:900 clamp(26px,5.6vh,66px)/1.1 'Cairo',sans-serif; color:#41483e; white-space:nowrap; }
.final-show-stage[data-act="encore"] .final-show-rematch-call { animation:final-show-nudge 2.6s ease-in-out 1s infinite; transform-origin:center; }
.final-show-rematch-tally { margin:0; font:800 clamp(15px,2.6vh,30px)/1.3 'Cairo',sans-serif; color:#5d6456; white-space:nowrap; }
.final-show-rematch-host { margin:0; font:700 clamp(13px,2.1vh,24px)/1.3 'Cairo',sans-serif; color:#6a6f61; white-space:nowrap; }
.final-show-rematch-seats { flex:0 1 auto; min-width:0; display:flex; flex-wrap:nowrap; gap:.8vw; }
.final-show-rematch-seat { position:relative; width:clamp(36px,8.6vh,96px); aspect-ratio:1; flex:0 1 auto; min-width:0; border:3px dashed #a69b82; border-radius:50%; background:#fffdf7; opacity:.45; filter:grayscale(1); transition:opacity .25s, filter .25s; }
.final-show-rematch-avatar { width:100%; height:100%; display:block; border-radius:50%; object-fit:cover; }
.final-show-rematch-seat.is-in { border:3px solid var(--player-color); opacity:1; filter:none; box-shadow:0 0 0 4px color-mix(in srgb,var(--player-color),transparent 62%); animation:final-show-stamp .4s cubic-bezier(.2,1.6,.4,1) both; }
.final-show-rematch-seat.is-in::after { content:'✓'; position:absolute; inset-inline-end:-18%; bottom:-14%; width:46%; aspect-ratio:1; display:grid; place-items:center; font:900 clamp(11px,2vh,22px)/1 sans-serif; color:#fffdf5; background:#60755d; border:2px solid #fffdf5; border-radius:50%; }

@keyframes final-show-pop { from { opacity:0; transform:translateY(9vh) rotate(-6deg) scale(.7); } to { opacity:1; transform:none; } }
@keyframes final-show-slam { 0% { opacity:0; transform:scale(2.1) rotate(7deg); } 60% { opacity:1; transform:scale(.94) rotate(-1.5deg); } 100% { opacity:1; transform:none; } }
@keyframes final-show-stamp { from { opacity:0; transform:scale(.4) rotate(-9deg); } to { opacity:1; transform:none; } }
@keyframes final-show-burst { 0% { opacity:1; transform:translate(0,0) rotate(0); } 70% { opacity:1; } 100% { opacity:0; transform:translate(var(--bx),calc(var(--by) + 16vmin)) rotate(var(--r)); } }
@keyframes final-show-drumroll { from { transform:translateX(-.5vmin) rotate(-1deg); } to { transform:translateX(.5vmin) rotate(1deg); } }
@keyframes final-show-turn { from { opacity:0; transform:translateY(1.6vh); } to { opacity:1; transform:none; } }
@keyframes final-show-nudge { 0%,78%,100% { transform:none; } 84% { transform:scale(1.07) rotate(-2deg); } 92% { transform:scale(1.04) rotate(1.5deg); } }

@media (prefers-reduced-motion: reduce) {
  .final-show-body, .final-show-moments, .final-show-rematch, .final-show-rematch-seat { transition:none; }
  .final-show-card, .final-show-award { opacity:1; transform:none; }
  .final-show-player:not(.is-in) .final-show-card, .final-show-player:not(.has-award) .final-show-award { visibility:hidden; }
  .final-show-player.is-in .final-show-card, .final-show-player.is-winner.is-in .final-show-card, .final-show-player.has-award .final-show-award,
  .final-show-rematch-seat.is-in, .final-show-moments.is-turning > *, .final-show-stage[data-act] .final-show-rematch-call,
  .final-show-stage[data-act="drumroll"] .final-show-player.is-winner:not(.is-in)::before { animation:none; }
  .final-show-confetti { display:none; }
}
