@font-face {
    font-family: "Inter Display";
    src: url("/polices/display-black.woff") format("woff");
    font-weight: 900;
    font-display: swap;
}

@font-face {
    font-family: "Inter Texte";
    src: url("/polices/texte.woff") format("woff");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Inter Texte";
    src: url("/polices/texte-gras.woff") format("woff");
    font-weight: 600;
    font-display: swap;
}

:root {
    --papier: #f6f7fb;
    --feuille: #ffffff;
    --encre: #1d2340;
    --doux: #3e4663;
    --gris: #646c8a;
    --trait: #d8dbe8;
    --seyes: rgb(96 122 214 / 0.16);
    --seyes-fort: rgb(96 122 214 / 0.3);
    --marge: #e0565b;
    --plume: #2f5bd3;
    --plume-pale: #e3eafc;
    --vert: #1f8a5b;
    --vert-pale: #e1f4ea;
    --rouge: #c2412d;
    --rouge-pale: #fbe6e2;
    --code: #1b2033;
    --code-texte: #e6e8f2;
    --titre: "Inter Display", "Segoe UI", system-ui, sans-serif;
    --texte: "Inter Texte", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --papier: #10121c;
        --feuille: #171a28;
        --encre: #e6e8f2;
        --doux: #bcc1d6;
        --gris: #8f96b2;
        --trait: #2a2f45;
        --seyes: rgb(120 145 230 / 0.09);
        --seyes-fort: rgb(120 145 230 / 0.18);
        --marge: #e8686d;
        --plume: #7c9cf5;
        --plume-pale: #232b4a;
        --vert: #4cc38a;
        --vert-pale: #16302a;
        --rouge: #f07a63;
        --rouge-pale: #3a1e1c;
        --code: #0b0d16;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --papier: #10121c;
    --feuille: #171a28;
    --encre: #e6e8f2;
    --doux: #bcc1d6;
    --gris: #8f96b2;
    --trait: #2a2f45;
    --seyes: rgb(120 145 230 / 0.09);
    --seyes-fort: rgb(120 145 230 / 0.18);
    --marge: #e8686d;
    --plume: #7c9cf5;
    --plume-pale: #232b4a;
    --vert: #4cc38a;
    --vert-pale: #16302a;
    --rouge: #f07a63;
    --rouge-pale: #3a1e1c;
    --code: #0b0d16;
    color-scheme: dark;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: var(--papier);
    color: var(--encre);
    font: 400 1rem/1.65 var(--texte);
    font-feature-settings: "cv11", "ss01";
}

main {
    flex: 1;
}

a {
    color: var(--plume);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--encre);
}

:focus-visible {
    outline: 2px solid var(--plume);
    outline-offset: 3px;
    border-radius: 3px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

::selection {
    background: var(--plume);
    color: #fff;
}

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 30;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    background: var(--encre);
    color: var(--papier);
}

.skip:focus {
    top: 1rem;
}

.large {
    width: min(100% - 2.5rem, 76rem);
    margin-inline: auto;
}

.muted {
    color: var(--gris);
}

.barre {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--trait);
    background: color-mix(in srgb, var(--papier) 88%, transparent);
    backdrop-filter: blur(10px);
}

.barre-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 3.75rem;
}

.marque {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--encre);
    font-weight: 600;
    text-decoration: none;
}

.marque img {
    border-radius: 7px;
}

.barre nav {
    display: flex;
    gap: 0.15rem;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.barre nav a {
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    color: var(--doux);
    font-size: 0.94rem;
    text-decoration: none;
    white-space: nowrap;
}

.barre nav a:hover,
.barre nav a[aria-current] {
    background: var(--plume-pale);
    color: var(--plume);
}

.theme {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: 1px solid var(--trait);
    border-radius: 50%;
    background: var(--feuille);
    color: var(--encre);
    cursor: pointer;
}

.theme svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: currentColor;
}

.theme-soleil {
    display: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

:root[data-theme="dark"] .theme-lune {
    display: none;
}

:root[data-theme="dark"] .theme-soleil {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-lune {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-soleil {
        display: block;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0 1.3rem;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font: 600 0.98rem var(--texte);
    text-decoration: none;
    cursor: pointer;
}

.btn-plein {
    background: var(--plume);
    color: #fff;
}

.btn-plein:hover {
    background: var(--encre);
    color: var(--papier);
}

.btn-contour {
    border-color: var(--encre);
    color: var(--encre);
}

.btn-contour:hover {
    background: var(--encre);
    color: var(--papier);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.chapeau {
    max-width: 62ch;
    color: var(--doux);
    font-size: 1.12rem;
}

.intro-site {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: 3rem;
    padding: clamp(3rem, 9vh, 6rem) 0 clamp(2.5rem, 6vh, 4rem);
}

.intro-texte {
    display: grid;
    gap: 1.5rem;
}

.intro-site h1 {
    font-family: var(--titre);
    font-size: clamp(2.6rem, 6vw, 4.6rem);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.045em;
    text-wrap: balance;
}

.ardoise {
    position: relative;
    display: grid;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--trait);
    border-radius: 14px;
    background: var(--feuille);
    box-shadow: 0 30px 60px -35px rgb(29 35 64 / 0.4);
    transform: rotate(1.2deg);
}

.ardoise-code {
    padding: 1.25rem 1.4rem;
    background: var(--code);
    color: var(--code-texte);
    min-height: calc(2 * 1.7em + 2.5rem);
    font: 0.95rem/1.7 var(--mono);
    white-space: pre;
}

.c-balise {
    color: #ff9db0;
}

.ardoise-rendu {
    display: grid;
    gap: 0.3rem;
    padding: 1.25rem 1.4rem 1.25rem 3rem;
    background:
        linear-gradient(90deg, transparent 2.1rem, var(--marge) 2.1rem, var(--marge) calc(2.1rem + 1.5px), transparent calc(2.1rem + 1.5px)),
        repeating-linear-gradient(transparent 0 calc(2rem - 1px), var(--seyes-fort) calc(2rem - 1px) 2rem);
    line-height: 2rem;
}

.ardoise-rendu strong {
    font: 900 1.7rem/2rem var(--titre);
    letter-spacing: -0.02em;
}

.ardoise figcaption {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.4rem;
    border-top: 1px solid var(--trait);
    color: var(--vert);
    font-size: 0.92rem;
    font-weight: 600;
}

.coche,
.case {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid var(--trait);
    border-radius: 5px;
}

.coche {
    border-color: var(--vert);
    background: var(--vert);
}

.coche::after,
.ok .case::after {
    content: "";
    width: 0.4rem;
    height: 0.7rem;
    margin-top: -0.15rem;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.modules,
.comment {
    padding-top: clamp(2.5rem, 7vh, 4rem);
}

.modules h2,
.comment h2 {
    margin-bottom: 1.5rem;
    font-family: var(--titre);
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.035em;
}

.modules-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 1.25rem;
}

.module-carte {
    position: relative;
    display: grid;
    gap: 0.7rem;
    padding: 1.75rem 1.75rem 1.5rem 3.4rem;
    border: 1px solid var(--trait);
    border-radius: 12px;
    background:
        linear-gradient(90deg, transparent 2.2rem, var(--marge) 2.2rem, var(--marge) calc(2.2rem + 1.5px), transparent calc(2.2rem + 1.5px)),
        var(--feuille);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.module-carte:hover {
    box-shadow: 0 20px 40px -28px rgb(29 35 64 / 0.45);
    transform: translateY(-3px);
}

.module-etape {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    color: var(--gris);
    font-size: 0.88rem;
}

.module-etape span:first-child {
    color: var(--marge);
    font-weight: 600;
}

.module-carte h3 {
    font-family: var(--titre);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.module-carte h3 a {
    color: var(--encre);
    text-decoration: none;
}

.module-carte h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.module-carte p {
    color: var(--doux);
}

.avancement {
    height: 6px;
    margin-top: 0.5rem;
    overflow: hidden;
    border-radius: 3px;
    background: var(--trait);
}

.avancement i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--vert);
    transition: width 0.6s ease;
}

.avancement-texte {
    font-size: 0.88rem;
}

.etapes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
    counter-reset: etape;
}

.etapes li {
    padding: 1.4rem;
    border-top: 3px solid var(--plume);
    border-radius: 4px;
    background: var(--feuille);
    color: var(--doux);
    counter-increment: etape;
}

.etapes li::before {
    content: counter(etape);
    display: block;
    margin-bottom: 0.4rem;
    color: var(--plume);
    font: 900 1.6rem var(--titre);
}

.etapes strong {
    display: block;
    color: var(--encre);
}

.pied {
    margin-top: clamp(3.5rem, 9vh, 5.5rem);
    border-top: 1px solid var(--trait);
    color: var(--gris);
    font-size: 0.9rem;
}

.pied-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.6rem 2rem;
    padding: 1.4rem 0 2rem;
}

.fil {
    color: var(--gris);
    font-size: 0.92rem;
}

.fil a {
    color: var(--gris);
}

.page-module {
    display: grid;
    gap: 1rem;
    padding-top: clamp(2.5rem, 7vh, 4rem);
}

.page-module h1,
.lecon-tete h1,
.simple h1 {
    font-family: var(--titre);
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.045em;
}

.liste-lecons {
    display: grid;
    gap: 0;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--trait);
}

.liste-lecons li {
    position: relative;
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0.5rem;
    border-bottom: 1px solid var(--trait);
}

.liste-lecons h2 {
    font-size: 1.15rem;
}

.liste-lecons h2 a {
    color: var(--encre);
    text-decoration: none;
}

.liste-lecons h2 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.liste-lecons li:hover h2 a {
    color: var(--plume);
}

.liste-lecons p {
    color: var(--gris);
    font-size: 0.95rem;
}

.numero {
    display: inline-grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border: 1.5px solid var(--trait);
    border-radius: 50%;
    color: var(--gris);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.fini .numero {
    border-color: var(--vert);
    background: var(--vert);
    color: #fff;
}

.duree {
    color: var(--gris);
    font-size: 0.88rem;
    white-space: nowrap;
}

.etat {
    color: var(--vert);
    font-size: 0.85rem;
    font-weight: 600;
}

.etat::before {
    content: "Terminée";
}

.page-lecon {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    align-items: start;
    gap: 3rem;
    padding-top: 2rem;
}

.sommaire {
    position: sticky;
    top: 5rem;
    font-size: 0.92rem;
}

.sommaire-titre {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.sommaire-titre a {
    color: var(--encre);
    text-decoration: none;
}

.sommaire ol {
    display: grid;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sommaire a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    color: var(--doux);
    text-decoration: none;
}

.sommaire .numero {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.78rem;
}

.sommaire a:hover,
.sommaire .ici a {
    background: var(--plume-pale);
    color: var(--plume);
}

.sommaire .ici .numero {
    border-color: var(--plume);
    color: var(--plume);
}

.lecon {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
    min-width: 0;
    max-width: 52rem;
}

.lecon-tete {
    display: grid;
    gap: 1rem;
}

.meta-lecon {
    color: var(--gris);
    font-size: 0.9rem;
}

.meta-lecon span::before {
    content: "";
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    margin-right: 0.4rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    vertical-align: -0.05rem;
}

.objectifs {
    padding: 1.1rem 1.3rem;
    border-left: 3px solid var(--vert);
    border-radius: 0 8px 8px 0;
    background: var(--vert-pale);
}

.objectifs h2 {
    margin-bottom: 0.4rem;
    font-size: 0.98rem;
}

.objectifs ul {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--doux);
}

.cahier {
    padding: 2rem 2rem 2rem 4.25rem;
    border: 1px solid var(--trait);
    border-radius: 12px;
    background:
        linear-gradient(90deg, transparent 3rem, var(--marge) 3rem, var(--marge) calc(3rem + 1.5px), transparent calc(3rem + 1.5px)),
        repeating-linear-gradient(transparent 0 calc(1.75rem - 1px), var(--seyes) calc(1.75rem - 1px) 1.75rem),
        var(--feuille);
    font-size: 1.04rem;
    line-height: 1.75rem;
}

.cahier > * + * {
    margin-top: 1.75rem;
}

.cahier h2 {
    color: var(--encre);
    font-size: 1.45rem;
    line-height: 1.75rem;
    letter-spacing: -0.01em;
}

.cahier h2:not(:first-child) {
    margin-top: 3.5rem;
}

.cahier h3 {
    margin: 1.75rem 0 0;
    font-size: 1.1rem;
}

.cahier p,
.cahier li {
    color: var(--doux);
}

.cahier ul,
.cahier ol {
    padding-left: 1.3rem;
}

.cahier code {
    overflow-wrap: anywhere;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: var(--plume-pale);
    color: var(--encre);
    font: 0.9em var(--mono);
}

.code {
    position: relative;
    margin: 0;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    border-radius: 10px;
    background: var(--code);
    color: var(--code-texte);
    font: 0.92rem/1.6 var(--mono);
    tab-size: 2;
}

.code code {
    padding: 0;
    background: none;
    color: inherit;
    font: inherit;
}

.code::before {
    content: attr(data-langage);
    position: absolute;
    top: 0.45rem;
    right: 0.75rem;
    color: #8f96b2;
    font: 0.72rem var(--texte);
    text-transform: uppercase;
}

.astuce,
.attention {
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    background: var(--plume-pale);
}

.attention {
    background: var(--rouge-pale);
}

.astuce strong,
.attention strong {
    color: var(--encre);
}

.exercice,
.quiz {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    padding: 1.75rem;
    border: 1px solid var(--trait);
    border-radius: 12px;
    background: var(--feuille);
}

.exercice h2,
.quiz h2 {
    font-family: var(--titre);
    font-size: 1.9rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.exercice h2::before {
    content: "";
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    margin-right: 0.6rem;
    border-radius: 3px;
    background: var(--marge);
    transform: rotate(45deg);
    vertical-align: 0.15rem;
}

.consigne {
    color: var(--doux);
}

.consigne p + p,
.consigne p + ul {
    margin-top: 0.6rem;
}

.consigne code {
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: var(--plume-pale);
    color: var(--encre);
    font: 0.9em var(--mono);
}

.atelier {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.atelier.avec-apercu {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.editeur,
.apercu {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 1px solid var(--trait);
    border-radius: 10px;
}

.onglet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0.8rem;
    border-bottom: 1px solid var(--trait);
    background: var(--papier);
    color: var(--gris);
    font-size: 0.82rem;
}

.editeur textarea {
    width: 100%;
    min-height: 20rem;
    padding: 1rem;
    border: 0;
    background: var(--code);
    color: var(--code-texte);
    font: 0.92rem/1.6 var(--mono);
    resize: vertical;
    tab-size: 2;
    caret-color: #ff9db0;
}

.editeur textarea:focus {
    outline: 2px solid var(--plume);
    outline-offset: -2px;
}

.apercu iframe {
    width: 100%;
    height: 100%;
    min-height: 20rem;
    border: 0;
    background: #fff;
}

.lien-petit {
    padding: 0;
    border: 0;
    background: none;
    color: var(--plume);
    font: inherit;
    cursor: pointer;
}

.verifications {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.verifications li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--doux);
    transition: color 0.2s;
}

.verifications li.ok {
    color: var(--vert);
}

.ok .case {
    border-color: var(--vert);
    background: var(--vert);
    animation: cocher 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes cocher {
    from {
        transform: scale(0.5);
    }
}

.bravo {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: var(--vert-pale);
    color: var(--vert);
    font-weight: 600;
}

.solution summary {
    color: var(--gris);
    cursor: pointer;
}

.solution .code {
    margin-top: 0.75rem;
}

.question {
    min-width: 0;
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0 0 1.25rem;
    border: 0;
    border-bottom: 1px solid var(--trait);
}

.question legend {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    margin-bottom: 0.6rem;
    padding: 0;
    font-weight: 600;
}

.question legend .numero {
    width: 1.7rem;
    height: 1.7rem;
    font-size: 0.8rem;
}

.question code,
.explication code,
.choix code {
    overflow-wrap: anywhere;
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    background: var(--plume-pale);
    font: 0.9em var(--mono);
}

.choix {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--trait);
    border-radius: 8px;
    color: var(--doux);
    cursor: pointer;
}

.choix:hover {
    border-color: var(--plume);
}

.choix input {
    accent-color: var(--plume);
}

.choix.juste {
    border-color: var(--vert);
    background: var(--vert-pale);
    color: var(--encre);
}

.choix.faux {
    border-color: var(--rouge);
    background: var(--rouge-pale);
}

.explication {
    padding-left: 0.2rem;
    color: var(--gris);
    font-size: 0.95rem;
}

.quiz-bas {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.score {
    font-weight: 600;
}

.suite {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.suite a {
    display: grid;
    gap: 0.2rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--trait);
    border-radius: 10px;
    background: var(--feuille);
    color: var(--encre);
    font-weight: 600;
    text-decoration: none;
}

.suite a span {
    color: var(--gris);
    font-size: 0.85rem;
    font-weight: 400;
}

.suite a:hover {
    border-color: var(--plume);
}

.suivante {
    text-align: right;
}

.simple {
    display: grid;
    gap: 0.9rem;
    max-width: 46rem;
    padding-top: clamp(2.5rem, 7vh, 4rem);
}

.simple h2 {
    margin-top: 1rem;
    font-size: 1.15rem;
}

.simple p {
    color: var(--doux);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 62rem) {
    .intro-site,
    .page-lecon,
    .atelier.avec-apercu {
        grid-template-columns: minmax(0, 1fr);
    }

    .sommaire {
        display: none;
    }

    .ardoise {
        transform: none;
    }
}

@media (max-width: 44rem) {
    .modules-grille,
    .etapes,
    .suite {
        grid-template-columns: minmax(0, 1fr);
    }

    .liste-lecons li {
        grid-template-columns: 2.5rem minmax(0, 1fr);
    }

    .liste-lecons .duree,
    .liste-lecons .etat {
        grid-column: 2;
    }

    .cahier {
        padding: 1.5rem 1.1rem 1.5rem 2.6rem;
        background:
            linear-gradient(90deg, transparent 1.6rem, var(--marge) 1.6rem, var(--marge) calc(1.6rem + 1.5px), transparent calc(1.6rem + 1.5px)),
            repeating-linear-gradient(transparent 0 calc(1.75rem - 1px), var(--seyes) calc(1.75rem - 1px) 1.75rem),
            var(--feuille);
    }

    .exercice,
    .quiz {
        padding: 1.25rem;
    }

    .barre nav .externe {
        display: none;
    }

    .marque span {
        display: none;
    }
}

.pied nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
}

.page-doc {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    align-items: start;
    gap: 3rem;
    padding-top: 2rem;
}

.cahier h3 {
    color: var(--encre);
}

.cahier h2[id] {
    scroll-margin-top: 5rem;
}

@media (max-width: 62rem) {
    .page-doc {
        grid-template-columns: minmax(0, 1fr);
    }
}

.resultat-sql {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 1px solid var(--trait);
    border-radius: 10px;
    background: var(--feuille);
}

.sortie {
    max-height: 26rem;
    min-height: 20rem;
    padding: 0.9rem;
    overflow: auto;
}

.lien-petit kbd {
    padding: 0 0.3rem;
    border: 1px solid var(--trait);
    border-radius: 4px;
    font: 0.75rem var(--mono);
}

.tableau-sql {
    overflow-x: auto;
}

.tableau-sql table {
    width: 100%;
    border-collapse: collapse;
    font: 0.86rem var(--mono);
}

.tableau-sql th,
.tableau-sql td {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--trait);
    text-align: left;
    white-space: nowrap;
}

.tableau-sql th {
    background: var(--plume-pale);
    color: var(--encre);
}

.nul {
    color: var(--gris);
    font-style: italic;
}

.compte-sql {
    margin-top: 0.4rem;
    font-size: 0.82rem;
}

.message-sql {
    margin-bottom: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    background: var(--vert-pale);
    color: var(--vert);
    font-size: 0.92rem;
}

.erreur-sql {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    background: var(--rouge-pale);
    color: var(--rouge);
    font-size: 0.92rem;
}

.schema summary {
    color: var(--plume);
    cursor: pointer;
}

.schema-tables {
    display: grid;
    gap: 1rem;
    margin-top: 0.8rem;
}

.nom-table {
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.badge {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: 4.2rem;
    height: 4.2rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #6f8ff0, var(--plume) 60%, #1f3f9e);
    box-shadow: inset 0 0 0 4px rgb(255 255 255 / 0.35), 0 6px 14px -6px rgb(29 35 64 / 0.6);
    color: #fff;
    font: 900 1rem/1 var(--titre);
    letter-spacing: -0.02em;
}

.badge::before,
.badge::after {
    content: "";
    position: absolute;
    bottom: -0.7rem;
    width: 0.9rem;
    height: 1.3rem;
    background: var(--marge);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
    z-index: -1;
}

.badge::before {
    left: 1.05rem;
    transform: rotate(14deg);
}

.badge::after {
    right: 1.05rem;
    transform: rotate(-14deg);
}

.badge span {
    max-width: 3.4rem;
    overflow: hidden;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
}

.badge-or {
    background: radial-gradient(circle at 35% 30%, #ffe28a, #e8b021 60%, #a8740a);
    color: #3b2700;
}

.badge-gris {
    background: var(--papier);
    box-shadow: inset 0 0 0 2px var(--trait);
    color: var(--gris);
}

.badge-gris::before,
.badge-gris::after {
    display: none;
}

.badge.petit {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 0.72rem;
}

.badge.petit::before,
.badge.petit::after {
    bottom: -0.5rem;
    width: 0.6rem;
    height: 0.9rem;
}

.badge.petit::before {
    left: 0.7rem;
}

.badge.petit::after {
    right: 0.7rem;
}

.carte-titre,
.module-tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.badges-zone {
    padding-top: clamp(1rem, 4vh, 2rem);
}

.badges-zone h2 {
    margin-bottom: 1.25rem;
    font-family: var(--titre);
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.badges-liste {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem 2rem;
}

.badge-item {
    display: grid;
    justify-items: center;
    gap: 1rem;
    width: 6rem;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    isolation: isolate;
}

.badge-item[hidden] {
    display: none;
}

.module-carte,
.module-tete,
.medaille {
    isolation: isolate;
}

.item-defi .numero {
    border-color: #e8b021;
    color: #b07d0c;
}

.item-defi.fini .numero {
    border-color: #e8b021;
    background: #e8b021;
    color: #3b2700;
}

.liste-lecons .item-defi {
    background: linear-gradient(90deg, rgb(232 176 33 / 0.08), transparent 60%);
}

.lecon-defi .lecon-tete h1::before {
    content: "★ ";
    color: #e8b021;
}

.medaille {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem 2rem;
    border: 1px solid #e8b021;
    border-radius: 12px;
    background: linear-gradient(120deg, rgb(232 176 33 / 0.14), var(--feuille));
}

.medaille[hidden] {
    display: none;
}

.medaille h2 {
    margin-bottom: 0.3rem;
    font-family: var(--titre);
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.medaille .badge {
    animation: gagner 0.7s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes gagner {
    from {
        transform: scale(0.3) rotate(-30deg);
    }
}

.explication-badge {
    font-size: 0.95rem;
}

/* ---------- Motion design ---------- */

@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    .barre {
        view-transition-name: barre;
    }

    ::view-transition-old(root) {
        animation: 0.18s ease both page-sort;
    }

    ::view-transition-new(root) {
        animation: 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both page-entre;
    }

    .intro-texte > * {
        animation: monter 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    }

    .intro-texte > :nth-child(2) {
        animation-delay: 0.12s;
    }

    .intro-texte > :nth-child(3) {
        animation-delay: 0.24s;
    }

    .surligne {
        background: linear-gradient(var(--plume-pale), var(--plume-pale)) 0 88% / 0 0.32em no-repeat;
        animation: surligner 0.9s cubic-bezier(0.6, 0, 0.2, 1) 0.6s forwards;
    }

    .ardoise {
        animation:
            ardoise-entre 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both,
            flotter 7s ease-in-out 1.2s infinite;
    }

    .a-reveler {
        opacity: 0;
        transform: translateY(26px);
        transition:
            opacity 0.6s ease var(--delai, 0s),
            transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delai, 0s);
    }

    .a-reveler.vu {
        opacity: 1;
        transform: none;
    }

    .module-carte.a-reveler.vu {
        transition:
            opacity 0.6s ease var(--delai, 0s),
            transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delai, 0s),
            box-shadow 0.25s ease;
    }

    .module-carte.a-reveler.vu:hover {
        transform: translateY(-3px);
        transition-delay: 0s;
    }

    .a-reveler:not(.vu) .avancement i {
        width: 0 !important;
    }

    .avancement i {
        transition: width 1.1s cubic-bezier(0.6, 0, 0.2, 1) calc(var(--delai, 0s) + 0.3s);
    }

    .module-carte .badge.petit {
        transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
    }

    .module-carte:hover .badge.petit {
        transform: rotate(-12deg) scale(1.12);
    }

    .badge-or {
        background:
            linear-gradient(115deg, transparent 42%, rgb(255 255 255 / 0.6) 50%, transparent 58%) 160% 0 / 250% 100% no-repeat,
            radial-gradient(circle at 35% 30%, #ffe28a, #e8b021 60%, #a8740a);
        animation: briller 5s ease-in-out 1s infinite;
    }

    .medaille .badge-or {
        animation:
            gagner 0.7s cubic-bezier(0.3, 1.6, 0.5, 1),
            briller 5s ease-in-out 1s infinite;
    }

    .bravo:not([hidden]) {
        animation: bravo 0.5s cubic-bezier(0.3, 1.4, 0.5, 1);
    }

    .lecon-defi .lecon-tete h1::before {
        display: inline-block;
        animation: etoile 1.2s cubic-bezier(0.3, 1.5, 0.5, 1) 0.2s both;
    }

    .lecon-tete > * {
        animation: monter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    }

    .lecon-tete > :nth-child(2) {
        animation-delay: 0.08s;
    }

    .lecon-tete > :nth-child(3) {
        animation-delay: 0.16s;
    }

    .btn-plein {
        position: relative;
        overflow: hidden;
    }

    .btn-plein::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 0.35) 50%, transparent 65%) -150% 0 / 200% 100% no-repeat;
        transition: background-position 0.6s ease;
    }

    .btn-plein:hover::after {
        background-position: 150% 0;
    }
}

.ardoise-code .curseur {
    display: inline-block;
    width: 0.55em;
    height: 1.15em;
    margin-bottom: -0.2em;
    background: var(--code-texte);
    animation: clignoter 1s steps(1) infinite;
}

.ardoise-rendu .vide {
    visibility: hidden;
}

.ardoise figcaption {
    transition: color 0.3s ease;
}

.ardoise figcaption.attente {
    color: var(--gris);
}

.ardoise figcaption.attente .coche {
    border-color: var(--trait);
    background: transparent;
}

.ardoise figcaption.attente .coche::after {
    display: none;
}

.ardoise figcaption.pop .coche {
    animation: cocher 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes monter {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
}

@keyframes surligner {
    to {
        background-size: 100% 0.32em;
    }
}

@keyframes ardoise-entre {
    from {
        opacity: 0;
        transform: translateY(40px) rotate(5deg);
    }
}

@keyframes flotter {
    0%,
    100% {
        transform: rotate(1.2deg) translateY(0);
    }

    50% {
        transform: rotate(0.4deg) translateY(-9px);
    }
}

@keyframes briller {
    0%,
    60% {
        background-position: 160% 0, 0 0;
    }

    85%,
    100% {
        background-position: -60% 0, 0 0;
    }
}

@keyframes bravo {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
}

@keyframes etoile {
    from {
        opacity: 0;
        transform: scale(0.2) rotate(-160deg);
    }
}

@keyframes clignoter {
    50% {
        opacity: 0;
    }
}

@keyframes page-sort {
    to {
        opacity: 0;
    }
}

@keyframes page-entre {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

/* ---------- Pages légales ---------- */

.legal {
    padding-bottom: 3rem;
}

.legal h2 {
    scroll-margin-top: 5rem;
    margin-top: 1.4rem;
    font-family: var(--titre);
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.legal ul {
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding-left: 1.2rem;
    color: var(--doux);
}

.legal li::marker {
    color: var(--marge);
}

.legal code {
    overflow-wrap: anywhere;
}

.legal-sommaire {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

.legal-sommaire a {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--trait);
    border-radius: 999px;
    background: var(--feuille);
    color: var(--doux);
    font-size: 0.85rem;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.legal-sommaire a:hover {
    border-color: var(--plume);
    color: var(--plume);
}

.legal-resume {
    display: grid;
    gap: 0.6rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--trait);
    border-left: 4px solid var(--vert);
    border-radius: 10px;
    background: var(--vert-pale);
}

.legal-resume h2 {
    margin: 0;
    color: var(--vert);
}

.legal-resume ul {
    color: var(--encre);
}

.tableau-legal {
    overflow-x: auto;
    border: 1px solid var(--trait);
    border-radius: 10px;
}

.tableau-legal table {
    width: 100%;
    min-width: 32rem;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.tableau-legal th,
.tableau-legal td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--trait);
    text-align: left;
    vertical-align: top;
}

.tableau-legal tr:last-child td {
    border-bottom: 0;
}

.tableau-legal th {
    background: var(--papier);
    color: var(--encre);
}

.tableau-legal td {
    background: var(--feuille);
    color: var(--doux);
}

.tableau-legal td:first-child code {
    white-space: nowrap;
    overflow-wrap: normal;
}
