/* ===== Bye Bye Telinha! — estilo geral ===== */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&display=swap');

:root {
  --roxo: #8e5bd6;
  --rosa: #f2649b;
  --amarelo: #f7b32b;
  --verde-agua: #2bbfb3;
  --laranja: #f57e3f;
  --fundo: #fdf6ff;
  --texto: #4a3b63;
  --branco: #ffffff;
  --sombra: 0 6px 0 rgba(74, 59, 99, .12);
  --raio: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Baloo 2', 'Comic Sans MS', cursive, sans-serif;
  background: var(--fundo);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(43, 191, 179, .10) 0 120px, transparent 120px),
    radial-gradient(circle at 90% 10%, rgba(242, 100, 155, .10) 0 150px, transparent 150px),
    radial-gradient(circle at 80% 85%, rgba(247, 179, 43, .12) 0 130px, transparent 130px);
  color: var(--texto);
  min-height: 100vh;
}

.container { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ===== Cabeçalho ===== */
header.topo {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0;
}
header.topo img.logo { height: 120px; }
header.topo .espaco { flex: 1; }
a.voltar {
  text-decoration: none; color: var(--roxo); font-weight: 800; font-size: 1.05rem;
  background: var(--branco); padding: 8px 16px; border-radius: 999px; box-shadow: var(--sombra);
}

/* Chip do tempo restante */
.chip-tempo {
  background: var(--branco); border-radius: 999px; padding: 8px 18px;
  font-weight: 800; box-shadow: var(--sombra); font-size: 1.05rem;
}
.chip-tempo.acabando { background: #ffe3e3; color: #d33; animation: pisca 1s infinite; }
@keyframes pisca { 50% { opacity: .55; } }

/* ===== Cartões dos jogos (página inicial) ===== */
.grade-jogos {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px; margin-top: 20px;
}
.cartao-jogo {
  background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra);
  padding: 20px; text-align: center; text-decoration: none; color: var(--texto);
  transition: transform .15s ease;
  border: 4px solid transparent;
}
.cartao-jogo:hover { transform: translateY(-6px) rotate(-1deg); border-color: var(--amarelo); }
.cartao-jogo img { width: 130px; height: 130px; object-fit: contain; }

/* Moldura padrão dos personagens: todos com o mesmo fundo */
.moldura {
  width: 140px; height: 140px; margin: 0 auto 8px;
  border-radius: 50%; border: 4px solid #eadffa;
  background: radial-gradient(circle at 50% 30%, #ffffff 0 40%, #f0e6fd 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.moldura img { width: 80% !important; height: 80% !important; object-fit: contain; }
.moldura-grande { width: 170px; height: 170px; margin-bottom: 12px; }
.cartao-jogo h2 { font-size: 1.35rem; margin-top: 8px; }
.cartao-jogo p { font-size: .95rem; opacity: .8; }

/* ===== Botões ===== */
.botao {
  display: inline-block; border: none; cursor: pointer; text-decoration: none;
  font-family: inherit; font-weight: 800; font-size: 1.1rem;
  background: var(--roxo); color: var(--branco);
  padding: 12px 26px; border-radius: 999px; box-shadow: var(--sombra);
  transition: transform .1s ease;
}
.botao:hover { transform: scale(1.05); }
.botao:active { transform: scale(.97); }
.botao.rosa { background: var(--rosa); }
.botao.verde { background: var(--verde-agua); }
.botao.amarelo { background: var(--amarelo); color: #6b4a00; }
.botao.laranja { background: var(--laranja); }
.botao:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ===== Painéis ===== */
.painel {
  background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra);
  padding: 24px; margin-top: 20px;
}
.painel h2 { color: var(--roxo); margin-bottom: 12px; }
.centro { text-align: center; }

/* Campo de nome */
input.campo {
  font-family: inherit; font-size: 1.1rem; font-weight: 700; color: var(--texto);
  border: 3px solid var(--roxo); border-radius: 999px; padding: 10px 18px; outline: none;
  width: min(300px, 100%);
}
input.campo:focus { border-color: var(--rosa); }

/* ===== Níveis ===== */
.escolha-nivel { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }

/* ===== Jogo da tabuada ===== */
.pergunta-tabuada { font-size: 3rem; font-weight: 800; color: var(--roxo); margin: 16px 0; }
.respostas { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 420px; margin: 0 auto; }
.respostas .botao { font-size: 1.6rem; padding: 18px; }
.respostas .certa { background: #3cb96c !important; }
.respostas .errada { background: #e35b5b !important; }
.barra-tempo { height: 14px; background: #eee4fb; border-radius: 999px; overflow: hidden; max-width: 420px; margin: 12px auto; }
.barra-tempo > div { height: 100%; background: var(--verde-agua); border-radius: 999px; transition: width .2s linear; }
.placar-jogo { font-size: 1.15rem; font-weight: 800; }

/* ===== Jogo da memória ===== */
/* As colunas e a largura máxima são definidas pelo jogo (piscou.js);
   as cartas se esticam para preencher, então encolhem sozinhas no celular */
.tabuleiro { display: grid; gap: 10px; justify-content: center; margin: 20px auto; }
.carta {
  width: 100%; max-width: 92px; aspect-ratio: 1 / 1; border-radius: 16px; cursor: pointer;
  perspective: 500px; background: transparent; border: none; padding: 0;
}
.carta .faces {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .35s ease;
}
.carta.virada .faces, .carta.achada .faces { transform: rotateY(180deg); }
.carta .face {
  position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--sombra);
}
.carta .frente { background: var(--roxo); color: var(--branco); font-size: 2rem; font-weight: 800; }
.carta .verso {
  background: radial-gradient(circle at 50% 30%, #ffffff 0 40%, #f0e6fd 100%);
  transform: rotateY(180deg); font-size: 2.6rem; overflow: hidden;
}
.carta .verso img { width: 86%; height: 86%; object-fit: contain; }
.carta.achada .verso { background: #e7f9ef; outline: 3px solid #3cb96c; }

/* ===== Clubinho Telinha ===== */
.mascote-area { text-align: center; }
.mascote-area img.mascote { width: 220px; height: 220px; object-fit: contain; transition: transform .3s ease, filter .8s ease; }

/* Palco do mascote + efeito de noite (soninho) */
.palco { position: relative; display: inline-block; }
.moldura-mascote {
  width: 260px; height: 260px;
  transition: background 1s ease, border-color 1s ease;
}
.moldura-mascote img.mascote { width: 82% !important; height: 82% !important; }
.palco .lua, .palco .zzz { position: absolute; opacity: 0; pointer-events: none; transition: opacity .8s ease; }
.palco .lua { top: 6px; right: 10px; font-size: 2.2rem; }
.palco .zzz { top: 30px; left: 14px; font-size: 1.8rem; }
.palco.noite .moldura-mascote {
  background: radial-gradient(circle at 50% 30%, #3d3564 0 40%, #221c40 100%);
  border-color: #4a4180;
}
.palco.noite img.mascote { filter: brightness(.45); transform: rotate(-4deg); }
.palco.noite .lua { opacity: 1; animation: balanca 3s ease-in-out infinite; }
.palco.noite .zzz { opacity: 1; animation: sobe-zzz 2s ease-in-out infinite; }
@keyframes balanca { 50% { transform: rotate(12deg); } }
@keyframes sobe-zzz {
  0% { transform: translateY(0) scale(.8); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateY(-26px) scale(1.15); opacity: 0; }
}
.mascote-area img.mascote.feliz { animation: pula .6s ease; }
@keyframes pula { 30% { transform: translateY(-24px) rotate(-4deg); } 60% { transform: translateY(0) rotate(3deg); } }
.humor { font-size: 1.3rem; font-weight: 800; margin: 8px 0; }
.barras-status { max-width: 420px; margin: 0 auto; text-align: left; }
.barras-status .linha { margin: 10px 0; }
.barras-status label { font-weight: 800; }
.barra-status { height: 20px; background: #f0e9fa; border-radius: 999px; overflow: hidden; }
.barra-status > div { height: 100%; border-radius: 999px; transition: width .4s ease; }
.acoes-mascote { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* Prateleiras de itens arrastáveis */
.dica-arrastar { font-weight: 800; margin-top: 16px; }
.prateleiras { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.prateleira { background: #f7f1fd; border-radius: 18px; padding: 12px 16px; min-width: 150px; }
.prateleira h3 { color: var(--roxo); font-size: 1rem; margin-bottom: 8px; }
.itens { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.item {
  font-size: 2.1rem; font-family: inherit; line-height: 1;
  width: 56px; height: 56px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--branco); border: none; border-radius: 14px;
  cursor: grab; box-shadow: var(--sombra);
  touch-action: none; /* essencial para arrastar com o dedo */
  transition: transform .1s ease;
}
.item:hover { transform: scale(1.12); }
.item:active { cursor: grabbing; }
.item-flutuante {
  position: fixed; z-index: 1000; font-size: 2.6rem;
  transform: translate(-50%, -50%); pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25));
}
.mascote-area img.mascote.alvo {
  transform: scale(1.08);
  filter: drop-shadow(0 0 18px rgba(142, 91, 214, .8));
}

/* ===== Telinha in English! (jogo de inglês) ===== */
.enunciado { font-size: 1.5rem; font-weight: 800; color: var(--roxo); margin-top: 10px; }
.enunciado-pt { font-size: .95rem; opacity: .75; font-weight: 700; margin-bottom: 6px; }

/* A figura da pergunta: emoji grande dentro da moldura de sempre */
.figura-emoji { font-size: 5.5rem; line-height: 1; }
.trio-emoji { font-size: 3.4rem; line-height: 1.1; margin: 14px 0; letter-spacing: 6px; }
.legenda-figura {
  font-size: 1.8rem; font-weight: 800; color: var(--laranja);
  letter-spacing: 3px; margin-top: 4px;
}

/* Quando a pergunta é a palavra e as opções são figuras */
.palavra-alvo {
  font-size: 2.6rem; font-weight: 800; color: var(--roxo);
  margin: 18px 0; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.opcao-emoji { font-size: 2.8rem !important; padding: 10px !important; background: #f7f1fd !important; }

/* Botão de ouvir a pronúncia */
.botao-som {
  font-family: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer;
  background: var(--branco); border: none; border-radius: 50%;
  width: 42px; height: 42px; box-shadow: var(--sombra);
}
.botao-som:hover { transform: scale(1.12); }

/* Cena das preposições: o bichinho e a caixa */
.cena { position: relative; width: 220px; height: 210px; margin: 10px auto; }
.cena .caixa {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 130px; height: 84px; border-radius: 10px;
  background: linear-gradient(#e0a86a, #c98a4b);
  border: 4px solid #a56b33; box-shadow: var(--sombra);
}
.cena .caixa::before { /* a tampa aberta da caixa */
  content: ''; position: absolute; inset: 0 0 auto 0; height: 14px;
  background: #a56b33; border-radius: 6px 6px 0 0;
}
.cena .bicho { position: absolute; font-size: 2.6rem; line-height: 1; }
.cena.in    .bicho { left: 50%; top: 58%; transform: translate(-50%, -50%) scale(.85); z-index: 2; }
.cena.on    .bicho { left: 50%; top: 26%; transform: translate(-50%, -50%); }
.cena.under .bicho { left: 50%; top: 80%; transform: translate(-50%, -50%); }
.cena.next-to .bicho { left: 86%; top: 52%; transform: translate(-50%, -50%); }

/* Nível difícil: digitar a palavra */
.area-digitar { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.area-digitar .campo { text-align: center; font-size: 1.4rem; letter-spacing: 1px; }
.dica-letras { font-weight: 800; letter-spacing: 2px; opacity: .8; }

/* Faltou a Palavra!: a frase com o buraco */
.frase-alvo {
  font-size: 1.35rem; font-weight: 800; line-height: 1.5;
  max-width: 520px; margin: 10px auto 0;
}
/* Sem isto o círculo do botão escorrega para baixo da linha de base */
.frase-alvo .botao-som { vertical-align: middle; margin-left: 8px; }
/* No jogo de português o emoji é enfeite, não a pergunta (no de inglês
   ele É a pergunta e usa .figura-emoji, bem maior) */
.emoji-enfeite { font-size: 3.4rem; line-height: 1; }

/* Capital da Telinha!: a bandeira */
.bandeira {
  height: 140px; width: auto; max-width: 100%;
  border-radius: 8px; box-shadow: var(--sombra);
  /* Bandeira com borda branca (Japão, Nigéria) desaparece no fundo claro */
  outline: 1px solid rgba(0,0,0,.15);
  margin: 10px auto 0; display: block;
}
.bandeira-mini { height: 26px; width: auto; border-radius: 3px; outline: 1px solid rgba(0,0,0,.15); }
/* Nome de capital é comprido: fonte menor que a dos emoji, e duas colunas
   para as 4 opções caberem sem a criança precisar rolar no meio do tempo */
.respostas-texto { max-width: 460px; }
.respostas-texto .botao { font-size: 1rem; padding: 12px 10px; line-height: 1.25; }

/* Resposta certa/errada */
.feedback { min-height: 1.8em; font-size: 1.2rem; font-weight: 800; margin-top: 12px; }
.feedback.bom { color: #2c9c5c; }
.feedback.ruim { color: #d33; }

/* ===== Ranking ===== */
#area-ranking { overflow-x: auto; }
table.ranking { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.ranking th, table.ranking td { padding: 8px 10px; text-align: left; }
table.ranking tr:nth-child(even) td { background: #f7f1fd; }
table.ranking th { color: var(--roxo); border-bottom: 3px solid var(--roxo); }
table.ranking td.medalha { font-size: 1.2rem; width: 40px; }

/* ===== Tela de "acabou o tempo" ===== */
#tela-bye {
  position: fixed; inset: 0; z-index: 999;
  background: linear-gradient(160deg, #8e5bd6, #f2649b);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 24px; color: var(--branco);
}
#tela-bye img { width: min(320px, 70vw); border-radius: 24px; }
#tela-bye h1 { font-size: 2.2rem; }
#tela-bye p { font-size: 1.2rem; max-width: 480px; }

footer { text-align: center; padding: 24px; opacity: .65; font-weight: 700; }

/* ===== Celular (telas estreitas) ===== */
@media (max-width: 600px) {
  .container { padding: 10px; }

  header.topo { padding: 8px 0; gap: 8px; }
  header.topo img.logo { height: 76px; }
  a.voltar { padding: 6px 12px; font-size: .9rem; }
  .chip-tempo { padding: 6px 12px; font-size: .95rem; }

  .painel { padding: 16px 12px; margin-top: 14px; }
  .grade-jogos { gap: 12px; margin-top: 14px; }
  .cartao-jogo { padding: 14px; }
  .cartao-jogo img { width: 96px; height: 96px; }
  .cartao-jogo h2 { font-size: 1.2rem; }

  .bandeira { height: 110px; }
  /* No celular a rolagem é natural: uma coluna lê melhor que duas apertadas */
  .respostas-texto { grid-template-columns: 1fr; }
  .respostas-texto .botao { font-size: .95rem; padding: 10px 12px; }

  .frase-alvo { font-size: 1.15rem; }
  .emoji-enfeite { font-size: 2.6rem; }

  .botao { font-size: 1rem; padding: 10px 18px; }
  .escolha-nivel { gap: 8px; }
  .escolha-nivel .botao { flex: 1 1 100px; padding: 10px 8px; }

  input.campo { font-size: 1rem; }

  .pergunta-tabuada { font-size: 2.4rem; margin: 10px 0; }
  .respostas { gap: 10px; }
  .respostas .botao { font-size: 1.3rem; padding: 14px; }
  .placar-jogo { font-size: 1rem; }

  .tabuleiro { gap: 6px; }
  .carta .verso { font-size: 1.7rem; }
  .carta .frente { font-size: 1.4rem; }

  .mascote-area img.mascote { width: 160px; height: 160px; }
  .moldura { width: 110px; height: 110px; }
  .moldura-grande { width: 140px; height: 140px; }
  .moldura-mascote { width: 200px; height: 200px; }
  .humor { font-size: 1.1rem; }
  .acoes-mascote { gap: 8px; }
  .acoes-mascote .botao { flex: 1 1 100%; }
  .prateleiras { gap: 8px; }
  .prateleira { min-width: 0; flex: 1 1 44%; padding: 10px; }
  .item { width: 48px; height: 48px; font-size: 1.8rem; }

  .enunciado { font-size: 1.2rem; }
  .figura-emoji { font-size: 4.2rem; }
  .trio-emoji { font-size: 2.6rem; letter-spacing: 3px; }
  .palavra-alvo { font-size: 2rem; margin: 12px 0; }
  .opcao-emoji { font-size: 2.2rem !important; }
  .legenda-figura { font-size: 1.5rem; }
  .cena { width: 190px; height: 180px; }
  .cena .caixa { width: 110px; height: 70px; }
  .feedback { font-size: 1.05rem; }

  table.ranking { font-size: .88rem; }
  table.ranking th, table.ranking td { padding: 6px; }

  #tela-bye h1 { font-size: 1.7rem; }
  #tela-bye p { font-size: 1rem; }
}
