/* =============================================================================
 * Jogos Intersalas — base
 * =============================================================================
 * A estética é a do site oficial do colégio (cpmpatobranco.com.br): fundo creme,
 * azul-marinho como cor primária, dourado de apoio e bordô nos destaques. Os
 * tokens abaixo foram copiados do CSS compilado de lá — não foram inventados.
 *
 *   --primary    → hsl(214 80% 21%) ≈ #0B2C5F  (azul-marinho)
 *   --secondary  → hsl(46  65% 52%) ≈ #D3AD3C  (dourado)
 *   --accent     → hsl(354 65% 33%) ≈ #8B1E28  (bordô)
 *   --background → hsl(43  33% 95%) ≈ #F5F2EC  (creme)
 *
 * As cores ficam em CANAIS HSL soltos ("214 80% 21%") para poderem ser usadas
 * como `hsl(var(--primary) / .5)` — transparência sem precisar de uma variável
 * nova. É o mesmo esquema do shadcn/Tailwind que o site do colégio usa.
 *
 * Mobile-first: todo `@media` é `min-width`. O telão é a exceção, e mora no
 * telao.css.
 * ========================================================================== */

@import url('fontes.css');

/* -----------------------------------------------------------------------------
 * 1. Tokens
 * -------------------------------------------------------------------------- */

:root {
  /* Cor — idêntico ao site do colégio */
  --background: 43 33% 95%;
  --foreground: 214 80% 21%;
  --card: 0 0% 100%;
  --card-foreground: 214 80% 21%;
  --popover: 0 0% 100%;
  --popover-foreground: 214 80% 21%;
  --primary: 214 80% 21%;
  --primary-foreground: 43 33% 95%;
  --secondary: 46 65% 52%;
  --secondary-foreground: 214 80% 21%;
  --muted: 43 20% 92%;
  --muted-foreground: 220 15% 30%;
  --accent: 354 65% 33%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214 20% 88%;
  --input: 214 20% 88%;
  --ring: 214 80% 21%;

  /* Degradê do herói, também do site do colégio */
  --hero-from: 214 80% 14%;
  --hero-via: 214 80% 21%;
  --hero-to: 214 70% 28%;
  --hero-gold-glow: 46 65% 52%;
  --hero-blue-glow: 214 80% 50%;

  /* Estados. O colégio não tem verde nem âmbar no CSS dele, mas a tabela de
   * jogos precisa sinalizar "classificado", "eliminado" e "sem resultado" sem
   * depender só de texto. Escolhidos para conviver com o marinho e o dourado. */
  --success: 152 52% 30%;
  --success-foreground: 0 0% 100%;
  --warning: 35 78% 42%;
  --warning-foreground: 0 0% 100%;
  --info: 214 65% 42%;
  --info-foreground: 0 0% 100%;

  /* Tipografia */
  --fonte-titulo: 'Roboto Slab', Georgia, 'Times New Roman', serif;
  --fonte-texto: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fonte-numero: 'Roboto', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --texto-xs: .75rem;
  --texto-sm: .875rem;
  --texto-md: 1rem;
  --texto-lg: 1.125rem;
  --texto-xl: 1.375rem;
  --texto-2xl: 1.75rem;
  --texto-3xl: 2.25rem;
  --texto-4xl: 3rem;

  /* Espaço */
  --esp-1: .25rem;
  --esp-2: .5rem;
  --esp-3: .75rem;
  --esp-4: 1rem;
  --esp-5: 1.5rem;
  --esp-6: 2rem;
  --esp-7: 3rem;
  --esp-8: 4rem;

  /* Forma */
  --radius: .5rem;
  --radius-sm: calc(var(--radius) - 2px);
  --radius-lg: calc(var(--radius) + 4px);
  --radius-cheio: 999px;
  --borda: 1px solid hsl(var(--border));

  /* Sombra e movimento — do site do colégio */
  --shadow-card: 0 0 0 1px #0b2c5f0d, 0 2px 4px #0000000d;
  --shadow-card-hover: 0 0 0 1px #0b2c5f14, 0 8px 24px #0000001a;
  --shadow-forte: 0 10px 30px hsl(var(--primary) / .18);
  --transition: cubic-bezier(.2, .8, .2, 1);
  --transicao-rapida: 150ms var(--transition);
  --transicao: 250ms var(--transition);

  --largura: 1200px;
}

/* Tema escuro — usado pelo telão e por quem preferir. Mesmos nomes de token,
 * então nenhum componente precisa saber que trocou de tema. */
.dark,
:root[data-tema='escuro'] {
  --background: 214 80% 6%;
  --foreground: 43 33% 95%;
  --card: 214 70% 10%;
  --card-foreground: 43 33% 95%;
  --popover: 214 70% 10%;
  --popover-foreground: 43 33% 95%;
  --primary: 214 80% 35%;
  --primary-foreground: 43 33% 95%;
  --muted: 214 40% 14%;
  --muted-foreground: 214 20% 65%;
  --accent: 354 65% 40%;
  --destructive: 0 62.8% 30.6%;
  --border: 214 30% 18%;
  --input: 214 30% 18%;
  --ring: 214 80% 35%;
  --success: 152 45% 42%;
  --warning: 35 72% 50%;
  --info: 214 70% 55%;
}

/* -----------------------------------------------------------------------------
 * 2. Reset
 * -------------------------------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--fonte-texto);
  font-size: var(--texto-md);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: hsl(var(--primary)); text-decoration-color: hsl(var(--secondary)); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Quem pediu menos movimento no sistema operacional não recebe nenhum. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -----------------------------------------------------------------------------
 * 3. Tipografia
 * -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--fonte-titulo);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
}

h1 { font-size: var(--texto-3xl); }
h2 { font-size: var(--texto-2xl); }
h3 { font-size: var(--texto-xl); }
h4 { font-size: var(--texto-lg); }

.titulo-secao {
  font-family: var(--fonte-titulo);
  font-size: var(--texto-2xl);
  font-weight: 600;
  margin-bottom: var(--esp-4);
}

.titulo-secao::after {
  content: '';
  display: block;
  width: 3.5rem;
  height: 3px;
  margin-top: var(--esp-3);
  background: hsl(var(--secondary));
  border-radius: var(--radius-cheio);
}

.legenda {
  font-size: var(--texto-sm);
  color: hsl(var(--muted-foreground));
}

.numero {
  font-family: var(--fonte-numero);
  font-variant-numeric: tabular-nums;
}

/* -----------------------------------------------------------------------------
 * 4. Layout
 * -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--largura);
  margin-inline: auto;
  padding-inline: var(--esp-4);
}

main { flex: 1 0 auto; }

.secao { padding-block: var(--esp-6); }

.grade { display: grid; gap: var(--esp-4); }

@media (min-width: 640px) {
  .grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.pilha { display: flex; flex-direction: column; gap: var(--esp-4); }
.linha { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp-3); }
.linha--centro { justify-content: center; }
.espalhado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--esp-3); }

/* -----------------------------------------------------------------------------
 * 5. Cabeçalho e navegação
 * -------------------------------------------------------------------------- */

.cabecalho {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 2px 12px hsl(var(--primary) / .25);
}

.cabecalho__interno {
  display: flex;
  align-items: center;
  gap: var(--esp-4);
  padding-block: var(--esp-3);
  min-height: 4.5rem;
}

.cabecalho__marca {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.cabecalho__marca img { height: 2.5rem; width: auto; flex: none; }

.cabecalho__texto { min-width: 0; }

.cabecalho__titulo {
  font-family: var(--fonte-titulo);
  font-size: var(--texto-lg);
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cabecalho__subtitulo {
  font-size: var(--texto-xs);
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav e ações formam um bloco só, encostado na direita: o `auto` empurra a nav
 * e as ações vêm atrás dela, na mesma linha. */
.cabecalho__nav { margin-left: auto; }

.cabecalho__nav ul {
  display: flex;
  align-items: center;
  gap: var(--esp-1);
  list-style: none;
  padding: 0;
  overflow-x: auto;
}

.cabecalho__nav a {
  display: block;
  padding: var(--esp-2) var(--esp-3);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: var(--texto-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transicao-rapida);
}

.cabecalho__nav a:hover { background: hsl(var(--primary-foreground) / .12); }
.cabecalho__nav a[aria-current='page'] {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.cabecalho__acoes {
  display: flex;
  align-items: center;
  gap: var(--esp-2);
  flex: none;
}

/* A porta do professor. Contorno em vez de preenchimento: é um atalho, não a
 * seção onde o visitante está — e preenchida competiria com o item de menu
 * ativo, que é o que diz onde ele está. */
.cabecalho__professor {
  padding: var(--esp-2) var(--esp-3);
  border: 1px solid hsl(var(--primary-foreground) / .35);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: var(--texto-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transicao-rapida), border-color var(--transicao-rapida);
}

.cabecalho__professor:hover {
  background: hsl(var(--primary-foreground) / .1);
  border-color: hsl(var(--primary-foreground) / .6);
}

/* Menu do celular: o cabeçalho vira duas linhas e a nav rola na horizontal.
 *
 * A nav ganha `order: 2` para a marca e as ações ficarem juntas na primeira
 * linha. Sem isso, como as ações vêm depois da nav no HTML e a nav ocupa a
 * linha inteira, o botão de tema e a porta do professor cairiam sozinhos numa
 * terceira linha, órfãos no meio do nada. */
@media (max-width: 767px) {
  .cabecalho__interno { flex-wrap: wrap; }
  .cabecalho__acoes { order: 2; margin-left: auto; }
  .cabecalho__nav { order: 3; width: 100%; margin-left: 0; }
  .cabecalho__nav ul { padding-bottom: var(--esp-1); }
}

/* Celular estreito: o nome do evento cede espaço para a porta do professor, que
 * no dia do jogo é o que o dono da casa precisa achar. O rótulo encolhe, o alvo
 * de toque não. */
@media (max-width: 480px) {
  .cabecalho__professor { font-size: var(--texto-xs); padding-inline: var(--esp-2); }
}

/* Faixa de aviso logo abaixo do cabeçalho (ex.: "competição ainda sem sorteio"). */
.faixa {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  font-size: var(--texto-sm);
  font-weight: 500;
  text-align: center;
  padding-block: var(--esp-2);
}

/* -----------------------------------------------------------------------------
 * 6. Rodapé
 * -------------------------------------------------------------------------- */

.rodape {
  flex: none;
  margin-top: var(--esp-8);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding-block: var(--esp-5);
  font-size: var(--texto-sm);
}

.rodape a { color: inherit; }

.rodape__grade {
  display: grid;
  gap: var(--esp-4);
}

@media (min-width: 700px) {
  .rodape__grade { grid-template-columns: 1fr auto; align-items: center; }
}

.rodape__escola { font-family: var(--fonte-titulo); font-size: var(--texto-lg); font-weight: 600; }
.rodape__nota { opacity: .8; font-size: var(--texto-xs); margin-top: var(--esp-1); }

/* Assinatura Tricagono — discreta, mas presente: o projeto é doação e a marca
 * aparece uma vez por página, no canto. */
.rodape__assinatura {
  display: flex;
  align-items: center;
  gap: var(--esp-2);
  font-size: var(--texto-xs);
  opacity: .85;
}

/* O nome é link: quem quiser saber quem fez o site tem onde clicar. Sublinhado
 * só no hover — sublinhado permanente num canto de rodapé vira ruído. */
.rodape__marca {
  font-family: var(--fonte-titulo);
  letter-spacing: .04em;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.rodape__marca:hover { text-decoration: underline; }

/* -----------------------------------------------------------------------------
 * 7. Botões
 * -------------------------------------------------------------------------- */

.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--esp-2);
  padding: var(--esp-2) var(--esp-4);
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: var(--texto-sm);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transicao-rapida), box-shadow var(--transicao-rapida),
              transform var(--transicao-rapida);
}

.botao:hover { box-shadow: var(--shadow-card-hover); }
.botao:active { transform: translateY(1px); }

.botao[disabled], .botao[aria-disabled='true'] {
  opacity: .5;
  pointer-events: none;
}

.botao--secundario {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.botao--perigo { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }

.botao--fantasma {
  background: transparent;
  color: hsl(var(--primary));
  border-color: hsl(var(--border));
}

.botao--fantasma:hover { background: hsl(var(--muted)); box-shadow: none; }

.botao--sobre-cor {
  background: transparent;
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary-foreground) / .35);
}

.botao--sobre-cor:hover { background: hsl(var(--primary-foreground) / .12); }

.botao--pequeno { min-height: 2rem; padding: var(--esp-1) var(--esp-3); font-size: var(--texto-xs); }
.botao--grande { min-height: 3rem; padding: var(--esp-3) var(--esp-5); font-size: var(--texto-md); }
.botao--largo { width: 100%; }

/* -----------------------------------------------------------------------------
 * 8. Formulário
 * -------------------------------------------------------------------------- */

.campo { display: flex; flex-direction: column; gap: var(--esp-1); }

.campo__rotulo { font-size: var(--texto-sm); font-weight: 500; }

.campo__ajuda { font-size: var(--texto-xs); color: hsl(var(--muted-foreground)); }

.campo__erro { font-size: var(--texto-xs); color: hsl(var(--accent)); font-weight: 500; }

.entrada,
.selecao,
.area {
  width: 100%;
  min-height: 2.5rem;
  padding: var(--esp-2) var(--esp-3);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  transition: border-color var(--transicao-rapida), box-shadow var(--transicao-rapida);
}

.entrada:focus, .selecao:focus, .area:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .15);
}

.area { min-height: 7rem; resize: vertical; font-family: var(--fonte-numero); font-size: var(--texto-sm); }

/* Validação: o cliente marca `aria-invalid`; a borda acompanha. */
.entrada[aria-invalid='true'],
.selecao[aria-invalid='true'],
.area[aria-invalid='true'] { border-color: hsl(var(--accent)); }

/* -----------------------------------------------------------------------------
 * 9. Cartões e painéis
 * -------------------------------------------------------------------------- */

.cartao {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--esp-4);
}

.cartao--clicavel { transition: box-shadow var(--transicao), transform var(--transicao); }
.cartao--clicavel:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }

.cartao__titulo {
  font-family: var(--fonte-titulo);
  font-size: var(--texto-lg);
  font-weight: 600;
  margin-bottom: var(--esp-1);
}

.cartao__meta { font-size: var(--texto-sm); color: hsl(var(--muted-foreground)); }

.cartao--destaque { border-top: 4px solid hsl(var(--secondary)); }

/* Herói da home */
.heroi {
  background: linear-gradient(135deg, hsl(var(--hero-from)), hsl(var(--hero-via)) 55%, hsl(var(--hero-to)));
  color: hsl(var(--primary-foreground));
  padding-block: var(--esp-7);
  position: relative;
  overflow: hidden;
}

.heroi::after {
  /* brilho dourado no canto — o mesmo recurso do site do colégio */
  content: '';
  position: absolute;
  inset-inline-end: -8rem;
  inset-block-start: -8rem;
  width: 26rem;
  height: 26rem;
  border-radius: var(--radius-cheio);
  background: radial-gradient(circle, hsl(var(--hero-gold-glow) / .22), transparent 65%);
  pointer-events: none;
}

.heroi__interno { position: relative; display: grid; gap: var(--esp-5); }

@media (min-width: 900px) {
  .heroi__interno { grid-template-columns: 1.2fr .8fr; align-items: center; }
}

.heroi__titulo {
  font-family: var(--fonte-titulo);
  font-size: var(--texto-3xl);
  font-weight: 700;
  line-height: 1.1;
}

@media (min-width: 700px) { .heroi__titulo { font-size: var(--texto-4xl); } }

.heroi__linha { font-size: var(--texto-lg); opacity: .9; margin-top: var(--esp-3); max-width: 46ch; }

.heroi__selo {
  display: inline-flex;
  align-items: center;
  gap: var(--esp-2);
  padding: var(--esp-1) var(--esp-3);
  border-radius: var(--radius-cheio);
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  font-size: var(--texto-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: var(--esp-4);
}

.heroi__brasao { justify-self: center; width: min(15rem, 60%); filter: drop-shadow(0 12px 30px hsl(var(--hero-from) / .5)); }

/* -----------------------------------------------------------------------------
 * 10. Etiquetas e estados
 * -------------------------------------------------------------------------- */

.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: var(--esp-1);
  padding: 2px var(--esp-2);
  border-radius: var(--radius-cheio);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: var(--texto-xs);
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.etiqueta--primaria { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.etiqueta--ouro { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.etiqueta--accento { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.etiqueta--sucesso { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }
.etiqueta--aviso { background: hsl(var(--warning)); color: hsl(var(--warning-foreground)); }
.etiqueta--contorno { background: transparent; border: 1px solid hsl(var(--border)); }

/* Círculo de colocação na tabela: 1º lugar dourado, 2º prata, 3º bronze. */
.posicao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-cheio);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-family: var(--fonte-numero);
  font-weight: 700;
  font-size: var(--texto-sm);
}

.posicao--1 { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.posicao--2 { background: hsl(var(--muted-foreground) / .3); color: hsl(var(--foreground)); }
.posicao--3 { background: hsl(var(--accent) / .18); color: hsl(var(--accent)); }

/* Marcador de "passa para a próxima fase" à esquerda da linha. */
.classificado { box-shadow: inset 3px 0 0 hsl(var(--success)); }

/* -----------------------------------------------------------------------------
 * 11. Tabelas
 * -------------------------------------------------------------------------- */

.rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--texto-sm);
  background: hsl(var(--card));
}

.tabela caption {
  text-align: left;
  font-family: var(--fonte-titulo);
  font-size: var(--texto-lg);
  font-weight: 600;
  padding-bottom: var(--esp-2);
}

.tabela th, .tabela td {
  padding: var(--esp-2) var(--esp-3);
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.tabela thead th {
  background: hsl(var(--muted));
  font-size: var(--texto-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

/* Colunas numéricas alinham à direita e usam números tabulares — senão a
 * classificação "dança" a cada ponto lançado. */
.tabela .num {
  text-align: right;
  font-family: var(--fonte-numero);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tabela tbody tr:hover { background: hsl(var(--muted) / .5); }
.tabela tbody tr + tr th { font-weight: 400; }

.tabela .time { display: flex; align-items: center; gap: var(--esp-2); font-weight: 500; }
.tabela .time__turma { font-size: var(--texto-xs); font-weight: 400; color: hsl(var(--muted-foreground)); }

.tabela .total { font-weight: 700; }
.tabela tfoot td { border-bottom: none; font-size: var(--texto-xs); color: hsl(var(--muted-foreground)); }

/* -----------------------------------------------------------------------------
 * 12. Confrontos e placares
 * -------------------------------------------------------------------------- */

.confronto {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--esp-2);
  padding: var(--esp-3);
  border: var(--borda);
  border-radius: var(--radius-sm);
  background: hsl(var(--card));
}

.confronto + .confronto { margin-top: var(--esp-2); }

.confronto__lado {
  display: flex;
  align-items: center;
  gap: var(--esp-2);
  min-width: 0;
}

.confronto__lado--b { justify-content: flex-end; text-align: right; }

.confronto__nome {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confronto__vaga { font-style: italic; color: hsl(var(--muted-foreground)); font-weight: 400; }

.confronto__placar {
  display: flex;
  align-items: center;
  gap: var(--esp-1);
  font-family: var(--fonte-numero);
  font-variant-numeric: tabular-nums;
  font-size: var(--texto-xl);
  font-weight: 700;
  padding: var(--esp-1) var(--esp-3);
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  min-width: 5rem;
  justify-content: center;
}

.confronto__placar .x { font-size: var(--texto-sm); color: hsl(var(--muted-foreground)); font-weight: 400; }
.confronto__placar--vazio { color: hsl(var(--muted-foreground)); font-weight: 400; font-size: var(--texto-sm); }

/* Lado vencedor ganha o dourado; perdedor fica neutro. */
.confronto--decidido .confronto__lado--vencedor .confronto__nome { color: hsl(var(--secondary-foreground)); font-weight: 700; }
.confronto--decidido .confronto__lado--vencedor::before {
  content: '';
  width: .4rem; height: .4rem; border-radius: var(--radius-cheio);
  background: hsl(var(--secondary)); flex: none;
}

.confronto__penaltis {
  grid-column: 1 / -1;
  text-align: center;
  font-size: var(--texto-xs);
  color: hsl(var(--muted-foreground));
}

.confronto__meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-3);
  font-size: var(--texto-xs);
  color: hsl(var(--muted-foreground));
}

.confronto--folga { background: hsl(var(--muted) / .6); border-style: dashed; }
.confronto--pendente { border-left: 3px solid hsl(var(--secondary)); }

/* -----------------------------------------------------------------------------
 * 13. Chaveamento
 * -------------------------------------------------------------------------- */

.chave {
  display: flex;
  gap: var(--esp-4);
  overflow-x: auto;
  padding-bottom: var(--esp-4);
  align-items: stretch;
}

.chave__rodada {
  display: flex;
  flex-direction: column;
  gap: var(--esp-3);
  min-width: 16rem;
  flex: 1 0 auto;
}

.chave__titulo {
  font-family: var(--fonte-titulo);
  font-size: var(--texto-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: hsl(var(--muted-foreground));
  padding-bottom: var(--esp-1);
  border-bottom: 2px solid hsl(var(--secondary));
}

/* O espaço entre os jogos cresce a cada rodada para os encontros ficarem
 * alinhados com quem os originou. */
.chave__jogos { display: flex; flex-direction: column; gap: var(--esp-3); flex: 1; justify-content: space-around; }

.chave__rodada[data-nivel='2'] .chave__jogos { padding-block: 1.5rem; }
.chave__rodada[data-nivel='1'] .chave__jogos { padding-block: 0; }

/* O confronto dentro da chave é mais compacto que o da lista de jogos. */
.chave .confronto { padding: var(--esp-2); }
.chave .confronto__placar { font-size: var(--texto-md); min-width: 4rem; padding: 0 var(--esp-2); }

.chave__terceiro { margin-top: var(--esp-4); max-width: 20rem; }

/* -----------------------------------------------------------------------------
 * 14. Campeão e pódio
 * -------------------------------------------------------------------------- */

.campeao {
  display: grid;
  gap: var(--esp-2);
  place-items: center;
  text-align: center;
  padding: var(--esp-6) var(--esp-4);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, hsl(var(--primary)), hsl(var(--hero-to)));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-forte);
}

.campeao__trofeu { font-size: var(--texto-4xl); line-height: 1; }
.campeao__rotulo {
  font-size: var(--texto-xs);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: hsl(var(--secondary));
}
.campeao__nome { font-family: var(--fonte-titulo); font-size: var(--texto-3xl); font-weight: 700; line-height: 1.1; }
.campeao__turma { opacity: .85; }
.campeao__nota { font-size: var(--texto-xs); opacity: .7; margin-top: var(--esp-2); }

.podio { display: grid; gap: var(--esp-3); }
@media (min-width: 700px) { .podio { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.podio__lugar {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  padding: var(--esp-3);
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: var(--shadow-card);
}

.podio__nome { font-weight: 600; }

/* -----------------------------------------------------------------------------
 * 15. Estatísticas e progresso
 * -------------------------------------------------------------------------- */

.painel-numeros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--esp-3); }
@media (min-width: 700px) { .painel-numeros { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.numero-destaque {
  background: hsl(var(--card));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--esp-4);
  text-align: center;
}

.numero-destaque__valor {
  font-family: var(--fonte-titulo);
  font-size: var(--texto-2xl);
  font-weight: 700;
  line-height: 1;
  color: hsl(var(--primary));
}

.numero-destaque__rotulo {
  font-size: var(--texto-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: hsl(var(--muted-foreground));
  margin-top: var(--esp-2);
}

.progresso {
  height: .5rem;
  border-radius: var(--radius-cheio);
  background: hsl(var(--muted));
  overflow: hidden;
}

.progresso__barra {
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--secondary)), hsl(var(--accent)));
  transition: width var(--transicao);
}

/* -----------------------------------------------------------------------------
 * 16. Avisos, carregando e vazio
 * -------------------------------------------------------------------------- */

.aviso {
  display: flex;
  gap: var(--esp-3);
  padding: var(--esp-3) var(--esp-4);
  border-radius: var(--radius-sm);
  border-left: 4px solid hsl(var(--info));
  background: hsl(var(--info) / .08);
  font-size: var(--texto-sm);
}

.aviso--sucesso { border-color: hsl(var(--success)); background: hsl(var(--success) / .1); }
.aviso--atencao { border-color: hsl(var(--warning)); background: hsl(var(--warning) / .12); }
.aviso--erro { border-color: hsl(var(--accent)); background: hsl(var(--accent) / .1); }

.vazio {
  text-align: center;
  padding: var(--esp-7) var(--esp-4);
  color: hsl(var(--muted-foreground));
  border: 2px dashed hsl(var(--border));
  border-radius: var(--radius);
}

.vazio__icone { font-size: var(--texto-3xl); opacity: .5; }

.carregando {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid hsl(var(--border));
  border-top-color: hsl(var(--primary));
  border-radius: var(--radius-cheio);
  animation: girar .7s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }

/* Esqueleto para quando a página já sabe o formato do que vai chegar. */
.esqueleto {
  background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--border)) 50%, hsl(var(--muted)) 75%);
  background-size: 200% 100%;
  animation: brilhar 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 1rem;
}

@keyframes brilhar { to { background-position: -200% 0; } }

/* O esqueleto é uma barra só; o tamanho vem do contexto em que ele fica. */
.esqueleto--alta { height: 9rem; }
.esqueleto--media { height: 3rem; }
.esqueleto--curta { width: 55%; }

/* Aviso flutuante (toast) — erro de rede e confirmação de gravação. */
.toasts {
  position: fixed;
  inset-inline: var(--esp-4);
  inset-block-end: var(--esp-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
  pointer-events: none;
}

@media (min-width: 640px) {
  .toasts { inset-inline-start: auto; width: min(24rem, calc(100vw - 2rem)); }
}

.toast {
  pointer-events: auto;
  padding: var(--esp-3) var(--esp-4);
  border-radius: var(--radius-sm);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-forte);
  font-size: var(--texto-sm);
  animation: entrar var(--transicao);
}

.toast--erro { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.toast--sucesso { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }

@keyframes entrar { from { opacity: 0; transform: translateY(.5rem); } }

/* -----------------------------------------------------------------------------
 * 17. Modal
 * -------------------------------------------------------------------------- */

dialog.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: min(32rem, calc(100vw - 2rem));
  width: 100%;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-forte);
}

dialog.modal::backdrop { background: hsl(var(--hero-from) / .6); backdrop-filter: blur(2px); }

.modal__corpo { padding: var(--esp-5); }
.modal__titulo { font-family: var(--fonte-titulo); font-size: var(--texto-xl); margin-bottom: var(--esp-2); }
.modal__acoes {
  display: flex;
  justify-content: flex-end;
  gap: var(--esp-2);
  padding: var(--esp-3) var(--esp-5) var(--esp-5);
}

/* -----------------------------------------------------------------------------
 * 18. Abas e filtros
 * -------------------------------------------------------------------------- */

.abas {
  display: flex;
  gap: var(--esp-1);
  overflow-x: auto;
  border-bottom: 2px solid hsl(var(--border));
  padding-bottom: 0;
}

.abas button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: var(--esp-2) var(--esp-3);
  font-size: var(--texto-sm);
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  white-space: nowrap;
}

.abas button:hover { color: hsl(var(--foreground)); }

.abas button[aria-selected='true'] {
  color: hsl(var(--primary));
  border-bottom-color: hsl(var(--secondary));
  font-weight: 700;
}

/* -----------------------------------------------------------------------------
 * 19. Letreiro de resultados
 * -------------------------------------------------------------------------- */

/* O cartão de competição é um link; sem isto o texto sai azul e sublinhado. */
a.cartao { display: block; color: inherit; text-decoration: none; }

.letreiro { display: flex; flex-direction: column; gap: var(--esp-2); }

/* Uma linha do letreiro: time — placar — time. Os nomes podem ser longos
 * ("9º A — Manhã"), então quem cede espaço são eles, nunca o placar. */
.faixa-resultado {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--esp-3);
  padding: var(--esp-2) var(--esp-3);
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  font-size: var(--texto-sm);
}

.faixa-resultado__time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faixa-resultado__time:nth-of-type(1) { text-align: right; }
.faixa-resultado__time--vencedor { font-weight: 700; color: hsl(var(--primary)); }

.faixa-resultado__placar {
  font-family: var(--fonte-numero);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding-inline: var(--esp-2);
  white-space: nowrap;
}

/* Qual modalidade — a faixa sozinha não distingue dois "7º A". */
.faixa-resultado__meta {
  grid-column: 1 / -1;
  text-align: center;
  font-size: var(--texto-xs);
  color: hsl(var(--muted-foreground));
}

/* -----------------------------------------------------------------------------
 * 20. Utilitários
 * -------------------------------------------------------------------------- */

.oculto { display: none !important; }
.visualmente-oculto {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.centro { text-align: center; }
.direita { text-align: right; }
.negrito { font-weight: 700; }
.suave { color: hsl(var(--muted-foreground)); }
.pequeno { font-size: var(--texto-sm); }
.minusculo { font-size: var(--texto-xs); }
.maiusculo { text-transform: uppercase; letter-spacing: .06em; }
.mt-2 { margin-top: var(--esp-2); }
.mt-4 { margin-top: var(--esp-4); }
.mt-6 { margin-top: var(--esp-6); }
.mb-4 { margin-bottom: var(--esp-4); }
.sem-quebra { white-space: nowrap; }
.rolagem-horizontal { overflow-x: auto; }
