/* Livro de papel em camadas (eixo Z) do Sol Maior Kids — sem canvas, sem filtros pesados. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--sobra, #0c1b39);
  color: #fff;
  font-family: "Fredoka", "Baloo 2", system-ui, sans-serif;
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 1.2s ease;
}

/* ---------- palco ---------- */
.palco { position: fixed; left: 50%; top: 0; translate: -50% 0; overflow: hidden; background: var(--sobra); }
.cena { position: absolute; inset: 0; perspective: var(--p, 1000px); perspective-origin: 50% 50%; }
.cena > .zoom { position: absolute; inset: 0; transform: scale(1.13); transform-style: preserve-3d; }
.mundo { position: absolute; inset: 0; transform-style: preserve-3d; }
.camada { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.camada img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.piso { position: absolute; inset: 0; transform-origin: 50% 0%; }
.anim { position: absolute; inset: 0; transform-origin: 50% 100%; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
/* movimentos de papel */
.anim.onda    { animation-name: onda;    animation-duration: calc(6s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.onda2   { animation-name: onda2;   animation-duration: calc(7s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.balanca { animation-name: balanca; animation-duration: calc(7s * var(--t, 1)); }
.anim.ondula  { animation-name: ondula;  animation-duration: calc(3.6s * var(--t, 1)); }
.anim.voa     { animation-name: voa;     animation-duration: calc(4.5s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.nada    { animation-name: nada;    animation-duration: calc(9s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.nadaVira{ animation-name: nadaVira; animation-duration: calc(12s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.respira { animation-name: respira; animation-duration: calc(4s * var(--t, 1)); }
.anim.nuvem   { animation-name: nuvem;   animation-duration: calc(16s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.brilha  { animation-name: brilha;  animation-duration: calc(3.5s * var(--t, 1)); transform-origin: 50% 50%; }
.anim.gira    { animation-name: gira;    animation-duration: calc(9s * var(--t, 1)); transform-origin: 50% 0%; }
@keyframes onda    { 0%, 100% { transform: translateX(-1.4%) rotate(-.5deg); } 50% { transform: translateX(1.4%) rotate(.5deg); } }
@keyframes onda2   { 0%, 100% { transform: translateX(1.2%) translateY(.6%); } 50% { transform: translateX(-1.2%) translateY(-.6%); } }
@keyframes balanca { 0%, 100% { transform: skewX(-.45deg); } 50% { transform: skewX(.45deg); } }
@keyframes ondula  { 0%, 100% { transform: skewX(-1.2deg) scaleY(1); } 33% { transform: skewX(.9deg) scaleY(1.008); } 66% { transform: skewX(-.4deg) scaleY(.996); } }
@keyframes voa     { 0%, 100% { transform: translate(0, 0) rotate(0); } 30% { transform: translate(2%, -5%) rotate(-3deg); } 70% { transform: translate(-1.5%, -2%) rotate(2deg); } }
@keyframes nada    { 0%, 100% { transform: translate(-3%, 0) rotate(1deg); } 50% { transform: translate(3%, -2%) rotate(-1deg); } }
@keyframes nadaVira { 0% { transform: translateX(-6%) scaleX(1); } 44% { transform: translateX(6%) translateY(-3%) scaleX(1); }
  50% { transform: translateX(6%) translateY(-3%) scaleX(-1); } 94% { transform: translateX(-6%) scaleX(-1); } 100% { transform: translateX(-6%) scaleX(1); } }
@keyframes respira { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.025); } }
@keyframes nuvem   { 0%, 100% { transform: translateX(-2.2%); } 50% { transform: translateX(2.2%); } }
@keyframes brilha  { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.03); opacity: .85; } }
@keyframes gira    { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
/* luz do dia/noite por cima da cena */
.luz { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
/* partículas */
.faiscas { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.faiscas i { position: absolute; border-radius: 50%; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.faiscas.luz i, .faiscas.poeira i, .faiscas.polen i { background: #fff3c4; box-shadow: 0 0 8px 2px rgba(255, 224, 130, .8); animation-name: sobe; }
.faiscas.poeira i { opacity: .5; box-shadow: 0 0 6px 1px rgba(190, 200, 255, .5); background: #cfd8ff; }
.faiscas.polen i { background: #fffbd0; box-shadow: 0 0 6px 2px rgba(255, 250, 170, .7); animation-name: polen; }
.faiscas.bolhas i { border: 1.5px solid rgba(235, 252, 255, .85); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.8) 0 18%, transparent 22%); animation-name: bolha; }
.faiscas.estrelas i { background: #fff8d6; box-shadow: 0 0 8px 3px rgba(255, 240, 170, .9); animation-name: cintila; }
@keyframes sobe { 0% { transform: translate(0, 30px); opacity: 0; } 20% { opacity: 1; } 80% { opacity: .9; } 100% { transform: translate(18px, -90px); opacity: 0; } }
@keyframes polen { 0% { transform: translate(-20px, 10px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(60px, -50px); opacity: 0; } }
@keyframes bolha { 0% { transform: translate(0, 40px) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(10px, -160px) scale(1); opacity: 0; } }
@keyframes cintila { 0%, 100% { transform: scale(.3); opacity: .2; } 50% { transform: scale(1); opacity: 1; } }
.camada.parede { transform-origin: 50% 100%; }
.camada.parede::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--sombra, 0); pointer-events: none; }

/* ---------- texto ---------- */
.texto { position: fixed; z-index: 10; left: 50%; translate: -50% 0; width: min(980px, 100% - 24px); bottom: 14px;
  display: flex; align-items: flex-end; gap: 12px; }
.balao { flex: 1; min-height: 76px; background: rgba(28, 14, 6, .62); border-radius: 26px; padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer; }
.balao .ref { display: block; margin-top: 4px; font-size: clamp(.75rem, 1.5vw, .9rem); color: #ffe3a3; font-style: italic; opacity: 0; transition: opacity .6s; }
.balao .ref.mostra { opacity: .9; }
.frase { margin: 0; font-weight: 600; font-size: clamp(1.05rem, 2.5vw, 1.6rem); line-height: 1.35; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.frase .p { display: inline-block; white-space: nowrap; }
.frase .l { display: inline-block; opacity: 0; transform: translateY(.35em) scale(.6); filter: blur(4px); }
.frase .l.v { animation: letra .42s cubic-bezier(.2, .9, .3, 1.3) forwards; }
.frase.pronto .l { opacity: 1; transform: none; filter: none; animation: none; }
@keyframes letra { to { opacity: 1; transform: none; filter: blur(0); } }
.frase .cursor { display: inline-block; width: .5em; height: .5em; margin-left: .15em; border-radius: 50%; background: #ffd56b; vertical-align: middle; animation: pisca .8s infinite; }
.frase.pronto .cursor { display: none; }
@keyframes pisca { 50% { opacity: .2; } }

.acoes { display: flex; gap: 10px; align-items: center; }
.bt { font: inherit; font-weight: 600; border: 0; cursor: pointer; color: #fff; background: #8C78C4; border-radius: 999px; min-width: 56px; height: 56px;
  padding: 0 20px; display: grid; place-items: center; font-size: 1.3rem; box-shadow: 0 5px 0 #6B57AE;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s, opacity .2s; }
.bt:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 8px 0 #6B57AE; }
.bt:active { transform: translateY(3px); box-shadow: 0 2px 0 #6B57AE; }
.bt:disabled { opacity: .35; pointer-events: none; }
.bt.claro { background: #fff6e4; color: #6B57AE; box-shadow: 0 5px 0 #d8c9a8; font-size: 1.15rem; min-width: 48px; height: 48px; padding: 0 12px; }
.bt.ativo { background: #F3BA14; color: #4A2C1E; box-shadow: 0 5px 0 #c9940a; }
.bt.prox.chama { animation: chama 1.6s ease-in-out infinite; }
@keyframes chama { 50% { transform: scale(1.1); box-shadow: 0 5px 0 #6B57AE, 0 0 0 10px rgba(243, 186, 20, .35); } }

.pontos { position: fixed; z-index: 10; top: 14px; left: 50%; translate: -50% 0; display: flex; gap: 6px; }
.pontos i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .4); transition: background .3s, transform .3s; }
.pontos i.atual { background: #F3BA14; transform: scale(1.35); }
.voltar-site { position: fixed; z-index: 11; top: 10px; left: 10px; color: #fff3d6; font-weight: 600; text-decoration: none; background: rgba(0, 0, 0, .35);
  padding: 7px 14px; border-radius: 999px; font-size: .95rem; }
.carregando { position: fixed; z-index: 12; right: 14px; top: 12px; font-size: .85rem; color: #ffe9b0; opacity: .8; }

/* ---------- abertura e fim ---------- */
.abertura, .fim { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; text-align: center; padding: 20px;
  background: radial-gradient(70% 70% at 50% 45%, rgba(0, 0, 0, .15), rgba(0, 0, 0, .55)); cursor: pointer; }
.abertura h1, .fim h1 { font-family: "Baloo 2", "Fredoka", sans-serif; font-weight: 800; font-size: clamp(2.4rem, 8vw, 5rem); margin: 0 0 6px;
  color: #fff; text-shadow: 0 4px 0 rgba(74, 44, 30, .7), 0 0 40px rgba(255, 200, 90, .6); }
.abertura p, .fim p { margin: 0 0 22px; font-size: clamp(1rem, 2.6vw, 1.4rem); font-weight: 500; text-shadow: 0 2px 8px rgba(0, 0, 0, .7); }
.abertura .bt, .fim .bt { margin: 0 auto; font-size: 1.3rem; height: 62px; padding: 0 30px; }
.fim .coracao { font-size: 4rem; color: #ff8fb8; text-shadow: 0 0 30px rgba(255, 140, 180, .8); animation: bate 1.2s ease-in-out infinite; }
@keyframes bate { 50% { transform: scale(1.15); } }
.esconde { animation: some .6s ease forwards; }
@keyframes some { to { opacity: 0; visibility: hidden; } }

/* celular em pé: texto embaixo da cena, que fica maior e corta as laterais */
@media (max-aspect-ratio: 1/1) {
  .texto { flex-direction: column; align-items: stretch; bottom: 12px; }
  .acoes { justify-content: space-between; }
  .acoes .bt.prox { flex: 1; }
  .balao { background: rgba(255, 255, 255, .08); }
}
@media (prefers-reduced-motion: reduce) { .frase .l.v { animation-duration: .01s; } }

/* celular deitado (tela baixa): texto mais compacto para não cobrir a cena */
@media (max-height: 500px) and (min-aspect-ratio: 1/1) {
  .texto { bottom: 8px; width: min(900px, 100% - 16px); gap: 8px; }
  .balao { min-height: 0; padding: 8px 14px; border-radius: 18px; }
  .frase { font-size: 1rem; line-height: 1.3; }
  .balao .ref { font-size: .72rem; margin-top: 2px; }
  .bt { height: 44px; min-width: 44px; font-size: 1.05rem; padding: 0 14px; }
  .bt.claro { height: 40px; min-width: 40px; }
  .pontos { top: 8px; }
}

/* água: só onde a máscara marca água (azuis e brancos). cachoeira escorre para baixo; rio e lago têm distorção de malha */
.agua { position: absolute; inset: 0; pointer-events: none; overflow: hidden; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.agua-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.agua.lago .agua-img { filter: url(#f-agua-lago); }
.agua.queda .agua-img { filter: url(#f-agua-queda); }
.agua-ondas { position: absolute; inset: 0; }
.agua.queda .agua-ondas { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='200' viewBox='0 0 120 200'%3E%3Cg fill='none' stroke='white' stroke-linecap='round'%3E%3Cpath d='M12 -50 C15 -38 9 -12 12 0 C15 12 9 38 12 50 C15 62 9 88 12 100 C15 112 9 138 12 150 C15 162 9 188 12 200 C15 212 9 238 12 250' stroke-width='3' opacity='0.6' stroke-dasharray='50 20 25 30'/%3E%3Cpath d='M34 -50 C36 -38 32 -12 34 0 C36 12 32 38 34 50 C36 62 32 88 34 100 C36 112 32 138 34 150 C36 162 32 188 34 200 C36 212 32 238 34 250' stroke-width='2' opacity='0.4' stroke-dasharray='30 25 60 20'/%3E%3Cpath d='M55 -50 C59 -38 51 -12 55 0 C59 12 51 38 55 50 C59 62 51 88 55 100 C59 112 51 138 55 150 C59 162 51 188 55 200 C59 212 51 238 55 250' stroke-width='4' opacity='0.3' stroke-dasharray='70 30 20 25'/%3E%3Cpath d='M78 -50 C80 -38 76 -12 78 0 C80 12 76 38 78 50 C80 62 76 88 78 100 C80 112 76 138 78 150 C80 162 76 188 78 200 C80 212 76 238 78 250' stroke-width='2.4' opacity='0.55' stroke-dasharray='40 15 35 35'/%3E%3Cpath d='M101 -50 C104 -38 98 -12 101 0 C104 12 98 38 101 50 C104 62 98 88 101 100 C104 112 98 138 101 150 C104 162 98 188 101 200 C104 212 98 238 101 250' stroke-width='3.4' opacity='0.4' stroke-dasharray='25 30 55 15'/%3E%3C/g%3E%3C/svg%3E"); background-size: 120px 200px; opacity: .7; filter: blur(.4px); animation: agua-cai .85s linear infinite; }
@keyframes agua-cai { to { background-position: 0 200px; } }
.agua.lago .agua-ondas { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='160' viewBox='0 0 480 160'%3E%3Cg fill='none' stroke='white' stroke-linecap='round'%3E%3Cpath d='M-240 14 C-180 5 -180 23 -120 14 C-60 5 -60 23 0 14 C60 5 60 23 120 14 C180 5 180 23 240 14 C300 5 300 23 360 14 C420 5 420 23 480 14 C540 5 540 23 600 14 C660 5 660 23 720 14' stroke-width='3.4' opacity='0.65' stroke-dasharray='90 40 30 60'/%3E%3Cpath d='M-160 44 C-120 38 -120 50 -80 44 C-40 38 -40 50 0 44 C40 38 40 50 80 44 C120 38 120 50 160 44 C200 38 200 50 240 44 C280 38 280 50 320 44 C360 38 360 50 400 44 C440 38 440 50 480 44 C520 38 520 50 560 44 C600 38 600 50 640 44' stroke-width='2.2' opacity='0.45' stroke-dasharray='60 30 120 50'/%3E%3Cpath d='M-480 78 C-360 66 -360 90 -240 78 C-120 66 -120 90 0 78 C120 66 120 90 240 78 C360 66 360 90 480 78 C600 66 600 90 720 78 C840 66 840 90 960 78' stroke-width='5' opacity='0.25' stroke-dasharray='160 60 70 90'/%3E%3Cpath d='M-120 108 C-90 103 -90 113 -60 108 C-30 103 -30 113 0 108 C30 103 30 113 60 108 C90 103 90 113 120 108 C150 103 150 113 180 108 C210 103 210 113 240 108 C270 103 270 113 300 108 C330 103 330 113 360 108 C390 103 390 113 420 108 C450 103 450 113 480 108 C510 103 510 113 540 108 C570 103 570 113 600 108' stroke-width='2.6' opacity='0.5' stroke-dasharray='40 25 80 35'/%3E%3Cpath d='M-240 140 C-180 132 -180 148 -120 140 C-60 132 -60 148 0 140 C60 132 60 148 120 140 C180 132 180 148 240 140 C300 132 300 148 360 140 C420 132 420 148 480 140 C540 132 540 148 600 140 C660 132 660 148 720 140' stroke-width='3.8' opacity='0.35' stroke-dasharray='110 70 40 50'/%3E%3C/g%3E%3C/svg%3E"); background-size: 480px 160px; opacity: .4; filter: blur(.6px); animation: agua-passa 9s linear infinite; }
@keyframes agua-passa { to { background-position: 480px 0; } }

/* painel de música e sons */
.som-caixa{position:relative;display:flex}
.som-painel{position:absolute;bottom:calc(100% + 12px);right:-40px;width:230px;padding:14px 16px;border-radius:22px;background:#fff6e4;color:#4a2c1e;box-shadow:0 10px 30px #0006;display:grid;gap:12px;font-weight:600;font-size:1rem}
.som-painel label{display:grid;gap:4px}
.som-painel input[type=range]{width:100%;accent-color:#8c78c4;height:26px}
.bt.mini{height:40px;min-width:0;font-size:.95rem;width:100%}

.fim-botoes{display:flex;gap:14px;justify-content:center;flex-wrap:wrap}
.fim .bt.claro{height:62px;padding:0 26px;font-size:1.15rem;text-decoration:none;margin:0}
.ouvir{display:block;margin:18px auto 0;font:inherit;font-weight:600;font-size:1rem;color:#fff;background:#0000004d;border:2px solid #ffffff80;border-radius:999px;padding:10px 20px;cursor:pointer;animation:chama 1.6s ease-in-out infinite}
.anim.fogo{animation-name:fogo;animation-duration:calc(.9s * var(--t, 1));transform-origin:50% 100%}@keyframes fogo{0%,to{transform:scale(1,1) skew(0);filter:brightness(1)}25%{transform:scale(1.02,1.05) skew(.8deg);filter:brightness(1.15)}50%{transform:scale(.99,.97) skew(-.6deg);filter:brightness(.95)}75%{transform:scale(1.01,1.04) skew(.4deg);filter:brightness(1.1)}}
/* espada flamejante: anda de um lado para o outro, com labaredas e brasas por cima */
.anim.espada { animation-name: espada; animation-duration: calc(3.6s * var(--t, 1)); transform-origin: 50% 100%; }
@keyframes espada { 0%,100% { transform: translateX(-38%) rotate(-3deg); } 50% { transform: translateX(38%) rotate(3deg); } }
.anim.espada > img { animation: brilho-fogo .45s ease-in-out infinite alternate; }
@keyframes brilho-fogo { to { filter: brightness(1.18) saturate(1.15); } }
.fx-fogo { position: absolute; inset: -6% -25% 0; pointer-events: none; mix-blend-mode: screen; }
.fx-fogo .lab { position: absolute; width: var(--w); aspect-ratio: 1 / 1.7; translate: -50% 0; border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%;
  background: radial-gradient(50% 60% at 50% 68%, rgba(255,252,210,.95), rgba(255,180,50,.7) 42%, rgba(255,90,0,0) 75%);
  filter: blur(4px); animation: labareda var(--d) ease-in infinite; transform-origin: 50% 100%; }
@keyframes labareda { 0% { transform: translateY(0) scale(.55,.6); opacity: 0; } 20% { opacity: .95; } 100% { transform: translateY(-55%) scale(1,1.35); opacity: 0; } }
.fx-fogo .brasa { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ffe08a; box-shadow: 0 0 8px 3px #ff9a2a; animation: brasa var(--d) linear infinite; }
@keyframes brasa { 0% { transform: translate(0,0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--x), -200px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fx-fogo, .agua-ondas { animation: none; } }
