/* ==========================================================================
   Corrida de GPU — estilo.css
   Paleta do portal iauai aplicada ao tema deste jogo (rosa #EC4899).
   Fundo sempre na família #08080C–#101018, nunca preto puro.
   ========================================================================== */

:root {
  --fundo: #08080c;
  --superficie: #101018;
  --superficie-2: #1a1a26;
  --borda: #26263a;
  --texto: #ededf5;
  --texto-suave: #9a9ab0;

  --rosa: #ec4899;
  --violeta: #7c3aed;
  --azul: #2563eb;
  --esmeralda: #10b981;
  --ambar: #f59e0b;
  --vermelho: #ef4444;

  --raio: 14px;
  --raio-lg: 22px;
  --raio-full: 999px;

  --duracao-transicao: 220ms;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--fundo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--fundo);
  touch-action: none;
}

canvas#telaJogo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ---------------------------------------------------------------- overlays */

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  z-index: 40;
}

.overlay.ativo {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(160deg, var(--superficie) 0%, var(--superficie-2) 100%);
  border: 1px solid var(--borda);
  border-radius: var(--raio-lg);
  padding: 28px 26px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 60px -20px rgba(236, 72, 153, 0.35);
}

.modal-pequeno {
  width: min(360px, 100%);
}

.modal h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--rosa) 0%, var(--violeta) 60%, var(--azul) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitulo {
  margin: 0 0 18px;
  color: var(--texto-suave);
  font-size: 0.98rem;
  line-height: 1.5;
}

.secao-conceito {
  background: rgba(236, 72, 153, 0.08);
  border: 1px solid rgba(236, 72, 153, 0.25);
  border-radius: var(--raio);
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: left;
  font-size: 0.9rem;
  color: var(--texto);
  line-height: 1.5;
}

.secao-conceito strong {
  color: var(--rosa);
}

.secao-controles {
  text-align: left;
  margin-bottom: 18px;
}

.secao-controles h2 {
  font-size: 1rem;
  margin: 0 0 10px;
  color: var(--texto);
  letter-spacing: -0.01em;
}

.controles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.controle {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 10px;
  font-size: 0.82rem;
  text-align: center;
}

.controle .icone {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.controle .desc {
  color: var(--texto-suave);
  font-size: 0.76rem;
  margin-top: 2px;
}

.pausa-info {
  color: var(--texto-suave);
  font-size: 0.8rem;
  text-align: center;
}

.trade-off {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  text-align: left;
}

.trade-off .lado {
  flex: 1;
  border-radius: var(--raio);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  border: 1px solid var(--borda);
}

.trade-off .lado.bom {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.trade-off .lado.risco {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}

.trade-off .lado strong {
  display: block;
  margin-bottom: 4px;
}

.botao-primario,
.botao-secundario {
  display: inline-block;
  width: 100%;
  padding: 13px 20px;
  margin-top: 6px;
  border: none;
  border-radius: var(--raio-full);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--duracao-transicao) ease-out, filter var(--duracao-transicao) ease-out;
}

.botao-primario {
  background: linear-gradient(135deg, var(--rosa) 0%, var(--violeta) 100%);
  color: #fff;
}

.botao-secundario {
  background: transparent;
  color: var(--texto);
  border: 1px solid var(--borda);
  margin-top: 10px;
}

.botao-primario:hover,
.botao-secundario:hover {
  filter: brightness(1.12);
}

.botao-primario:active,
.botao-secundario:active {
  transform: scale(0.97);
}

.botao-primario:focus-visible,
.botao-secundario:focus-visible {
  outline: 2px solid var(--rosa);
  outline-offset: 2px;
}

.info {
  color: var(--texto-suave);
  font-size: 0.82rem;
  margin: 14px 0 0;
}

.placar {
  display: flex;
  gap: 10px;
  margin: 6px 0 16px;
}

.placar-item {
  flex: 1;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 12px 8px;
}

.placar-item .etiqueta {
  display: block;
  font-size: 0.72rem;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.placar-item .valor {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--texto);
}

.placar-item.recorde .valor {
  color: var(--ambar);
}

.moral {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--raio);
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--texto);
  margin: 0 0 18px;
}

.recorde-novo {
  color: var(--ambar);
  font-weight: 700;
  font-size: 0.8rem;
  margin: -10px 0 14px;
}

/* -------------------------------------------------------------------- HUD */

.hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: none;
  font-variant-numeric: tabular-nums;
}

.hud.ativo {
  display: block;
}

.hud-topo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}

.hud-bloco {
  background: rgba(16, 16, 24, 0.72);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 8px 12px;
  backdrop-filter: blur(4px);
}

.hud-bloco .rotulo {
  display: block;
  font-size: 0.66rem;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.hud-bloco .numero {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--texto);
  line-height: 1;
}

.hud-esquerda {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-direita {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hud-batch .numero {
  font-size: 1.7rem;
  color: var(--rosa);
}

.hud-vidas .numero {
  font-size: 1.05rem;
  letter-spacing: 2px;
}

.hud-vram {
  width: 180px;
}

.barra-vram {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: var(--raio-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 4px;
}

.barra-vram-preenchimento {
  height: 100%;
  width: 15%;
  border-radius: var(--raio-full);
  background: var(--esmeralda);
  transition: width 120ms linear, background-color 200ms linear;
}

.barra-vram-preenchimento.alerta {
  background: var(--ambar);
}

.barra-vram-preenchimento.critico {
  background: var(--vermelho);
}

.hud-vram .texto-vram {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--texto-suave);
}

.hud-central-baixo {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.aviso {
  padding: 8px 18px;
  border-radius: var(--raio-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
  background: rgba(16, 16, 24, 0.82);
}

.aviso.visivel {
  opacity: 1;
  transform: translateY(0);
}

.aviso.ambar {
  color: var(--ambar);
  border-color: rgba(245, 158, 11, 0.5);
}

.aviso.vermelho {
  color: var(--vermelho);
  border-color: rgba(239, 68, 68, 0.6);
}

.aviso.esmeralda {
  color: var(--esmeralda);
  border-color: rgba(16, 185, 129, 0.5);
}

.aviso.violeta {
  color: #c4b5fd;
  border-color: rgba(124, 58, 237, 0.5);
}

/* -------------------------------------------------------- flash de OOM */

#flashOom {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0) 40%, rgba(239, 68, 68, 0.55) 100%);
  opacity: 0;
}

#flashOom.piscando {
  opacity: 1;
  animation: pulsoOom 0.42s ease-in-out infinite;
}

@keyframes pulsoOom {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  #flashOom.piscando {
    animation: none;
    opacity: 0.45;
  }
  .overlay,
  .aviso,
  .botao-primario,
  .botao-secundario,
  .barra-vram-preenchimento {
    transition: none !important;
  }
}

/* --------------------------------------------------------- pausa (topo) */

#botaoPausaHud {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: var(--raio-full);
  border: 1px solid var(--borda);
  background: rgba(16, 16, 24, 0.72);
  color: var(--texto);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#botaoPausaHud:focus-visible {
  outline: 2px solid var(--rosa);
}

/* ------------------------------------------------------------ controles de toque */

#controlesToque {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
}

#controlesToque.ativo {
  display: block;
}

.zona-faixa {
  position: absolute;
  top: 0;
  bottom: 120px;
  width: 40%;
  pointer-events: auto;
}

.zona-faixa.esquerda {
  left: 0;
}

.zona-faixa.direita {
  right: 0;
}

.dica-faixa {
  position: absolute;
  bottom: 130px;
  font-size: 1.6rem;
  color: rgba(237, 237, 245, 0.28);
  pointer-events: none;
  user-select: none;
}

.dica-faixa.esquerda {
  left: 14px;
}

.dica-faixa.direita {
  right: 14px;
}

.botoes-batch {
  position: absolute;
  right: 16px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  z-index: 16;
}

.botao-batch {
  width: 68px;
  height: 68px;
  border-radius: var(--raio-full);
  border: 1px solid var(--borda);
  background: rgba(16, 16, 24, 0.82);
  color: var(--texto);
  font-size: 1.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.botao-batch.mais {
  color: var(--rosa);
  border-color: rgba(236, 72, 153, 0.5);
}

.botao-batch.menos {
  color: var(--texto-suave);
}

.botao-batch:active {
  transform: scale(0.94);
}

/* ------------------------------------------------------------ mensagem de erro */

#erroWebgl {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--fundo);
}

#erroWebgl.ativo {
  display: flex;
}

#erroWebgl .modal {
  border-color: rgba(239, 68, 68, 0.4);
}

@media (max-width: 480px) {
  .modal {
    padding: 22px 18px;
  }

  .controles-grid {
    grid-template-columns: 1fr;
  }

  .trade-off {
    flex-direction: column;
  }

  .hud-vram {
    width: 132px;
  }

  .hud-bloco {
    padding: 6px 9px;
  }

  .botao-batch {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
}

@media (min-width: 900px) {
  .zona-faixa {
    width: 30%;
  }
}
