:root {
    --primary: #3498db;
    --accent: #e74c3c;
    --bg-text: #2c3e50;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Quicksand', sans-serif;
}

body {
    position: relative;
}

/* SFONDO SFOCATO (Gestito con pseudo-elemento) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    
    background-image: url('sfondo.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;

    /* Applica entrambi i filtri sulla stessa riga */
    /* Brightness > 100% per schiarire */
    filter: blur(3px) brightness(100%);
    
    /* Nota: i prefissi -webkit- ecc. oggi sono quasi superati, 
       ma se vuoi tenerli per sicurezza, segui lo stesso schema: */
    -webkit-filter: blur(3px) brightness(100%);
    
    /* Importante per evitare l'alone bianco ai bordi dovuto al blur */
    transform: scale(1.1); 
}

/* TOOLBAR - Stile Desktop Base */
.toolbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 25px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    align-items: center;
    transition: all 0.3s ease;
}

.tool-group {
    display: flex;
    gap: 8px;
    border-right: 1px solid #ddd;
    padding-right: 15px;
    align-items: center;
}

.tool-group:last-child { border-right: none; }

button {
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
    background: #eee; /* Sfondo default desktop */
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

button.active { background: var(--primary); color: white; }
button:hover { opacity: 0.8; }
.btn-send { background: var(--primary); color: white; font-weight: 700; }

/* LAYOUT CENTRALE */
.artboard {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* BIO LAYER */
.bio-layer {
    position: absolute;
    width: 80%;
    max-width: 900px;
    z-index: 1;
    pointer-events: none;
    user-select: none;
    color: #FFFFFF;
    text-align: center;
    
    /* ABBIAMO TOLTO: background, border-radius e box-shadow */
    padding: 20px; 
    transition: all 0.3s ease;
}

/* Aggiungiamo un'ombra bianca al testo per leggerlo meglio senza il riquadro */
.bio-layer p, .bio-layer h1 {
    text-shadow: 0px 0px 10px rgba(255, 255, 255, 0.8);
}

.bio-layer h1 { 
    font-weight: 700; 
    font-size: 2.5rem; 
    margin-bottom: 20px; 
    color: var(--primary); 
    text-shadow: none; 
}

.bio-layer p { 
    font-weight: 400; 
    font-size: 1.1rem; 
    line-height: 1.6; 
    margin-bottom: 20px; 
}

.photo-placeholder img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* CANVAS */
#sketchLayer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    cursor: crosshair;
    touch-action: none;
}

/* MODAL */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.modal-content { background: white; margin: 5% auto; padding: 30px; border-radius: 20px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 5px 30px rgba(0,0,0,0.3); }
.modal-content input, .modal-content textarea { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; font-family: inherit; }
.modal-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 15px; }
.btn-confirm { background: var(--primary); color: white; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; font-weight: bold; }
.btn-cancel { background: var(--accent); color: white; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; }

/* =========================================
   OTTIMIZZAZIONE MOBILE (Smartphone)
   ========================================= */
/* =========================================
   OTTIMIZZAZIONE MOBILE (Smartphone) - CORRETTA
   ========================================= */
@media screen and (max-width: 768px) {
    /* Toolbar Compatta */
    .toolbar {
        top: 10px;
        width: 95%; /* Leggermente più larga per stare comoda */
        padding: 5px 10px;
        justify-content: space-between;
        gap: 5px;
    }

    .tool-group {
        padding-right: 5px;
        gap: 2px;
    }

    /* Nascondi il testo dei pulsanti SOLO nella toolbar */
    .toolbar .btn-text {
        display: none;
    }

    /* Rendi trasparenti SOLO i pulsanti della toolbar (escluso quello di invio) */
    .toolbar button:not(.btn-send) {
        background: transparent;
        padding: 8px;
        font-size: 1.2rem;
    }
    
    /* Effetto attivo per i pulsanti toolbar */
    .toolbar button.active:not(.btn-send) {
        background: transparent;
        color: var(--primary);
        transform: scale(1.2);
    }

    /* Pulsante Send (Invia) nella toolbar */
    .btn-send {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* --- FIX PER LA MODALE (DIALOG) --- */
    /* Assicuriamoci che i pulsanti della modale restino visibili e colorati */
    .modal-buttons {
        flex-direction: row; /* Mantieni affiancati */
        gap: 10px;
    }

    .modal-content .btn-confirm, 
    .modal-content .btn-cancel {
        display: block;
        width: 100%; /* Su mobile è più facile cliccarli se sono larghi */
        font-size: 0.9rem;
        padding: 12px 5px;
    }
    
    /* Forza il testo a vedersi nella modale */
    .modal-content .btn-text {
        display: inline !important;
    }

    /* Ottimizzazione Bio Layer */
    .bio-layer {
        width: 90%;
        padding: 15px;
        top: 45%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-height: 70vh;
        overflow-y: auto; 
    }

    .bio-layer h1 {
        font-size: 1.6rem;
        margin-bottom: 10px;
    }

    .bio-layer p {
        font-size: 0.90rem;
        line-height: 1.4;
        margin-bottom: 10px;
    }

    /* Foto più piccola */
    .photo-placeholder img {
        width: 80px;
        height: 80px;
        border-width: 3px;
    }
}