/* ==========================================================
   Omoussa Academy — styles de base
   Idée : un tableau d'école (vert ardoise, craie, jaune craie)
   ========================================================== */

:root {
    --bg: #F4F7F5;
    --surface: #FFFFFF;
    --ink: #10201F;
    --muted: #556966;
    --line: #D3DFDB;
    --accent: #0E6B5C;
    --accent-hover: #0A5548;
    --accent-ink: #FFFFFF;
    --ring: rgba(14, 107, 92, .28);
    --danger: #A8231B;
    --danger-bg: #FCEDEB;
    --info-bg: #E9F3F0;

    --board: #0E2F2F;
    --chalk: #EAF2EF;
    --chalk-soft: rgba(234, 242, 239, .72);
    --yellow: #F2B84B;

    --radius: 12px;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0B1514;
    --surface: #12201F;
    --ink: #E6F0ED;
    --muted: #93A9A5;
    --line: #243836;
    --accent: #4FC3AA;
    --accent-hover: #6ED3BC;
    --accent-ink: #06211C;
    --ring: rgba(79, 195, 170, .35);
    --danger: #FF9C93;
    --danger-bg: #3A1B19;
    --info-bg: #14302C;
    --board: #081C1C;

    color-scheme: dark;
}

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

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1 {
    margin: 0 0 .35rem;
    font-family: var(--serif);
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 700;
}

.lead { margin: 0 0 1.5rem; color: var(--muted); }

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

/* ---------- Structure de la page de connexion ---------- */

.auth { display: grid; min-height: 100vh; min-height: 100dvh; }

.panel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px 20px 24px;
}

.panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.card { width: 100%; max-width: 400px; }

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
}

.mobile-brand img { display: block; border-radius: 9px; }

/* ---------- Bouton icône (thème) ---------- */

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.icon-btn:hover { border-color: var(--accent); }

.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Formulaire ---------- */

.field { margin-bottom: 1.1rem; }

.field label {
    display: block;
    margin-bottom: .4rem;
    font-size: .92rem;
    font-weight: 600;
}

.input-wrap { position: relative; }

.field input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 16px; /* évite le zoom automatique sur iOS */
    transition: border-color .15s, box-shadow .15s;
}

.input-wrap input { padding-right: 48px; }

.field input:hover { border-color: var(--muted); }

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--ring);
}

.toggle-pw {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.toggle-pw:hover { color: var(--ink); }

.hint { margin: .4rem 0 0; font-size: .85rem; color: var(--muted); }

/* ---------- Boutons ---------- */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }

.btn--ghost {
    width: auto;
    height: 42px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: .95rem;
}

.btn--ghost:hover { background: var(--surface); border-color: var(--accent); }

.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label { opacity: 0; }

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Messages ---------- */

.alert {
    margin-bottom: 1.1rem;
    padding: 12px 14px;
    border-radius: 10px;
    border-left: 4px solid;
    font-size: .95rem;
}

.alert--error { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.alert--info  { background: var(--info-bg);  border-color: var(--accent);  color: var(--ink); }

.foot-note { margin: 1.5rem 0 0; font-size: .88rem; color: var(--muted); }

/* ---------- Panneau « tableau » (grand écran) ---------- */

.board { display: none; }

@media (min-width: 960px) {
    .auth { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
    .mobile-brand { display: none; }
    .panel-top { justify-content: flex-end; }

    .board {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        overflow: hidden;
        padding: 48px 56px;
        background: radial-gradient(120% 80% at 15% 0%, #174343 0%, var(--board) 62%);
        color: var(--chalk);
    }

    /* cadre de tableau, tracé à la craie */
    .board::after {
        content: "";
        position: absolute;
        inset: 20px;
        border: 1px dashed rgba(234, 242, 239, .18);
        border-radius: 18px;
        pointer-events: none;
    }

    .board > * { position: relative; z-index: 1; }
}

.board-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 700;
}

.board-brand img { display: block; border-radius: 10px; }

.equation {
    display: grid;
    gap: .15em;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(2.2rem, 4.2vw, 3.6rem);
    line-height: 1.2;
}

.chalk-line {
    justify-self: start;
    opacity: 0;
    animation: chalk .8s ease-out forwards;
}

.chalk-line:nth-child(1) { animation-delay: .3s; }
.chalk-line:nth-child(2) { animation-delay: 1.1s; }
.chalk-line:nth-child(3) { animation-delay: 1.9s; }

.chalk-line--answer { position: relative; color: var(--yellow); }

.chalk-line--answer::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -.05em;
    height: 3px;
    border-radius: 2px;
    background: var(--yellow);
    transform: scaleX(0);
    transform-origin: left;
    animation: underline .6s ease-out 2.6s forwards;
}

@keyframes chalk {
    from { opacity: 0; clip-path: inset(0 100% 0 0); }
    to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes underline { to { transform: scaleX(1); } }

.board-title {
    margin: 0 0 .5rem;
    font-family: var(--serif);
    font-size: 1.6rem;
    line-height: 1.3;
    font-weight: 700;
}

.board-text { margin: 0 0 1.5rem; max-width: 46ch; color: var(--chalk-soft); }

.mini-progress { max-width: 360px; }

.mini-progress-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: .4rem;
    font-size: .9rem;
    color: var(--chalk-soft);
}

.mini-progress-bar {
    height: 8px;
    border-radius: 4px;
    background: rgba(234, 242, 239, .16);
    overflow: hidden;
}

.mini-progress-fill {
    display: block;
    height: 100%;
    width: 82%;
    border-radius: 4px;
    background: var(--chalk);
    transform: scaleX(0);
    transform-origin: left;
    animation: fill 1s ease-out 2.2s forwards;
}

@keyframes fill { to { transform: scaleX(1); } }

/* ---------- Tableau de bord provisoire ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.dash { max-width: 720px; margin: 0 auto; padding: 32px 20px 48px; }

.dash-card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.dash-card-title { margin: 0 0 .75rem; font-weight: 700; }

.dash-list { margin: 0; }

.dash-list > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: .6rem 0;
    border-top: 1px solid var(--line);
}

.dash-list > div:first-child { border-top: 0; }
.dash-list dt { color: var(--muted); }
.dash-list dd { margin: 0; font-weight: 600; word-break: break-all; text-align: right; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--info-bg);
    color: var(--accent);
    font-size: .85rem;
    font-weight: 600;
}

/* ---------- Accessibilité : animations réduites ---------- */

@media (prefers-reduced-motion: reduce) {
    .chalk-line, .chalk-line--answer::after, .mini-progress-fill {
        animation: none;
        opacity: 1;
        transform: none;
        clip-path: none;
    }
    .btn.is-loading::after { animation-duration: 1.6s; }
}

/* ==========================================================
   Étape 2 : inscription + administration
   ========================================================== */

a { color: var(--accent); }
a.btn { text-decoration: none; }

.input-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.alert-list { margin: 0; padding-left: 1.1rem; }

.btn--inline { width: auto; height: 44px; padding: 0 20px; font-size: .95rem; }
.btn--small  { height: 34px; padding: 0 12px; font-size: .85rem; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); }

.admin-nav {
    display: flex;
    gap: 6px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}
.admin-nav a {
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
    white-space: nowrap;
}
.admin-nav a:hover { background: var(--info-bg); }

.admin { max-width: 960px; margin: 0 auto; padding: 28px 20px 56px; }
.admin .dash-card { margin-bottom: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-grid .dash-card { margin-bottom: 0; }
.stat-num { margin: 0; font-family: var(--serif); font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.stat-label { margin: .2rem 0 0; color: var(--muted); }

.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-row .field { margin-bottom: 0; flex: 1 1 150px; }
.form-row .btn { flex: 0 0 auto; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 12px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.table thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.table .actions { display: flex; gap: 8px; }
.table .actions form { margin: 0; }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.cell-sub { margin-top: 4px; font-size: .82rem; color: var(--muted); }
.cell-sub summary { cursor: pointer; }
.plain-list { margin: 6px 0 0; padding-left: 1rem; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.chip--on  { background: var(--info-bg); color: var(--accent); }
.chip--off { background: var(--danger-bg); color: var(--danger); }

/* ==========================================================
   Étapes 3 à 5 : application (menu, matières, cours, quiz, admin)
   ========================================================== */

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

h2 { margin: 0; font-family: var(--serif); font-size: 1.35rem; }
.section-title { margin: 2rem 0 .8rem; }
.crumbs { margin: 0 0 .5rem; font-size: .92rem; }
.crumbs a { text-decoration: none; font-weight: 600; }
.stat-unit { font-size: 1.1rem; color: var(--muted); font-weight: 400; }
.steps { margin: 0; padding-left: 1.2rem; line-height: 1.9; }

/* ---------- Coque : menu latéral ---------- */

.shell { min-height: 100vh; min-height: 100dvh; }

.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    display: flex; flex-direction: column;
    width: 272px; max-width: 86vw; padding: 18px 14px;
    background: var(--surface); border-right: 1px solid var(--line);
    overflow-y: auto; transform: translateX(-102%); transition: transform .2s ease;
}
.sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }

.scrim {
    position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .4);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }

.mobile-bar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.mobile-title { font-family: var(--serif); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand {
    display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px;
    color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 700;
}
.brand img { display: block; border-radius: 9px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.nav a:hover { background: var(--info-bg); }
.nav a.is-active { background: var(--info-bg); color: var(--accent); font-weight: 700; }
.nav-ico { width: 1.4em; text-align: center; }
.nav-title { margin: 18px 10px 6px; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-empty { margin: 0 10px; font-size: .88rem; color: var(--muted); }

.sidebar-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.who { display: flex; flex-direction: column; margin-bottom: 10px; padding: 0 6px; }
.who span { font-size: .82rem; color: var(--muted); }
.sidebar-actions { display: flex; align-items: center; gap: 8px; }
.sidebar-actions form { margin: 0; }

.page { max-width: 980px; margin: 0 auto; padding: 24px 20px 64px; }

@media (min-width: 960px) {
    .sidebar { transform: none; width: 264px; }
    .scrim, .mobile-bar { display: none; }
    .shell-main { margin-left: 264px; }
    .page { padding: 36px 32px 64px; }
}

/* Mode concentration (exercice) : pas de menu */
.shell--focus .sidebar, .shell--focus .mobile-bar, .shell--focus .scrim { display: none; }
.shell--focus .shell-main { margin-left: 0; }

/* ---------- Cartes, listes, progression ---------- */

.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 1.2rem; }
.page-head .lead { margin: 0; }
.page-head h1 { margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.subject-card {
    display: flex; flex-direction: column; gap: 10px; padding: 18px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
    color: var(--ink); text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.subject-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(0, 0, 0, .08); }
.subject-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--info-bg); font-size: 1.5rem; }
.subject-icon--lg { width: 60px; height: 60px; font-size: 2rem; flex: none; }
.subject-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }
.subject-meta { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.subject-card .subject-meta { margin: 0; }
.subject-cta { color: var(--accent); font-weight: 700; font-size: .92rem; }

.bar { display: block; width: 100%; height: 10px; border: 0; border-radius: 6px; overflow: hidden; background: var(--line); accent-color: var(--accent); appearance: none; -webkit-appearance: none; }
.bar::-webkit-progress-bar { background: var(--line); border-radius: 6px; }
.bar::-webkit-progress-value { background: var(--accent); border-radius: 6px; transition: width .4s ease; }
.bar::-moz-progress-bar { background: var(--accent); border-radius: 6px; }

.list-card { padding: 0; overflow: hidden; }
.list-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 14px 18px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--info-bg); }
.list-main { display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.list-main small { font-weight: 400; color: var(--muted); font-size: .84rem; }
.list-row--bar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; }
.row-bar { min-width: 80px; }
.grade { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; white-space: nowrap; text-decoration: none; color: var(--accent); }
.empty { text-align: center; }
.average-card { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.average-card p { margin: 0; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--line); color: var(--ink); font-size: .8rem; font-weight: 600; }
.chip--on { background: var(--info-bg); color: var(--accent); }
.chip--off { background: var(--danger-bg); color: var(--danger); }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1rem; }

/* ---------- Cours : contenu ---------- */

.prose { line-height: 1.75; font-size: 1.04rem; overflow-wrap: anywhere; }
.prose h2 { margin: 1.6em 0 .5em; }
.prose h3 { margin: 1.4em 0 .4em; font-family: var(--serif); font-size: 1.15rem; }
.prose > :first-child { margin-top: 0; }
.prose img, .prose iframe { display: block; max-width: 100%; border-radius: 10px; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }
.prose blockquote { margin: 1em 0; padding: .4em 1em; border-left: 4px solid var(--line); color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--info-bg); }
.prose code, .prose pre { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--info-bg); border-radius: 6px; }
.prose code { padding: 1px 6px; }
.prose pre { padding: 12px; overflow-x: auto; }
.callout, .example { margin: 1em 0; padding: 14px 16px; border-radius: 10px; border-left: 4px solid; }
.callout { background: #FFF4DB; border-color: var(--yellow); color: #3B2C00; }
.example { background: var(--info-bg); border-color: var(--accent); }
[data-theme="dark"] .callout { background: #3A2F12; color: #FBE9B7; }

.course-done { margin: 1.2rem 0 0; }
.btn--secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn--secondary:hover { background: var(--info-bg); }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 1.8rem; }
.start-form { margin-top: 1.2rem; }

/* ---------- Exercice ---------- */

.quiz-wrap { max-width: 720px; margin: 0 auto; }
.quiz-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 1.4rem; }
.quiz-subject { margin: 0; font-size: .9rem; color: var(--muted); }
.quiz-title { margin: 0; font-family: var(--serif); font-size: 1.25rem; font-weight: 700; }
.timer { padding: 6px 14px; border-radius: 999px; background: var(--info-bg); font-variant-numeric: tabular-nums; font-weight: 700; }
.timer--low { background: var(--danger-bg); color: var(--danger); }
.quiz-progress { display: flex; justify-content: space-between; margin-bottom: .5rem; font-size: .92rem; color: var(--muted); font-weight: 600; }
.quiz-card { margin-top: 1.4rem; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.quiz-hint { margin: 0 0 .5rem; font-size: .85rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.quiz-question { margin: 0 0 1.4rem; font-family: var(--serif); font-size: 1.5rem; line-height: 1.35; }
.options { margin: 0; padding: 0; border: 0; display: grid; gap: 10px; }
.option {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer;
    border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg);
    transition: border-color .12s ease, background .12s ease, transform .1s ease;
}
.option:hover { border-color: var(--accent); }
.option:active { transform: scale(.995); }
.option input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.option:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.option-text { font-size: 1.05rem; }
.q-text { width: 100%; height: 54px; padding: 0 16px; font: inherit; font-size: 1.1rem; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; }
.q-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.quiz-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 1.6rem; }

/* ---------- Résultat ---------- */

.result-card { padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: center; }
.result-grade { margin: 0; font-family: var(--serif); font-size: 3.4rem; font-weight: 700; line-height: 1.1; }
.result-grade span { font-size: 1.4rem; color: var(--muted); font-weight: 400; }
.result-percent { margin: .2rem 0 1rem; color: var(--muted); font-weight: 600; }
.result-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 1.2rem 0 0; padding: 0; list-style: none; }
.ok-mark { color: var(--accent); font-weight: 700; }
.ko-mark { color: var(--danger); font-weight: 700; }
.review { margin-bottom: 14px; padding: 16px 18px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px; background: var(--surface); }
.review--ok { border-left-color: var(--accent); }
.review--ko { border-left-color: var(--danger); }
.review-head { margin: 0 0 .4rem; font-size: .88rem; font-weight: 700; color: var(--muted); }
.review-q { margin: 0 0 .6rem; font-weight: 600; }
.review-line { margin: .2rem 0; }
.review-expl { margin: .7rem 0 0; padding: 10px 12px; border-radius: 8px; background: var(--info-bg); }

/* ---------- Notes : courbe ---------- */

.chart { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--line); stroke-dasharray: 4 4; }
.chart-axis { stroke: var(--muted); }
.chart-label { fill: var(--muted); font-size: 12px; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }

/* ---------- Formulaires (admin) ---------- */

.field textarea, .field select, .search {
    display: block; width: 100%; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--ink);
    background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px;
}
.field select { height: 48px; }
.field textarea { resize: vertical; min-height: 80px; }
.field textarea:focus, .field select:focus, .search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.search { max-width: 360px; height: 44px; }
.field--icon { flex: 0 0 90px !important; }
.field--grow { flex: 2 1 220px !important; }
.field--full { flex: 1 1 100% !important; }
.hint-inline { font-weight: 400; color: var(--muted); font-size: .85rem; }
.form-stack .field { margin-bottom: 1rem; }
.form-stack .form-row .field { margin-bottom: 0; }
.form-stack .form-row { margin-bottom: 1rem; }
.form-row--top { margin-top: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: .4rem; }
.form-actions form { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 1rem; }
.toolbar-filter { margin: 0; }
.toolbar-filter select { height: 44px; padding: 0 12px; font-size: 16px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; }
.checks { margin: 0 0 1rem; padding: 0; border: 0; display: grid; gap: 8px; }
.checks legend { margin-bottom: 6px; font-weight: 600; font-size: .92rem; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check--solo { flex: none; }
.answer-rows { display: grid; gap: 8px; }
.answer-row { display: flex; align-items: center; gap: 10px; }
.answer-row input[type="text"] { flex: 1; }
.actions--wrap { flex-wrap: wrap; }
details.dash-card > summary { cursor: pointer; }
a.stat-link { display: block; text-decoration: none; color: var(--ink); transition: border-color .15s ease; }
a.stat-link:hover { border-color: var(--accent); }
.stat-link .stat-label { margin-top: .2rem; }

@media (max-width: 600px) {
    .quiz-card { padding: 18px; }
    .quiz-question { font-size: 1.3rem; }
    .list-row--bar { grid-template-columns: 1fr auto; }
    .row-bar { display: none; }
    .table th, .table td { padding: 10px; }
}

/* ---------- Éditeur de cours ---------- */

.editor { border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--info-bg); }
.editor-toolbar button {
    height: 34px; padding: 0 10px; font: inherit; font-size: .88rem; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.editor-toolbar button:hover { border-color: var(--accent); }
.editor-area { min-height: 320px; padding: 16px; outline: none; }
.editor-area:empty::before { content: "Écris ton cours ici…"; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .sidebar, .scrim, .subject-card, .option, .bar::-webkit-progress-value { transition: none; }
}

/* ==========================================================
   Étape 6 : accès par élève, récompenses, solde, retraits
   ========================================================== */

.nav-label { flex: 1; }
.nav-badge {
    min-width: 22px; padding: 1px 8px; border-radius: 999px; text-align: center;
    background: var(--accent); color: var(--accent-ink); font-size: .74rem; font-weight: 700;
}

.chip--reward { background: #FFF4DB; color: #6B4A00; }
[data-theme="dark"] .chip--reward { background: #3A2F12; color: #FBE9B7; }

.audience, .reward { margin: 0; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; flex: 1 1 280px; display: grid; gap: 8px; align-content: start; }
.audience legend, .reward legend { padding: 0 6px; font-weight: 600; font-size: .92rem; }
.audience-list { display: grid; gap: 8px; margin-top: 4px; }
.audience-list[hidden], .reward-amount[hidden] { display: none; }
.audience-items { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; padding: 4px 2px; }
.audience-items .check[hidden] { display: none; }
.audience-items small { color: var(--muted); }
.reward-amount { display: flex; align-items: center; gap: 8px; }
.reward-amount input { width: 140px; height: 44px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; }
.reward-amount input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.form-row--top { align-items: flex-start; }

.wallet-card { padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.wallet-balance { margin: 0; font-family: var(--serif); font-size: 3rem; font-weight: 700; line-height: 1.1; color: var(--accent); }
.wallet-sub { margin: .8rem 0 0; padding: 0; list-style: none; color: var(--muted); display: grid; gap: 4px; }
.withdraw-form { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--accent); }
.claim-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.claim-row:first-of-type { border-top: 0; }
.claim-amount { display: flex; align-items: center; gap: 10px; text-align: right; }
.reason { color: var(--danger) !important; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1rem; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.tab:hover { border-color: var(--accent); }
.tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lead--inline { margin: 0; }
.stat-link--alert { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(242, 184, 75, .25); }
.refuse-box { margin-top: 8px; }
.refuse-box summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none; }
.refuse-box summary::-webkit-details-marker { display: none; }
.refuse-box form { margin-top: 10px; min-width: 240px; }
.btn--danger-fill { background: var(--danger); color: #fff; }
.btn--danger-fill:hover { background: var(--danger); filter: brightness(.9); }

/* ==========================================================
   Étape 7 : mode sécurisé, notifications, réglages
   ========================================================== */

.secure-badge { margin: 0 0 1rem; padding: 8px 14px; border-radius: 10px; background: var(--info-bg); font-size: .9rem; font-weight: 600; }
.rescue-card { text-align: left; border-color: var(--yellow); }
.secure-fields[hidden] { display: none; }
.secure-box .secure-fields { display: grid; gap: 4px; margin-top: 8px; }
.notif-prefs { margin-bottom: 16px; }
.list-row.is-new { background: var(--info-bg); }
.maintenance { text-align: center; padding-top: 18vh; }

/* ==========================================================
   Étape 8 : formules, fichiers, niveaux, badges, classement
   ========================================================== */

math { font-size: 1.12em; }
math[display="block"] { display: block math; margin: .8em 0; text-align: center; }

.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.file-row .list-main { flex: 1; min-width: 140px; }
.file-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--info-bg); }
.file-thumb--pdf { display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; color: var(--danger); }
input[type="file"] { display: block; width: 100%; padding: 8px; font: inherit; background: var(--surface); border: 1.5px dashed var(--line); border-radius: 10px; color: var(--ink); }

.level-card, .level-mini { display: block; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.level-mini { display: grid; gap: 8px; margin-top: 16px; padding: 16px 18px; transition: border-color .15s ease; }
.level-mini:hover { border-color: var(--accent); }
.level-num { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; }
.level-card .bar { margin: 10px 0 6px; }
.level-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: .9rem 0 0; padding: 0; list-style: none; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.badge-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); opacity: .6; }
.badge-card.is-earned { opacity: 1; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(242, 184, 75, .18); }
.badge-card small { color: var(--muted); }
.badge-icon { font-size: 2rem; filter: grayscale(1); }
.badge-card.is-earned .badge-icon { filter: none; }

.rank-row.is-me { background: var(--info-bg); }
.rank-pos { flex: 0 0 34px; text-align: center; font-weight: 700; font-size: 1.1rem; }
