/* =====================================================================
   bicho3d.css — interface do "Modo Explorar" (bicho3d.html)
   Bicho grande no centro; barra compacta no topo; ações na lateral.
   ===================================================================== */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: #dcebd4; }
#palco { position: fixed; inset: 0; }
#palco canvas { display: block; touch-action: none; }

:root { --topo-h: 76px; }   /* altura real do cabeçalho: medida pelo bicho3d.js */
/* cabeçalho padrão de todo bicho 3D:
   linha 1 = voltar · nome · Pequeno/Explorador   |   linha 2 = abas (rolam para o lado se não couberem)
   em telas largas (iPad deitado) tudo cabe numa linha só */
.topo3d { position: fixed; z-index: 10; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; pointer-events: none; }
.topo3d > * { pointer-events: auto; }
.voltar { width: 48px; height: 48px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-decoration: none; color: var(--color-nature); font-size: 24px; font-weight: 900; box-shadow: var(--shadow-m); }
.topo3d h1 { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; background: rgba(255, 255, 255, .94); border-radius: 999px; padding: 8px 18px; font-size: 20px; font-weight: 900; color: var(--color-nature); box-shadow: var(--shadow-s); }
.abas { grid-column: 1 / -1; justify-self: start; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; display: flex; gap: 4px; background: rgba(255, 255, 255, .94); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-s); }
.abas:empty { display: none; }
.abas::-webkit-scrollbar { display: none; }
.abas button { flex: none; white-space: nowrap; border: 0; background: none; border-radius: 999px; padding: 8px 14px; min-height: 40px; font-weight: 800; font-size: 15px; cursor: pointer; color: var(--text); }
.abas button.on { background: var(--color-accent); }

.acoes { position: fixed; z-index: 10; right: max(12px, env(safe-area-inset-right)); top: calc(var(--topo-h) + 12px); display: flex; flex-direction: column; gap: 8px; }
.acao { width: 76px; min-height: 66px; border-radius: 20px; border: 0; background: rgba(255, 255, 255, .95); box-shadow: var(--shadow-m); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; color: var(--color-nature); }
.acao b { font-size: 24px; line-height: 1; }
.acao span { font-size: 12px; font-weight: 900; line-height: 1.1; }
.acao.on { background: var(--color-accent); color: var(--text); }
.acao:active { transform: scale(.94); }

.base3d { position: fixed; z-index: 10; left: max(12px, env(safe-area-inset-left)); right: max(100px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.bolso, .acao-ficha { border: 0; border-radius: 999px; min-height: 48px; padding: 0 18px; font-weight: 900; font-size: 15px; cursor: pointer; box-shadow: var(--shadow-m); background: #fff; color: var(--text-soft); }
.bolso.no { background: var(--color-primary); color: #fff; }
.acao-ficha { color: var(--color-nature); }

#etiquetas { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.etq { position: absolute; left: 0; top: 0; pointer-events: auto; border: 2px solid #fff; background: var(--color-nature); color: #fff; font: inherit; font-weight: 900; font-size: 13px; border-radius: 999px; padding: 4px 10px; cursor: pointer; white-space: nowrap; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); }
.etq.on { background: var(--color-accent); color: var(--text); }
.cartao { position: fixed; z-index: 12; left: max(12px, env(safe-area-inset-left)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 60px); width: min(420px, calc(100vw - 120px)); background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow-m); }
.cartao.topo { bottom: auto; top: calc(var(--topo-h) + 8px); }
.prog-toast { top: calc(var(--topo-h) + 8px) !important; }
.cartao b { display: block; font-size: 19px; color: var(--color-nature); margin-right: 36px; }
.cartao p { margin: 4px 0 0; font-size: 16px; line-height: 1.35; }
.cartao-prox { margin-top: 10px; border: 0; border-radius: 999px; min-height: 44px; padding: 0 18px; font: inherit; font-weight: 900; font-size: 15px; background: var(--color-primary); color: #fff; cursor: pointer; }
.cartao #cartao-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); cursor: pointer; }

.curu { position: fixed; z-index: 11; left: max(12px, env(safe-area-inset-left)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 62px); display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 999px 22px 22px 999px; padding: 6px 16px 6px 6px; box-shadow: var(--shadow-m);
  transform: translateX(-130%); transition: transform .45s cubic-bezier(.25, 1.3, .5, 1); max-width: calc(100vw - 120px); pointer-events: none; }
.curu.on { transform: none; }
.curu img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; }
.curu span { font-weight: 800; font-size: 15px; line-height: 1.25; }
.aviso3d { position: fixed; z-index: 13; left: 50%; top: calc(var(--topo-h) + 8px); transform: translate(-50%, -20px); opacity: 0; transition: .3s; background: var(--color-nature); color: #fff; border-radius: 999px; padding: 8px 18px; font-weight: 900; pointer-events: none; text-align: center; max-width: 90vw; }
.aviso3d.on { opacity: 1; transform: translate(-50%, 0); }
.carregando { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--bg); color: var(--color-nature); font-size: 22px; font-weight: 900; transition: opacity .5s; }
.carregando.fora { opacity: 0; pointer-events: none; }

.voltar-ui { display: none; position: fixed; z-index: 14; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 900; background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-m); }
body.limpo .topo3d, body.limpo .acoes, body.limpo .base3d, body.limpo .cartao, body.limpo #etiquetas, body.limpo .curu { display: none; }
body.limpo .voltar-ui { display: block; }

/* ---------- Por Dentro do Bicho ---------- */
.idade { grid-column: 3; grid-row: 1; justify-self: end; white-space: nowrap; margin-left: 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .94); min-height: 44px; padding: 0 14px; font-weight: 900; font-size: 14px; color: var(--color-nature); box-shadow: var(--shadow-s); cursor: pointer; margin-right: 0; }
.modos { position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 62px); display: flex; gap: 6px; background: rgba(255, 255, 255, .95); border-radius: 26px; padding: 6px; box-shadow: var(--shadow-m); }
.modos button { border: 0; background: none; border-radius: 20px; min-height: 58px; padding: 4px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; color: var(--color-nature); cursor: pointer; }
.modos button b { font-size: 22px; line-height: 1.1; }
.modos button.on { background: var(--color-nature); color: #fff; }
.passos3d { position: fixed; z-index: 12; left: 50%; transform: translateX(-50%); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 136px); width: min(560px, calc(100vw - 110px)); display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 24px; padding: 12px 14px; box-shadow: var(--shadow-m); }
.passos3d img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--color-primary-soft); }
.passos3d > div { flex: 1; min-width: 0; }
.passos3d b { display: block; color: var(--color-nature); font-size: 16px; }
.passos3d p { margin: 2px 0 6px; font-size: 18px; font-weight: 700; line-height: 1.3; }
body.pequeno .passos3d p { font-size: 21px; }
.dots { display: flex; gap: 4px; } .dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); } .dots i.on { background: var(--color-leaf); }
.passos3d small { display: block; margin-top: 6px; font-size: 12px; color: var(--text-soft); }
.passo-bt { flex: none; border: 0; border-radius: 999px; background: var(--color-accent); min-height: 48px; padding: 0 16px; font-weight: 900; font-size: 15px; cursor: pointer; color: var(--text); }
.passo-x { position: absolute; top: -12px; right: -8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow-s); cursor: pointer; }
body.com-modos .cartao:not(.topo) { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 136px); }
body.limpo .modos, body.limpo .passos3d, body.limpo .idade { display: none; }

@media (max-width: 600px) {
  .idade { margin-right: 0; font-size: 12px; min-height: 36px; padding: 0 10px; }
  .modos { left: max(10px, env(safe-area-inset-left)); transform: none; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 54px); }
  .modos button { min-height: 50px; padding: 2px 9px; font-size: 12px; } .modos button b { font-size: 18px; }
  .passos3d { left: 10px; transform: none; width: calc(100vw - 92px); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 116px); padding: 10px; gap: 8px; flex-wrap: wrap; }
  .passos3d img { width: 46px; height: 46px; }
  .passos3d p { font-size: 16px; } body.pequeno .passos3d p { font-size: 18px; }
  .passo-bt { width: 100%; }
  .topo3d h1 { font-size: 16px; padding: 6px 12px; }
  .abas button { padding: 6px 10px; font-size: 13px; min-height: 36px; }
  .acao { width: 62px; min-height: 56px; border-radius: 16px; }
  .acao b { font-size: 20px; } .acao span { font-size: 11px; }
  .acoes { gap: 6px; }
  .bolso, .acao-ficha { font-size: 13px; padding: 0 12px; min-height: 42px; }
  .base3d { right: 84px; justify-content: flex-start; flex-wrap: nowrap; }
  .base3d .bolso { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.15; padding: 4px 12px; font-size: 12.5px; }
  .base3d .acao-ficha { flex: none; }
  .cartao { width: calc(100vw - 100px); }
  body.com-modos .cartao:not(.topo) { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 116px); }
}

@media (min-width: 1000px) {
  .topo3d { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .abas { grid-column: 3; grid-row: 1; }
  .idade { grid-column: 4; }
}

/* ---------- o bicho fala (modo Pequeno): balão + voz, para quem ainda não lê ---------- */
.fala { position: fixed; z-index: 11; left: max(12px, env(safe-area-inset-left)); top: calc(var(--topo-h) + 10px); max-width: min(440px, calc(100vw - 120px));
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 26px 26px 26px 8px; padding: 10px 10px 10px 12px; box-shadow: var(--shadow-m); }
.fala[hidden] { display: none; }
.fala.pula { animation: falaPula .35s cubic-bezier(.25, 1.4, .5, 1); }
@keyframes falaPula { from { transform: scale(.7); opacity: 0; } }
.fala-bicho { flex: none; width: 54px; height: 54px; border-radius: 50%; background: var(--color-accent); display: grid; place-items: center; font-size: 32px; }
.fala > div { flex: 1; min-width: 0; }
.fala p { margin: 0; font-size: 19px; font-weight: 900; line-height: 1.25; color: var(--color-nature); }
.fala small { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 700; line-height: 1.3; color: var(--text-soft); }
#fala-rep { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--bg); font-size: 22px; cursor: pointer; }
.voz-bt { margin-right: auto; border: 0; border-radius: 999px; min-height: 48px; padding: 0 16px; font-weight: 900; font-size: 15px; cursor: pointer; box-shadow: var(--shadow-m); background: #fff; color: var(--color-nature); }
.cartao #cartao-ouvir { position: absolute; top: 8px; right: 50px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); cursor: pointer; }
.cartao:has(#cartao-ouvir:not([hidden])) b { margin-right: 84px; }
.estrela { position: fixed; z-index: 15; left: 0; top: 0; font-size: 44px; pointer-events: none; animation: estrela 1.1s ease-out forwards; }
@keyframes estrela { from { transform: translate(-50%, -50%) scale(.5); opacity: 1; } to { transform: translate(-50%, -160%) scale(1.5); opacity: 0; } }
.etq.dica { font-size: 26px; padding: 2px 8px; background: var(--color-accent); animation: dica 1s ease-in-out infinite; }
@keyframes dica { 50% { box-shadow: 0 0 0 12px rgba(255, 197, 61, .35); } }
/* Pequeno: menos botões, botões maiores; Cadê? e Conversar só aparecem nele */
body.pequeno .acao[data-id="cam"], body.pequeno .acao[data-id="limpo"] { display: none; }
body:not(.pequeno) .acao[data-id="cade"], body:not(.pequeno) .acao[data-id="conversa"] { display: none; }
body.pequeno .acao { width: 84px; min-height: 74px; }
body.pequeno .acao b { font-size: 30px; }
body.pequeno .acao span { font-size: 13px; }
body.limpo .fala { display: none; }
@media (prefers-reduced-motion: reduce) { .fala.pula, .estrela, .etq.dica { animation: none; } }

/* zoom com botões (pinça é difícil para crianças pequenas) */
.zoom3d { position: fixed; z-index: 10; left: max(12px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }
.zoom3d button { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .95); box-shadow: var(--shadow-m); font-size: 26px; cursor: pointer; }
.zoom3d button:active { transform: scale(.92); background: var(--color-accent); }
body.pequeno .zoom3d button { width: 72px; height: 72px; font-size: 32px; }
body.limpo .zoom3d { display: none; }

/* 🍼 faixa Bebês (js/faixa.js): só o bicho, as ações dele e o zoom */
html[data-faixa="bebe"] .acao[data-id="partes"], html[data-faixa="bebe"] .acao[data-id="tam"], html[data-faixa="bebe"] .acao[data-id="cade"],
html[data-faixa="bebe"] .acao[data-id="conversa"], html[data-faixa="bebe"] .modos, html[data-faixa="bebe"] .base3d .bolso, html[data-faixa="bebe"] .acao-ficha,
html[data-faixa="bebe"] .acao span { display: none; }
html[data-faixa="bebe"] .acao { width: 88px; min-height: 88px; border-radius: 50%; }
html[data-faixa="bebe"] .acao b { font-size: 40px; }
.mao3d { position: fixed; z-index: 9; left: 50%; top: 55%; font-size: 72px; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); animation: maoToca 1.2s ease-in-out infinite; }
.mao3d[hidden] { display: none; }
@keyframes maoToca { 0%, 100% { transform: translate(-30%, 0) scale(1); } 50% { transform: translate(-30%, 18px) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .mao3d { animation: none; } }
