@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

/* ========================================================
   VARIÁVEIS DE COR E TEMA NUVITO
   ======================================================== */
:root {
  --laranja: #ff8a3d;
  --laranja-escuro: #d66e2d;
  --azul-ceu: #a5d8ff;
  --azul-escuro: #2f7dff;
  --verde: #2ecc71;
  --verde-escuro: #219653;
  --vermelho: #ff7675;
  --vermelho-escuro: #d63031;
  --roxo: #a29bfe;
  --roxo-escuro: #6c5ce7;
  --amarelo: #ffa502;
  --cinza: #636e72;
  --cinza-claro: #f1f5f9;
  --borda-raio: 24px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ========================================================
   MODAIS E OVERLAYS
   ======================================================== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background: rgba(165, 216, 255, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.25s ease;
}

.card-info {
  background: #ffffff;
  border: 7px solid var(--laranja);
  border-radius: 36px;
  padding: 26px 20px;
  max-width: 480px;
  width: min(94vw, 480px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-inicio {
  max-width: 440px;
}

.icone-topo-modal {
  font-size: 3rem;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #fff3e6;
  color: var(--laranja);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(255, 138, 61, 0.2);
}

.texto-destaque {
  font-family: 'Fredoka', sans-serif;
  line-height: 1.2;
}

/* Grid de Modos no Modal Inicial */
.grid-modos-inicio {
  display: grid;
  gap: 12px;
  margin: 15px 0;
}

.card-modo-inicio {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 22px;
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Nunito', sans-serif;
}

.card-modo-inicio:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--azul-escuro);
  background: #f0f7ff;
}

.card-modo-inicio.destaque {
  background: #fff8f0;
  border-color: var(--laranja);
  box-shadow: 0 6px 16px rgba(255, 138, 61, 0.15);
}

.card-modo-inicio .modo-emoji {
  font-size: 2.2rem;
  flex-shrink: 0;
}

.card-modo-inicio .modo-textos strong {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  color: #1e293b;
}

.card-modo-inicio .modo-textos small {
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.3;
}

/* ========================================================
   BARRA SUPERIOR (TOPO)
   ======================================================== */
.topo {
  width: 100%;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.94);
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  position: relative;
  flex-shrink: 0;
  gap: 8px;
}

.grupo-esq {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lado-dir {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.centro-topo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.modo-pill {
  background: #eef4ff;
  color: var(--azul-escuro);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 5px 14px;
  border-radius: 20px;
  border: 2px solid #c7dcff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.btn-ouvir-desafio {
  background: #ffffff;
  border: 1.5px solid #c7dcff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.btn-ouvir-desafio:hover { transform: scale(1.15); }

.btn-sair, .btn-modo {
  text-decoration: none;
  color: #fff;
  padding: 7px 12px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
  transition: transform 0.1s, box-shadow 0.1s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-sair {
  background: var(--vermelho);
  box-shadow: 0 3px 0 var(--vermelho-escuro);
}
.btn-sair:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--vermelho-escuro);
}

.btn-modo {
  background: var(--roxo);
  box-shadow: 0 3px 0 var(--roxo-escuro);
}
.btn-modo:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--roxo-escuro);
}

/* Botões Rápidos de Ação (Undo, Redo, Limpar, Salvar) */
.btn-acao-topo {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  padding: 6px 9px;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: 0 2px 0 #cbd5e1;
}

.btn-acao-topo:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #ffffff;
  border-color: #94a3b8;
}

.btn-acao-topo:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.btn-acao-topo:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-acao-topo.btn-limpar:hover {
  background: #fff0f0;
  border-color: var(--vermelho);
}

.btn-acao-topo.btn-salvar {
  background: #e8fff3;
  border-color: var(--verde);
  box-shadow: 0 2px 0 var(--verde-escuro);
}

/* ========================================================
   ÁREA CENTRAL: LOUSA & CANVAS
   ======================================================== */
.lousa-container {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px 6px;
  position: relative;
  z-index: 10;
  min-height: 0;
  overflow: hidden;
}

/* Banner de Desafio do Nuvito */
.banner-desafio {
  width: min(96vw, 840px);
  background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
  border: 3px solid var(--laranja);
  border-radius: 18px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  box-shadow: 0 6px 18px rgba(255, 138, 61, 0.18);
  flex-shrink: 0;
  animation: slideDown 0.3s ease;
}

.desafio-conteudo {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.desafio-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--laranja-escuro);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.1;
  margin-bottom: 2px;
}

#texto-desafio {
  font-size: 0.95rem;
  line-height: 1.25;
  color: #1e293b;
  font-family: 'Fredoka', sans-serif;
  word-break: break-word;
  overflow-wrap: break-word;
}

.desafio-botoes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-mini-desafio {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px 10px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-mini-desafio:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.btn-mini-desafio.btn-concluir-desafio {
  background: var(--verde);
  color: #ffffff;
  border-color: var(--verde-escuro);
  box-shadow: 0 3px 0 var(--verde-escuro);
}
.btn-mini-desafio.btn-concluir-desafio:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Caixa do Canvas */
.canvas-box {
  width: min(96vw, 860px);
  flex: 1;
  min-height: 0;
  background: #ffffff;
  border: 7px solid var(--laranja);
  border-radius: var(--borda-raio);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#canvas-fundo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#canvas-desenho {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  touch-action: none;
  z-index: 2;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🖌️%3C/text%3E%3C/svg%3E") 2 28, crosshair;
}

/* Cursores Temáticos de Emojis */
#canvas-desenho.cursor-pincel {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🖌️%3C/text%3E%3C/svg%3E") 2 28, crosshair;
}
#canvas-desenho.cursor-magico {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🪄%3C/text%3E%3C/svg%3E") 2 28, crosshair;
}
#canvas-desenho.cursor-neon {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🖍️%3C/text%3E%3C/svg%3E") 2 28, crosshair;
}
#canvas-desenho.cursor-borracha {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🧽%3C/text%3E%3C/svg%3E") 6 24, crosshair;
}
#canvas-desenho.cursor-balde {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🪣%3C/text%3E%3C/svg%3E") 6 24, crosshair;
}
#canvas-desenho.cursor-forma {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E📐%3C/text%3E%3C/svg%3E") 2 28, crosshair;
}
#canvas-desenho.cursor-carimbo {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E🌟%3C/text%3E%3C/svg%3E") 16 16, crosshair;
}
#canvas-desenho.cursor-texto {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='24'%3E✍️%3C/text%3E%3C/svg%3E") 2 28, text;
}

/* ========================================================
   PAINEL INFERIOR DE FERRAMENTAS E CORES
   ======================================================== */
.painel-ferramentas {
  width: 100%;
  background: rgba(255, 255, 255, 0.97);
  border-top: 4px solid var(--laranja);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  overflow: hidden;
}

.linha-ferramentas {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  padding: 2px 4px;
  scrollbar-width: none;
}
.linha-ferramentas::-webkit-scrollbar { display: none; }

@media (min-width: 768px) {
  .linha-ferramentas {
    justify-content: center;
  }
}

.grupo-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-tool {
  background: #f8fafc;
  border: 2.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 52px;
  flex-shrink: 0;
  touch-action: pan-x;
}

.btn-tool .icon-tool {
  font-size: 1.3rem;
  line-height: 1;
}

.btn-tool .label-tool {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  margin-top: 2px;
}

.btn-tool:hover {
  transform: translateY(-2px);
  background: #ffffff;
  border-color: var(--azul-escuro);
}

.btn-tool:active {
  transform: translateY(1px);
}

.btn-tool.ativo {
  background: #fff7ed;
  border-color: var(--laranja);
  box-shadow: 0 4px 10px rgba(255, 138, 61, 0.25);
  transform: scale(1.05);
}
.btn-tool.ativo .label-tool {
  color: var(--laranja-escuro);
  font-weight: 800;
}

.divisor-tools {
  width: 2px;
  height: 36px;
  background: #e2e8f0;
  border-radius: 2px;
  flex-shrink: 0;
  margin: 0 2px;
}

/* Grupo de Espessura */
.grupo-tamanhos {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  padding: 4px 6px;
  border-radius: 16px;
  flex-shrink: 0;
}

.btn-size {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  touch-action: pan-x;
}

.btn-size .dot-size {
  background: #334155;
  border-radius: 50%;
  transition: background 0.15s;
}

.btn-size:hover {
  border-color: #94a3b8;
  transform: scale(1.1);
}

.btn-size.ativo {
  background: var(--azul-escuro);
  border-color: #ffffff;
  box-shadow: 0 2px 6px rgba(47, 125, 255, 0.35);
}
.btn-size.ativo .dot-size {
  background: #ffffff;
}

/* Linha 2: Cores */
.linha-cores {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
}

@media (min-width: 768px) {
  .linha-cores {
    justify-content: center;
  }
  .scroll-cores {
    justify-content: center;
  }
}

.scroll-cores {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  padding: 4px 4px 6px;
  scrollbar-width: none;
}
.scroll-cores::-webkit-scrollbar { display: none; }

.cor-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.cor-btn:hover {
  transform: scale(1.18);
}

.cor-btn:active {
  transform: scale(0.95);
}

.cor-btn.ativo {
  transform: scale(1.22);
  border-color: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cor-btn.ativo::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Color Picker Personalizado */
.cor-btn-picker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4757, #ffa502, #2ed573, #1e90ff, #8c7ae6);
  border: 3px solid #ffffff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.cor-btn-picker:hover { transform: scale(1.18); }
.cor-btn-picker span {
  font-size: 0.9rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}
.cor-btn-picker input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* ========================================================
   MODAIS DE FORMAS E FIGURINHAS (STICKERS)
   ======================================================== */
.modal-sub {
  z-index: 500;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 10px;
}

.modal-titulo {
  font-family: 'Fredoka', sans-serif;
  color: var(--azul-escuro);
  font-size: 1.4rem;
  margin: 0;
}

.btn-fechar-modal {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-fechar-modal:hover {
  background: #fee2e2;
  color: var(--vermelho);
}

.grid-escolha-formas {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.card-escolha-forma {
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  color: #334155;
  transition: all 0.15s;
}
.card-escolha-forma:hover {
  border-color: var(--azul-escuro);
  background: #f0f7ff;
  transform: translateY(-2px);
}
.card-escolha-forma .simbolo-forma {
  font-size: 1.6rem;
}

/* Stickers / Figurinhas */
.modal-box-stickers {
  max-width: 520px;
  width: min(94vw, 520px);
}

.subtitulo-stickers {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  color: var(--laranja);
  text-align: left;
  margin: 12px 0 8px;
}

.grid-stickers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.item-sticker {
  background: #f8fafc;
  border: 2.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.item-sticker img {
  max-width: 50px;
  height: 50px;
  object-fit: contain;
}

.item-sticker span {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: #475569;
}

.item-sticker:hover {
  border-color: var(--laranja);
  background: #fff8f0;
  transform: scale(1.08);
}

.emojis-grid {
  grid-template-columns: repeat(6, 1fr);
}

.emoji-stk {
  padding: 8px;
}
.emoji-stk span {
  font-size: 1.8rem;
}

/* Abas do Modal de Figurinhas e Letras */
.nav-abas-modal {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  border-bottom: 2px solid #f1f5f9;
  scrollbar-width: none;
}
.nav-abas-modal::-webkit-scrollbar { display: none; }

.tab-btn {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn:hover {
  background: #ffffff;
  border-color: var(--laranja);
  color: var(--laranja-escuro);
}
.tab-btn.ativo {
  background: var(--laranja);
  border-color: var(--laranja-escuro);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(255, 138, 61, 0.3);
}

/* Grid de Letras e Números */
.grid-alfabeto {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding: 4px;
}
.grid-alfabeto.grid-numeros {
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 600px) {
  .grid-alfabeto {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 210px;
  }
}

.item-letra {
  background: #ffffff;
  border: 2.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 4px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 3px 0 #e2e8f0;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-letra:hover {
  border-color: var(--azul-escuro);
  background: #f0f7ff;
  transform: scale(1.1);
}
.item-letra:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Área de Digitar Texto Livre */
.area-escrever-texto {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.input-texto-custom {
  width: 100%;
  max-width: 360px;
  padding: 12px 16px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  border: 3px solid #cbd5e1;
  border-radius: 18px;
  text-align: center;
  outline: none;
  color: #1e293b;
  transition: border-color 0.2s;
}
.input-texto-custom:focus {
  border-color: var(--laranja);
}
.chips-sugestoes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 380px;
}
.chip-sugestao {
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 5px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.chip-sugestao:hover {
  background: #fff8f0;
  border-color: var(--laranja);
  color: var(--laranja-escuro);
  transform: translateY(-1px);
}

/* ========================================================
   MODAL DE PAPÉIS DE FUNDO TEMÁTICOS
   ======================================================== */
.modal-box-fundos {
  max-width: 560px;
  width: min(94vw, 560px);
}

.modal-subtitulo {
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: #64748b;
  margin: -4px 0 16px;
}

.grid-fundos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

@media (max-width: 500px) {
  .grid-fundos {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.card-fundo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  width: 100%;
}

.card-fundo:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--azul-escuro);
  background: #ffffff;
}

.card-fundo.ativo {
  border-color: var(--laranja);
  background: #fff8f0;
  box-shadow: 0 4px 14px rgba(255, 138, 61, 0.25);
}

.preview-fundo {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.preview-fundo-branco {
  background: #ffffff;
  border-color: #cbd5e1;
}

.preview-fundo-espaco {
  background: linear-gradient(135deg, #070919 0%, #151c44 60%, #2b1c5a 100%);
  color: #fff;
}

.preview-fundo-quadriculado {
  background-color: #ffffff;
  background-image: linear-gradient(#cbd5e1 1px, transparent 1px), linear-gradient(90deg, #cbd5e1 1px, transparent 1px);
  background-size: 10px 10px;
}

.preview-fundo-natureza {
  background: linear-gradient(180deg, #5fa8ff 0%, #d8f0ff 55%, #2ed573 55%, #10ac84 100%);
}

.preview-fundo-mar {
  background: linear-gradient(180deg, #00d2d3 0%, #0984e3 50%, #0c1b40 100%);
}

.preview-fundo-pordosol {
  background: linear-gradient(180deg, #2d1345 0%, #d3363b 50%, #fed330 100%);
}

.info-fundo strong {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  color: #1e293b;
}

.info-fundo small {
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.2;
}

/* ========================================================
   BOTÕES DE AÇÃO GLOBAIS
   ======================================================== */
.btn-acao {
  background: var(--verde);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: 50px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--verde-escuro);
  transition: transform 0.1s, box-shadow 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-acao:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--verde-escuro);
}

/* ========================================================
   CONTROLES DE ÁUDIO, MÚSICA E TELA CHEIA (BARRA INFERIOR)
   ======================================================== */
.floating-controls {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 6px;
}

.botoes-secundarios {
  display: none;
  flex-direction: column-reverse;
  gap: 8px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.96);
  padding: 6px;
  border-radius: 30px;
  border: 2px solid #e2e8f0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  transition: opacity 0.25s, transform 0.25s;
}

.btn-circular {
  width: 38px;
  height: 38px;
  border-radius: 50% !important;
  border: 2.5px solid #ffffff !important;
  cursor: pointer;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14) !important;
  background: #ffffff;
  color: #4b5563;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
}
.btn-circular:hover { transform: scale(1.1); }
.btn-circular:active { transform: scale(0.92); }

#btn-musica.ativo { background: #ff8533 !important; color: #ffffff !important; }
#btn-musica:not(.ativo) { background: #ffffff !important; color: #4b5563 !important; }

#btn-som.ativo { background: #2ecc71 !important; color: #ffffff !important; }
#btn-som:not(.ativo) { background: #ffffff !important; color: #4b5563 !important; }

#btn-fullscreen { background: #8e7df0 !important; color: #ffffff !important; }

/* Telas grandes (> 1366px): remove a engrenagem e exibe botões lado a lado */
@media (min-width: 1367px) {
  .floating-controls {
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: calc(18px + env(safe-area-inset-right));
  }
  #btn-config {
    display: none !important;
  }
  .botoes-secundarios {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ========================================================
   BADGE & PARTÍCULAS
   ======================================================== */
.badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
}
.badge.show { transform: translateX(-50%) scale(1); }
.badge.ok { background: var(--verde); box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4); }
.badge.info { background: var(--azul-escuro); box-shadow: 0 4px 12px rgba(47, 125, 255, 0.4); }

.nuvito-animado {
  animation: pular 2s infinite ease-in-out;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.15));
}

@keyframes pular {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes popIn {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideDown {
  0% { transform: translateY(-15px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Partículas Brilhantes do Pincel Mágico */
.particle-magic {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: magicFade 0.7s forwards ease-out;
  z-index: 999;
}
@keyframes magicFade {
  0% { transform: translate(0, 0) scale(1.2) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0) rotate(180deg); opacity: 0; }
}

/* Indicador Visual Tátil da Ferramenta (Touch Ripple para Celular e Tablet) */
.touch-ripple {
  position: absolute;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  border: 3px solid #ff8a3d;
  pointer-events: none;
  z-index: 998;
  animation: touchRippleAnim 0.38s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}
@keyframes touchRippleAnim {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Indicador de Scroll Padrão Oficial do Portal Nuvito */
.scroll-indicator {
  position: absolute;
  bottom: 15px;
  left: 20px;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  animation: floatScroll 10s infinite ease-in-out;
  z-index: 500;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
@media (max-width: 768px) {
  .scroll-indicator {
    display: none !important;
  }
  .centro-topo {
    display: none !important;
  }
  .topo {
    justify-content: space-between;
    padding: 6px 12px;
  }
}
.scroll-indicator:hover { color: #fff; }

@keyframes floatScroll {
  0%, 90%, 100% { transform: translate(0, 0); }
  95% { transform: translate(0, 10px); }
}
.scroll-indicator svg {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  fill: none;
  stroke: white;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* Botão Voltar ao Jogo da Seção SEO */
.btn-voltar-jogo {
  background: var(--laranja, #ff8a3d);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 15px rgba(255, 138, 61, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-voltar-jogo:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 138, 61, 0.45);
}

/* ========================================================
   BLOQUEIO EM MODO PAISAGEM NO CELULAR
   ======================================================== */
#landscape-lock {
  display: none;
  position: fixed;
  inset: 0;
  background: #2f7dff;
  z-index: 99999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding: 20px;
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  #landscape-lock { display: flex; }
}
.icon-rotate {
  font-size: 4rem;
  margin-bottom: 12px;
  animation: rotatePhone 2s ease-in-out infinite;
}
@keyframes rotatePhone {
  0%, 100% { transform: rotate(-90deg); }
  50% { transform: rotate(0deg); }
}

/* ========================================================
   RESPONSIVIDADE MOBILE (TELAS MENORES QUE 600px)
   ======================================================== */
@media (max-width: 600px) {
  .topo {
    padding: 6px 8px;
    justify-content: space-between;
    gap: 4px;
  }
  .centro-topo {
    display: none !important;
  }
  .btn-sair, .btn-modo {
    padding: 6px 9px;
    font-size: 0.8rem;
  }
  .btn-acao-topo {
    padding: 5px 6px;
    font-size: 0.92rem;
  }

  .lousa-container { padding: 4px 6px; }
  .canvas-box { border-width: 5px; border-radius: 18px; }

  .painel-ferramentas {
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    gap: 4px;
    overflow-x: hidden;
  }
  .linha-ferramentas {
    padding: 2px 6px 4px;
    gap: 6px;
    min-width: 0;
    width: 100%;
  }
  .grupo-tools {
    gap: 5px;
  }
  .btn-tool {
    min-width: 44px;
    padding: 4px 5px;
  }
  .btn-tool .icon-tool { font-size: 1.15rem; }
  .btn-tool .label-tool { font-size: 0.65rem; }

  .linha-cores {
    min-width: 0;
    width: 100%;
  }
  .scroll-cores {
    padding: 2px 6px 4px;
    gap: 6px;
    min-width: 0;
    width: 100%;
  }

  .cor-btn, .cor-btn-picker { width: 28px; height: 28px; }
  .btn-size { width: 28px; height: 28px; }
  .grupo-tamanhos { gap: 4px; padding: 3px 5px; }
  
  .grid-stickers { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .emojis-grid { grid-template-columns: repeat(6, 1fr); gap: 4px; }
  .item-sticker img { max-width: 40px; height: 40px; }
  
  .banner-desafio { padding: 5px 8px; gap: 6px; }
  .desafio-tag { font-size: 0.7rem; }
  #texto-desafio { font-size: 0.84rem; line-height: 1.2; }
  .btn-mini-desafio { padding: 4px 6px; font-size: 0.72rem; }

  .floating-controls { bottom: calc(10px + env(safe-area-inset-bottom)); right: 8px; }
  .btn-circular { width: 34px; height: 34px; font-size: 0.95rem; }
}
