/* Reset e Variabili */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #ff6b6b;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --white: #ffffff;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Quicksand', sans-serif; /* Font moderno e leggibile */
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.game-container {
    background: var(--white);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow);
    max-width: 650px;
    width: 100%;
    text-align: center;
    position: relative;
}

/* Header */
h1 {
    font-family: 'Luckiest Guy', cursive; /* Font giocoso per il titolo */
    color: var(--primary-color);
    font-size: 2.8em;
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.subtitle {
    color: #777;
    margin-bottom: 25px;
    font-weight: 700;
}

/* Area Disegno */
.canvas-wrapper {
    position: relative;
    margin-bottom: 25px;
}

.canvas-container {
    background: #fdfdfd;
    border: 4px solid #eee;
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.3s;
}

#drawingCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Badge Tentativi */
.attempts-badge {
    position: absolute;
    top: -15px;
    right: -10px;
    background: var(--accent-color);
    color: white;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    font-size: 0.9em;
}

/* Input e Pulsanti */
.guess-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

#guessInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.1em;
    font-family: inherit;
    border: 3px solid #eee;
    border-radius: 15px;
    outline: none;
    transition: all 0.3s;
}

#guessInput:focus {
    border-color: var(--primary-color);
    background-color: #f8f9ff;
}

#submitBtn {
    padding: 15px 25px;
    font-size: 1.1em;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
}

#submitBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Feedback */
.feedback {
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.3s;
    margin: 10px 0;
}

.feedback.correct { background: #e8f5e9; color: #2e7d32; border: 2px solid #c8e6c9; }
.feedback.wrong { background: #fff3e0; color: #ef6c00; border: 2px solid #ffe0b2; }
.feedback.gameover { background: #ffebee; color: #c62828; border: 2px solid #ffcdd2; }

/* Overlay Risultato Finale */
.result-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    z-index: 10;
    animation: fadeIn 0.4s ease-out;
}

.result-content h2 {
    font-family: 'Luckiest Guy', cursive;
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.result-info {
    font-size: 1.4em;
    margin-bottom: 30px;
}

.primary-btn {
    padding: 18px 40px;
    font-size: 1.2em;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Footer */
footer {
    margin-top: 30px;
    font-size: 0.85em;
    color: #aaa;
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes confetti-fall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s linear forwards;
    z-index: 9999;
}

.level-selector {
    margin-bottom: 20px;
}

.level-selector label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

#difficulty {
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #667eea;
    font-family: inherit;
    font-size: 1em;
    cursor: pointer;
    background-color: white;
    outline: none;
}

#difficulty:hover {
    border-color: #764ba2;
}