﻿        :root {
            --primary: #3498db;
            --bg: #0a0a0a;
            --card-bg: #161616;
            --text: #ffffff;
            /* Variabili dinamiche gestite dal pannello impostazioni */
            --quest-size: 2.5rem;
            --math-size: 1.1em;
            --quest-color: #ffffff;
            --math-color: #3498db;
        }

body { 
            font-family: 'Segoe UI', Arial, sans-serif; 
            background: var(--bg); 
            color: var(--text);
            display: flex; 
            flex-direction: column;
            align-items: center; 
            /* Rimosso justify-content: center che spinge i contenuti fuori se sono alti */
            min-height: 100vh; 
            margin: 0; 
            /* Modificato overflow: permette lo scroll se il contenuto eccede */
            overflow-y: auto; 
            overflow-x: hidden;
            padding: 40px 0; /* Aggiunto spazio sopra e sotto per non far toccare i bordi */
            -webkit-overflow-scrolling: touch; /* Rende lo scroll fluido su touch */
            touch-action: pan-y; /* Ottimizza il tocco per lo scroll verticale */
        }

.header-prof { 
            position: fixed; /* Cambiato da absolute a fixed */
            top: 20px; 
            left: 20px; /* Meglio specificare left se non è centrato */
            font-size: 1.2rem; 
            color: var(--primary); 
            font-weight: 800; 
            text-transform: uppercase; 
            letter-spacing: 3px; 
            opacity: 0.6; 
            z-index: 100;
        }
        
        .btn-file {
            /* position: fixed;
            top: 20px; 
            left: 150px; 
            z-index: 100; */
            /* ... resto del codice invariato ... */
        }
        
        .btn-file:hover {
            opacity: 1;
            background: #333;
            border-color: var(--primary);
        }

        /* PANNELLO LATERALE IMPOSTAZIONI */
        .side-panel {
            position: fixed;
            right: -280px;
            top: 0;
            width: 280px;
            height: 100%;
            background: #111;
            border-left: 2px solid var(--primary);
            z-index: 2000;
            transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            padding: 25px;
            box-sizing: border-box;
            box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        }
        .side-panel.open { right: 0; }
        .side-toggle {
            position: absolute;
            left: -45px;
            top: 50%;
            transform: translateY(-50%);
            background: var(--primary);
            color: white;
            width: 45px;
            height: 60px;
            border-radius: 12px 0 0 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.5rem;
            box-shadow: -5px 0 15px rgba(0,0,0,0.3);
        }
        .side-panel h3 { color: #fff; margin-top: 0; border-bottom: 1px solid #333; padding-bottom: 10px; font-size: 1.1rem; }
        .setting-group { margin-bottom: 25px; }
        .setting-group label { display: block; font-size: 0.75rem; color: var(--primary); text-transform: uppercase; margin-bottom: 10px; font-weight: bold; }
        .setting-group input[type=range] { width: 100%; accent-color: var(--primary); cursor: pointer; }
        .setting-group input[type=color] { width: 100%; height: 40px; border: none; background: none; cursor: pointer; }

        /* CONTENITORE PRINCIPALE */
		.container { 
            background: var(--card-bg); 
            padding: 40px; 
            border-radius: 30px; 
            box-shadow: 0 25px 50px rgba(0,0,0,0.8); 
            text-align: center; 
            width: 92vw; 
            max-width: 1300px; 
            border: 1px solid #252525;
            /* Aggiunto margine per sicurezza */
            margin: auto; 
        }

        #box-domanda { 
            font-size: var(--quest-size); 
            color: var(--quest-color);
            line-height: 1.4;
            /* Cambiato da 500px a min-height generoso ma flessibile */
            min-height: 300px; 
            display: block; 
            text-align: left; 
            margin: 20px 0; 
            padding: 30px;
            background: #000;
            border-radius: 20px;
            box-shadow: inset 0 0 40px rgba(0,0,0,1);
            word-wrap: break-word;
            overflow-wrap: break-word;
        }
        
        #titolo-verifica { color: #555; font-size: 1.2rem; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 1px; }

        .katex-display {
            display: inline-block; 
            margin: 0.5em 0;
        }

        .katex { 
            white-space: nowrap; 
            font-size: var(--math-size) !important; 
            color: var(--math-color) !important;
        }

        #box-domanda img {
            display: block;
            margin: 25px auto;
            border-radius: 12px;
            border: 2px solid #333;
            max-width: 100%; 
            max-height: 55vh;
            height: auto;
        }

/* CONTROLLI COMPATTI */
.controls { 
    display: flex; 
    gap: 15px; 
    justify-content: center; 
    align-items: center; /* Allinea verticalmente tutto */
    margin-top: 25px; 
}

button.action-btn { 
    padding: 10px 20px; /* Molto più bassi */
    font-size: 1rem;    /* Testo meno urlato */
    border: none; 
    border-radius: 10px; 
    cursor: pointer; 
    font-weight: bold; 
    text-transform: uppercase;
    transition: 0.3s; 
    height: 42px; /* Altezza simile ai cerchietti dei voti */
    display: flex;
    align-items: center;
}

.btn-reset { 
    background: #333; 
    color: #888; 
    border: 1px solid #444;
}

.btn-reset:hover { 
    background: #444; 
    color: #fff; 
}
       .btn-estrai { background: var(--primary); color: white; box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3); }
        .btn-estrai:hover { transform: translateY(-3px); background: #2980b9; }
        
        #info { margin-top: 25px; font-size: 1.1rem; color: #444; font-weight: bold; }

        /* MODALE FILE SYSTEM */
        .modal-overlay {
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.9); z-index: 1000; justify-content: center; align-items: center;
        }
        .modal-content {
            background: #161616; width: 90%; max-width: 550px; border-radius: 20px;
            max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #333;
        }
        .modal-header { padding: 20px; background: #222; color: var(--primary); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; }
        .modal-list { flex: 1; overflow-y: auto; padding: 15px; }
        .modal-item { 
            padding: 15px; border-bottom: 1px solid #222; cursor: pointer; 
            display: flex; align-items: center; gap: 12px; font-size: 1.1rem; color: #aaa; transition: 0.2s;
        }
        .modal-item:hover { background: #222; color: var(--primary); }
        .breadcrumb { padding: 12px 20px; background: #000; font-size: 0.85rem; color: #555; border-bottom: 1px solid #222; }
        .close-btn { cursor: pointer; font-size: 2rem; color: #666; }

        /* STILE LAVAGNA CON SIDEBAR */
        #lavagna-overlay {
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: #000; z-index: 3000; flex-direction: row; /* Elementi affiancati */
        }

        .lavagna-sidebar {
            width: 90px;
            background: #1a1a1a;
            display: flex;
            flex-direction: column;
            gap: 15px;
            padding: 15px 5px;
            border-right: 2px solid var(--primary);
            flex-shrink: 0;
            box-sizing: border-box;
        }

        .btn-sidebar {
            width: 100%;
            padding: 15px 5px;
            font-size: 0.9rem;
            color: white;
            background: #222;
            border: 1px solid #444;
            border-radius: 12px;
            cursor: pointer;
            text-align: center;
            box-sizing: border-box;
        }

        .lavagna-main {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        #lavagna-header {
            background: #111;
            padding: 20px 30px;
            border-bottom: 1px solid #333;
            min-height: 80px;
            flex-shrink: 0;
        }

        #domanda-lavagna { 
            font-size: 2.2rem; 
            color: #fff; 
            line-height: 1.3;
        }

        /* MODIFICA: VIEWPORT PER LO SCROLL */
        .canvas-viewport {
            flex-grow: 1;
            overflow-y: auto;
            overflow-x: hidden;
            background: #111;
            position: relative;
        }

        #canvas-lavagna { 
            display: block; /* Importante per il viewport */
            background: #111; 
            touch-action: none; 
            cursor: crosshair;
        }

        /* STRUMENTI SIDEBAR AGGIUNTIVI */
        .color-picker {
            display: flex;
            flex-direction: column;
            gap: 15px;
            align-items: center;
        }
        .color-dot {
            width: 35px;
            height: 35px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid transparent;
            transition: transform 0.2s;
        }
        .color-dot:hover { transform: scale(1.2); }
        .color-dot.active { border-color: white; transform: scale(1.1); }

        #pen-size {
            writing-mode: bt-lr; /* Verticale su alcuni browser */
            appearance: none;
            height: 5px;
            background: #444;
            border-radius: 5px;
            width: 100%;
            cursor: pointer;
        }

.button-link {
  display: inline-block;
  padding: 10px 20px;
  background-color: #007bff; /* Colore sfondo */
  color: white; /* Colore testo */
  text-decoration: none; /* Rimuove sottolineatura */
  border-radius: 5px; /* Angoli arrotondati */
  font-family: sans-serif;
  transition: background-color 0.3s; /* Animazione hover */
}

.button-link:hover {
  background-color: #0056b3; /* Colore al passaggio mouse */
}

/* Modale per il disegno specifico sull'immagine */
#modal-disegno {
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); 
    z-index: 4000; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
}

#canvas-container-modale {
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,1);
    background: #fff; /* Sfondo bianco per far risaltare l'immagine */
    line-height: 0;
}

#canvas-foto {
    position: absolute;
    top: 0; left: 0;
    cursor: crosshair;
    touch-action: none;
}

.toolbar-disegno {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    background: #222;
    padding: 15px;
    border-radius: 15px;
    width: 40%; /* Forza la toolbar a essere larga */
    justify-content: center; /* Centra i bottoni all'interno */
}

.color-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;   /* Anche qui, vietato andare a capo */
    gap: 8px;            /* Spazio tra un colore e l'altro */
}

/* Etichetta suggerimento immagine */
.hint-immagine {
    display: inline-block;
    background: rgba(52, 152, 219, 0.2); /* Blu trasparente */
    color: var(--primary);
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(52, 152, 219, 0.4);
    margin-bottom: 8px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none; /* Non intralcia il click */
}

/* Effetto al passaggio del mouse sull'immagine per far capire che è cliccabile */
#box-domanda img:hover {
    filter: brightness(1.2);
    transition: 0.3s;
}

.scelta-voto-slim {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255,255,255,0.05); /* Un leggero velo per staccare dallo sfondo */
    border-radius: 50px;
}

.label-voto {
    font-size: 0.9rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.voti-bar {
    display: flex;
    gap: 8px;
}

.btn-v-slim {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%; /* Perfettamente tondi */
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-v-slim:hover {
    transform: translateY(-3px);
    filter: brightness(1.2);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Colori sobri ma distinti */
.v6 { background: #27ae60; }
.v7 { background: #2ecc71; }
.v8 { background: #f1c40f; color: #333; }
.v9 { background: #e67e22; }
.v10 { background: #e74c3c; }

/* Stile per il badge del conteggio sotto i voti */
.voto-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.count-badge {
    font-size: 0.7rem;
    color: #666;
    font-weight: bold;
    min-width: 15px;
    text-align: center;
}

.header-prof-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px 0 25px 0;
}

.header-prof {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.logo-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px #f39c12);
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.logo-text .highlight {
  background: linear-gradient(135deg, #3498db, #2ecc71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.author-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: #a0aec0;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  letter-spacing: 0.3px;
}