* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    background-color: #f0f4f8;
    color: #1e293b;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    margin: 0;
}

.targeta {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 500px;
}

.amagat {
    display: none !important;
}

.camp {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

select, button {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

button {
    background-color: #2563eb;
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover:not(:disabled) {
    background-color: #1d4ed8;
}

button:disabled {
    background-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

.capcalera-perfil {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.capcalera-perfil h2 {
    margin: 0 0 0.4rem 0;
}

.etiqueta {
    background: #e2e8f0;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.etiqueta.nivell {
    background: #fef08a;
    color: #854d0e;
}

.btn-secundari {
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: #64748b;
}

.estadistiques {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-caixa {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.stat-numero {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: #2563eb;
}

.stat-text {
    font-size: 0.85rem;
    color: #475569;
}

.menu-temes {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.btn-tema {
    background-color: #0ea5e9;
    text-align: left;
    padding-left: 1.2rem;
}

.btn-tema:hover {
    background-color: #0284c7;
}

hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

/* Estils de la pantalla d'exercicis */
.caixa-equacio {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.instruccio {
    margin: 0 0 0.5rem 0;
    color: #475569;
    font-size: 0.95rem;
}

.enunciat {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #0f172a;
    word-break: break-word;
}

.form-resposta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.form-resposta label {
    font-size: 1.4rem;
    margin: 0;
    white-space: nowrap;
}

.form-resposta input {
    width: 110px;
    padding: 0.8rem;
    font-size: 1.3rem;
    text-align: center;
    border: 2px solid #94a3b8;
    border-radius: 8px;
}

.feedback {
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.feedback.correcte {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.feedback.incorrecte {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.btn-seguent {
    background-color: #16a34a;
}

.btn-seguent:hover {
    background-color: #15803d;
}

/* Enllaços amb aparença de botó */
.btn-tema-link {
    display: block;
    background-color: #0ea5e9;
    color: white;
    font-weight: 600;
    text-decoration: none;
    padding: 0.8rem 0.8rem 0.8rem 1.2rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-tema-link:hover {
    background-color: #0284c7;
}

.btn-secundari-link {
    display: inline-block;
    background: #64748b;
    color: white;
    font-weight: 600;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-secundari-link:hover {
    background: #475569;
}

/* Estils per als problemes de text */
.enunciat-problema {
    font-size: 1.2rem;
    line-height: 1.5;
    color: #0f172a;
    margin: 0;
    text-align: left;
}

.form-problema {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.fila-pregunta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.fila-pregunta label {
    margin: 0;
    font-size: 1.05rem;
}

.fila-pregunta input {
    width: 110px;
    padding: 0.6rem;
    font-size: 1.2rem;
    text-align: center;
    border: 2px solid #94a3b8;
    border-radius: 8px;
}

.llista-preguntes { display: flex; flex-direction: column; gap: 0.9rem; }

.opcio-sense-solucio {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f1f5f9;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.opcio-sense-solucio input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

/* =========================================
   PANELL DEL PROFESSOR I LLIGUES D'AULA
   ========================================= */
.panell-profe {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.capcalera-profe {
    background: white;
    padding: 1.2rem 1.5rem;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.capcalera-profe h1 {
    margin: 0 0 0.3rem 0;
    font-size: 1.5rem;
}

.rellotge-gran {
    font-size: 2.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
    background: #f1f5f9;
    padding: 0.3rem 1.2rem;
    border-radius: 10px;
}

.controls-profe {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.controls-profe select, .controls-profe button {
    width: auto;
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
}

.btn-profe-obrir { background: #0284c7; }
.btn-profe-start { background: #16a34a; }
.btn-profe-tancar { background: #dc2626; }

.graella-lligues {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.columna-lliga {
    background: white;
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    border-top: 6px solid #94a3b8;
}

.columna-lliga.bronze { border-top-color: #b45309; }
.columna-lliga.plata { border-top-color: #64748b; }
.columna-lliga.or { border-top-color: #eab308; }
.columna-lliga.diamant { border-top-color: #06b6d4; }

.columna-lliga h2 {
    margin: 0 0 0.8rem 0;
    font-size: 1.2rem;
    text-align: center;
}

.llista-jugadors {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.llista-jugadors .buit {
    color: #94a3b8;
    text-align: center;
    font-size: 0.9rem;
    padding: 1rem 0;
}

.fila-jugador {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.95rem;
}

.fila-jugador.zona-ascens {
    background: #dcfce7;
    border-left: 4px solid #16a34a;
}

.fila-jugador.zona-descens {
    background: #fee2e2;
    border-left: 4px solid #dc2626;
}

.punts-jugador {
    font-weight: 800;
    font-size: 1.1rem;
    background: white;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Botó d'aula al perfil i marcador d'alumne */
.btn-partida-desactivada {
    display: block;
    text-align: center;
    background: #cbd5e1;
    color: #475569;
    padding: 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    pointer-events: none;
}

.btn-partida-activa {
    display: block;
    text-align: center;
    background: #16a34a;
    color: white;
    padding: 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    animation: bategar 1.5s infinite;
}

@keyframes bategar {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.marcador-alumne {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.rellotge-mini {
    background: #0f172a;
    color: white;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.punts-badge {
    background: #fef08a;
    color: #854d0e;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-size: 1rem;
}