/*
======================================================================================
SISTEMA DE DIÁLOGO EASTER EGG - ESTILO TEDINVER-REBORN
Visual inspirado na UI do jogo, com paleta de cores corrigida
======================================================================================
*/

@font-face {
    font-family: 'TedInver';
    src: url('../Assets/tedinver/NormalFont.ttf') format('truetype');
}

/* Modal com fundo escuro e ruidoso (estilo o jogo) */
.dialogue-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Não bloqueia cliques quando invisível */
}

.dialogue-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(26, 20, 30, 0.85) 0%, rgba(10, 5, 20, 0.98) 100%);
    backdrop-filter: blur(10px);
    z-index: 99998;
}

.dialogue-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    pointer-events: all;
}

/* Cinematic Letterbox (Barras pretas) */
.dialogue-modal::before,
.dialogue-modal::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 10vh;
    background: #000;
    z-index: 100001;
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.dialogue-modal::before {
    top: 0;
    transform: translateY(-100%);
}

.dialogue-modal::after {
    bottom: 0;
    transform: translateY(100%);
}

.dialogue-modal.show::before,
.dialogue-modal.show::after {
    transform: translateY(0);
}

/* Container Principal - Estilo Arcano Luxo (GODOT MATCH) */
.dialogue-container {
    width: 90%;
    max-width: 1200px;
    height: auto;
    min-height: 480px; 
    max-height: 85vh; 
    position: relative;
    z-index: 100000;
    background: #1a141e; /* Cor oficial do background de Godot */
    border: 3px solid #e6cc80; /* Dourado Celestial oficial */
    border-radius: 4px;
    padding: 50px 60px;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 0 4px #1a141e,
        0 0 0 8px #e6cc80,
        0 0 60px rgba(230, 204, 128, 0.15),
        inset 0 0 80px rgba(0, 0, 0, 0.8);

    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: visible !important;
}

.dialogue-modal.show .dialogue-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Close button - inside the box for better visibility */
.dialogue-close-btn {
    position: absolute;
    top: 25px;
    right: 30px;
    background: rgba(40, 30, 50, 0.8);
    border: 2px solid #e6cc80;
    color: #e6cc80;
    font-family: 'TedInver', sans-serif;
    font-size: 14px;
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100010;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
}

.dialogue-close-btn:hover {
    background: #e6cc80;
    color: #1a141e;
    box-shadow: 0 0 25px rgba(230, 204, 128, 0.5);
    transform: translateY(-2px);
}

.dialogue-traveler {
    position: absolute;
    left: -120px;
    /* Offset to overlap nicely */
    bottom: -30px;
    z-index: 100005;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.traveler-sprite {
    width: 600px;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 40px rgba(230, 204, 128, 0.4)) brightness(1.2);
    animation: floating 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.traveler-sprite.talking {
    animation: floating 3s ease-in-out infinite, talking-bounce 0.2s infinite;
    filter: drop-shadow(0 0 60px rgba(230, 204, 128, 0.6)) brightness(1.4);
}

.traveler-label {
    background: #e6cc80;
    color: #1a141e;
    padding: 5px 15px;
    font-family: 'TedInver', sans-serif;
    font-size: 14px;
    margin-top: -30px;
    border: 2px solid #1a141e;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    word-spacing: 0.3em;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.traveler-label.talking {
    box-shadow: 0 0 20px #e6cc80;
    transform: scale(1.1);
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Área de Texto */
.dialogue-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    padding-left: 180px;
    /* Fixed spacing for portrait */
    position: relative;
}

/* Texto de Resposta (Fonte Pixelada) */
.dialogue-response {
    flex: 1;
    font-family: 'TedInver', sans-serif;
    font-size: 26px;
    line-height: 1.4;
    color: #e6cc80;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    word-wrap: break-word;
    margin-bottom: 25px;
    padding: 10px 10px 10px 0;
    max-height: 250px;
    overflow-y: auto;
    text-transform: uppercase;
    word-spacing: 0.6em;
    letter-spacing: 1px;
}

.dialogue-response::-webkit-scrollbar {
    width: 6px;
}
.dialogue-response::-webkit-scrollbar-thumb {
    background: #e6cc80;
    border-radius: 10px;
}

/* Indicador de "Clique para continuar" */
.dialogue-continue {
    position: absolute;
    bottom: 30px;
    right: 40px;
    font-family: 'TedInver', sans-serif;
    font-size: 14px;
    color: rgba(230, 204, 128, 0.6);
    opacity: 0;
    animation: blink 1.5s infinite;
    transition: opacity 0.5s ease;
    text-transform: uppercase;
    pointer-events: none;
}

.dialogue-continue.show {
    opacity: 1;
}

/* Opções */
.dialogue-options {
    margin: 20px auto 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    width: 90%;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(230, 204, 128, 0.2);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.dialogue-options.show {
    opacity: 1;
    pointer-events: all;
}

.dialogue-option-btn {
    background: rgba(26, 20, 30, 0.9);
    border: 2px solid rgba(230, 204, 128, 0.4);
    color: #e6cc80;
    font-family: 'TedInver', sans-serif;
    font-size: 18px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    text-transform: uppercase;
    text-align: left;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.dialogue-option-btn::before {
    content: '▶';
    margin-right: 15px;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    transform: translateX(-10px);
}

.dialogue-option-btn:hover {
    border-color: #e6cc80;
    background: rgba(40, 30, 50, 0.9);
    box-shadow: 0 0 20px rgba(230, 204, 128, 0.3);
    padding-left: 30px;
}

.dialogue-option-btn:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* Animação do balão de curiosidade (mantém mas ajusta) */
.traveler-speech-bubble {
    position: fixed;
    /* Muda para fixed se for ficar acima do portal no site */
    z-index: 10001;
    background: #1F1A26;
    border: 3px solid #E8C673;
    padding: 20px;
    font-family: 'TedInver', monospace;
    color: #FFF;
    min-width: 250px;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

/* Responsividade RPG */
@media screen and (max-width: 1200px) {
    .dialogue-traveler {
        left: -80px;
    }

    .traveler-sprite {
        width: 350px;
    }
}

@media screen and (max-width: 1024px) {
    .dialogue-container {
        width: 90%;
        padding: 30px;
    }

    .dialogue-traveler {
        left: -40px;
        bottom: -20px;
    }

    .traveler-sprite {
        width: 300px;
    }

    .dialogue-content {
        padding-left: 140px;
    }

    .dialogue-response {
        font-size: 20px;
    }
}

@media screen and (max-width: 768px) {
    .dialogue-modal.show {
        align-items: flex-end;
        /* Mobile: box at bottom */
        padding-bottom: 20px;
    }

    .dialogue-container {
        width: 95%;
        padding: 20px;
        min-height: auto;
    }

    .dialogue-traveler {
        position: relative;
        left: 0;
        bottom: 0;
        margin-top: -100px;
        /* Overlap top of box */
        margin-left: 20px;
        align-items: flex-start;
    }

    .traveler-sprite {
        width: 150px;
    }

    .traveler-label {
        margin-top: -15px;
        font-size: 10px;
    }

    .dialogue-content {
        padding-left: 0;
        padding-top: 10px;
    }

    .dialogue-response {
        font-size: 18px;
        max-height: 150px;
    }

    .dialogue-option-btn {
        font-size: 15px;
        padding: 8px 15px;
    }

    .dialogue-close-btn {
        top: 10px;
        right: 15px;
        font-size: 12px;
    }
}

/* BBCODE SIMULATION (CLASSES PARA JS) */
.ted-gold {
    color: #E8C673;
    font-weight: bold;
}

.ted-lavender {
    color: #9D8DBE;
    font-weight: bold;
}

.ted-white {
    color: #FFFFFF;
}

/* 
======================================================================================
TELA DE RECOMPENSA LENDÁRIA - CHAVE DOURADA
======================================================================================
*/
.key-reward-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0.9;
    z-index: 199999;
}

.key-reward-content {
    text-align: center;
    max-width: 800px;
    padding: 60px;
    background: rgba(20, 15, 30, 0.9);
    border: 3px solid #E8C673;
    border-radius: 4px;
    box-shadow: 0 0 150px rgba(232, 198, 115, 0.3);
    transform: scale(0.8);
    transition: transform 0.8s cubic-bezier(0.17, 0.84, 0.44, 1);
    z-index: 200001;
    position: relative;
}

.key-glow-container {
    padding: 40px;
    margin-bottom: 20px;
    position: relative;
}

.key-glow-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(232, 198, 115, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-gold 2s infinite alternate;
}

@keyframes pulse-gold {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }

    to {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.key-animation {
    width: 250px;
    height: auto;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 40px #E8C673);
}

.key-title {
    font-family: 'TedInver', sans-serif;
    color: #E8C673;
    font-size: 32px;
    margin-bottom: 15px;
    text-shadow: 0 0 15px rgba(232, 198, 115, 0.6);
    text-transform: uppercase;
    word-spacing: 0.5em;
    letter-spacing: 2px;
}

.key-text {
    font-family: 'TedInver', sans-serif;
    color: #9D8DBE;
    font-size: 20px;
    margin-bottom: 30px;
    text-transform: uppercase;
    word-spacing: 0.4em;
}

.key-footer {
    margin-top: 30px;
    font-family: 'TedInver', sans-serif;
    color: #9D8DBE;
    font-size: 14px;
    animation: blink 1.5s infinite;
    text-transform: uppercase;
    word-spacing: 0.4em;
    opacity: 0.7;
}

/* Botões da Recompensa */
.reward-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.btn-play-tedinver {
    background: #e6cc80;
    color: #1a141e;
    border: none;
    padding: 15px 40px;
    font-family: 'TedInver', sans-serif;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(230, 204, 128, 0.4);
    word-spacing: 0.5em;
}

.btn-play-tedinver:hover {
    transform: scale(1.05);
    background: #FFF;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.6);
}

.key-close-btn {
    background: transparent;
    border: 2px solid #9D8DBE;
    color: #9D8DBE;
    padding: 10px 25px;
    font-family: 'TedInver', sans-serif;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    word-spacing: 0.3em;
}

.key-close-btn:hover {
    background: rgba(157, 141, 190, 0.1);
    color: #FFF;
}

@keyframes gold-glow {
    from {
        filter: drop-shadow(0 0 20px #e6cc80) brightness(1);
        transform: scale(1) rotate(-5deg);
    }

    to {
        filter: drop-shadow(0 0 50px #e6cc80) brightness(1.2);
        transform: scale(1.1) rotate(5deg);
    }
}

@keyframes talking-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes speaking-glow {
    0%, 100% { filter: drop-shadow(0 0 40px rgba(230, 204, 128, 0.4)); }
    50% { filter: drop-shadow(0 0 60px rgba(230, 204, 128, 0.7)); }
}