* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fef3c7, #fde68a);
  font-family: "Segoe UI", system-ui, sans-serif;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden; /* rede de segurança: nunca deixa a página cortar/rolar de lado */
}

main {
  width: 100%;
  max-width: 520px;
  min-width: 0; /* item flex do body — sem isso ele não encolhe menos que o filho mais largo (o canvas) */
}

header {
  text-align: center;
  margin-bottom: 16px;
}

header h1 {
  font-size: 28px;
  margin: 0 0 4px;
  color: #78350f;
}

header p {
  margin: 0;
  color: #92400e;
}

.cartao {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(120, 53, 15, 0.15);
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: #451a03;
  font-size: 15px;
}

.opcional {
  font-weight: 400;
  color: #a8a29e;
  font-size: 13px;
}

select {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #fde68a;
  outline: none;
  background: #fff;
}

input[type="text"] {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #fde68a;
  outline: none;
  flex: 1;
  min-width: 0;
}

input[type="text"]:focus {
  border-color: #f59e0b;
}

.campo-com-voz {
  display: flex;
  gap: 8px;
}

.botao-voz {
  flex-shrink: 0;
  width: 48px;
  padding: 0;
  font-size: 20px;
  border-radius: 12px;
  background: #fde68a;
  color: #451a03;
}

.botao-voz.ouvindo {
  background: #ef4444;
  color: #fff;
  animation: pulsar 1s infinite;
}

@keyframes pulsar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

button {
  font-size: 17px;
  font-weight: 700;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  cursor: pointer;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

#mensagem-status {
  text-align: center;
  color: #b91c1c;
  font-weight: 600;
  min-height: 20px;
  margin: 12px 0 0;
}

#secao-placar {
  margin-top: 20px;
  border-top: 2px dashed #fde68a;
  padding-top: 16px;
}

#secao-placar h2 {
  margin: 0 0 8px;
  font-size: 17px;
  color: #78350f;
}

#lista-placar {
  margin: 0;
  padding-left: 22px;
  color: #451a03;
  font-size: 14px;
}

#lista-placar li {
  padding: 3px 0;
}

#lista-placar li.vazio {
  list-style: none;
  padding-left: -22px;
  color: #a8a29e;
}

.topo-jogo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

#botao-mudo {
  width: 40px;
  padding: 6px;
  font-size: 16px;
  border-radius: 10px;
  background: #fde68a;
}

#painel-jogo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0; /* mesmo motivo: sem isso a coluna inteira não encolhe no celular */
}

#titulo-jogo {
  margin: 0;
  color: #78350f;
  text-align: center;
}

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #451a03;
  text-align: center;
  width: 100%;
  min-width: 0;
}

.hud-fase {
  color: #b45309;
  font-size: 14px;
}

.hud-status {
  display: flex;
  gap: 20px;
  font-size: 16px;
}

.area-canvas {
  position: relative;
  max-width: 100%;
  width: 100%;
  min-width: 0; /* o vilão de verdade: o <canvas> tem 480px "de fábrica" e sem isso
                   ele nunca deixava esse container (e todos os pais) encolherem
                   abaixo disso — é por isso que cortava no celular */
}

canvas {
  display: block;
  border-radius: 14px;
  width: 100%;
  max-width: 100%;
  height: auto;
  touch-action: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.dica {
  margin: 0;
  font-size: 13px;
  color: #92400e;
}

#botao-atirar {
  background: #dc2626;
  width: 100%;
}

#botao-novo-jogo {
  background: #78350f;
}

.cta-curso {
  width: 100%;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: aparecer 0.4s ease-out;
}

@keyframes aparecer {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cta-curso-titulo {
  margin: 0;
  font-weight: 700;
  color: #78350f;
  font-size: 16px;
}

.cta-curso-texto {
  margin: 0;
  color: #92400e;
  font-size: 14px;
}

.botao-whatsapp {
  display: inline-block;
  background: #25d366;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 999px;
  text-decoration: none;
  margin-top: 4px;
}

.botao-whatsapp:active {
  transform: scale(0.98);
}

#overlay-pergunta {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(69, 26, 3, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

#overlay-pergunta[hidden] {
  display: none;
}

#pergunta-enunciado {
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  margin: 0;
}

#pergunta-alternativas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

#pergunta-alternativas button {
  background: #fde68a;
  color: #451a03;
  font-size: 15px;
  padding: 12px;
}

#pergunta-alternativas button.correta {
  background: #22c55e;
  color: #fff;
}

#pergunta-alternativas button.errada {
  background: #ef4444;
  color: #fff;
}
