@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 VAMOS COLORIR?
   ======================================================== */
: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(255, 235, 204, 0.55);
  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: 460px;
}

.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;
}

.texto-bolha {
  font-family: 'Fredoka', sans-serif;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* ========================================================
   ESTILOS DO NOVO MENU INICIAL LÚDICO (VAMOS COLORIR)
   ======================================================== */
.menu-colorir-card {
  max-width: 460px !important;
  width: min(94vw, 460px) !important;
  padding: 20px 20px 16px 20px !important;
  border-radius: 34px !important;
  border: 6px solid var(--laranja) !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22), inset 0 -6px 0 rgba(0, 0, 0, 0.05) !important;
}

.menu-colorir-topo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.menu-mascote-wrapper {
  position: relative;
  margin-top: -6px;
  margin-bottom: 6px;
}

.menu-mascote-img {
  height: 74px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.14));
  animation: floatPintor 3.2s ease-in-out infinite;
}

@keyframes floatPintor {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}

.menu-colorir-titulo {
  font-size: 1.85rem;
  color: var(--laranja);
  margin: 0 0 2px 0;
  line-height: 1.15;
  text-align: center;
}

.menu-colorir-subtitulo {
  margin: 0 0 8px 0;
  color: #64748b;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

/* Chips das Super Ferramentas */
.menu-chips-destaque {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.chip-item {
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  user-select: none;
}

/* Grid de Modos com Relevo 3D */
.grid-modos-inicio {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 14px 0;
  width: 100%;
}

.card-modo-opcao {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border-radius: 20px;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Fredoka', sans-serif;
  position: relative;
  box-sizing: border-box;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

/* Modo 1: Colorir Livre */
.card-modo-opcao.modo-livre-btn {
  background: linear-gradient(135deg, #ffffff 0%, #fff8f0 100%);
  border: 3.5px solid #ff9f43;
  box-shadow: 0 6px 0 #e67e22, 0 10px 18px rgba(255, 159, 67, 0.18);
}
.card-modo-opcao.modo-livre-btn:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 9px 0 #e67e22, 0 14px 22px rgba(255, 159, 67, 0.26);
}
.card-modo-opcao.modo-livre-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #e67e22;
}
.card-modo-opcao.modo-livre-btn .modo-icone-box {
  background: #fff3e6;
  border: 2px solid #ff9f43;
  color: #d35400;
}
.card-modo-opcao.modo-livre-btn .modo-titulo {
  color: #d35400;
}

/* Modo 2: Desafios */
.card-modo-opcao.modo-desafio-btn {
  background: linear-gradient(135deg, #ffffff 0%, #f4f0ff 100%);
  border: 3.5px solid #8c7ae6;
  box-shadow: 0 6px 0 #6c5ce7, 0 10px 18px rgba(108, 92, 231, 0.18);
}
.card-modo-opcao.modo-desafio-btn:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 9px 0 #6c5ce7, 0 14px 22px rgba(108, 92, 231, 0.26);
}
.card-modo-opcao.modo-desafio-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #6c5ce7;
}
.card-modo-opcao.modo-desafio-btn .modo-icone-box {
  background: #ede7f6;
  border: 2px solid #8c7ae6;
  color: #5f27cd;
}
.card-modo-opcao.modo-desafio-btn .modo-titulo {
  color: #4834d4;
}

/* Ícones e Textos dos Cards */
.modo-icone-box {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.modo-textos {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.modo-linha-topo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modo-titulo {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.modo-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-livre {
  background: #ffeaa7;
  color: #d35400;
}

.badge-desafio {
  background: #e8e4f9;
  color: #5f27cd;
}

.modo-descricao {
  font-size: 0.84rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.3;
}

.modo-seta {
  font-size: 1.25rem;
  font-weight: 900;
  color: #b2bec3;
  margin-left: 4px;
  transition: transform 0.2s, color 0.2s;
}

.card-modo-opcao:hover .modo-seta {
  transform: translateX(4px);
  color: #636e72;
}

/* Rodapé: Botões Galeria & Voltar ao Portal */
.menu-colorir-rodape {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn-menu-galeria {
  flex: 1.3;
  background: var(--azul-escuro, #1e5ac0);
  color: white;
  box-shadow: 0 5px 0 #133b7e;
  border: none;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 11px 14px;
  border-radius: 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-sizing: border-box;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-menu-galeria:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-menu-galeria:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #133b7e;
}

.btn-menu-sair {
  flex: 0.9;
  background: var(--vermelho, #ff7675);
  color: white;
  box-shadow: 0 5px 0 var(--vermelho-escuro, #d63031);
  border: none;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 11px 14px;
  border-radius: 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-sizing: border-box;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-menu-sair:hover {
  background: var(--vermelho-escuro, #d63031);
  transform: translateY(-2px);
}

.btn-menu-sair:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--vermelho-escuro, #d63031);
}

.btn-ico {
  font-size: 1.05rem;
}

@media (max-width: 600px) {
  .menu-colorir-card {
    padding: 14px 14px 12px 14px !important;
    border-width: 4px !important;
    border-radius: 24px !important;
  }
  .menu-mascote-img {
    height: 56px;
  }
  .menu-colorir-titulo {
    font-size: 1.45rem;
  }
  .menu-colorir-subtitulo {
    font-size: 0.82rem;
    margin-bottom: 6px;
  }
  .chip-item {
    font-size: 0.68rem;
    padding: 2px 8px;
  }
  .grid-modos-inicio {
    gap: 9px;
    margin: 9px 0 11px 0;
  }
  .card-modo-opcao {
    padding: 9px 12px;
    gap: 10px;
    border-radius: 16px;
  }
  .modo-icone-box {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1.25rem;
    border-radius: 11px;
  }
  .modo-titulo {
    font-size: 0.98rem;
  }
  .modo-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
  }
  .modo-descricao {
    font-size: 0.74rem;
  }
  .modo-seta {
    font-size: 1.1rem;
  }
  .menu-colorir-rodape {
    gap: 8px;
  }
  .btn-menu-galeria, .btn-menu-sair {
    font-size: 0.82rem;
    padding: 9px 10px;
    border-radius: 14px;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  }
  .btn-ico {
    font-size: 0.9rem;
  }
}

@media (max-width: 360px) {
  .menu-colorir-card {
    padding: 10px 10px 10px 10px !important;
    border-radius: 20px !important;
  }
  .menu-mascote-img {
    height: 48px;
  }
  .menu-colorir-titulo {
    font-size: 1.3rem;
  }
  .card-modo-opcao {
    padding: 7px 10px;
    gap: 8px;
  }
  .modo-icone-box {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 1.1rem;
  }
  .btn-menu-galeria, .btn-menu-sair {
    font-size: 0.76rem;
    padding: 7px 8px;
  }
}

/* ========================================================
   MODAL DE GALERIA DE DESENHOS
   ======================================================== */
.modal-box-galeria {
  max-width: 880px;
  width: min(96vw, 880px);
  padding: 18px 18px 14px;
}

.modal-box-galeria .modal-header {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.modal-box-galeria .modal-titulo {
  font-size: 1.25rem;
}

.modal-subtitulo {
  font-size: 0.86rem;
  font-weight: 700;
  color: #64748b;
  margin: -4px 0 8px;
  text-align: left;
}

/* Painel de Filtros por Categoria (Compacto e sem ocupar espaço da tela) */
.filtros-galeria {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 6px;
  padding: 0 0 10px;
  margin-bottom: 8px;
  border-bottom: 1.5px dashed #e2e8f0;
}

.btn-filtro-galeria {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.btn-filtro-galeria:hover {
  border-color: var(--laranja);
  background: #fff8f3;
  color: var(--laranja);
  transform: translateY(-1px);
}

.btn-filtro-galeria.ativo {
  background: var(--laranja);
  border-color: var(--laranja);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(255, 138, 61, 0.28);
  transform: scale(1.02);
}

.btn-filtro-galeria .badge-cat {
  background: rgba(0, 0, 0, 0.07);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.btn-filtro-galeria.ativo .badge-cat {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.grid-galeria-desenhos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.card-galeria-item {
  background: #ffffff;
  border: 3.5px solid #e2e8f0;
  border-radius: 22px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  position: relative;
  text-align: center;
}

.card-galeria-item:hover {
  transform: translateY(-4px);
  border-color: var(--laranja);
  box-shadow: 0 10px 24px rgba(255, 138, 61, 0.2);
}

.card-galeria-item.ativo {
  border-color: var(--laranja);
  background: #fffaf5;
  box-shadow: 0 8px 20px rgba(255, 138, 61, 0.25);
}

.card-galeria-item .thumb-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f8fafc;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
  border: 1.5px solid #f1f5f9;
}

.card-galeria-item .thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}

.card-galeria-item:hover .thumb-wrap img {
  transform: scale(1.05);
}

.card-galeria-item .info-desenho {
  margin-top: 10px;
  width: 100%;
}

.card-galeria-item .titulo-desenho {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

.card-galeria-item .desc-desenho {
  display: none;
}

.card-galeria-item .btn-escolher-desenho {
  background: var(--laranja);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 6px 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--laranja-escuro);
  cursor: pointer;
  transition: transform 0.1s;
}

.card-galeria-item.ativo .btn-escolher-desenho {
  background: var(--verde);
  box-shadow: 0 3px 0 var(--verde-escuro);
}

/* ========================================================
   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 {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 440px);
  pointer-events: auto;
  z-index: 10;
}

.modo-pill {
  background: #fff6ee;
  color: var(--laranja-escuro);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 5px 18px;
  border-radius: 20px;
  border: 2px solid #fed7aa;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  max-width: 100%;
  box-shadow: 0 2px 6px rgba(255, 138, 61, 0.08);
}

.nome-desenho-topo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding-right: 4px;
}

.btn-ouvir-desafio {
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  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, .btn-desenhos {
  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-desenhos {
  background: var(--azul-escuro);
  box-shadow: 0 3px 0 #1e5ac0;
}
.btn-desenhos:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1e5ac0;
}

.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 MULTICAMADAS
   ======================================================== */
.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);
  max-width: 100%;
  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;
}

/* Área de Desenho Wrapper (Contém Canvas 4:3 e Lupa de Zoom Externa) */
.area-desenho-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1;
}

/* Caixa do Canvas (Sempre 4:3 e contida no espaço visível em qualquer resolução) */
.canvas-box {
  width: auto;
  height: auto;
  max-width: calc(100% - 74px);
  max-height: 100%;
  aspect-ratio: 4 / 3;
  flex-shrink: 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;
}

/* Stage de Transform do Zoom (as 3 camadas escalam juntas mantendo a moldura externa fixa) */
.canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1);
  will-change: transform;
}

.canvas-stage.dragging {
  transition: none !important;
}

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

#canvas-cor {
  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") 6 24, crosshair;
}

#canvas-linhas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
  z-index: 3;
}

/* Sombra / Ghost Preview da figurinha que segue o mouse */
.sticker-ghost-preview {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  display: none;
  opacity: 0.70;
  z-index: 4;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.35));
  will-change: left, top, width, height;
  transition: width 0.12s ease, height 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
}

/* Barra de Controles de Zoom (Lupa Externa - 100% fora do quadro do desenho) */
.controles-zoom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 8px;
  border-radius: 26px;
  border: 3px solid #fed7aa;
  box-shadow: 0 8px 24px rgba(255, 138, 61, 0.2);
  backdrop-filter: blur(8px);
  z-index: 20;
  flex-shrink: 0;
}

.btn-zoom {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #fed7aa;
  background: #ffffff;
  color: #334155;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  user-select: none;
  touch-action: manipulation;
  padding: 0;
}

.btn-zoom:hover:not(:disabled) {
  transform: scale(1.08);
  border-color: var(--laranja);
  background: #fff7ed;
  box-shadow: 0 6px 14px rgba(255, 138, 61, 0.35);
}

.btn-zoom:active:not(:disabled) {
  transform: scale(0.95);
}

.btn-zoom:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.8);
  transform: none;
  box-shadow: none;
}

.btn-zoom .icon-zoom {
  font-size: 1.25rem;
  line-height: 1;
  pointer-events: none;
}

.btn-zoom .sinal-zoom {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--laranja-escuro);
  line-height: 1;
  pointer-events: none;
}

.btn-zoom.btn-zoom-reset {
  border-radius: 20px;
  height: auto;
  min-height: 48px;
  padding: 5px 6px;
  gap: 2px;
}

.btn-zoom.btn-zoom-reset .icon-zoom {
  font-size: 1.05rem;
}

.btn-zoom .label-zoom {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--laranja-escuro);
  line-height: 1;
  font-family: 'Nunito', sans-serif;
  pointer-events: none;
}

.btn-zoom.btn-zoom-pan.ativo {
  background: #ffedd5;
  border-color: var(--laranja);
  color: var(--laranja-escuro);
  box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.4), 0 4px 10px rgba(0, 0, 0, 0.1);
  animation: pulsePan 2s infinite ease-in-out;
}

@keyframes pulsePan {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Responsivo para celular / orientação retrato: lupa embaixo do quadro e proporção 4:3 rígida */
@media (max-width: 768px), (orientation: portrait) {
  .area-desenho-wrapper {
    flex-direction: column;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 0;
    justify-content: center;
    align-items: center;
  }

  .canvas-box {
    width: 96vw;
    height: auto !important;
    max-width: 96vw;
    max-height: calc(100% - 56px);
    aspect-ratio: 4 / 3 !important;
    flex-shrink: 0;
    margin: 0 auto;
    border-width: 5px;
    border-radius: 18px;
  }

  .controles-zoom {
    flex-direction: row;
    gap: 12px;
    padding: 5px 14px;
    border-radius: 999px;
  }

  .btn-zoom {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .btn-zoom.btn-zoom-reset {
    min-height: 42px;
    border-radius: 999px;
    padding: 3px 10px;
    flex-direction: row;
    gap: 5px;
  }

  .btn-zoom.btn-zoom-reset .icon-zoom {
    font-size: 0.95rem;
  }

  .btn-zoom .label-zoom {
    font-size: 0.72rem;
  }

  /* BARRA SUPERIOR COMPACTA NO MOBILE (SOMENTE EMOJIS PARA CABER TUDO) */
  .btn-sair .btn-label,
  .btn-desenhos .btn-label,
  .btn-modo .btn-label,
  .nome-desenho-topo {
    display: none !important;
  }

  .topo {
    padding: 6px 8px;
    gap: 4px;
    justify-content: space-between;
  }

  .grupo-esq {
    gap: 4px;
    flex-shrink: 0;
  }

  .game-wrapper .topo .btn-sair,
  .game-wrapper .topo .btn-desenhos,
  .game-wrapper .topo .btn-modo {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
    box-shadow: 0 2.5px 0 rgba(0, 0, 0, 0.2) !important;
  }

  .centro-topo {
    position: static;
    transform: none;
    flex: 0 1 auto;
    min-width: 0;
    justify-content: center;
    max-width: none;
  }

  .modo-pill {
    padding: 3px 8px;
    height: 36px;
    min-width: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 5px rgba(255, 138, 61, 0.12);
  }

  .lado-dir {
    gap: 4px;
    flex-shrink: 0;
  }

  .btn-acao-topo {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    font-size: 1.05rem;
    border-radius: 10px;
    box-shadow: 0 2px 0 #cbd5e1;
  }
}

/* ========================================================
   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;
}

#tool-magico .icon-tool {
  display: inline-block;
  transform: rotate(180deg);
}

.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(--laranja);
}

.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;
}

#tool-travar-linha.ativo {
  background: #f0fdf4;
  border-color: var(--verde);
  box-shadow: 0 4px 10px rgba(46, 204, 113, 0.25);
}
#tool-travar-linha.ativo .label-tool {
  color: var(--verde-escuro);
}
#tool-travar-linha:not(.ativo) {
  opacity: 0.75;
  background: #f8fafc;
}

.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(--laranja);
  border-color: #ffffff;
  box-shadow: 0 2px 6px rgba(255, 138, 61, 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;
}

/* Botão de Estampas na Barra de Ferramentas */
.btn-tool#tool-estampas.estampa-em-uso,
.btn-tool#tool-estampas.ativo {
  border-color: #6366f1;
  background: #ede9fe;
  color: #4f46e5;
  box-shadow: 0 0 0 2.5px rgba(99, 102, 241, 0.4);
}
.btn-tool#tool-estampas.estampa-em-uso .label-tool,
.btn-tool#tool-estampas.ativo .label-tool {
  color: #4f46e5;
  font-weight: 800;
}
.btn-tool#tool-estampas.estampa-em-uso .icon-tool,
.btn-tool#tool-estampas.ativo .icon-tool {
  animation: pulseEstampa 1.5s infinite ease-in-out;
}
@keyframes pulseEstampa {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

/* ========================================================
   MODAL DE ESTAMPAS MÁGICAS (PADRÕES E TEXTURAS)
   ======================================================== */
.modal-box-estampas {
  max-width: 640px;
  width: min(94vw, 640px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.grid-estampas-modal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 12px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
}

.item-estampa-card {
  background: #ffffff;
  border: 2.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  user-select: none;
}

.item-estampa-card:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: #6366f1;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.item-estampa-card.ativo {
  border-color: #6366f1;
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35), 0 8px 20px rgba(0, 0, 0, 0.12);
}

.item-estampa-card .thumb-estampa {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.item-estampa-card .nome-estampa {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  text-align: center;
  line-height: 1.2;
}

.item-estampa-card .badge-estampa-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #64748b;
  transition: all 0.15s;
}

.item-estampa-card.ativo .badge-estampa-status {
  background: #6366f1;
  color: #ffffff;
}

.btn-voltar-cores {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  margin-top: 10px;
}

.btn-voltar-cores:hover {
  background: #eef2f6;
  border-color: #94a3b8;
  color: #1e293b;
  transform: scale(1.01);
}

/* ========================================================
   BALÃO FLUTUANTE DE TONS (SUB-CORES INTELIGENTES)
   ======================================================== */
.popover-tons {
  position: fixed;
  z-index: 1000;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 28px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 3px 8px rgba(0, 0, 0, 0.08);
  border: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: popoverBounce 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom center;
  user-select: none;
  touch-action: manipulation;
}

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

.popover-tons-conteudo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.popover-tons-seta {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-right: 2px solid #e2e8f0;
  border-bottom: 2px solid #e2e8f0;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

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

.btn-tom:hover {
  transform: scale(1.2);
}

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

.btn-tom.ativo {
  transform: scale(1.24);
  border-color: #1e293b;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

/* ========================================================
   MODAIS DE FORMAS, STICKERS, LETRAS E FUNDOS
   ======================================================== */
.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(--laranja-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(--laranja);
  background: #fff8f0;
  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;
  cursor: pointer;
  transition: all 0.15s;
}
.item-sticker:hover {
  transform: scale(1.08);
  border-color: var(--laranja);
  background: #ffffff;
}
.item-sticker img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.item-sticker span {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
}

.emojis-grid .item-sticker.emoji-stk {
  font-size: 2rem;
  padding: 10px 4px;
}

/* Letras e Números */
.nav-abas-modal {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  padding: 8px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.ativo {
  background: #fff8f0;
  border-color: var(--laranja);
  color: var(--laranja-escuro);
  box-shadow: 0 2px 6px rgba(255, 138, 61, 0.15);
}

.grid-alfabeto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.item-letra {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
}
.item-letra:hover {
  transform: scale(1.15);
  border-color: var(--laranja);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.area-escrever-texto {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.input-texto-custom {
  width: 100%;
  max-width: 360px;
  padding: 12px 16px;
  border: 3px solid #cbd5e1;
  border-radius: 16px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  outline: none;
}
.input-texto-custom:focus {
  border-color: var(--laranja);
  box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.2);
}

.chips-sugestoes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.chip-sugestao {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.chip-sugestao:hover {
  background: #fff8f0;
  border-color: var(--laranja);
}

/* Papéis de Fundo */
.modal-box-fundos {
  max-width: 580px;
  width: min(94vw, 580px);
}

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

.card-fundo {
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  border-radius: 18px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.card-fundo:hover {
  transform: translateY(-2px);
  border-color: var(--laranja);
}
.card-fundo.ativo {
  border-color: var(--laranja);
  background: #fff8f0;
  box-shadow: 0 4px 12px rgba(255, 138, 61, 0.18);
}

.preview-fundo {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  flex-shrink: 0;
}

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

/* ========================================================
   BOTÕES DE AÇÃO E UTILITÁRIOS
   ======================================================== */
.btn-acao {
  background: var(--laranja);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 10px 22px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 5px 0 var(--laranja-escuro);
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-acao:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}
.btn-acao:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--laranja-escuro);
}

.modal-box-small {
  max-width: 400px;
  width: min(92vw, 400px);
}

/* Badge de Notificação */
.badge {
  position: absolute;
  top: 16px;
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 50px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  z-index: 300;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.badge.show {
  opacity: 1;
  transform: translateY(0);
}
.badge.ok { background: #10ac84; }
.badge.erro { background: #ff4757; }
.badge.info { background: #2f7dff; }
.badge.aviso { background: #ff9f43; }

/* ========================================================
   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 (> 1024px): remove a engrenagem e exibe botões lado a lado */
@media (min-width: 1025px) {
  .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;
  }
}

/* Telas até 1024px (Tablets e celulares): o botão de engrenagem sobe para ficar acima da barra inferior de ferramentas */
@media (max-width: 1024px) {
  .floating-controls {
    bottom: calc(120px + env(safe-area-inset-bottom));
    right: calc(12px + env(safe-area-inset-right));
    z-index: 80;
  }
}

@media (max-width: 600px) {
  .floating-controls {
    bottom: calc(112px + env(safe-area-inset-bottom));
    right: 8px;
    z-index: 80;
  }
  .btn-circular {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* Partículas Mágicas */
#fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 350;
  overflow: hidden;
}

.particle-magic {
  position: absolute;
  pointer-events: none;
  animation: explodeParticle 0.7s forwards cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 215, 0, 0.8);
  user-select: none;
}

@keyframes explodeParticle {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

.touch-ripple {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--laranja);
  transform: translate(-50%, -50%) scale(0.3);
  animation: rippleAnim 0.4s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleAnim {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

/* Miniatura da figurinha ativa no botão da toolbar */
.miniatura-carimbo-btn {
  width: 26px;
  height: 26px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 1.5px 3px rgba(0, 0, 0, 0.25));
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Efeito de Puf e Estrelinhas ao Carimbar */
.particle-stamp-star {
  position: absolute;
  pointer-events: none;
  animation: explodeStampStar 0.65s forwards cubic-bezier(0.2, 0.9, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.95), 0 0 10px rgba(255, 138, 61, 0.85);
  user-select: none;
}

@keyframes explodeStampStar {
  0% { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 1; }
  50% { opacity: 1; transform: translate(calc(var(--dx) * 0.65), calc(var(--dy) * 0.65)) scale(1.3) rotate(90deg); }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(180deg); opacity: 0; }
}

.stamp-puff {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 230, 200, 0.45) 50%, transparent 75%);
  border: 2.5px dashed rgba(255, 138, 61, 0.7);
  transform: translate(-50%, -50%) scale(0.3);
  animation: stampPuffAnim 0.5s ease-out forwards;
  pointer-events: none;
}

@keyframes stampPuffAnim {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  55% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.4); }
  100% { transform: translate(-50%, -50%) scale(2.0); opacity: 0; }
}

/* Dica para iPhone / Celulares no Modal Salvar */
.dica-salvar-iphone {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  border: 1.5px dashed #86efac;
  border-radius: 16px;
  padding: 10px 14px;
  margin-top: 14px;
  text-align: left;
}

.icone-dica-iphone {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dica-salvar-iphone p {
  margin: 0 !important;
  font-size: 0.82rem !important;
  color: #166534 !important;
  line-height: 1.35 !important;
  font-weight: 600 !important;
}

/* Animação Nuvito comemorando */
.nuvito-animado {
  animation: nuvitoBounce 1.2s infinite alternate ease-in-out;
}
@keyframes nuvitoBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.04); }
}

/* 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;
  }
}
.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);
}

/* Orientação do celular */
#landscape-lock {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff8f0;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}
#landscape-lock .icon-rotate {
  font-size: 3.5rem;
  animation: rotatePhone 2s infinite ease-in-out;
}
@keyframes rotatePhone {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}

@media (max-height: 480px) and (orientation: landscape) {
  #landscape-lock { display: flex; }
}

/* Animações Globais */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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