/* Pre-battle VS loading screen (vs.js). Same language as the hero select and lobby: dark glass, hero-colour light,
   gold trim, Luckiest Guy for the big words. Phone landscape first (844x390); a turned phone (html.rot) uses the
   same layout because #vs fills the turned body. */
#vs { --gold: #ffd36b; --gold2: #f5a623; --trim: rgba(255,214,120,.75); --red: #e5484d; --blue: #3b82f6;
  position: fixed; inset: 0; z-index: 58; overflow: hidden; color: #fff; background: #0b0718;
  display: flex; flex-direction: column; gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; opacity: 0; transition: opacity .3s; }
#vs[hidden] { display: none !important; }
#vs.in { opacity: 1; }
#vs.out { opacity: 0; }

/* backdrop: red light from the left, blue from the right, slow rays behind the VS */
#vs .vs-bg { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 90% at 50% 50%, #1c1240 0%, #0b0718 70%); }
#vs .vs-bg .l, #vs .vs-bg .r { position: absolute; top: -10%; bottom: -10%; width: 60%; }
#vs .vs-bg .l { left: -12%; background: radial-gradient(closest-side, rgba(229,72,77,.42), transparent); }
#vs .vs-bg .r { right: -12%; background: radial-gradient(closest-side, rgba(59,130,246,.42), transparent); }
#vs .vs-bg .rays { position: absolute; left: 50%; top: 48%; width: 150vmax; height: 150vmax; transform: translate(-50%, -50%); opacity: .16;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,120,.55) 0 4deg, transparent 4deg 16deg);
  -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 70%); mask: radial-gradient(closest-side, #000 10%, transparent 70%);
  animation: vsSpin 40s linear infinite; }
@keyframes vsSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

#vs .vs-top { position: relative; display: flex; justify-content: center; flex: none; }
/* the Match ID (online), small, top right */
#vs .vs-id { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px;
  background: rgba(16,10,34,.72); border: 1px solid rgba(255,214,120,.4); font: 700 11px/1 'Cinzel', Georgia, serif; letter-spacing: .06em; color: #ffe7a6; }
#vs .vs-id[hidden] { display: none; }
#vs .vs-id small { font: 700 8px/1 'Cinzel', Georgia, serif; letter-spacing: .14em; color: #cdbf9c; }
#vs .vs-mode { font: 400 15px/1 'Luckiest Guy', system-ui, sans-serif; letter-spacing: .12em; color: var(--gold);
  padding: 5px 16px 4px; border: 1px solid var(--trim); border-radius: 999px; background: rgba(16,10,34,.7);
  text-shadow: 0 2px 0 rgba(0,0,0,.5); }

/* the two teams and the VS */
#vs .vs-teams { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 10px; }
#vs .vs-side { display: flex; gap: 8px; min-width: 0; min-height: 0; }
#vs .vs-side.red { justify-content: flex-end; }
#vs .vs-side.blue { justify-content: flex-start; }
#vs .vs-mid { display: grid; place-items: center; width: 74px; }
#vs .vs-mid b { font: 400 58px/1 'Luckiest Guy', system-ui, sans-serif; letter-spacing: .02em;
  background: linear-gradient(180deg, #fff6d0 0%, var(--gold) 45%, var(--gold2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.55)) drop-shadow(0 0 14px rgba(255,190,80,.55)); transform: skewX(-8deg);
  animation: vsPulse 1.8s ease-in-out infinite; }
@keyframes vsPulse { 50% { transform: skewX(-8deg) scale(1.08); } }

/* one player card: big showcase art, hero colour glow, gold trim, plate with names, rank, bar */
#vs .vs-card { --hc: #ffd36b; position: relative; flex: 0 1 190px; min-width: 0; height: 100%; max-height: 320px; align-self: center;
  border-radius: 14px; overflow: hidden; padding: 1.5px;
  background: linear-gradient(160deg, #ffe39a, #b9781a 40%, #6b4510 60%, #ffd36b);
  box-shadow: 0 8px 22px rgba(0,0,0,.55); animation: vsCardIn .5s cubic-bezier(.2,.9,.25,1.12) both; }
#vs .vs-side.red .vs-card:nth-child(2), #vs .vs-side.blue .vs-card:nth-child(2) { animation-delay: .08s; }
#vs .vs-side.red .vs-card { --from: -40px; } #vs .vs-side.blue .vs-card { --from: 40px; }
@keyframes vsCardIn { from { opacity: 0; transform: translateX(var(--from, 0)) scale(.96); } }
#vs .vs-card::before { content: ''; position: absolute; inset: 1.5px; border-radius: 12.5px; z-index: 0;
  background: linear-gradient(180deg, rgba(20,12,40,.92), rgba(8,5,20,.96)); }
#vs .vs-side.red .vs-card::after, #vs .vs-side.blue .vs-card::after { content: ''; position: absolute; left: 1.5px; right: 1.5px; top: 1.5px; height: 4px; z-index: 3;
  border-radius: 12px 12px 0 0; }
#vs .vs-side.red .vs-card::after { background: var(--red); } #vs .vs-side.blue .vs-card::after { background: var(--blue); }
#vs .vs-glow { position: absolute; z-index: 1; left: 50%; top: 38%; width: 120%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--hc) 55%, transparent), transparent 75%); opacity: .85; }
#vs .vs-art { position: absolute; z-index: 2; inset: 1.5px 1.5px 0; overflow: hidden; border-radius: 12.5px; }
/* portrait crop of the 3/4 showcase art: a bit larger than the card, top-anchored on the face */
#vs .vs-art img { position: absolute; left: 50%; top: 2%; height: 118%; width: auto; max-width: none; transform: translateX(-50%);
  object-fit: contain; -webkit-user-drag: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
#vs .vs-side.blue .vs-art img { transform: translateX(-50%) scaleX(-1); }   /* the blue team faces left, towards the VS */
#vs .vs-plate { position: absolute; z-index: 3; left: 1.5px; right: 1.5px; bottom: 1.5px; padding: 26px 8px 7px; border-radius: 0 0 12.5px 12.5px;
  background: linear-gradient(180deg, transparent 0%, rgba(8,5,20,.82) 28%, rgba(8,5,20,.96) 100%); display: flex; flex-direction: column; gap: 3px; }
#vs .vs-hero { font: 400 20px/1 'Luckiest Guy', system-ui, sans-serif; color: var(--hc); letter-spacing: .04em; text-shadow: 0 2px 0 rgba(0,0,0,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#vs .vs-name { font: 800 12px/1.15 system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
#vs .vs-you { flex: none; font: 900 9px/1 system-ui, sans-serif; letter-spacing: .1em; color: #1a1200; background: var(--gold); padding: 3px 5px; border-radius: 3px; }
#vs .vs-rank { display: flex; align-items: center; gap: 5px; min-height: 22px; font-size: 11px; color: #d9d3ec; }
#vs .vs-rank .badge { flex: none; }
#vs .vs-stars { color: var(--gold); letter-spacing: .02em; white-space: nowrap; }
#vs .vs-stars i { font-style: normal; color: rgba(255,214,120,.35); }
#vs .vs-rank em { margin-left: auto; font-style: normal; font-weight: 800; color: #b9b3cc; }
#vs .vs-bar { position: relative; height: 14px; border-radius: 7px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,214,120,.45); overflow: hidden; }
#vs .vs-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 7px; transition: width .25s;
  background: linear-gradient(90deg, var(--gold2), var(--gold)); }
#vs .vs-bar span { position: relative; display: block; text-align: center; font: 900 10px/13px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
#vs .vs-card.ready .vs-bar i { background: linear-gradient(90deg, #2fb36e, #6ff0a8); }
#vs .vs-card.me { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(255,211,107,.55), 0 8px 22px rgba(0,0,0,.55); }
#vs .vs-card.lag { filter: grayscale(.8) brightness(.7); }
#vs .vs-card.lag .vs-bar span::after { content: ' · JOINS LATE'; }
/* 2v2: two narrower cards per side */
#vs .vs-card.two { flex-basis: 150px; }
#vs .vs-card.two .vs-hero { font-size: 16px; }
/* 3v3 / 4v4 (FEATURES-BRIEF 37a): a 2 x 2 grid of small cards per side (844x390 and 667x375) */
#vs .vs-side.many { display: grid; grid-template-columns: repeat(2, minmax(0, 150px)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; align-content: stretch; }
#vs .vs-side.red.many { justify-content: end; } #vs .vs-side.blue.many { justify-content: start; }
#vs .vs-side.many .vs-card { height: auto; max-height: none; min-height: 0; align-self: stretch; border-radius: 11px; }
#vs .vs-side.many .vs-card::before, #vs .vs-side.many .vs-art { border-radius: 9.5px; }
#vs .vs-side.many .vs-art img { top: 0; height: 160%; }
#vs .vs-side.many .vs-plate { padding: 14px 6px 5px; gap: 2px; border-radius: 0 0 9.5px 9.5px; }
#vs .vs-side.many .vs-hero { font-size: 13px; }
#vs .vs-side.many .vs-name { font-size: 10.5px; }
#vs .vs-side.many .vs-rank { min-height: 16px; font-size: 9.5px; gap: 3px; }
#vs .vs-side.many .vs-rank canvas { width: 16px !important; height: 16px !important; }
#vs .vs-side.many .vs-you { font-size: 8px; padding: 2px 4px; }
#vs .vs-side.many .vs-bar { height: 11px; }
#vs .vs-side.many .vs-bar span { font-size: 8.5px; line-height: 10px; }
#vs .vs-side.many .vs-card:nth-child(3):last-child { grid-column: 1 / -1; justify-self: center; width: calc(50% - 3px); }

/* map + tip + who we wait for */
#vs .vs-foot { position: relative; flex: none; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 3px; align-items: center;
  padding: 6px 12px; border-radius: 12px; background: rgba(16,10,34,.78); border: 1px solid rgba(255,214,120,.45); }
#vs .vs-foot small { font: 900 9px/1 system-ui, sans-serif; letter-spacing: .14em; color: #1a1200; background: var(--gold); padding: 3px 6px; border-radius: 3px; margin-right: 6px; }
#vs .vs-map { font: 400 15px/1 'Luckiest Guy', system-ui, sans-serif; letter-spacing: .06em; color: #fff; white-space: nowrap; display: flex; align-items: center; }
#vs .vs-tip { font-size: 12px; line-height: 1.25; color: #e9e4f7; display: flex; align-items: center; min-width: 0; }
#vs .vs-tip small { background: rgba(255,255,255,.85); flex: none; }
#vs .vs-wait { grid-column: 1 / -1; font: 800 11px/1 system-ui, sans-serif; color: var(--gold); letter-spacing: .04em; text-align: center; min-height: 11px; }

/* the shared 3-2-1 */
#vs .vs-count { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none;
  font: 400 120px/1 'Luckiest Guy', system-ui, sans-serif; color: var(--gold); background: rgba(8,5,20,.35);
  text-shadow: 0 5px 0 rgba(0,0,0,.55), 0 0 30px rgba(255,190,80,.7); }
#vs .vs-count[hidden] { display: none; }
#vs .vs-count.pop { animation: vsPop .6s cubic-bezier(.2,.9,.25,1.2); }
@keyframes vsPop { from { transform: scale(1.9); opacity: 0; } 40% { opacity: 1; } }
#vs.counting .vs-mid b { animation: none; opacity: .25; }

/* short phones (844x390 and smaller) */
@media (max-height: 420px) {
  #vs { gap: 5px; }
  #vs .vs-mode { font-size: 13px; padding: 4px 12px 3px; }
  #vs .vs-mid { width: 60px; } #vs .vs-mid b { font-size: 46px; }
  #vs .vs-tip { font-size: 11px; }
}
html.short #vs { gap: 5px; }
html.short #vs .vs-mid { width: 60px; }
html.short #vs .vs-mid b { font-size: 46px; }
@media (prefers-reduced-motion: reduce) {
  #vs .vs-bg .rays, #vs .vs-mid b, #vs .vs-card { animation: none; }
}
