/* =========================================================
   BASE: fontes locais, variáveis, reset e fundo de estádio
   ========================================================= */

@font-face { font-family: "Bebas Neue"; src: url("../assets/fonts/bebas-neue-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/inter-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/inter-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  /* Paleta oficial */
  --gramado: #1B7F3A;
  --gramado-escuro: #0E5C2A;
  --ouro: #F5C518;
  --ouro-claro: #FFE27A;
  --ouro-escuro: #B88A00;
  --branco: #FFFFFF;
  --preto: #050A07;
  --erro: #E63946;
  --sucesso: #06D6A0;

  --vidro: rgba(8, 24, 14, 0.62);
  --vidro-borda: rgba(255, 255, 255, 0.16);
  --texto-suave: rgba(255, 255, 255, 0.78);

  --fonte-display: "Bebas Neue", "Anton", Impact, "Arial Narrow", sans-serif;
  --fonte-corpo: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --fonte-emoji: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;

  --raio: 1.1rem;
  --sombra: 0 0.8rem 2.2rem rgba(0, 0, 0, 0.45);
}

/* Tamanho base escala com a tela: 16px em 1366×768, ~22px em 1920×1080.
   Todo o layout usa rem, então o jogo "cresce" junto com a tela. */
html { font-size: clamp(11px, min(1.17vw, 2.08vh), 26px); }

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

html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  font-family: var(--fonte-corpo);
  color: var(--branco);
  background: var(--preto);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input { user-select: text; -webkit-user-select: text; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.45em;
  border-radius: 0.35em;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-bottom-width: 3px;
  font-family: var(--fonte-corpo);
  font-weight: 800;
  font-size: 0.85em;
  text-align: center;
  line-height: 1.4;
}

/* Foco visível para navegação por teclado (acessibilidade) */
:focus { outline: none; }
:focus-visible {
  outline: 0.25rem solid var(--ouro);
  outline-offset: 0.25rem;
  border-radius: 0.6rem;
}

/* ---------- Fundo de estádio ---------- */
#fundo { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

#fundo .ceu {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 240, 190, 0.18), transparent 70%),
    radial-gradient(ellipse 120% 70% at 50% 110%, #1a8a43 0%, #0b4a22 45%, transparent 75%),
    linear-gradient(180deg, #03100a 0%, #062a15 45%, #0a4220 100%);
}

/* Refletores do estádio */
#fundo .luz {
  position: absolute; top: -18vh; width: 60vw; height: 80vh;
  background: radial-gradient(ellipse at center, rgba(255, 255, 230, 0.32), rgba(255, 255, 230, 0.05) 45%, transparent 70%);
  filter: blur(8px);
  animation: luz-pulsa 6s ease-in-out infinite alternate;
}
#fundo .luz-e { left: -18vw; transform: rotate(18deg); }
#fundo .luz-d { right: -18vw; transform: rotate(-18deg); animation-delay: -3s; }
@keyframes luz-pulsa { from { opacity: 0.65; } to { opacity: 1; } }

/* Gramado em perspectiva com faixas */
#fundo .gramado {
  position: absolute; left: -30%; right: -30%; bottom: -8vh; height: 52vh;
  transform: perspective(60vh) rotateX(58deg);
  transform-origin: 50% 100%;
  background:
    repeating-linear-gradient(90deg, #1d8a40 0 6vw, #17753a 6vw 12vw);
  box-shadow: 0 -4vh 8vh rgba(0, 0, 0, 0.5) inset;
  opacity: 0.9;
}
#fundo .gramado .linhas {
  position: absolute; inset: 6% 18%;
  border: 0.5vh solid rgba(255, 255, 255, 0.35);
  border-bottom: 0;
}
#fundo .gramado .linhas::before {
  content: ""; position: absolute; left: 50%; top: 18%;
  width: 26vh; height: 26vh; transform: translateX(-50%);
  border: 0.5vh solid rgba(255, 255, 255, 0.35); border-radius: 50%;
}
#fundo .gramado::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(3, 16, 10, 0.95) 0%, transparent 45%);
}

/* Ruído leve (textura) */
#fundo .ruido {
  position: absolute; inset: 0; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Estrutura de telas ---------- */
#app { position: relative; z-index: 1; width: 100%; height: 100%; }

.tela {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 2rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: scale(1.03);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.tela.ativa {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s;
}

/* Canvas de confete por cima de tudo, sem bloquear cliques */
#confete { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }

/* Telas de aviso (carregando / erro) */
.aviso-tela {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  background: rgba(3, 16, 10, 0.92);
  font-size: 1.2rem;
}
.spinner { font-family: var(--fonte-emoji); font-size: 4rem; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.aviso-caixa {
  max-width: 40rem; padding: 2rem 2.5rem; text-align: center;
  background: var(--vidro); border: 1px solid var(--vidro-borda); border-radius: var(--raio);
  line-height: 1.6;
}
.aviso-caixa h3 { font-family: var(--fonte-display); font-weight: 400; font-size: 2.4rem; letter-spacing: 0.04em; color: var(--ouro); margin-bottom: 0.8rem; }
.aviso-detalhe { margin-top: 1rem; font-size: 0.85rem; opacity: 0.7; }

/* Obs.: não desligamos animações via prefers-reduced-motion de propósito —
   muitos PCs escolares têm "animações do Windows" desativadas e o jogo
   perderia o impacto visual no evento. As animações são curtas e suaves. */
