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

/* Fundo preto para começar, a experiência nasce no escuro */
body {
    background: #000;

    min-height: 100vh;
    min-height: 100dvh;  /* FIX: altura real no mobile */

    overflow: hidden;  /* Esconde o que sair da tela */
}

                  /* CENA 1: A QUEDA  */

/* Container da cena de queda: ocupa toda a tela */   
#cena-queda {
    position: fixed;     
    inset: 0;             /* Atalho para top, right, bottom, left:0 */
    overflow: hidden;    /* Corta o que sair da tela */
    perspective: 800px; /* Cria profundidade 3D para animações */
}


/* Alice: Posicionada no centro horizontal, começa acima da tela */
.alice {
    position: absolute;                 /* Permite mover livremente com top/left */
    left: 50%;                        
    top: -100px;                      /* Começa escondida acima da tela */
    
    animation: cairTunel 4s ease-in forwards; /* Aplica animação de queda */
}

.alice img {
    width: 120px;
    height: auto;
    display: block;
}


/* ANIMAÇÃO de queda: define o movimento de queda do início ao fim */
@keyframes cairTunel {
    0% {
        transform: translate(-50%) scale(1);             /* centralizada, tamanho normal */
        opacity: 1;                                     
    }
    100% {
        transform: translate(-50%) scale(0.25);      /* encolhe para 25% */
        top: 110vh;                                 /* termina abaixo da tela */
        opacity: 0.6;                             
    }
}


/* Objetos da queda: posição horizontal para cada um */
.objeto {
    position: absolute;  /* Permite mover livremente com top/left */
    font-size: 32px;    /* Tamanho menor que Alice */
    top: -80px ;       /* Começa escondido acima da tela */
    animation: cairObjetoTunel 4s ease-in forwards;  /* mesma duração que Alice */

}

.objeto img {
    width: 50px;
    height: auto;
    display: block;
}

/* Objetos da queda: Posição horizontal e atraso de cada objeto */
.objeto-1 { left: 20%; animation-delay: 0.3s; }   /* Aparece 0.3s depois */
.objeto-2 { left: 35%; animation-delay: 0.6s; }  /* Aparece 0.6s depois */
.objeto-3 { left: 65%; animation-delay: 0.1s; } /* Aparece 0.1s depois */
.objeto-4 { left: 78%; animation-delay: 0.5s; }/* Aparece 0.5s depois */


.objeto-5 { left: 45%; animation-delay: 0.8s; }
.objeto-6 { left: 55%; animation-delay: 0.2s; }

/* ANIMAÇÃO dos objetos: caem, encolhem e giram 360° */
@keyframes cairObjetoTunel {
    0% {
        transform: translateY(-80px) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(120vh) scale(0.1) rotate(360deg);
        opacity: 0.5;
    }
}
            /* CENA 2: ACORDAR */

/* Mensagem de despertar */
#mensagem-despertar {
    position: fixed;                   
    top: 50%;                          
    left: 50%;                        
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2s ease;
    z-index: 30;

    color: rgba(255, 255, 100, 0.85); 
    font-family: 'Georgia', serif;
    font-size: 1.5rem;
    font-style: italic;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;

    
    border: 1px solid rgba(255,170,110,0.35);
    padding: 1.2rem 2.8rem;
    border-radius: 999px;
    background: rgba(20, 15, 5, 0.45);
    box-shadow:
         0 0 20px rgba(200, 170, 110, 0.15),
         inset 0 0 15px rgba(200, 170, 110, 0.08);     
}

#mensagem-despertar:focus-visible,
#porta-machaneta:focus-visible {
    outline: 2px solid rgba(255, 220, 150, 0.8);
    outline-offset: 4px;
}

/* Mensagem aparece quando desmaiada */
body.estado-desmaiada #mensagem-despertar {
    opacity: 1;                
    pointer-events: auto;      

}

/* Some quando acordada */
body.estado-acordada #mensagem-despertar,
body.estado-porta #mensagem-despertar,
body.estado-fechadura #mensagem-despertar {
    opacity: 0;
    pointer-events: none;
}

/* Cena da lanterna: começa invisível */
#cena-lanterna {
    position: fixed; 
    inset: 0;                        /* Ocupa toda a tela */
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease; /* Aparece suavemente */
    background: #0d0a00;

}

/* Cena da lanterna: visível */
body.estado-acordada #cena-lanterna {
    opacity: 1;            
    pointer-events: auto;    /* Passa a capturar o mouse */

}

/* Camada de escuridão com o buraco de luz */
 #escuridao {
    position: fixed;
    inset: 0;
    height: 100vh;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    --x: 50%;
    --y: 50%;
    
    background: radial-gradient(
        ellipse 160px 135px at var(--x) var(--y),
        transparent 0%,
        transparent 30%,
        rgba(0,0,0,0.85) 60%,
        rgba(0,0,0,0.98) 80%
    );
}


body.estado-acordada #escuridao {
    opacity: 1;
    animation: tremor-lanterna 0.15s infinite alternate;
}

@keyframes tremor-lanterna {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(0.5px, 0.3px) scale(1.005); }
}

/* Garante que a lanterna não aparece antes da hora */
body.estado-caindo #cena-lanterna,
body.estado-desmaiada #cena-lanterna {
    opacity: 0 !important;
    pointer-events: none !important;
}


.objeto-ambiente {
    position: absolute;  
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    transition: none; 
}
.objeto-ambiente img {
    width: clamp(45px, 9vw, 160px);
    height: auto;
    filter: brightness(0.08) saturate(0.2);
    transition: filter 0.4s ease;
}

.objeto-ambiente.iluminado img {
    filter: brightness(1) saturate(1) drop-shadow(0 0 18px rgba(255, 220, 150, 0.45));
    animation: pulsar-luz 2.5s ease-in-out infinite alternate;
}

@keyframes pulsar-luz {
    from { filter: brightness(1) saturate(1) drop-shadow(0 0 18px rgba(255,220,150,0.45)); }
    to   { filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 26px rgba(255,220,150,0.6)); }
}



/* Ajustes individuais — algumas artes são naturalmente maiores/menores */
#obj-casticai img    { width: clamp(40px, 7vw, 130px); }
#obj-prateleira img  { width: clamp(45px, 8vw, 145px); }
#obj-tela img        { width: clamp(45px, 8vw, 145px); }
#obj-chave img       { width: clamp(55px, 10vw, 210px); }
#obj-espelho img     { width: clamp(50px, 9vw, 175px); }
#obj-cogumelo img    { width: clamp(50px, 9vw, 175px); }

/* Posição do Drink no desktop (puxado um pouco pra baixo) */
#obj-chave {
    top: 20% !important;
    right: 18%;
}
#obj-chave img { width: clamp(55px, 10vw, 210px) !important; }

          /*  FALAS DOS OBJETOS  */
  
.fala-objeto { 
    position: absolute; 
    top: calc(100% + 8px); 
    left: 50%; 
    transform: translateX(-50%) translateY(4px); 

    width: max-content;
    max-width: min(220px, 80vw);
    text-align: center;
    
    color: rgba(255, 240, 255, 1);
    font-family: 'Georgia', serif; 
    font-style: italic; 
    font-size: 0.8rem; 
    line-height: 1.4;
    letter-spacing: 0.04em; 
 
    opacity: 0; 
    filter: blur(0px);
    pointer-events: none; 

    transition: 
        opacity 0.8s ease, 
        filter 0.8s ease, 
        transform 0.8s ease;

    text-shadow: 
        0 0 4px rgba(255, 255, 255, 1),
        0 0 10px rgba(210, 170, 255, 0.9),
        0 0 20px rgba(170, 120, 255, 0.6);

    z-index: 20;
}

.objeto-ambiente.iluminado .fala-objeto { 
    opacity: 1; 
    filter: blur(0); 
    transform: translateX(-50%) translateY(0); 
}


        /* POSIÇÃO DE CADA FALA  */


/* RELÓGIO
   Está no alto → fala abaixo */
#obj-casticai .fala-objeto {
    top: calc(100% + 1px);
    max-width: min(190px, 80vw);
}


/* RAINHA
   Texto maior → duas linhas */
#obj-prateleira .fala-objeto {
    top: calc(100% + 10px);
    max-width: min(230px, 80vw);
}


/* GATO
   Está próximo ao final da tela → fala acima */
#obj-tela .fala-objeto {
    top: auto;
    bottom: calc(100% - 10px);
    max-width: min(210px, 80vw);
}


/* DRINK ME / EAT ME
   Está no alto → fala abaixo */
#obj-chave .fala-objeto {
    top: auto;
    bottom: 30%;
    max-width: min(180px, 80vw);
}

/* ESPELHO
   Centro da tela → fala abaixo */
#obj-espelho .fala-objeto {
    top: calc(100% + 10px);
    max-width: min(180px, 80vw);
}


/* COGUMELO
   Fala acima, mais perto */
#obj-cogumelo .fala-objeto {
    top: auto;
    bottom: calc(100% - 80px);   /* mais perto da arte */
    max-width: min(210px, 80vw);
}

            /* ALICE NA TOCA */

#dica-avancar {
    position: fixed;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 230, 180, 0.6);
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    opacity: 0;
    pointer-events: none;
    z-index: 25;
    animation: piscar-dica 2.5s ease-in-out infinite;
}

#dica-avancar.escondida {
    opacity: 0 !important;
    animation: none;
    transition: opacity 0.6s ease;
}

body.estado-acordada #dica-avancar {
    opacity: 1;
    transition: opacity 1s ease 1.5s; /* aparece 1.5s depois de acordar */
}

body.estado-porta #dica-avancar,
body.estado-fechadura #dica-avancar {
    opacity: 0 !important;
}

@keyframes piscar-dica {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.2; }
}
 
#alice-lanterna {
    position: fixed;
    bottom: -10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;  /* centraliza horizontalmente */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 20;
}
 
#alice-img {
    width: 145px;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
    transform: scaleX(0.9);

}
 
                /* A PORTA */

/* A porta: começa pequena e desfocada ao fundo (distante) */
#porta {
    position: absolute;
    left: 50%;
    top: 15%;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
    --scale-atual: 0.35;
}

@keyframes respirar-porta {
    0%,100% { transform: scale(var(--scale-atual)); }
    50% { transform: scale(calc(var(--scale-atual) * 1.03)); }
}


body.estado-acordada #porta {
    opacity: 1 !important;
    pointer-events: auto;
}

/* Estado inicial desfocado */
#porta img {
    display: block;
    filter: blur(20px);
    transition: filter 0.3s ease-out;
    animation: respirar-porta 4s ease-in-out infinite;
}


/* PORTA grande e brilhando */
#porta.chegou {
    transform: translateX(-50%) scale(1.4) !important;
    filter: drop-shadow(0 0 20px rgba(255, 230, 150, 0.6)) 
            drop-shadow(0 0 40px rgba(255, 200, 100, 0.4))
            brightness(1.2);
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), 
                filter 1s ease;
    z-index: 10;
}

#porta.chegou {
    pointer-events: auto; /* só libera quando grande */
}

#dica-machaneta {
    position: absolute;
    top: calc(50% + 160px);
    left: 50%;
    transform: translate(-50%, 0);
    white-space: nowrap;

    color: rgba(255, 225, 180, 0.85);
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 0.95rem;
    letter-spacing: 0.12em;

    opacity: 0;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(220, 180, 120, 0.6);
    z-index: 20;
}

#dica-clicar {
    position: absolute;
    bottom: -2.2rem;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;

    color: rgba(255, 230, 180, 0.65);
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 0.85rem;
    letter-spacing: 0.08em;

    opacity: 0;
    pointer-events: none;
    z-index: 15;
}

#porta.chegou #dica-clicar {
    opacity: 1;
    animation: piscar-dica 2.5s ease-in-out infinite;
}

#dica-clicar.escondida {
    opacity: 0 !important;
    animation: none;
    transition: opacity 0.5s ease;
}

#dica-machaneta.visivel {
    animation: sussurrar-sombrio 4s ease-in-out infinite;
}


#dica-machaneta.escondida {
    opacity: 0 !important;
    animation: none;
    transition: opacity 0.6s ease;
}

#dica-machaneta span {
    display: inline-block;
    animation: derreter-letra 3s ease-in-out infinite;
}

@keyframes derreter-letra {
    0%, 100% { opacity: 0.15; filter: blur(0px); transform: translateY(0px); }
    50%      { opacity: 0.6;  filter: blur(1.5px); transform: translateY(3px); }
}

@keyframes sussurrar-sombrio {
    0%   { opacity: 0.35; filter: blur(0px);   transform: translateX(-50%) translateY(0px); }
    35%  { opacity: 0.9;  filter: blur(0.4px); transform: translateX(-50%) translateY(1px); }
    65%  { opacity: 0.6;  filter: blur(1.8px); transform: translateX(-50%) translateY(4px); }
    100% { opacity: 0.35; filter: blur(0px);   transform: translateX(-50%) translateY(0px); }
}

#porta.chegou #porta-machaneta {
    pointer-events: auto !important;
}

#porta:not(.chegou) #porta-machaneta {
    pointer-events: none;
    cursor: default;
}


#porta-machaneta {
    position: absolute;
    width: 70px;
    height: 70px;
    background: transparent;
    border-radius: 50%;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}

/* tira esse hover dourado que pinta um quadrado em cima da art-porta */
#porta-machaneta:hover {
    box-shadow: 0 0 20px rgba(200, 160, 80, 0.9);
    background: transparent; /* mantém invisível */
}

/* Quando o estado muda para "porta": Alice sumiu, porta some junto */
body.estado-porta #porta {
    opacity: 0;                              
    pointer-events: none;                  
}

            /* CENA 4: FECHADURA */

#cena-fechadura {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;

    display: flex;
    align-items: center;
    justify-content: center;
}        

body.estado-fechadura #cena-fechadura {
    opacity: 1;
    pointer-events: auto;
}

/* Interior da fechadura: Pais das Maravilhas */
#fechadura-interior {
    position: absolute;
    width: 157px; 
    height: 239px; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out;
    z-index: 1; /* fica atrás da máscara */
}
#fechadura-mascara {
    position: absolute;
    inset: 0;
    background: transparent;
    width: 90px;
    height: 130px;
    position: relative;

    box-shadow: 0 0 0 100vmax #000;
    clip-path: path('M 45 0 A 45 45 0 1 1 44.9 0 Z M 20 90 L 70 90 L 65 130 L 25 130 Z');
    background: transparent;
}

#img-fechadura-final {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: brightness(1.1) contrast(1.1);
    transition: transform 0.15s ease-out;
}

#fechadura-texto {
    display: none;
} 

@keyframes brilharFechadura {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.1); }

    }

#creditos {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%);
    width: max-content;
    max-width: 90vw;
    text-align: center;
    color: rgba(255, 255, 255, 0.25);
    font-family: serif;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    opacity: 0;
    transition: opacity 2s ease 1s;
}

body.estado-fechadura #creditos {
    opacity: 1;
}

        /* BOTÃO DE MUTE */


#btn-mute {
    position: fixed;
    bottom: 1.5rem; 
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0; /* Começa invisível */
    pointer-events: none;
    transition: opacity 1.5s ease;
    z-index: 100;
}


body.estado-acordada #btn-mute,
body.estado-porta #btn-mute,
body.estado-fechadura #btn-mute {
    opacity: 0.5;
    pointer-events: auto;
}

/* Hover: fica mais visivel ao passar o mouse */
#btn-mute:hover {
    opacity: 1;
}

/* ==================== AJUSTES PARA MOBILE ==================== */

@media (max-width: 600px) {

    .objeto-ambiente:not(#porta) img {
        width: clamp(40px, 16vw, 90px) !important;
    }

    #obj-casticai .fala-objeto {
        left: -25px !important;
        transform: translateX(0) !important;
        text-align: center !important;
    }

    #obj-tela .fala-objeto {
        left: -40px !important;
        transform: translateX(0) !important;
        text-align: center !important;
    }

    #obj-chave .fala-objeto {
        left: auto !important;
        right: 5px !important;
        transform: translateX(0) !important;
        text-align: center !important;
    }

    #obj-cogumelo .fala-objeto {
        top: auto !important;
        bottom: 80% !important;
        margin-bottom: 4px !important;
        transform: translateX(-50%) translateY(0) !important;
    }

    #obj-casticai img    { width: clamp(35px, 14vw, 75px) !important; }
    #obj-prateleira img  { width: clamp(40px, 15vw, 80px) !important; }
    #obj-tela img        { width: clamp(40px, 15vw, 80px) !important; }
    .objeto-ambiente#obj-chave img { width: clamp(60px, 22vw, 130px) !important; }
    #obj-espelho img     { width: clamp(42px, 16vw, 90px) !important; }
    #obj-cogumelo img    { width: clamp(42px, 16vw, 90px) !important; }

    /* Reposiciona os objetos */
    #obj-casticai   { left: 15% !important; top: 10% !important; }
    #obj-prateleira { left: 25% !important; top: 30% !important; }
    #obj-tela       { left: 22% !important; top: 88% !important; }

    #obj-chave      { right: 15% !important; top: 8% !important; }
    #obj-espelho    { right: 20% !important; top: 38% !important; }
    #obj-cogumelo   { right: 19% !important; top: 88% !important; }

    /* Só a arte do drink vai mais pra esquerda */
    #obj-chave img {
        position: relative;
        left: -22px !important;
    }

    #porta.chegou {
        transform: translateX(-50%) scale(1.9) !important;
    }

    .fala-objeto {
        font-size: 0.7rem !important;
        max-width: min(160px, 70vw) !important;
    }

    #dica-clicar {
        white-space: normal !important;
        width: 38vw;
        text-align: center;
        font-size: 0.75rem !important;
        line-height: 1.3;
    }
}

/* ==================== MOBILE LANDSCAPE ==================== */

@media (max-height: 500px), (max-width: 900px) and (orientation: landscape) {

    /* Reduz o tamanho das artes */
    .objeto-ambiente:not(#porta) img {
        width: clamp(32px, 12vw, 70px) !important;
    }

    #obj-casticai img    { width: clamp(28px, 10vw, 60px) !important; }
    #obj-prateleira img  { width: clamp(32px, 11vw, 65px) !important; }
    #obj-tela img        { width: clamp(32px, 11vw, 65px) !important; }
    .objeto-ambiente#obj-chave img { width: clamp(48px, 16vw, 100px) !important; }
    #obj-espelho img     { width: clamp(34px, 12vw, 70px) !important; }
    #obj-cogumelo img    { width: clamp(34px, 12vw, 70px) !important; }

    /* Reposiciona com mais folga vertical */
    #obj-casticai   { left: 12% !important; top: 8% !important; }
    #obj-prateleira { left: 22% !important; top: 28% !important; }
    #obj-tela       { left: 18% !important; top: 78% !important; }

    #obj-chave      { right: 12% !important; top: 20% !important; }
    #obj-espelho    { right: 18% !important; top: 35% !important; }
    #obj-cogumelo   { right: 14% !important; top: 78% !important; }

    /* Drink um pouco mais pra esquerda */
    #obj-chave img {
        left: -18px !important;
    }

    /* Falas menores */
    .fala-objeto {
        font-size: 0.65rem !important;
        max-width: min(140px, 60vw) !important;
    }

    /* Cogumelo — usa o valor que calibrou (-25px) */
    #obj-cogumelo .fala-objeto {
        bottom: calc(100% - 25px) !important;
    }

    #obj-tela .fala-objeto {
        bottom: calc(100% - 8px) !important;
    }

    /* Porta e Alice menores */
    #porta.chegou {
        transform: translateX(-50%) scale(1.5) !important;
    }

    #alice-img {
        width: 110px !important;
    }

    #porta img {
        width: 120px !important;
    }
}

/* Ajuste para tablets em pé (retrato) — afasta relógio, gato e cogumelo da borda */
@media (min-width: 601px) and (max-width: 1024px) and (orientation: portrait) {
    #obj-casticai   { left: 18% !important; }
    #obj-tela       { left: 18% !important; }
    #obj-cogumelo   { right: 18% !important; }
    #obj-chave img  { width: clamp(70px, 14vw, 260px) !important; }
}

