:root {
    --bg-color: #f0f4f8;
    --primary: #4a90e2;
    --secondary: #673ab7;
    --success: #4caf50;
    --error: #e74c3c;
    --text: #2d3436;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
}

.game-container {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-align: center;
    width: 90%;
    max-width: 550px;
}

header h1 { margin: 0 0 10px 0; color: var(--primary); }

.stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}
.mode-badge { background: var(--secondary); }
.bg-easy { background: var(--success); }
.bg-medium { background: #f39c12; }
.bg-hard { background: var(--error); }

.progress { font-size: 0.9rem; margin-bottom: 20px; color: #636e72; }

/* Griglia di gioco */
.grid-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 16px;
    min-height: 100px;
}

.circle {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.1rem;
    border: 3px solid var(--primary);
    background: white;
}

.circle.fixed { background: var(--primary); color: white; }

input.circle-input {
    width: 60px;
    height: 60px;
    text-align: center;
    border: 3px dashed var(--primary);
    outline: none;
    transition: 0.3s;
    border-radius: 50%;
    font-size: 1rem;
}

input.circle-input:focus { transform: scale(1.1); border-style: solid; }

.operator { font-size: 1.5rem; font-weight: bold; }

/* Frazioni */
.fraction { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; }
.fraction .num { border-bottom: 2px solid currentColor; padding-bottom: 2px; }

/* Aiuto Visivo Pizza */
.visual-helper { display: flex; justify-content: center; gap: 15px; margin-bottom: 15px; }
.pizza {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #333;
    background: conic-gradient(#ffce54 var(--p), #e0e0e0 0);
}

.selector-box button {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: none;
    border-radius: 12px;
    background: #e9ecef;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: 0.2s;
}
.selector-box button:hover { background: var(--primary); color: white; }

.main-btn {
    background: var(--primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    display: none;
    margin: 10px auto;
}

.back-btn {
    background-color: #95a5a6 !important; /* Grigio per distinguersi */
    margin-top: 10px;
}

.back-btn:hover {
    background-color: #7f8c8d !important;
}

.next-btn { background: var(--success); }

.feedback-message { height: 24px; margin: 15px 0; font-weight: bold; }