*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #1a1a1a;
    background: #f0f0f0;
    padding: 1rem;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 2rem 1.5rem;
}

/* ─── Tipografia ─────────────────────────────────────────────────────────── */

h1 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

p {
    margin-bottom: 0.75rem;
}

a {
    color: #1a1a1a;
    text-decoration: underline;
}

/* ─── Navigazione ────────────────────────────────────────────────────────── */

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e8e8e8;
    font-size: 0.9rem;
}

.nav strong {
    font-size: 1rem;
}

/* ─── Messaggi di errore ─────────────────────────────────────────────────── */

.error {
    background: #fff0f0;
    border: 1px solid #e8c0c0;
    border-radius: 6px;
    padding: 0.65rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: #b00;
}

/* ─── Form ───────────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    background: #fafafa;
    transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #888;
    background: #fff;
}

button[type="submit"] {
    background: #1a1a1a;
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit; /* i button non ereditano font-family per default */
    cursor: pointer;
    margin-top: 0.5rem;
    width: 100%;
}

button[type="submit"]:hover {
    background: #333;
}

/* ─── Schede esame (dashboard) ───────────────────────────────────────────── */

.exam-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.exam-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.exam-card .meta {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.exam-card button[type="submit"] {
    width: auto;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.5rem 1.25rem;
    border: 1px solid transparent;
    margin-top: 0; /* annulla il margin-top della regola base: dentro flex causa disallineamento */
}

.exam-card button[type="submit"]:disabled {
    background: transparent;
    color: #999;
    border: 1px solid #d0d0d0;
    cursor: default;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.badge-progress  { background: #fff3cd; color: #856404; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-default   { background: #e9ecef; color: #495057; }

/* ─── Pagina esame ───────────────────────────────────────────────────────── */

.container--wide {
    max-width: 960px;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.exam-header h1 {
    margin-bottom: 0;
}

.timer {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #1a1a1a;
}

.timer.urgent {
    color: #b00;
}

.progress {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.25rem;
}

.questions-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

fieldset {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1rem 1.25rem;
}

legend {
    font-size: 1rem;
    font-weight: 700;
    padding: 0 0.25rem;
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

/* Radio nascosti — l'intera label è la card cliccabile */
fieldset input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

fieldset label {
    display: block;
    padding: 0.55rem 0.9rem;
    margin-top: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    user-select: none;
}

fieldset label:hover {
    border-color: #999;
    background: #f5f5f5;
}

fieldset label:has(input[type="radio"]:checked) {
    border-color: #1a1a1a;
    background: #1a1a1a;
    color: #fff;
}

.btn-next {
    width: 100%;
    margin-top: 0.5rem;
}

/* ─── Risultato esame ────────────────────────────────────────────────────── */

.result-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.result-card .outcome {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.outcome-pass { color: #155724; }
.outcome-fail { color: #b00; }

.result-card .score {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.result-card .score-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.result-card .detail {
    font-size: 0.85rem;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
/* ─── Report / azioni card ───────────────────────────────────────────────── */

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-actions form {
    margin: 0;
}

.card-actions .exam-card button[type="submit"],
.exam-card .card-actions button[type="submit"] {
    width: auto;
}

.btn-report {
    display: inline-block;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.5rem 1.25rem;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    color: #1a1a1a;
    text-decoration: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.btn-report:hover {
    background: #1a1a1a;
    color: #fff;
}