/* ==========================================================================
   Estilos Gerais
   ========================================================================== */
body {
    background: #1A2525;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* ==========================================================================
   Imagem de Fundo
   ========================================================================== */
.bg-img {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    transform: scale(1.15);
    animation: driftZoom 60s infinite ease-in-out, pulseOpacity 30s infinite ease-in-out, pulseBlur 20s infinite ease-in-out;
    opacity: 0.75;
    will-change: transform, opacity, filter;
}

@keyframes driftZoom {
    0% { transform: scale(1.15) translate(0, 0); }
    50% { transform: scale(1.35) translate(-4%, 4%); }
    100% { transform: scale(1.15) translate(0, 0); }
}

@keyframes pulseOpacity {
    0% { opacity: 0.65; }
    50% { opacity: 0.95; }
    100% { opacity: 0.65; }
}

@keyframes pulseBlur {
    0% { filter: blur(2px); }
    50% { filter: blur(8px); }
    100% { filter: blur(2px); }
}

/* ==========================================================================
   Canvas para Linhas
   ========================================================================== */
.constellation-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9;
}

/* ==========================================================================
   Container de Memórias
   ========================================================================== */
.memoria-container {
    position: relative;
    width: 100%;
    height: 100vh;
    z-index: 10;
}

.memoria-celula {
    position: absolute;
    width: 100px;
    height: 100px;
    opacity: 0.8;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    background: radial-gradient(circle at center, rgba(255, 215, 150, 0.8) 0%, rgba(255, 215, 150, 0.5) 100%);
}

.memoria-celula.revealed {
    animation: ripple 6s infinite ease-in-out;
}

.memoria-celula:hover {
    opacity: 1;
    transform: scale(1.2);
    box-shadow: 0 0 15px #FFD700;
}

.memoria-celula img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.memoria-celula.revealed img {
    opacity: 0.9 !important;
}

.memoria-celula .veil {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(50, 50, 50, 0.7);
    transition: opacity 0.5s ease;
}

.memoria-celula.revealed .veil {
    opacity: 0;
}

@keyframes ripple {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Pop-up de Memórias
   ========================================================================== */
.memory-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(28, 37, 38, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    transform: translateY(-50px); /* Move o pop-up 50px para cima */
    z-index: 103;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    will-change: opacity;
    overflow-y: auto;
    padding: 40px 0;
}

.memory-popup.active {
    display: flex;
    opacity: 1;
}

.memory-container {
    max-width: 1200px;
    width: 90%;
    padding: 16px;
    background: rgba(10, 20, 40, 0.2);
    text-align: center;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 215, 150, 0.3);
    max-height: 80vh;
    overflow-y: auto;
    margin: auto;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.memory-images {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.memory-images img {
    width: 480px;
    height: 480px;
    object-fit: cover;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    will-change: opacity;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.memory-popup.active .memory-images img {
    opacity: 1;
}

.memory-images.fading img {
    opacity: 0;
}

.poetica-message {
    font-family: 'Raleway', sans-serif;
    font-size: 1.4em;
    color: #FFD700;
    text-align: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    visibility: visible !important;
    z-index: 104;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.poetica-message .poetica-cta,
.poetica-message .poetica-res {
    opacity: 0;
    transition: opacity 2s ease-in-out;
    display: block !important;
}

.poetica-message .poetica-cta.active,
.poetica-message .poetica-res.active {
    opacity: 1 !important;
}

.poetica-message .poetica-cta.active {
    transition-delay: 0.1s;
}

.poetica-message .poetica-res.active {
    transition-delay: 0.3s;
}

.poetica-message.final-text {
    font-size: 1.2em;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

/* ==========================================================================
   Diário Popup
   ========================================================================== */
.diario-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(28, 37, 38, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 102;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    overflow-y: auto;
    padding: 40px 0;
}

.diario-popup.active {
    display: flex;
    opacity: 1;
}

.diario-container {
    max-width: 600px;
    width: 90%;
    padding: 16px;
    background: rgba(10, 20, 40, 0.2);
    text-align: center;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 215, 150, 0.3);
    max-height: 80vh;
    overflow-y: auto;
    margin: auto;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.diario-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.diario-entry {
    display: flex;
    align-items: center;
    margin: 10px 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s ease-in-out, transform 1.5s ease-in-out;
}

.diario-entry.active {
    opacity: 1;
    transform: translateY(0);
}

.diario-entry img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    margin-right: 10px;
}

.diario-entry p {
    font-family: 'Raleway', sans-serif;
    font-weight: 300;
    font-size: 1.2em;
    color: rgba(255, 215, 150, 0.9);
    margin: 0;
}

/* ==========================================================================
   Contador de Tentativas
   ========================================================================== */
.tentativas-counter {
    position: fixed;
    top: 5%;
    right: 5%;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.2em;
    color: #FFD700;
    z-index: 101;
}

/* ==========================================================================
   Links Flutuantes e Botão de Reinício
   ========================================================================== */
.floating-text {
    position: fixed;
    color: #F5F5F5;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5em;
    font-weight: 300;
    text-decoration: none;
    z-index: 101;
    background: rgba(0, 0, 0, 0.01);
    padding: 8px 12px;
    border-radius: 15% 40% 25% 55%;
    transition: all 0.5s ease;
}

.floating-text:hover {
    color: #FFD700;
    background: rgba(0, 0, 0, 0.02);
}

.floating-text.chaos8 {
    top: 5%;
    left: 5%;
    animation: subtleChaos8 100s infinite ease-in-out;
}

.floating-text.chaos9 {
    bottom: 10%;
    right: 5%;
    animation: subtleChaos9 96s infinite ease-in-out;
}

.floating-text.chaos10 {
    bottom: 10%;
    left: 5%;
    animation: subtleChaos10 98s infinite ease-in-out;
}

@keyframes subtleChaos8 {
    0% { top: 5%; left: 5%; transform: rotate(0deg); }
    20% { top: 7%; left: 7%; transform: rotate(5deg); }
    40% { top: 9%; left: 6%; transform: rotate(-3deg); }
    60% { top: 6%; left: 8%; transform: rotate(4deg); }
    80% { top: 8%; left: 6%; transform: rotate(-2deg); }
    100% { top: 5%; left: 5%; transform: rotate(0deg); }
}

@keyframes subtleChaos9 {
    0% { bottom: 10%; right: 5%; transform: rotate(0deg); }
    20% { bottom: 12%; right: 7%; transform: rotate(-5deg); }
    40% { bottom: 14%; right: 6%; transform: rotate(4deg); }
    60% { bottom: 11%; right: 8%; transform: rotate(-3deg); }
    80% { bottom: 13%; right: 6%; transform: rotate(2deg); }
    100% { bottom: 10%; right: 5%; transform: rotate(0deg); }
}

@keyframes subtleChaos10 {
    0% { bottom: 10%; left: 5%; transform: rotate(0deg); }
    20% { bottom: 12%; left: 7%; transform: rotate(-4deg); }
    40% { bottom: 14%; left: 6%; transform: rotate(3deg); }
    60% { bottom: 11%; left: 8%; transform: rotate(-5deg); }
    80% { bottom: 13%; left: 6%; transform: rotate(2deg); }
    100% { bottom: 10%; left: 5%; transform: rotate(0deg); }
}

/* ==========================================================================
   Responsividade
   ========================================================================== */
@media (max-width: 768px) {
    .memory-popup {
        transform: translateY(-30px); /* Move o pop-up 30px para cima em telas menores */
    }
    .memory-container {
        max-width: 90%;
        padding: 12px;
    }
    .memory-images img {
        width: 400px;
        height: 400px;
    }
    .poetica-message {
        font-size: 1.2em;
    }
    .poetica-message.final-text {
        font-size: 1em;
    }
    .diario-container {
        max-width: 90%;
        padding: 12px;
        max-height: 70vh;
    }
    .diario-content {
        max-height: 50vh;
    }
    .diario-entry img {
        width: 64px;
        height: 48px;
    }
    .diario-entry p {
        font-size: 1em;
    }
    .memoria-celula {
        width: 80px;
        height: 80px;
    }
    .memoria-celula img {
        max-width: 80px;
        max-height: 80px;
    }
    .tentativas-counter {
        font-size: 1em;
    }
}