/* ==========================================================================
   COBOL Academy — thème « salle des machines » : papier listing le jour,
   écran phosphore la nuit. IBM Plex Sans / Mono.
   ========================================================================== */

:root {
    --bg: #f3f0e8;
    --bg-band: #ebe6da;
    --surface: #fbfaf6;
    --surface-2: #f4f1e9;
    --ink: #1c1d1a;
    --ink-2: #4a4b45;
    --ink-3: #7a7a72;
    --line: #dcd6c8;
    --line-strong: #c4bca9;
    --accent: #17603c;
    --accent-ink: #ffffff;
    --accent-soft: #dcefe2;
    --accent-2: #b4690e;
    --accent-2-soft: #f8ead4;
    --danger: #b42318;
    --danger-soft: #fbe4e1;
    --ok: #17603c;
    --ok-soft: #dcefe2;
    --code-bg: #15201a;
    --code-ink: #d7f5df;
    --code-comment: #7d9a87;
    --code-keyword: #8fe3a9;
    --code-header: #f2c46d;
    --code-string: #f6a97a;
    --code-number: #9cc9ff;
    --code-pic: #e6b3ff;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 6px 20px -12px rgba(30, 30, 20, .25);
    --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1210;
        --bg-band: #131915;
        --surface: #151b17;
        --surface-2: #1a221d;
        --ink: #e3ece5;
        --ink-2: #aab8ad;
        --ink-3: #78867b;
        --line: #26302a;
        --line-strong: #344038;
        --accent: #4ade80;
        --accent-ink: #062611;
        --accent-soft: #163322;
        --accent-2: #f2b146;
        --accent-2-soft: #3a2c12;
        --danger: #ff7b6e;
        --danger-soft: #3b1714;
        --ok: #4ade80;
        --ok-soft: #163322;
        --code-bg: #0a0f0c;
        --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

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

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body { margin: 0; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 .5rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }

.mono, code, pre, kbd { font-family: var(--mono); }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.eyebrow {
    font-family: var(--mono);
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 .35rem;
}

h1:focus { outline: none; }

/* ---------- Coquille ---------- */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

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

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: .6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--mono);
    font-weight: 700;
    font-size: .95rem;
}
.brand-name { font-family: var(--mono); font-weight: 600; letter-spacing: .02em; }
.brand-name span { color: var(--ink-3); font-weight: 400; margin-left: .2rem; }

.mainnav { display: flex; gap: .25rem; flex: 1; }
.mainnav a {
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    text-decoration: none;
    font-size: .93rem;
    font-weight: 500;
}
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a.active { background: var(--accent-soft); color: var(--accent); }

.account { display: flex; align-items: center; gap: .6rem; }
.account form { margin: 0; }
.account-name {
    font-size: .85rem;
    color: var(--ink-2);
    text-decoration: none;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-toggle, .nav-burger { display: none; }

.page {
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.footer {
    border-top: 1px solid var(--line);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    color: var(--ink-3);
    font-size: .82rem;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 860px) {
    .topbar-inner { flex-wrap: wrap; gap: .75rem; }
    .nav-burger {
        display: block;
        margin-left: auto;
        width: 36px; height: 36px;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        position: relative;
        cursor: pointer;
    }
    .nav-burger span, .nav-burger span::before, .nav-burger span::after {
        position: absolute; left: 9px; width: 16px; height: 2px; background: var(--ink); content: "";
    }
    .nav-burger span { top: 17px; }
    .nav-burger span::before { top: -5px; left: 0; }
    .nav-burger span::after { top: 5px; left: 0; }
    .mainnav, .account { display: none; width: 100%; }
    .nav-toggle:checked ~ .mainnav { display: flex; flex-direction: column; }
    .nav-toggle:checked ~ .account { display: flex; padding-bottom: .5rem; }
    .account-name { max-width: none; }
}

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

.btn-primary-x, .btn-secondary-x, .btn-ghost, .btn-danger-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .6rem 1.1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 600;
    font-size: .93rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    white-space: nowrap;
    line-height: 1.2;
}
.btn-primary-x { background: var(--accent); color: var(--accent-ink); }
.btn-primary-x:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--accent-ink); }
.btn-secondary-x { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary-x:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); padding: .45rem .8rem; font-weight: 500; }
.btn-ghost:hover { color: var(--ink); border-color: var(--line-strong); }
.btn-danger-x { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger-x:hover { background: var(--danger-soft); color: var(--danger); }
.btn-primary-x.small { padding: .45rem .8rem; font-size: .88rem; }
.btn-primary-x:active, .btn-secondary-x:active { transform: translateY(1px); }
button:disabled, .btn-primary-x[disabled], .btn-secondary-x[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

kbd {
    font-size: .75rem;
    padding: .05rem .35rem;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink-2);
}

/* ---------- Cartes et grilles ---------- */

.card-x {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow);
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat-value { font-family: var(--mono); font-size: 1.8rem; font-weight: 600; }
.stat-label { color: var(--ink-3); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Barre de progression ---------- */

.progress-x {
    height: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 99px;
    overflow: hidden;
}
.progress-x > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width .4s ease;
}
.progress-x.lg { height: 12px; }

/* ---------- Accueil (visiteur) ---------- */

.hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 2.5rem;
    align-items: center;
    padding: 2rem 0 3rem;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); letter-spacing: -0.025em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 36rem; }
.hero .btn-row { margin-top: 1.5rem; }

.terminal {
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: 0 20px 50px -25px rgba(0, 0, 0, .55);
    overflow: hidden;
    font-family: var(--mono);
    font-size: .86rem;
}
.terminal-bar {
    display: flex; gap: 6px; padding: .6rem .8rem;
    background: rgba(255, 255, 255, .05);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.terminal-bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.terminal pre { margin: 0; padding: 1rem 1.1rem; color: var(--code-ink); background: transparent; white-space: pre; overflow-x: auto; }
.terminal .out { color: var(--code-keyword); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0 2.5rem; }
.feature h3 { margin-top: .2rem; font-size: 1rem; }
.feature p { margin: 0; color: var(--ink-2); font-size: .93rem; }
.feature .num { font-family: var(--mono); color: var(--accent); font-size: .85rem; }

@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }

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

.dash-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.dash-progress { min-width: 280px; flex: 0 1 380px; }
.dash-progress .row-x { display: flex; justify-content: space-between; font-size: .88rem; color: var(--ink-2); margin-bottom: .35rem; }

.resume {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-left: 4px solid var(--accent);
}
.resume h2 { margin: 0 0 .2rem; font-size: 1.15rem; }
.resume p { margin: 0; }

.module-card {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: border-color .15s, transform .15s;
}
a.module-card:hover { border-color: var(--accent); color: inherit; transform: translateY(-2px); }
.module-card .num {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--ink-3);
    display: flex;
    justify-content: space-between;
}
.module-card h3 { margin: 0; font-size: 1.08rem; }
.module-card p { margin: 0; color: var(--ink-2); font-size: .9rem; flex: 1; }
.module-card .meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-3); font-family: var(--mono); }
.module-card.locked { opacity: .55; }
.module-card.done { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.badge-x {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-family: var(--mono);
    font-size: .72rem;
    padding: .12rem .5rem;
    border-radius: 99px;
    border: 1px solid var(--line);
    color: var(--ink-2);
    background: var(--surface-2);
    white-space: nowrap;
}
.badge-x.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge-x.warn { color: var(--accent-2); background: var(--accent-2-soft); border-color: transparent; }
.badge-x.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

/* ---------- Page module ---------- */

.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: .8rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.item-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.item-list li + li { border-top: 1px solid var(--line); }
.item-list a {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: .8rem;
    align-items: center;
    padding: .85rem 1.1rem;
    text-decoration: none;
    color: var(--ink);
}
.item-list a:hover { background: var(--surface-2); color: var(--ink); }
.item-list .kind { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.item-list .title { font-weight: 500; }
.check {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: .8rem;
    color: transparent;
}
.check.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.item-group-title { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin: 1.6rem 0 .5rem; }

.locked-box { text-align: center; padding: 3rem 1rem; }

/* ---------- Leçon (prose) ---------- */

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 2.5rem; align-items: start; }
.lesson-aside { position: sticky; top: 80px; font-size: .88rem; }
.lesson-aside ol { list-style: none; padding: 0; margin: 0; }
.lesson-aside li a { display: flex; gap: .5rem; padding: .35rem .5rem; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; }
.lesson-aside li a:hover { background: var(--surface-2); }
.lesson-aside li a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lesson-aside li a .tick { width: 1rem; color: var(--accent); }
@media (max-width: 960px) { .lesson-layout { grid-template-columns: 1fr; } .lesson-aside { position: static; } }

.prose { max-width: 46rem; font-size: 1.02rem; }
.prose h1 { margin-bottom: 1.2rem; }
.prose p, .prose li { color: var(--ink); }
.prose code {
    font-size: .88em;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: .05em .35em;
    color: var(--ink);
}
.prose pre {
    background: var(--code-bg);
    color: var(--code-ink);
    padding: 1rem 1.15rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: .88rem;
    line-height: 1.55;
    margin: 1rem 0 1.3rem;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.4rem; font-size: .93rem; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: .5rem .6rem; text-align: left; vertical-align: top; }
.prose th { font-weight: 600; background: var(--surface-2); }
.prose blockquote {
    margin: 1.2rem 0;
    padding: .8rem 1rem;
    border-left: 4px solid var(--accent-2);
    background: var(--accent-2-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose blockquote p { margin: 0; }

.lesson-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

/* Coloration COBOL (CodeMirror runMode + éditeur) */
.cm-s-academy .cm-keyword, .cm-s-academy.CodeMirror .cm-keyword { color: var(--code-keyword); font-weight: 500; }
.cm-s-academy .cm-header, .cm-s-academy.CodeMirror .cm-header { color: var(--code-header); font-weight: 600; }
.cm-s-academy .cm-string, .cm-s-academy.CodeMirror .cm-string { color: var(--code-string); }
.cm-s-academy .cm-number, .cm-s-academy.CodeMirror .cm-number { color: var(--code-number); }
.cm-s-academy .cm-comment, .cm-s-academy.CodeMirror .cm-comment { color: var(--code-comment); font-style: italic; }
.cm-s-academy .cm-atom, .cm-s-academy.CodeMirror .cm-atom { color: var(--code-number); }
.cm-s-academy .cm-variable-3, .cm-s-academy.CodeMirror .cm-variable-3 { color: var(--code-pic); }
.cm-s-academy .cm-meta { color: var(--code-comment); }
.cm-s-academy .cm-punctuation { color: var(--code-header); font-weight: 700; }

/* ---------- Quiz ---------- */

.quiz { max-width: 48rem; }
.question { margin-bottom: 1.2rem; }
.question .q-head { display: flex; gap: .75rem; align-items: baseline; }
.question .q-num { font-family: var(--mono); color: var(--accent); font-weight: 600; }
.question .q-text { font-weight: 550; margin: 0; }
.question pre { background: var(--code-bg); color: var(--code-ink); padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .86rem; margin: .8rem 0; }
.choices { display: flex; flex-direction: column; gap: .45rem; margin-top: .8rem; }
.choice {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    padding: .65rem .85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}
.choice:hover { border-color: var(--line-strong); }
.choice input { margin-top: .3rem; accent-color: var(--accent); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.wrong { border-color: var(--danger); background: var(--danger-soft); }
.explanation { margin-top: .7rem; padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .93rem; color: var(--ink-2); }
.score-box { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.score-big { font-family: var(--mono); font-size: 2.6rem; font-weight: 600; }
.score-big.ok { color: var(--ok); }
.score-big.ko { color: var(--danger); }

/* ---------- Exercice / éditeur ---------- */

.ide { display: grid; grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1080px) { .ide { grid-template-columns: 1fr; } }

.ide-statement { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
@media (max-width: 1080px) { .ide-statement { position: static; max-height: none; } }
.ide-statement .prose { font-size: .97rem; }

.editor-frame {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--code-bg);
}
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .45rem .7rem;
    background: color-mix(in srgb, var(--code-bg) 85%, #fff 15%);
    color: var(--code-ink);
    font-family: var(--mono);
    font-size: .78rem;
}
.editor-toolbar .file { display: flex; gap: .5rem; align-items: center; }
.editor-toolbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--code-keyword); }
.editor-toolbar .dot.dirty { background: var(--code-header); }
.editor-host .CodeMirror {
    height: 460px;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.55;
    background: var(--code-bg);
    color: var(--code-ink);
}
.editor-host.sandbox .CodeMirror { height: 560px; }
.editor-host .CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid rgba(255, 255, 255, .07); }
.editor-host .CodeMirror-linenumber { color: #4f6457; }
.editor-host .CodeMirror-cursor { border-left: 2px solid var(--code-keyword); }
.editor-host .CodeMirror-activeline-background { background: rgba(255, 255, 255, .045); }
.editor-host .CodeMirror-selected { background: rgba(143, 227, 169, .18) !important; }
.editor-host .CodeMirror-focused .CodeMirror-selected { background: rgba(143, 227, 169, .25) !important; }

.ide-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin: .8rem 0; }
.ide-actions .hint-keys { font-size: .8rem; color: var(--ink-3); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .8rem; overflow-x: auto; }
.tabs button {
    border: 0;
    background: none;
    padding: .55rem .8rem;
    font-family: var(--font);
    font-weight: 500;
    font-size: .9rem;
    color: var(--ink-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-family: var(--mono); font-size: .75rem; margin-left: .3rem; }

.console {
    background: var(--code-bg);
    color: var(--code-ink);
    font-family: var(--mono);
    font-size: .85rem;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    min-height: 3rem;
    max-height: 340px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}
.console.error { color: #ffb4aa; }
.console .placeholder { color: var(--code-comment); }
textarea.stdin {
    width: 100%;
    min-height: 90px;
    font-family: var(--mono);
    font-size: .85rem;
    padding: .7rem .8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    resize: vertical;
}

.tests { display: flex; flex-direction: column; gap: .5rem; }
.test-row { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.test-row > summary, .test-row > .test-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .6rem;
    padding: .6rem .85rem;
    cursor: pointer;
    list-style: none;
    font-size: .92rem;
}
.test-row > summary::-webkit-details-marker { display: none; }
.test-row .test-body { padding: 0 .85rem .85rem; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.test-row .test-body h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 .3rem; font-family: var(--mono); }
.test-row .console { max-height: 200px; font-size: .8rem; }
.test-row.pass { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.test-row.fail { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.banner {
    display: flex;
    gap: .8rem;
    align-items: center;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: .8rem;
    font-weight: 500;
}
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.ko { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--accent-2-soft); color: var(--accent-2); }
.banner .grow { flex: 1; }

.hints { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.hint { padding: .6rem .85rem; border-radius: var(--radius-sm); background: var(--accent-2-soft); font-size: .92rem; }
.hint b { font-family: var(--mono); font-size: .78rem; color: var(--accent-2); margin-right: .4rem; }

.file-list { display: flex; flex-direction: column; gap: .8rem; }
.file-list h4 { font-family: var(--mono); font-size: .85rem; margin: 0 0 .3rem; }

.spinner {
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tableaux de données ---------- */

.table-x { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table-x th, .table-x td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table-x th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
.table-x td.num, .table-x th.num { text-align: right; font-family: var(--mono); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap .table-x tr:last-child td { border-bottom: 0; }
.mini-bar { display: flex; align-items: center; gap: .6rem; min-width: 140px; }
.mini-bar .progress-x { flex: 1; height: 6px; }
.mini-bar span.v { font-family: var(--mono); font-size: .8rem; width: 3rem; text-align: right; }

.toolbar-x { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.search-input {
    padding: .5rem .8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    min-width: 260px;
    font-family: var(--font);
}

/* ---------- Authentification (pages Identity) ---------- */

.auth-wrap { display: grid; place-items: center; padding: 2rem 0; }
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.6rem; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; font-size: .9rem; }

.form-control, .form-select {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-strong);
}
.form-control:focus {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 22%, transparent);
}
.form-floating > label { color: var(--ink-3); }
.form-floating > .form-control:focus ~ label, .form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--ink-2); }
.form-floating > .form-control:focus ~ label::after, .form-floating > .form-control:not(:placeholder-shown) ~ label::after { background: transparent; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.text-danger { color: var(--danger) !important; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: var(--accent); }
.nav-pills .nav-link.active { background: var(--accent); color: var(--accent-ink); }
.nav-pills .nav-link { color: var(--ink-2); }
hr { border-color: var(--line); opacity: 1; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--ok); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

/* ---------- Divers ---------- */

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-3); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 2.2rem 0 .9rem; }
.section-head h2 { margin: 0; }
.stack > * + * { margin-top: 1rem; }
.mt-0 { margin-top: 0 !important; }

#blazor-error-ui {
    background: var(--accent-2-soft);
    color: var(--ink);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: var(--danger-soft);
    padding: 1rem;
    color: var(--danger);
    border-radius: var(--radius-sm);
}
.blazor-error-boundary::after { content: "Une erreur est survenue."; }

/* ---------- Correctifs de mise en page étroite ---------- */
.ide > *, .grid > *, .lesson-layout > * { min-width: 0; }
@media (max-width: 1080px) { .ide { grid-template-columns: minmax(0, 1fr); } }
.prose code { overflow-wrap: anywhere; }
.module-card .meta { gap: .75rem; align-items: baseline; }
.module-card .meta span:last-child { white-space: nowrap; }
@media (max-width: 600px) {
    .page { padding: 1.25rem 1rem 3rem; }
    .card-x { padding: 1rem; }
    .editor-host .CodeMirror { height: 380px; font-size: 13px; }
    .ide-actions .hint-keys { display: none; }
    .footer { flex-direction: column; gap: .3rem; }
}
