/*
 * The stream overlays (brand/README.md, "Stream"): OBS browser sources, laid
 * out at 1920×1080 and scaled to the source's size by stream.js. Same identity as the site and the channel art: Klein ground, the
 * mark's 45° lattice, Branco ink, Klein claro accents, Space Grotesk.
 */
@font-face {
  font-family: "Space Grotesk";
  src: url("space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: block;
}

:root {
  --klein: #002fa7;
  --klein-claro: #85a7ff;
  --paper: #f4f5f7;
  --navy: #001447;
  /* One lattice cell, as in the 404 and the channel art. */
  --unit: 24px;
  --lattice-line: rgb(133 167 255 / 0.22);
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

body {
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* A 1920×1080 canvas, so pages lay out in the same pixels OBS composes in. */
.stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: 0 0;
}

/*
 * The lattice as a background: hairlines at ±45°, one every --unit. It drifts
 * one cell along the diagonal every 12 s, slow enough to read as texture and
 * enough to show the stream isn't frozen.
 */
.ground {
  position: absolute;
  inset: 0;
  background: var(--klein);
}
.ground::before {
  content: "";
  position: absolute;
  inset: calc(var(--unit) * -2);
  background:
    repeating-linear-gradient(45deg, transparent 0 calc(var(--unit) * 0.7071 - 1px), var(--lattice-line) 0 calc(var(--unit) * 0.7071)),
    repeating-linear-gradient(-45deg, transparent 0 calc(var(--unit) * 0.7071 - 1px), var(--lattice-line) 0 calc(var(--unit) * 0.7071));
  animation: drift 12s linear infinite;
}
@keyframes drift {
  to {
    transform: translate(var(--unit), var(--unit));
  }
}

/* --- The camera frame (stream.js, frame()) -------------------------------- */

/*
 * A Klein band around the camera, cut at 45° on two opposite corners like the
 * mark's 180° symmetry. Two light streaks run around it, half a lap apart:
 * Branco and Klein claro, the mark's two copies.
 */
.frame {
  position: absolute;
  pointer-events: none;
}
.frame svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}
/* December's lights on the frame (acender() in stream.js), twinkling in three groups out of step. */
.frame .luzes {
  animation: piscar 2.7s ease-in-out infinite;
}
.frame .luzes-1 {
  animation-delay: -0.9s;
}
.frame .luzes-2 {
  animation-delay: -1.8s;
}
@keyframes piscar {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
/* December's snow on the ground (neve() in stream.js), over the lattice. */
.ground .neve {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.frame .streak {
  animation: lap var(--lap, 9s) linear infinite;
}
@keyframes lap {
  from {
    stroke-dashoffset: var(--from);
  }
  to {
    stroke-dashoffset: calc(var(--from) - 1000);
  }
}

/*
 * The name plate: a Klein tab on the frame's bottom edge, its right side cut
 * at 45°. It wipes in along that diagonal and swaps its line now and then.
 */
.plate {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 72px 0 14px;
  background: var(--klein);
  clip-path: polygon(0 0, 100% 0, calc(100% - 52px) 100%, 0 100%);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
  animation: wipe-in 0.8s var(--ease) 0.4s both;
}
.plate img {
  width: 40px;
  height: 40px;
}
.plate .line {
  display: inline-block;
}
.plate .line.swap {
  animation: swap 0.7s var(--ease);
}
.plate .accent {
  color: var(--klein-claro);
}
@keyframes wipe-in {
  from {
    clip-path: polygon(0 0, 0 0, -52px 100%, 0 100%);
  }
}
/* The record plate (stream.js, recordPlate()): the name plate turned 180°, on the frame's top edge. */
.plate.turned {
  padding: 0 14px 0 66px;
  clip-path: polygon(52px 0, 100% 0, 100% 100%, 0 100%);
  font-size: 22px;
  animation-name: wipe-in-turned;
}
.plate.turned .rank {
  font-weight: 600;
  line-height: 1.05;
}
.plate.turned .rank .points {
  display: block;
  color: var(--klein-claro);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.plate.turned .rank small {
  color: var(--klein-claro);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.plate.turned .line {
  padding-left: 12px;
  border-left: 2px solid rgb(133 167 255 / 0.5);
}
@keyframes wipe-in-turned {
  from {
    clip-path: polygon(100% 0, 100% 0, 100% 100%, calc(100% + 52px) 100%);
  }
}
@keyframes swap {
  0% {
    clip-path: inset(0 0 0 0);
  }
  45% {
    clip-path: inset(0 0 0 100%);
  }
  55% {
    clip-path: inset(0 100% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

/* --- Chat (stream.js, chat()) -------------------------------------------- */

.chat {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  overflow: hidden;
  /* Old messages fade out at the top instead of being cut. */
  -webkit-mask: linear-gradient(to bottom, transparent, #000 96px);
  mask: linear-gradient(to bottom, transparent, #000 96px);
}
.message {
  flex: none;
  padding: 12px 16px 13px;
  background: rgb(0 20 71 / 0.55);
  border-left: 4px solid var(--klein-claro);
  font-size: 22px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  animation: wipe-in-message 0.5s var(--ease) both;
}
.message.broadcaster {
  border-left-color: var(--paper);
}
.message.out {
  animation: fade-out 0.6s var(--ease) both;
}
.message .name {
  display: block;
  margin-bottom: 2px;
  color: var(--klein-claro);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.message.broadcaster .name {
  color: var(--paper);
}
.message .name img {
  width: 20px;
  height: 20px;
  margin-right: 6px;
  vertical-align: -4px;
}
.message .emote {
  height: 1.5em;
  vertical-align: -0.38em;
  margin: 0 1px;
}
.message.action .text {
  font-style: italic;
  color: var(--klein-claro);
}
@keyframes wipe-in-message {
  from {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    transform: translateY(12px);
  }
  to {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
    transform: translateX(-24px);
  }
}

/* --- Type ----------------------------------------------------------------- */

.eyebrow {
  margin: 0;
  color: var(--klein-claro);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* The keyboard and the mouse (teclas.js): the game's keys and the mouse's buttons on a navy pane cut at 45° like the
   camera frame, each lit in Branco while it's held. The pane comes while a game is in front and goes when it isn't. */
.teclas {
  position: absolute;
  display: grid;
  place-items: center;
  background: rgb(0 20 71 / 0.55);
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
.teclas.visivel {
  opacity: 1;
}
.teclas svg {
  overflow: visible;
}
.teclas .tecla polygon,
.teclas .tecla rect {
  fill: rgb(0 20 71 / 0.85);
  stroke: rgb(133 167 255 / 0.45);
  stroke-width: 1.5;
  transition:
    fill 0.15s ease-out,
    stroke 0.15s ease-out;
}
.teclas .tecla text {
  fill: var(--klein-claro);
  font-size: 16px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  transition: fill 0.15s ease-out;
}
.teclas .tecla line {
  stroke: var(--klein-claro);
  stroke-width: 2;
  transition: stroke 0.15s ease-out;
}
/* Held: lit at once, and let go a touch slower, so a tap still shows. */
.teclas .tecla.apertada polygon,
.teclas .tecla.apertada rect {
  fill: var(--paper);
  stroke: var(--paper);
  transition: none;
}
.teclas .tecla.apertada text {
  fill: var(--klein);
  transition: none;
}
.teclas .tecla.apertada line {
  stroke: var(--klein);
  transition: none;
}
.teclas .corpo {
  fill: rgb(0 20 71 / 0.85);
  stroke: rgb(133 167 255 / 0.45);
  stroke-width: 1.5;
}
.teclas .roda rect {
  fill: var(--navy);
}
/* Each tick of the wheel: a chevron that flashes above or below it. */
.teclas .seta {
  fill: none;
  stroke: var(--paper);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
.teclas .seta.girou {
  animation: girou 0.35s ease-out;
}
@keyframes girou {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* The Pix call: a QR code to the site's /pix (pix-qr.svg, from scripts/pix-qr.mjs), in pix.html and conversa.html. */
.chamada {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px 12px 12px;
  background: rgb(0 20 71 / 0.82);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  position: relative;
  overflow: hidden;
}
.chamada img {
  width: var(--qr, 116px);
  height: var(--qr, 116px);
  flex: none;
}
/* It catches the light now and then, like the camera frame (chamada() in stream.js). */
.chamada .luz {
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 42%, rgb(133 167 255 / 0.35) 50%, transparent 58%);
  transform: translateX(-100%);
}
.chamada p {
  margin: 0;
}
.chamada .pix {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--klein-claro);
}
.chamada .convite {
  margin-top: 4px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.chamada .site {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--klein-claro);
}

/* --- The match's numbers (numeros.js) --------------------------------------------------------------------------- */

/* In the game scene: a column beside the camera frame, as tall as it, on a navy pane cut at 45° like the frame. */
.numeros {
  position: absolute;
  width: 196px;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgb(0 20 71 / 0.62);
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  opacity: 0;
  transform: translateX(-12px);
  transition:
    opacity 0.6s var(--ease),
    transform 0.6s var(--ease);
}
.numeros.visivel {
  opacity: 1;
  transform: none;
}
.numeros .titulo {
  margin: 0 0 2px;
  color: var(--klein-claro);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.numeros.mvp .titulo::after {
  content: " · MVP";
  color: var(--paper);
}
.numeros .linha {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 -8px;
  padding: 0 8px;
}
.numeros .rotulo {
  color: var(--klein-claro);
  font-size: 17px;
  font-weight: 500;
}
.numeros .valor {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
/* A number that went up: its line lights in Branco and a +1 rises beside it. */
.numeros .linha::after {
  content: attr(data-mais);
  position: absolute;
  right: 58px;
  top: 4px;
  color: var(--paper);
  font-size: 16px;
  font-weight: 700;
  opacity: 0;
}
.numeros .linha.subiu {
  animation: subiu 1.8s var(--ease);
}
.numeros .linha.subiu .rotulo,
.numeros .linha.subiu .valor {
  animation: subiu-tinta 1.8s var(--ease);
}
.numeros .linha.subiu::after {
  animation: mais-um 1.8s var(--ease);
}
@keyframes subiu {
  0%,
  35% {
    background: var(--paper);
  }
  100% {
    background: transparent;
  }
}
@keyframes subiu-tinta {
  0%,
  35% {
    color: var(--klein);
  }
}
@keyframes mais-um {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  20%,
  60% {
    opacity: 1;
    color: var(--klein);
  }
  100% {
    opacity: 0;
    transform: translateY(-18px);
  }
}

/* In Conversa: the match that just ended, in the topic's place under the camera. */
.fim-de-partida {
  position: absolute;
  left: 64px;
  top: 712px;
  width: 700px;
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.6s var(--ease),
    transform 0.6s var(--ease);
}
.fim-de-partida.visivel {
  opacity: 1;
  transform: none;
}
.fim-de-partida p {
  margin: 0;
}
.fim-de-partida .eyebrow {
  font-size: 18px;
}
.fim-de-partida .resultado {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 10px 0 18px;
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
/* The result on its colour, the site's ranked records' pair (brand/README.md). */
.fim-de-partida .resultado .palavra {
  padding: 4px 16px 8px;
  background: var(--navy);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.fim-de-partida .resultado.win .palavra {
  background: #007645;
}
.fim-de-partida .resultado.loss .palavra {
  background: #b53031;
}
.fim-de-partida .resultado .placar {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fim-de-partida .resultado .selo {
  padding: 6px 12px 7px;
  background: var(--paper);
  color: var(--klein);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.fim-de-partida .tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
/* Valorant's five: K/D/A wide, then ACS and headshots; first kills and damage per round half a row each. */
.fim-de-partida.valorant .tile:first-child,
.fim-de-partida.valorant .tile:nth-child(n + 4) {
  grid-column: span 2;
}
.fim-de-partida .tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px 12px;
  background: rgb(0 20 71 / 0.62);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.fim-de-partida .tile .valor {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.fim-de-partida .tile .rotulo {
  color: var(--klein-claro);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.fim-de-partida .accent {
  color: var(--klein-claro);
}
