* {
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  overscroll-behavior: none;
  background: radial-gradient(ellipse at 50% 35%, #2e4a40 0%, #1c332c 55%, #0f1e19 100%);
  color: #f2f2f2;
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fundo-formulas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
}

.fundo-formulas text {
  font-family: 'Chalkboard SE', 'Comic Sans MS', 'Bradley Hand', cursive, sans-serif;
  fill: #f5f3ea;
  opacity: 0.22;
  filter: blur(0.4px);
}

.fundo-formulas text.destaque {
  fill: #ffcc00;
}

.tela {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 2rem 1.5rem;
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  letter-spacing: 0.05em;
  margin-bottom: 0;
}

.subtitulo {
  color: #9aa0a6;
  margin-top: 0.25rem;
}

.recorde {
  margin: 2rem 0;
  font-size: 1.1rem;
}

.botao-principal {
  width: 100%;
  min-height: 56px;
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: #ffcc00;
  color: #0f1115;
}

.rodape {
  margin-top: 3rem;
  font-size: 0.8rem;
  color: #5f6368;
  line-height: 1.5;
}

.tela-partida {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.barra-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.botao-voltar {
  min-width: 48px;
  min-height: 48px;
  border: none;
  background: none;
  color: #9aa0a6;
  font-size: 1.5rem;
}

.contador {
  font-size: 1rem;
  color: #9aa0a6;
  font-variant-numeric: tabular-nums;
}

.timer {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fim-partida {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  text-align: center;
}

.fim-recorde {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffcc00;
  margin: 0;
}

.fim-acertos-grande {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.fim-pontos {
  font-size: 1.2rem;
  color: #9aa0a6;
  margin: 0;
}

.fim-stats {
  display: flex;
  gap: 2.5rem;
}

.fim-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.fim-stat-rotulo {
  font-size: 0.85rem;
  color: #9aa0a6;
}

.fim-stat-valor {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fim-partida .botao-principal {
  width: auto;
  padding: 0 2.5rem;
}

.botao-secundario {
  border: none;
  background: none;
  color: #9aa0a6;
  font-size: 1rem;
  min-height: 48px;
  padding: 0 1rem;
}

.problema {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.campo-resposta {
  min-height: 3.5rem;
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffcc00;
  font-variant-numeric: tabular-nums;
  border-bottom: 2px solid #3a4a44;
  margin-bottom: 1.5rem;
  transition: border-color 0.15s, color 0.15s;
}

.campo-resposta.campo-acerto {
  color: #4ade80;
  border-color: #4ade80;
}

.campo-resposta.campo-erro {
  color: #f87171;
  border-color: #f87171;
  animation: tremor 0.2s;
}

@keyframes tremor {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.teclado {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  padding-bottom: env(safe-area-inset-bottom);
}

.tecla {
  min-height: 56px;
  min-width: 48px;
  font-size: 1.4rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #1c2128;
  color: #f2f2f2;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tecla:active {
  background: #2a3038;
}

.tecla-inerte {
  opacity: 0.25;
  pointer-events: none;
}

.oculto {
  display: none;
}
