/* Jogo da Cobrinha — paleta: branco + roxo + azul-noite + preto */
:root {
  --roxo: #7c3aed;
  --roxo-escuro: #5b21b6;
  --roxo-neve: #ede9fe;
  --azul-noite: #1e1b4b;
  --grafite: #17131f;
  --fundo: #f7f6fc;
  --cartao: #ffffff;
  --borda: #e5e1f0;
  --suave: #6b6478;
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--fundo), var(--roxo-neve));
  color: var(--grafite);
  min-height: 100vh;
}

.topo {
  background: linear-gradient(135deg, var(--azul-noite), var(--roxo-escuro));
  color: #fff;
  text-align: center;
  padding: 26px 20px 34px;
}
.topo h1 { font-size: 1.6rem; font-weight: 800; }
.topo p { color: #c7d2fe; font-size: 0.9rem; margin-top: 6px; }

.palco { max-width: 560px; margin: -16px auto 40px; padding: 0 20px; }
.cartao-jogo {
  background: var(--cartao);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(30, 27, 75, 0.12);
  padding: 18px;
}
.marcador {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--suave);
  margin-bottom: 10px;
}
.marcador b { color: var(--roxo-escuro); font-size: 1rem; }

.cena { position: relative; }
canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: #f7f6fc;
  border: 2px solid var(--borda);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  background: rgba(23, 19, 31, 0.72);
  border-radius: 16px;
  color: #fff;
  padding: 20px;
}
.overlay.oculto { display: none; }
.overlay h2 { font-size: 1.4rem; }
.overlay p { color: #c7d2fe; font-size: 0.88rem; }
.overlay button {
  margin: 6px auto 0;
  background: var(--roxo);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px 26px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
  transition: filter 0.12s;
}
.overlay button:hover { filter: brightness(1.12); }

.direcoes {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.direcoes button {
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--roxo-neve);
  color: var(--roxo-escuro);
  font-size: 1rem;
  cursor: pointer;
  transition: filter 0.1s;
}
.direcoes button[data-dir="cima"] { grid-column: 2; }
.direcoes button:active { background: var(--roxo); color: #fff; }

footer {
  text-align: center;
  color: var(--suave);
  font-size: 0.8rem;
  padding: 0 20px 34px;
}
footer code {
  background: var(--roxo-neve);
  color: var(--roxo-escuro);
  padding: 2px 7px;
  border-radius: 6px;
}
footer a { color: var(--roxo-escuro); }
