/* The result screen after a match (T-37, docs/gdd.md «Интерфейс»; mockup «5 · Победа» on the
   canvas linked there). Built on the kit in ui.css: tokens, fonts, .px-btn. The overlay stays
   over the dimmed field; js/result.js fills it. */

/* Sizes follow the overlay's own width (cqi), not the window: on a laptop the field — and the
   overlay over it — can be much narrower than the window. */
#result.overlay { gap: 22px; container-type: inline-size; }
#result .hidden { display: none !important; }

.res-top { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.res-crown { display: flex; margin-bottom: -4px; color: var(--gold); }

/* The ribbon: a band with two tails behind it (drawn first, so the band covers them). */
.ribbon-wrap { position: relative; padding: 0 clamp(14px, 5.5cqi, 22px); }
.ribbon-wrap .tail {
  position: absolute; top: 16px; bottom: -16px; width: clamp(28px, 10cqi, 40px); box-sizing: border-box;
  background: var(--blue-2); border: 4px solid var(--ink);
}
.ribbon-wrap .tail.l { left: 0; }
.ribbon-wrap .tail.r { right: 0; }
.ribbon {
  position: relative; box-sizing: border-box; min-width: min(240px, 70cqi); padding: 16px clamp(12px, 5.5cqi, 22px);
  background: var(--blue); border: 4px solid var(--ink);
  box-shadow: inset 0 4px 0 var(--blue-3), inset 0 -4px 0 var(--blue-2);
}
.ribbon h1 {
  margin: 0; font-family: var(--font-title); font-weight: 400; font-size: clamp(14px, 6cqi, 26px);
  line-height: 1.15; letter-spacing: 0; white-space: nowrap; color: var(--gold);
  text-shadow: 3px 3px 0 var(--ink);
}
.ribbon-wrap.lose .ribbon {
  background: var(--red-2); box-shadow: inset 0 4px 0 var(--red), inset 0 -4px 0 #7f2620;
}
.ribbon-wrap.lose .tail { background: #7f2620; }
.ribbon-wrap.lose h1 { color: #fff; }
.ribbon-wrap.draw .ribbon { background: var(--panel); box-shadow: inset 0 4px 0 #2f4e6d, inset 0 -4px 0 var(--ink); }
.ribbon-wrap.draw .tail { background: var(--ink); }
.ribbon-wrap.draw h1 { color: var(--snow); }

/* A win: snow and gold sparks around the ribbon. */
.ribbon-wrap .spark { position: absolute; width: 8px; height: 8px; background: #fff; }
.ribbon-wrap .spark.g { width: 12px; height: 12px; background: var(--gold); }
.ribbon-wrap:not(.win) .spark { display: none; }
.ribbon-wrap .s1 { left: 4px; top: -22px; }
.ribbon-wrap .s2 { right: 10px; top: -30px; }
.ribbon-wrap .s3 { left: 44px; bottom: -34px; }
.ribbon-wrap .s4 { right: -14px; top: 30px; }
.ribbon-wrap .s5 { left: -16px; top: 4px; }

/* The reason when it is not the usual one, and the 2v2 score. */
.res-why {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-top: 10px;
  font-family: var(--font-title); font-size: 10px; line-height: 12px; color: var(--muted);
  background: var(--ink);
}
.res-score {
  display: flex; align-items: center; gap: 12px; margin-top: 6px;
  font-family: var(--font-title); font-size: 24px; line-height: 28px; text-shadow: 3px 3px 0 var(--ink);
}
.res-score .c-blue { color: #7fa8f0; }
.res-score .c-red { color: #ff8a80; }
.res-score .colon { color: var(--muted); }

/* «+1» with the gem of my league, and the league bar under it. */
.res-points { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.res-plus { display: flex; align-items: center; gap: 16px; }
.res-plus .plus {
  font-family: var(--font-title); font-size: 40px; line-height: 44px; color: #fff;
  text-shadow: 4px 4px 0 var(--ink);
}
/* The league bar itself is the leaderboard screen's: .lg-bar in css/leaderboard.css. */

/* Big icon buttons without captions (GD): their names are aria-labels. */
.res-btns { display: flex; justify-content: center; gap: clamp(12px, 5cqi, 24px); margin-top: 6px; }
.res-btn { width: clamp(64px, 25cqi, 96px); height: clamp(64px, 25cqi, 96px); padding: 0; }
.res-btn .px-ico.flip { transform: scaleX(-1); }
.res-btn.pulse { animation: res-pulse 0.5s steps(1) infinite alternate; }
@keyframes res-pulse { to { border-color: var(--gold-3); } }

/* The rematch vote: the humans in the room, a check under each who wants another round. */
.res-votes { display: flex; justify-content: center; gap: 18px; }
.res-votes .vote { display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0.5; color: var(--gold); }
.res-votes .vote.yes { opacity: 1; }
.res-votes .vote .dot {
  display: block; width: 8px; height: 8px; margin: 4px 0; background: var(--muted);
  animation: vote-wait 0.6s steps(1) infinite alternate;
}
@keyframes vote-wait { to { opacity: 0.2; } }

@media (max-height: 640px) {
  #result.overlay { gap: 14px; }
  .res-plus .plus { font-size: 30px; line-height: 34px; }
  .res-btn { width: clamp(64px, 21cqi, 80px); height: clamp(64px, 21cqi, 80px); }
}

@media (prefers-reduced-motion: reduce) {
  .res-btn.pulse, .res-votes .vote .dot { animation: none; }
}
