/* Fonte carregada via <link> no HTML — sem @import aqui */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Fredoka', sans-serif;
  background-color: transparent;
}

html, body {
  background-color: #BFD0FF;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  width: 100%;
}

/* ── TELAS ── */
.tela {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0.5rem 1rem 1.5rem;
  transition: opacity 0.35s ease;
}

.tela--oculta {
  display: none;
}

.tela--saindo {
  opacity: 0;
  pointer-events: none;
}

.tela--entrando {
  animation: fadeIn 0.4s ease forwards;
}

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

/* ── LOADING ── */
.logo--loading {
  width: clamp(140px, 45vw, 260px);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);    opacity: 1;    }
  50%       { transform: scale(1.04); opacity: 0.88; }
}

.loading-bar-track {
  width: min(72vw, 320px);
  height: 12px;
  background-color: rgba(255,255,255,0.45);
  border-radius: 99px;
  margin-top: 2rem;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background-color: #5b7fff;
  border-radius: 99px;
  transition: width 0.18s ease-out;
}

.loading-texto {
  margin-top: 0.9rem;
  font-size: clamp(14px, 3.5vw, 18px);
  color: #333;
  transition: opacity 0.2s ease;
}

.loading-texto--saindo {
  opacity: 0;
}

/* ── ELEMENTOS COMUNS ── */
.titulo {
  font-size: clamp(18px, 5vw, 32px);
  text-align: center;
  margin-top: clamp(6px, 1.5vh, 10px);
  width: 100%;
  padding: 0 1rem;
}

.logo {
  width: clamp(100px, 35vw, 200px);
  height: auto;
  margin: 0.3rem 0;
}

/* ── ÁREA DO JOGO ── */
.jogo {
  width: min(86vw, 600px);
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  justify-content: center;
  gap: 0.6rem;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 0.6rem;
  margin: 0.4rem 0 0.6rem;
}

/* ── COLUNA ESQUERDA (imagens arrastáveis) ── */
.coluna_esquerda {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  border: 1px solid #333;
  border-radius: 12px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4rem;
  align-content: start;
  justify-items: center;
}

/* ── COLUNA DIREITA (caixas de destino) ── */
.coluna_direita {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  flex: 1 1 0;
  min-width: 0;
  align-content: start;
}

/* ── ITENS (imagens arrastáveis) ── */
.item {
  border: 2px solid #333;
  border-radius: 10px;
  padding: 3px;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  cursor: grab;
  display: block;
  max-width: 120px;
}

/* ── CAIXAS DE DESTINO ── */
.caixa {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 120px;
  background-color: antiquewhite;
  border: 1px solid #333;
  border-radius: 10px;
  text-align: center;
  font-size: clamp(10px, 3vw, 18px);
  font-weight: 600;
  justify-self: center;
}

/* ── ITEM ENCAIXADO CORRETAMENTE ── */
.item--encaixado {
  width: 60%;
  max-width: 60%;
  cursor: default;
}

/* ── CAIXA QUE RECEBEU O ITEM ── */
.caixa--completa {
  border-color: #4caf50;
  background-color: #e8f5e9;
  flex-direction: column;
  gap: 2px;
  font-size: clamp(8px, 2.5vw, 14px);
}

/* ── DESKTOP / TABLET largo (600px+) ── */
@media (min-width: 600px) {
  .coluna_esquerda {
    grid-template-columns: repeat(3, 1fr);
  }
  .coluna_direita {
    grid-template-columns: repeat(3, 1fr);
  }
  .item {
    max-width: 100px;
  }
  .caixa {
    aspect-ratio: 4 / 3;
    max-width: 100px;
  }
}

/* ── COLUNA ESQUERDA VAZIA ── */
.coluna_esquerda--vazia {
  border: none;
  padding: 0;
  width: 0;
  min-width: 0;
  flex: 0 0 0;
  overflow: hidden;
  transition: all 0.4s ease;
}

/* ── JOGO CENTRALIZADO (após coluna esquerda sumir) ── */
.jogo--centralizado {
  justify-content: center;
  transition: all 0.4s ease;
}

.jogo--centralizado .coluna_direita {
  flex: 0 1 auto;
  width: min(90vw, 500px);
  grid-template-columns: repeat(3, 1fr);
  transition: all 0.4s ease;
}

/* ── OVERLAY DE SUCESSO ── */
.overlay-sucesso {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.overlay-sucesso--visivel {
  opacity: 1;
}

.card-sucesso {
  background-color: #fff;
  border-radius: 20px;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  max-width: min(90vw, 360px);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transform: scale(0.85);
  transition: transform 0.4s ease;
}

.overlay-sucesso--visivel .card-sucesso {
  transform: scale(1);
}

.icone-sucesso {
  width: clamp(60px, 20vw, 100px);
  height: auto;
}

.titulo-sucesso {
  font-size: clamp(22px, 6vw, 36px);
  font-weight: 700;
  color: #333;
}

.subtitulo-sucesso {
  font-size: clamp(14px, 3.5vw, 18px);
  color: #555;
}

.btn-jogar-novamente {
  margin-top: 0.5rem;
  padding: 0.6rem 1.8rem;
  background-color: #4caf50;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-jogar-novamente:hover {
  background-color: #43a047;
  transform: scale(1.05);
}

.btn-jogar-novamente:active {
  transform: scale(0.97);
}
