/* Styles propres à profile.php, sortis de la page le 2026-09-21 : la CSP n'autorise plus
   les blocs <style> en ligne (style-src-elem 'self'). Chargé par la page, à la place du bloc. */
.support-info {
    background: var(--info-tint);
    border: 1px solid rgba(38,104,127,.3);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.support-info p {
    margin: 0;
    color: var(--info-deep);
    font-size: 0.9rem;
    line-height: 1.4;
}

#userNumber {
    font-weight: bold;
    color: var(--accent);
    font-family: monospace;
    background: var(--surface-2);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.profile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--muted);
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Burger des onglets : affiché seulement quand la rangée devient trop large */
.tabs-burger {
    display: none;
}

@media (max-width: 640px) {
    .tabs-burger {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        width: 100%;
        padding: 0.7rem 1rem;
        margin-bottom: 0.5rem;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 6px;
        font-size: 1rem;
        font-weight: 600;
        color: var(--primary);
        cursor: pointer;
    }

    .tabs-burger-bars {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .tabs-burger-bars span {
        display: block;
        width: 16px;
        height: 2px;
        background: var(--primary);
    }

    .profile-tabs {
        display: none;
        flex-direction: column;
        gap: 0;
        border: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        border-radius: 6px;
        background: #fff;
        overflow: hidden;
        margin-bottom: 1rem;
    }

    .profile-tabs.open {
        display: flex;
    }

    .profile-tabs .tab-btn {
        text-align: left;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #eee;
        border-left: 3px solid transparent;
    }

    .profile-tabs .tab-btn:last-child {
        border-bottom: none;
    }

    .profile-tabs .tab-btn.active {
        border-left-color: var(--primary);
        background: var(--primary-tint);
    }
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(26, 35, 48, 0.06);
}

.stat-label {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    color: var(--accent);
    font-size: 2rem;
    font-weight: bold;
}

.badges-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.badge-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
}

.badge-card.locked {
    opacity: 0.55;
    filter: grayscale(1);
}

.badge-image {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 700;
    font-size: 1.3rem;
}

.badge-image img {
    width: 100%;
    height: 100%;
    display: block;
}

.badge-body {
    flex: 1;
    min-width: 0;
}

.badge-name {
    font-weight: 700;
    color: var(--accent);
}

.badge-desc {
    font-size: 0.9rem;
    color: var(--text);
}

.badge-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.badge-progressbar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.35rem;
    max-width: 260px;
}

.badge-progressbar > div {
    height: 100%;
    background: var(--primary);
}

.badge-card.failed {
    border-color: var(--danger);
}

/* Succès légendaires : catégorie à part, jamais grisés ; la carte du
   détenteur est mise en valeur. */
.badge-card.legendary {
    border-color: var(--warning);
    background: var(--warning-tint);
}
.badge-card.legendary .badge-image { background: #fff; }
.badge-card.legendary-mine {
    border: 2px solid var(--warning);
    box-shadow: 0 0 0 4px rgba(178, 106, 0, .12), 0 10px 28px rgba(178, 106, 0, .18);
}
.badge-card.legendary-mine .badge-name { color: var(--warning-deep); }
.badge-legend-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: var(--warning);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.badge-failed-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: var(--danger);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.stat-global {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.chart-container {
    position: relative;
    height: 400px;
    margin-top: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-ranking {
    background: var(--primary);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.user-ranking h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    color: #fff; /* le h3 global est quasi noir : illisible sur le fond bleu */
}

.user-ranking p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.95;
}

.per-subject-table {
    overflow-x: auto;
}

.subject-stats-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subject-stats-table thead {
    background: var(--primary);
    color: white;
}

.subject-stats-table th,
.subject-stats-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.subject-stats-table th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subject-stats-table tbody tr:hover {
    background: var(--surface-2);
}

.subject-stats-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mention de remboursement sous le montant, dans la teinte d'alerte du site */
 /* Litige : ce qui a été payé reste affiché, estompé, et l'explication passe
    par-dessus — comme un mur de paiement. Le titulaire voit donc l'objet de
    son achat, pas « Aucun abonnement actif ». */
.sub-wrap { position: relative; }
.sub-wrap.is-disputed .status-card {
    filter: grayscale(1) blur(1.5px);
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}
.dispute-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--warning);
    border-left-width: 4px;
    border-radius: 8px;
    background: var(--warning-tint);
    color: var(--warning-deep);
    font-size: 0.92rem;
    line-height: 1.5;
    overflow: auto;
}
.dispute-overlay p { margin: 0; }
.dispute-overlay strong { display: block; margin-bottom: 0.15rem; }
/* Écrans étroits : le voile ne tient plus dans la hauteur de la carte, il
   reprend le flux plutôt que de rogner le texte. */
@media (max-width: 600px) {
    .dispute-overlay { position: static; margin-top: 0.75rem; }
    .sub-wrap.is-disputed .status-card { filter: grayscale(1); opacity: 0.5; }
}

.payment-refunded {
    color: var(--warning-deep);
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

/* Même pastille de sujet que dans le rendu des questions (.question-subject) */
.subject-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--pill);
    background: var(--success);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.score-cell {
    font-weight: 600;
    font-size: 1.05rem;
}

.score-cell.score-excellent { color: var(--success); }
.score-cell.score-good { color: var(--warning); }
.score-cell.score-poor { color: var(--danger); }

/* ---------- Onglet Révisions ---------- */
.revisions-empty { color: var(--muted); padding: 1rem 0; }

.revisions-group {
    border: 1px solid var(--border-soft, #d9dce1);
    border-left-width: 4px;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
}
.revisions-group.revisions-poor { border-left-color: var(--danger); }
.revisions-group.revisions-good { border-left-color: var(--warning); }
.revisions-group.revisions-excellent { border-left-color: var(--success); }
.revisions-group.revisions-none { border-left-color: var(--muted); }

.revisions-group h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.revisions-hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.7rem; }
.section-hint { color: var(--muted); font-size: 0.88rem; margin: -0.5rem 0 1rem; max-width: 60ch; }
.revisions-none { color: var(--muted); font-size: 0.9rem; margin: 0; }

.revisions-list { list-style: none; margin: 0; padding: 0; }
.revisions-list li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--border-soft, #edeff2);
}
.revisions-list li:first-child { border-top: none; }
.revisions-subject { flex: 1; font-weight: 600; }
.revisions-na { color: var(--muted); }

/* ---------- Classement (onglet Succès) ---------- */
.pseudo-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pseudo-row label {
    font-weight: 600;
    white-space: nowrap;
}

.pseudo-row input {
    max-width: 220px;
    margin: 0;
}

.pseudo-row .btn {
    padding: 0.55rem 1.1rem;
    min-height: 0;
}

/* Rappel de la règle d'usage du pseudo (CGU, art. 3), pendant la saisie */
.pseudo-rules {
    margin: 0.35rem 0 0;
    font-size: 0.86rem;
    color: var(--danger);
}

/* Étiquettes du classement : ton taux / moyenne / meilleur */
.rank-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.rank-stat {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    min-width: 150px;
    text-align: center;
}

.rank-stat.me {
    background: var(--primary-tint);
    border-color: rgba(42, 92, 158,.18);
}

.rank-stat-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.rank-stat-value {
    display: block;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.rank-stat.me .rank-stat-value {
    color: var(--primary);
}

/* Pseudo défini : champ « figé » (grisé, non éditable) jusqu'à Modifier */
.pseudo-row input.pseudo-locked {
    background: var(--surface-2);
    color: var(--muted);
    border-color: var(--border-soft);
    cursor: default;
}

.my-ranking-line {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    background: var(--primary-tint);
    border: 1px solid rgba(42, 92, 158,.18);
    border-radius: var(--radius-sm);
}

/* ---------- Podium (rangs 1 à 3) ----------
   Médailles sobres : les seules couleurs hors tokens de la page, assumées.
   Colonne centrale (rang 1) plus haute : disposition 2-1-3.
   Les marches viennent d'un décalage en haut (margin-top) sur des cartes
   étirées à la hauteur de la rangée, pas de hauteurs minimales : une ligne
   de plus dans une carte (« (c'est toi) », pseudo long) grandit les trois
   ensemble et l'ordre des marches tient toujours. */
.podium {
    --gold: #a9822a;
    --silver: #7f8792;
    --bronze: #9a6b45;
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    max-width: 560px;
    margin: 0.75rem 0 1.25rem;
}

.podium-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
    padding: 0.9rem 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--surface-2);
    justify-content: flex-start;   /* rang, nom et score en haut de la marche */
}

.podium-step.rank-1 {
    order: 2;
    min-height: 128px;
    background: color-mix(in srgb, var(--gold) 10%, white);
    border-color: color-mix(in srgb, var(--gold) 35%, white);
}

.podium-step.rank-2 {
    order: 1;
    margin-top: 20px;
    background: color-mix(in srgb, var(--silver) 10%, white);
    border-color: color-mix(in srgb, var(--silver) 35%, white);
}

.podium-step.rank-3 {
    order: 3;
    margin-top: 32px;
    background: color-mix(in srgb, var(--bronze) 10%, white);
    border-color: color-mix(in srgb, var(--bronze) 35%, white);
}

.podium-rank {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.1rem;
}

.podium-step.rank-1 .podium-rank { color: var(--gold); font-size: 1.35rem; }
.podium-step.rank-2 .podium-rank { color: var(--silver); }
.podium-step.rank-3 .podium-rank { color: var(--bronze); }

.podium-name {
    font-weight: 600;
    color: var(--accent);
    overflow-wrap: anywhere;
}

.podium-step .me-tag { display: block; }

.podium-name.anon { color: var(--muted); font-weight: 500; }

.podium-rate {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Séries et temps par question, sous le taux */
.podium-detail { font-size: 0.75rem; color: var(--muted); }
.top3-detail { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* Classement : toi, moyenne des classés, moyenne du top 5 */
.rank-compare {
    width: 100%; max-width: 560px; margin-top: 1rem;
    border-collapse: collapse; font-size: 0.9rem;
}
.rank-compare th, .rank-compare td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border-soft); }
.rank-compare thead th {
    font-family: var(--font-mono); font-weight: 500; font-size: 0.62rem;
    text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); text-align: center;
}
.rank-compare tbody th { text-align: left; font-weight: 500; color: var(--text); }
.rank-compare td { text-align: center; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted-strong); }
.rank-compare .me { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.rank-compare tbody tr:last-child th, .rank-compare tbody tr:last-child td { border-bottom: none; }

/* ---------- Rangs 4 à 10 (liste sous le podium) ---------- */
.top3-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    counter-reset: top3 3; /* la liste démarre au rang 4, sous le podium */
    max-width: 560px;
}

.top3-list li {
    counter-increment: top3;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.6rem 0.25rem;
    border-bottom: 1px solid var(--border-soft);
}

.top3-list li:last-child { border-bottom: none; }

.top3-list li::before {
    content: counter(top3);
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--muted);
    width: 1.2rem;
    flex-shrink: 0;
    text-align: right;
}

.top3-name { flex: 1; font-weight: 600; color: var(--accent); }

.top3-name.anon { color: var(--muted); font-weight: 500; }

.me-tag { color: var(--primary); font-weight: 600; font-size: 0.85rem; }

.top3-rate {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--muted);
}

@media (max-width: 480px) {
    .podium { gap: 0.4rem; }
    .podium-step { padding: 0.6rem 0.3rem 0.5rem; }
}

@media (max-width: 768px) {
    .subject-stats-table {
        font-size: 0.85rem;
    }

    .subject-stats-table th,
    .subject-stats-table td {
        padding: 0.5rem;
    }
}

/* ---------- Personnalisation du cours (onglet Profil) ---------- */
/* Défilement depuis l'étiquette de l'en-tête : la section s'arrête sous le bandeau collant */
.profile-section { scroll-margin-top: 84px; }
.matiere-block { margin: 0; }
.status-name-note { margin: .5rem 0 .75rem; font-size: .85rem; }
/* .btn impose son display : sans ceci, l'attribut hidden ne masquait rien */
.matiere-block [hidden] { display: none !important; }
.matiere-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: .4rem 0 .5rem; }
.matiere-row select { flex: 1 1 220px; max-width: 340px; margin: 0; }
.matiere-row .btn { white-space: nowrap; }
.matiere-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem; }
/* La section a un fond crème : le survol des boutons secondaires (crème
   aussi) les faisait disparaître ; teinte bleue à la place */
.matiere-block .btn-secondary:hover { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); }
/* « (action déconseillée) » sous le libellé du bouton */
#scopeCustomizeBtn { line-height: 1.25; }
#scopeCustomizeBtn .btn-sub { display: block; font-size: .78em; font-weight: 500; color: var(--muted); margin-top: .1rem; }
.scope-panel { margin-top: 1rem; padding: 1.1rem; border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); background: var(--bg-card); }
.scope-panel > .info-text { margin-top: 0; }
.scope-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; margin: .75rem 0 .5rem; }
.scope-item { display: flex; align-items: center; justify-content: flex-start; gap: .6rem; text-align: left;
    padding: .55rem .8rem; font-weight: 500; line-height: 1.25; cursor: pointer;
    border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--bg-card);
    transition: border-color .15s var(--ease), background .15s var(--ease); }
.scope-item:hover { border-color: var(--primary); }
.scope-item:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.scope-item input[type="checkbox"] { width: auto; flex: none; margin: 0; padding: 0; accent-color: var(--primary); box-shadow: none; }

/* Examens (Personnalisation du cours) */
.exam-block { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--border-soft); }
.exam-title { font-size: 1rem; margin: 0 0 .6rem; }
.exam-count { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-bottom: .6rem; }
.exam-count label { display: flex; align-items: center; gap: .45rem; margin: 0; font-weight: 500; cursor: pointer; }
.exam-count input[type="radio"] { width: auto; margin: 0; accent-color: var(--primary); box-shadow: none; }
.exam-dates { display: grid; gap: .5rem; margin: .4rem 0; }
.exam-date-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
.exam-date-row label { min-width: 9rem; margin: 0; font-weight: 600; }
.exam-date-row input[type="date"] { width: auto; margin: 0; }
.exam-default { font-size: .85rem; color: var(--muted); }
/* Sélection des sujets avec deux examens : bouton H / É à droite */
/* Le nom ne passe jamais sous le bouton A / P : il revient à la ligne, et
   un mot trop long (Electromagnétisme) se coupe avec un trait d'union */
.scope-item .scope-name { flex: 1; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.scope-list:has(.scope-sem) { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.scope-item .scope-sem {
    flex: none; min-width: 2.7rem; height: 1.7rem; padding: 0 .5rem; margin: 0; padding: 0; box-shadow: none;
    font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--primary);
}
.scope-item .scope-sem[data-sem="A"] { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.scope-item .scope-sem[data-sem="P"] { background: var(--warning-tint); color: var(--warning-deep); border-color: var(--warning); }

/* Performance par sujet : colonne « Moyenne du site », neutre (pas de couleur de niveau) */
.subject-stats-table .score-cell.score-site { color: var(--muted-strong); font-weight: 500; }

/* Mode Custom : sélection par notions (chapitres, puis notions de chacun) */
.theme-block { margin-top: .5rem; }
.preset-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.theme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6rem; margin: .5rem 0; align-items: start; }
.theme-chapter { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--bg-card); overflow: hidden; }
.theme-chapter-head { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .6rem .8rem; font-weight: 600; cursor: pointer; line-height: 1.25; }
.theme-chapter-head:hover { background: var(--primary-tint); }
.theme-chapter-head input, .theme-item input { width: auto; flex: none; margin: 0; padding: 0; accent-color: var(--primary); box-shadow: none; }
.theme-chapter-name { flex: 1; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.theme-count { flex: none; font: 500 .8rem var(--mono, monospace); color: var(--muted); }
.theme-items { border-top: 1px solid var(--border-soft); }
.theme-item { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .4rem .8rem .4rem 1.6rem; font-weight: 400; font-size: .92rem; line-height: 1.25; cursor: pointer; }
.theme-item:hover { background: var(--primary-tint); }
.theme-item span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.theme-partial { flex: none; color: var(--muted); font-size: .76rem; }
.has-missing { box-shadow: inset 3px 0 0 var(--warning); }
/* Triangle « ! » devant le compteur d'une carte : prérequis manquant (message au survol) */
.theme-warn-icon { flex: none; display: inline-flex; align-items: center; cursor: help; padding: 0 .1rem; border-radius: 4px; }
.theme-warn-icon + .theme-count { margin-left: -.25rem; }
.theme-warn-icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Nombre d'examens, en tête de la personnalisation ; note quand un préréglage le fixe */
.exam-count-box { margin-bottom: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--border-soft); }
.exam-count-box .exam-title { font-size: 1rem; margin: 0 0 .5rem; }
.exam-preset-note { margin: .2rem 0 .6rem; }
.theme-warn { color: var(--warning-deep); background: var(--warning-tint); border: 1px solid var(--warning); border-radius: var(--radius-sm); padding: .45rem .7rem; margin: .4rem 0; }

.theme-toggle { flex: none; width: 1.8rem; height: 1.8rem; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent;
    color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; box-shadow: none; }
.theme-toggle:hover { background: var(--primary-tint); color: var(--primary); }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; }
.theme-toggle svg { transition: transform .15s ease; }
.theme-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .theme-toggle svg { transition: none; } }

/* Liste unifiée : une carte par sujet (case, semestre, compteur, notions dépliables) */
/* Liste unifiée : une carte par sujet (case, semestre, compteur, notions dépliables) */
/* Colonnes qui s'écoulent (et non une grille à lignes) : une carte dépliée s'allonge dans sa bulle sans laisser de vide à côté des autres */
.scope-list.scope-list-unified { display: block; columns: 290px; column-gap: .6rem; }
.scope-list-unified .scope-card { break-inside: avoid; margin-bottom: .6rem; }
.scope-card-head .theme-count { min-width: 2.6rem; text-align: right; }
.scope-card-head .theme-warn-icon + .theme-count { margin-left: 0; }
.theme-toggle-gap { flex: none; width: 2rem; height: 2rem; }
.scope-card-head { cursor: default; }
.scope-card-head:hover { background: transparent; }
.scope-card-head .theme-chapter-name { cursor: pointer; }
.scope-card-head .scope-sem {
    flex: none; min-width: 2.7rem; height: 1.7rem; margin: 0; padding: 0 .5rem; box-shadow: none;
    font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--primary);
}
.scope-card-head .scope-sem[data-sem="A"] { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.scope-card-head .scope-sem[data-sem="P"] { background: var(--warning-tint); color: var(--warning-deep); border-color: var(--warning); }
.scope-card:has(> .scope-card-head input:checked, > .scope-card-head input:indeterminate) { border-color: var(--primary); }
.scope-card-note { margin: 0; padding: 0 .8rem .55rem 2.4rem; }
.scope-card-head .theme-toggle:focus-visible, .scope-card-head .scope-sem:focus-visible,
.scope-card-head input:focus-visible, .scope-card .theme-item input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Préréglage appliqué et enregistré d'un clic */
.preset-saved { display: inline-flex; align-items: center; padding: .3rem .75rem; border-radius: 999px; font-weight: 600; font-size: .85rem;
    background: var(--primary-tint); color: var(--primary); border: 1px solid var(--primary); }
.preset-saved[hidden] { display: none; }

/* Mobile : cartes sur une colonne pleine largeur, en-tête resserré pour que le nom du sujet reste lisible */
@media (max-width: 600px) {
    .scope-list.scope-list-unified { columns: 1; }
    .scope-card-head { gap: .35rem; padding: .55rem .5rem; }
    .scope-card-head .theme-chapter-name { hyphens: manual; overflow-wrap: break-word; }
    .scope-card-head .theme-count { min-width: 2rem; font-size: .75rem; }
    .scope-card-head .scope-sem { min-width: 2.4rem; padding: 0 .35rem; }
    .scope-card-head .theme-toggle, .theme-toggle-gap { width: 1.7rem; height: 1.7rem; }
}
