:root {
    --oracolo-green: #00ff9d;
    --oracolo-glow: rgba(0, 255, 157, 0.4);
    --glass-bg: rgba(0, 10, 5, 0.85);
    --user-msg-bg: rgba(255, 255, 255, 0.05);
}

/* 1. LA SFERA */
#oracolo-sphere {
    position: fixed;
    bottom: 300px; 
    right: 30px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(0, 255, 157, 0.6), rgba(0, 100, 50, 0.2));
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
}

/* 2. IL LOGO (UNICA DEFINIZIONE) */
.sphere-logo {
    width: 70px; 
    height: 70px;
    /* Prova con questo percorso: se il file è nella stessa cartella del CSS */
    background-image: url('logo.png') !important; 
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.9;
    filter: drop-shadow(0 0 8px var(--oracolo-green));
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* 3. L'ANELLO ESTERNO */
#oracolo-sphere::after {
    content: '';
    position: absolute;
    width: 110%;
    height: 110%;
    border-radius: 50%;
    border: 1px solid var(--oracolo-green);
    opacity: 0.5;
    animation: orbit 3s linear infinite;
    pointer-events: none;
}

#oracolo-sphere:hover {
    transform: scale(1.1);
    box-shadow: 0 0 50px var(--oracolo-green), inset 0 0 20px rgba(255,255,255,0.4);
    filter: brightness(1.2);
}

#oracolo-sphere:hover::after {
    border-color: #fff;
    box-shadow: 0 0 15px var(--oracolo-green);
    animation-duration: 1.5s;
}

@keyframes orbit {
    0% { transform: rotate(0deg) scale(1); opacity: 0.5; }
    50% { transform: rotate(180deg) scale(1.1); opacity: 0.2; }
    100% { transform: rotate(360deg) scale(1); opacity: 0.5; }
}

/* PANNELLO CHAT */
#oracolo-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 95%;
    max-width: 700px;
    height: 75vh;
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#oracolo-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.panel-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 30px;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(0, 255, 157, 0.1);
    background-image: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px;
    position: relative; /* FONDAMENTALE per ancorare il logo */
    overflow: hidden;
    z-index: 1; 
}

/* LA FILIGRANA */
.panel-glass::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;  /* Ridotto un po' per estetica */
    height: 60%;
    background-image: url('logo.png') !important; /* Usiamo lo stesso file della sfera */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.12; /* Aumentata leggermente l'opacità per vederlo meglio */
    filter: saturate(1.5) brightness(1.2); /* Colori più intensi e leggermente più chiari */
    pointer-events: none;
    z-index: 0; /* Deve stare dietro ai messaggi ma sopra lo sfondo */
}

/* ASSICURIAMOCI CHE I MESSAGGI SIANO SOPRA */
#chat-output, .input-area {
    position: relative;
    z-index: 5; /* Forza il testo a stare SOPRA la filigrana */
}

#chat-output {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 15px;
}

#chat-output::-webkit-scrollbar { width: 4px; }
#chat-output::-webkit-scrollbar-thumb { background: var(--oracolo-green); border-radius: 10px; }

.msg-user {
    color: #fff;
    background: var(--user-msg-bg);
    padding: 12px 18px;
    border-radius: 15px 15px 0 15px;
    margin-bottom: 20px;
    align-self: flex-end;
    max-width: 80%;
    margin-left: auto;
    border: 1px solid rgba(255,255,255,0.1);
}

.msg-ai {
    color: var(--oracolo-green);
    margin-bottom: 25px;
    line-height: 1.6;
    text-shadow: 0 0 8px rgba(0, 255, 157, 0.3);
}

.holo-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid var(--oracolo-green);
    color: var(--oracolo-green) !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.holo-btn:hover {
    background: var(--oracolo-green);
    color: #000 !important;
    box-shadow: 0 0 20px var(--oracolo-green);
}

.input-area {
    border-top: 1px solid rgba(0, 255, 157, 0.1);
    padding-top: 20px;
}

#user-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    outline: none;
}

.glow-line {
    height: 1px;
    background: var(--oracolo-green);
    box-shadow: 0 0 15px var(--oracolo-green);
    width: 0%;
    transition: width 0.6s ease;
}

#user-input:focus + .glow-line { width: 100%; }

#oracolo-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
}
#oracolo-overlay.active { display: block; }

@media (max-width: 600px) {
    #oracolo-panel { height: 90vh; width: 100%; }
    #oracolo-sphere { width: 70px; height: 70px; bottom: 20px; right: 20px; }
    .sphere-logo { width: 55px; height: 55px; }
}