/* AtelierCTF – thème sombre « terminal ». Aucune police ni image externe (fonctionne hors Internet).
   Mobile d'abord pour les cibles tactiles ; mise en page en 3 colonnes à partir de 1100 px (voir la fin du fichier). */
:root {
  color-scheme: dark;
  --bg: #050709;
  --panel: #0e151d;
  --panel-2: #121c26;
  --line: #1e2b38;
  --line-2: #2a3b4d;
  --fg: #c9d6e2;
  --fg-strong: #eaf2f8;
  --muted: #7b8a9b;
  --accent: #39ff88;          /* vert « phosphore » */
  --accent-dim: #1f9d57;
  --link: #4cc9f0;            /* cyan */
  --warn: #ffb020;
  --err: #ff4d6d;
  --ok: #39ff88;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --radius: 6px;
  --glow: 0 0 .5rem rgba(57, 255, 136, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.55 var(--sans); color: var(--fg); background: var(--bg);
}
/* Fond : vagues grises sur noir, très discrètes, qui glissent lentement (deux nappes en sens opposés).
   Images SVG en ligne (CSP : img-src data:) ; seule la propriété transform est animée (composition GPU, pas de
   repeinte de la page). Animation coupée si le système demande moins de mouvement. */
body::before, body::after {
  content: ""; position: fixed; top: 0; bottom: 0; left: 0; z-index: -1; pointer-events: none;
  background-repeat: repeat; will-change: transform;
}
body::before {
  width: calc(100% + 1200px); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='320' viewBox='0 0 1200 320'%3E%3Cg fill='none' stroke='%238a96a3' stroke-opacity='0.075' stroke-width='1'%3E%3Cpath d='M0 124.0 C150 78.0 450 78.0 600 124.0 S1050 170.0 1200 124.0'/%3E%3Cpath d='M0 133.0 C150 89.3 450 89.3 600 133.0 S1050 176.7 1200 133.0'/%3E%3Cpath d='M0 142.0 C150 100.6 450 100.6 600 142.0 S1050 183.4 1200 142.0'/%3E%3Cpath d='M0 151.0 C150 111.9 450 111.9 600 151.0 S1050 190.1 1200 151.0'/%3E%3Cpath d='M0 160.0 C150 123.2 450 123.2 600 160.0 S1050 196.8 1200 160.0'/%3E%3Cpath d='M0 169.0 C150 134.5 450 134.5 600 169.0 S1050 203.5 1200 169.0'/%3E%3Cpath d='M0 178.0 C150 145.8 450 145.8 600 178.0 S1050 210.2 1200 178.0'/%3E%3Cpath d='M0 187.0 C150 157.1 450 157.1 600 187.0 S1050 216.9 1200 187.0'/%3E%3Cpath d='M0 196.0 C150 168.4 450 168.4 600 196.0 S1050 223.6 1200 196.0'/%3E%3C/g%3E%3C/svg%3E"); background-size: 1200px 320px;
  animation: waves-a 120s linear infinite;
}
body::after {
  width: calc(100% + 1600px); left: -1600px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='460' viewBox='0 0 1600 460'%3E%3Cg fill='none' stroke='%238a96a3' stroke-opacity='0.06' stroke-width='1' stroke-dasharray='2 7'%3E%3Cpath d='M0 195.0 C200 125.0 600 125.0 800 195.0 S1400 265.0 1600 195.0'/%3E%3Cpath d='M0 209.0 C200 142.5 600 142.5 800 209.0 S1400 275.5 1600 209.0'/%3E%3Cpath d='M0 223.0 C200 160.0 600 160.0 800 223.0 S1400 286.0 1600 223.0'/%3E%3Cpath d='M0 237.0 C200 177.5 600 177.5 800 237.0 S1400 296.5 1600 237.0'/%3E%3Cpath d='M0 251.0 C200 195.0 600 195.0 800 251.0 S1400 307.0 1600 251.0'/%3E%3Cpath d='M0 265.0 C200 212.5 600 212.5 800 265.0 S1400 317.5 1600 265.0'/%3E%3C/g%3E%3C/svg%3E"); background-size: 1600px 460px;
  background-position: 0 140px; animation: waves-b 200s linear infinite;
}
@keyframes waves-a { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-1200px, 0, 0); } }
@keyframes waves-b { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(1600px, 0, 0); } }
::selection { background: var(--accent); color: #04110a; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--mono); color: var(--fg-strong); letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.6rem; text-shadow: var(--glow); }
h1::before { content: "# "; color: var(--accent); }
h2 { font-size: 1.15rem; }
img, video, svg { max-width: 100%; height: auto; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
code { background: #0a1118; border: 1px solid var(--line); color: var(--accent); padding: .05rem .3rem; border-radius: 4px;
       overflow-wrap: anywhere; }
pre code { border: 0; padding: 0; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------- pages sans cadre (connexion…) */
body > header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1.2rem;
                background: rgba(14, 21, 29, .9); border-bottom: 1px solid var(--line); }
body > header nav { display: flex; gap: 1rem; align-items: center; }
main { max-width: 40rem; margin: 2rem auto; padding: 0 1rem; }
.brand { font-family: var(--mono); font-weight: 700; text-decoration: none; color: var(--accent); text-shadow: var(--glow);
         white-space: nowrap; }
.brand::before { content: ">_ "; color: var(--fg); text-shadow: none; }
.brand::after { content: "▌"; margin-left: .15rem; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --------------------------------------------------------------------- formulaires, boutons */
.card > button { justify-self: start; }
.card { display: grid; gap: .8rem; background: var(--panel); padding: 1.2rem; border: 1px solid var(--line);
        border-radius: var(--radius); }
label { display: grid; gap: .3rem; font-weight: 500; color: var(--fg-strong); }
input, select, textarea {
  font: inherit; font-size: 1rem; /* 16 px : pas de zoom automatique sur iOS */
  padding: .55rem .7rem; color: var(--fg-strong); background: #081018; border: 1px solid var(--line-2);
  border-radius: var(--radius); caret-color: var(--accent); min-height: 2.6rem; max-width: 100%;
}
input[name="flag"], input[type="password"], textarea { font-family: var(--mono); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
input[type="checkbox"], input[type="radio"] { min-height: auto; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
textarea { width: 100%; }
button {
  /* Bouton principal : fond vert sombre, bord et texte verts (un fond vert vif éblouit sur fond noir). */
  font: 600 .95rem var(--mono); padding: .55rem 1.1rem; min-height: 2.6rem; border: 1px solid rgba(57, 255, 136, .5);
  border-radius: var(--radius); background: rgba(57, 255, 136, .12); color: #8dffbd; cursor: pointer; letter-spacing: .02em;
  transition: box-shadow .15s, background .15s, border-color .15s;
}
button:hover { background: rgba(57, 255, 136, .2); border-color: var(--accent); color: var(--accent); box-shadow: var(--glow); }
button:active { background: rgba(57, 255, 136, .28); }
button.secondary { background: transparent; color: var(--fg); border-color: var(--line-2); }
button.secondary:hover { border-color: var(--accent); color: var(--accent); }
button.link { background: none; border: 0; color: var(--link); padding: 0; min-height: auto; text-decoration: underline;
              font: inherit; letter-spacing: normal; }
button.link:hover { box-shadow: none; color: var(--accent); }
button.small, a.small { font-size: .8rem; padding: .25rem .7rem; min-height: 2rem; }
form.inline { display: inline; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .45rem; }
legend { margin-bottom: .3rem; }
label.choice { display: flex; gap: .6rem; font-weight: normal; align-items: center; color: var(--fg);
               padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); background: #0a121a; }
label.choice:hover { border-color: var(--line-2); }
label.choice:has(input:checked) { border-color: var(--accent-dim); background: rgba(57, 255, 136, .06); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }

/* --------------------------------------------------------------------- messages, étiquettes */
.error, .info { padding: .6rem .8rem; border-radius: var(--radius); border: 1px solid; font-family: var(--mono); font-size: .92rem; }
.error { color: var(--err); background: rgba(255, 77, 109, .08); border-color: rgba(255, 77, 109, .4); }
.error::before { content: "[x] "; }
.info { color: var(--accent); background: rgba(57, 255, 136, .06); border-color: rgba(57, 255, 136, .3); }
.info::before { content: "[+] "; }
.muted { color: var(--muted); font-size: .9rem; }
.alert { color: var(--err); }
.tag { font: 600 .72rem var(--mono); padding: .1rem .5rem; border-radius: 3px; border: 1px solid var(--line-2);
       color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.tag.warn { color: var(--warn); border-color: rgba(255, 176, 32, .5); background: rgba(255, 176, 32, .07); }
.tag.ok { color: var(--ok); border-color: var(--accent-dim); background: rgba(57, 255, 136, .07); }

/* --------------------------------------------------------------------- contenus */
.statement { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1rem;
             margin: 1rem 0; overflow-wrap: anywhere; line-height: 1.65; }
/* Lignes de 80 caractères au plus : plus faciles à suivre. Le code et les tableaux gardent toute la largeur. */
.statement p, .statement ul, .statement ol, .statement blockquote, .statement h1, .statement h2, .statement h3,
.statement h4 { max-width: 80ch; }
.statement p { margin: .55rem 0; }
.statement ul, .statement ol { padding-left: 1.4rem; margin: .5rem 0; }
.statement li { margin: .2rem 0; }
.statement li::marker { color: var(--accent-dim); }
.statement h1, .statement h2, .statement h3, .statement h4 { font-size: 1rem; margin: 1.1rem 0 .4rem; color: var(--accent);
                                                             text-shadow: none; }
.statement h1::before, .statement h2::before, .statement h3::before, .statement h4::before { content: "## "; color: var(--accent-dim); }
.statement strong { color: var(--fg-strong); }
.statement a { overflow-wrap: anywhere; }
.statement pre { max-height: 28rem; }
.statement pre { overflow-x: auto; background: #050a0f; border: 1px solid var(--line); padding: .7rem .8rem;
                 border-radius: var(--radius); color: #b7f7cf; }
.statement blockquote { margin: .8rem 0; padding: .2rem 1rem; border-left: 3px solid var(--line-2); color: var(--muted); }
.statement table { border-collapse: collapse; display: block; overflow-x: auto; }
.statement th, .statement td { border: 1px solid var(--line); padding: .3rem .6rem; }
.sets { list-style: none; padding: 0; display: grid; gap: .4rem; }
.sets li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .8rem; }
.sets li:hover { border-color: var(--line-2); }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line);
             border-radius: var(--radius); }
table.list td, table.list th { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: left; }
table.list th { font: 600 .8rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
table.list .num { text-align: right; font-family: var(--mono); }
table.list tr:hover td { background: rgba(255, 255, 255, .02); }
tr.me td { background: rgba(57, 255, 136, .08); color: var(--accent); font-weight: 600; }
td.pre { white-space: pre-line; }
details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .75rem;
          margin-bottom: .3rem; }
details summary { cursor: pointer; font-family: var(--mono); }
details[open] > label.choice { margin-left: .5rem; }
.instance { margin-bottom: .8rem; }
.instance ul.svc { margin: 0; padding-left: 1.2rem; }

/* --------------------------------------------------------------------- temps réel, tableau de bord */
main.wide { max-width: 90rem; }
.live-status { font: .8rem var(--mono); color: var(--muted); }
.live-status.on::before { content: "● "; color: var(--ok); text-shadow: var(--glow); }
.live-status.off::before { content: "● "; color: var(--err); }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem; }
.stats strong { display: block; font: 700 1.5rem var(--mono); color: var(--accent); text-shadow: var(--glow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: 1rem; }
.matrix-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.matrix { border-collapse: collapse; font: .82rem var(--mono); }
table.matrix th, table.matrix td { padding: .2rem .45rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.matrix thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
table.matrix th.col { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 10rem; overflow: hidden; font-weight: normal; }
table.matrix td.solved { background: rgba(57, 255, 136, .18); color: var(--ok); text-align: center; }
table.matrix td.tried { background: rgba(255, 176, 32, .16); color: var(--warn); text-align: center; }
table.matrix td.none { text-align: center; color: #34465a; }
table.matrix th.name { position: sticky; left: 0; background: var(--panel-2); text-align: left; }
svg.chart { width: 100%; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
svg.chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; filter: drop-shadow(0 0 3px rgba(57, 255, 136, .6)); }

/* --------------------------------------------------------------------- questionnaire chronométré */
.timer { position: sticky; top: 0; z-index: 5; font-family: var(--mono); background: rgba(14, 21, 29, .95);
         border: 1px solid var(--line-2); border-radius: var(--radius); padding: .5rem .8rem; }
.timer strong { color: var(--accent); text-shadow: var(--glow); font-size: 1.2rem; }
.quiz { display: grid; gap: .8rem; }

/* ===================================================================== cadre des pages connectées */
/* Mobile (par défaut) : barre du haut avec le menu en tiroir, notifications compactes, contenu. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "notices" "main"; min-height: 100vh; }
.layout > main { grid-area: main; max-width: none; margin: 0; padding: 1rem .8rem 3rem; min-width: 0; }

.sidebar { grid-area: side; position: sticky; top: 0; z-index: 30; background: rgba(7, 10, 14, .92);
           border-bottom: 1px solid var(--line); padding: .4rem .7rem; backdrop-filter: blur(6px); }
.side-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; min-height: 2.6rem; }
.side-toggle { background: transparent; color: var(--accent); border: 1px solid var(--line-2); padding: 0; width: 2.6rem;
               min-height: 2.6rem; font: 700 1.2rem var(--mono); }
.side-toggle:hover { border-color: var(--accent); }
.side-nav { display: grid; gap: .1rem; font-size: .95rem; padding: .4rem 0 1rem; }
/* Tiroir mobile : fermé par défaut (même avant le chargement du script), ouvert par le bouton ☰ (classe menu-open),
   avec son propre défilement. */
.side-nav { display: none; }
.layout.menu-open .side-nav { display: grid; max-height: calc(100vh - 3.6rem); max-height: calc(100dvh - 3.6rem);
                              overflow-y: auto; overscroll-behavior: contain; }
.side-item { display: flex; align-items: center; gap: .5rem; padding: .55rem .6rem; border-radius: var(--radius);
             text-decoration: none; color: var(--fg); border: 1px solid transparent; }
.side-item:hover, .side-theme li a:hover { background: rgba(57, 255, 136, .06); color: var(--accent); }
.side-item.current, .side-theme a.current { background: rgba(57, 255, 136, .09); border-color: rgba(57, 255, 136, .35);
                                            color: var(--accent); font-weight: 600; }
.side-item button.link { display: flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; font: inherit; }
.ico { display: inline-block; flex: 0 0 1.9rem; width: 1.9rem; text-align: center; font: 700 .85rem var(--mono); color: var(--accent); }
.side-sep { margin: .9rem 0 .2rem; padding: .6rem .6rem 0; border-top: 1px dashed var(--line-2);
            font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side-sep::before { content: "// "; color: var(--accent-dim); }
.side-sep:empty::before { content: ""; }
.side-theme { border: 0; background: none; padding: 0; margin: 0; }
.side-theme summary { padding: .45rem .6rem; font: 600 .92rem var(--mono); color: var(--fg-strong); border-radius: var(--radius);
                      list-style: none; }
.side-theme summary::-webkit-details-marker { display: none; }
.side-theme summary::before { content: "▸ "; color: var(--accent); }
.side-theme[open] summary::before { content: "▾ "; }
.side-theme ul { list-style: none; margin: 0 0 .2rem; padding: 0 0 0 .9rem; border-left: 1px solid var(--line); margin-left: .9rem; }
.side-theme li { display: flex; align-items: center; gap: .3rem; }
.side-theme li a { flex: 1; padding: .45rem .5rem; border-radius: var(--radius); text-decoration: none; color: var(--fg);
                   border: 1px solid transparent; }
.progress { font: .75rem var(--mono); color: var(--muted); padding-right: .3rem; }
.progress.full { color: var(--ok); font-weight: 700; }

/* Notifications */
.notices { grid-area: notices; padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: rgba(9, 14, 20, .6);
           max-height: 11rem; overflow-y: auto; }
.notices:not(:has(.notice:not([hidden]))) { display: none; }   /* rien à signaler : pas de panneau sur petit écran */
.notices-title { font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; }
.notices-title::before { content: "// "; color: var(--accent-dim); }
.notice { position: relative; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--link);
          border-radius: var(--radius); padding: .5rem .7rem; margin-bottom: .5rem; font-size: .9rem; }
.notice p { margin: .1rem 0; }
.notice-head { font: 600 .85rem var(--mono); color: var(--fg-strong); padding-right: 1.8rem; }
.notice-text { white-space: pre-line; overflow-wrap: anywhere; }
.notice.msg { border-left-color: var(--warn); }
.notice.msg .notice-head { color: var(--warn); }
.notice.inst .notice-head { color: var(--link); }
.notice.inst.warn { border-left-color: var(--warn); background: rgba(255, 176, 32, .07); }
.notice.inst.warn [data-countdown] { color: var(--warn); }
.notice.inst.expired { border-left-color: var(--err); opacity: .7; }
.notice.inst.expired [data-countdown] { color: var(--err); }
.notice .actions { margin-top: .35rem; }
.dismiss { position: absolute; top: .15rem; right: .15rem; background: none; border: 0; color: var(--muted); padding: 0;
           width: 2rem; min-height: 2rem; font-size: 1.1rem; }
.dismiss:hover { color: var(--err); box-shadow: none; }

/* Page d'un sujet : cellules pleine largeur */
main.cells { display: grid; gap: 1rem; align-content: start; }
.cell { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
        padding: .3rem 1rem 1rem; scroll-margin-top: 4rem; min-width: 0; }
.cell::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: var(--radius) var(--radius) 0 0;
                background: linear-gradient(90deg, var(--accent-dim), transparent 70%); opacity: .6; }
.cell:target { border-color: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-dim), var(--glow); }
.cell .statement { border: 0; padding: 0; margin: .5rem 0; background: none; }
.cell.solved { border-left: 3px solid var(--ok); }
.cell-head h1 { margin: .2rem 0 .4rem; }
.cell-title { display: flex; align-items: center; gap: .4rem .7rem; flex-wrap: wrap; border-bottom: 1px dashed var(--line-2);
              padding: .55rem 0 .5rem; }
.cell-title .num { font: 700 .8rem var(--mono); color: #04110a; background: var(--accent-dim); border-radius: 4px;
                   padding: .1rem .4rem; min-width: 2rem; text-align: center; }
.cell.solved .cell-title .num { background: var(--accent); }
.cell.lesson .cell-title .num { background: var(--link); }
.cell-title h2 { margin: 0; font-size: 1.1rem; flex: 1 1 10rem; }
.cell-title .pts { font: 700 .85rem var(--mono); color: var(--accent); }
.cell-title .muted { font-family: var(--mono); font-size: .8rem; }
.tag.lesson { color: var(--link); border-color: rgba(76, 201, 240, .45); }
.cell.lesson { border-left: 3px solid var(--link); }
.cell.lesson::before { background: linear-gradient(90deg, var(--link), transparent 70%); }
.permalink { text-decoration: none; font-family: var(--mono); padding: .2rem .4rem; }
.crumbs { margin: .6rem 0 0; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.box-panel { border-top: 1px dashed var(--line-2); margin-top: .8rem; }
.box-panel h2 { font-size: 1rem; }
.inline-form { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
form.answer { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin: .8rem 0; }
form.answer label { flex: 1 1 14rem; }
form.answer fieldset { flex: 1 1 100%; }
form.answer button { flex: 0 0 auto; }
.files { font-size: .9rem; font-family: var(--mono); }
.hints details { display: inline-block; vertical-align: top; margin-right: .4rem; max-width: 100%; }
/* Sommaire du sujet : une pastille par challenge (numéro, titre, état) */
.toc { list-style: none; margin: .9rem 0 .2rem; padding: .7rem 0 0; border-top: 1px dashed var(--line-2);
       display: grid; grid-template-columns: repeat(auto-fill, minmax(min(12.5rem, 100%), 1fr)); gap: .35rem; }
.toc a { display: flex; align-items: center; gap: .5rem; padding: .35rem .55rem; min-height: 2.3rem; text-decoration: none;
         color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); background: #0a1118; font-size: .88rem; }
.toc a:hover { border-color: var(--accent-dim); color: var(--accent); }
.toc .num { font: 700 .78rem var(--mono); color: var(--muted); }
.toc .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc a.ok { border-color: rgba(57, 255, 136, .35); color: var(--ok); }
.toc a.ok .num::before { content: "✔ "; }
.toc a.lesson .num { color: var(--link); }

/* Petits écrans : tableaux défilants, cibles tactiles confortables */
@media (max-width: 699px) {
  h1 { font-size: 1.35rem; }
  table.list { display: block; overflow-x: auto; }
  .layout > main.cells { gap: .7rem; }
  .cell { padding: .2rem .8rem .9rem; }
  form.answer button { flex: 1 1 100%; }
  .filters > * { flex: 1 1 100%; }
}
@media (pointer: coarse) {
  .side-theme li a, .side-item { min-height: 2.75rem; }
  .hints details summary { padding: .4rem 0; }
}

/* Tablette : index à gauche (repliable), notifications au-dessus du contenu */
@media (min-width: 700px) {
  .layout { grid-template-columns: 15rem minmax(0, 1fr); grid-template-areas: "side notices" "side main";
            grid-template-rows: auto 1fr; }
  .layout.collapsed { grid-template-columns: 3.2rem minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; border-bottom: 0;
             border-right: 1px solid var(--line); padding: .6rem .6rem 2rem; }
  .side-nav, .layout.menu-open .side-nav { display: grid; max-height: none; overflow: visible; }
  .layout.collapsed .side-nav { display: none; }
  .layout.collapsed .sidebar { padding: .6rem .3rem; overflow: hidden; }
  .layout.collapsed .brand { display: none; }
  .layout.collapsed .side-head { justify-content: center; }
  .layout > main { padding: 1.2rem 1.4rem 3rem; }
  .cell { padding: .4rem 1.3rem 1.1rem; }
}

/* Ordinateur : 3 colonnes, notifications à droite */
@media (min-width: 1100px) {
  .layout { grid-template-columns: 16rem minmax(0, 1fr) 19rem; grid-template-areas: "side main notices"; grid-template-rows: auto; }
  .layout.collapsed { grid-template-columns: 3.2rem minmax(0, 1fr) 19rem; }
  .notices { position: sticky; top: 0; height: 100vh; max-height: none; padding: 1rem .8rem; border-bottom: 0;
             border-left: 1px solid var(--line); background: rgba(9, 14, 20, .55); }
  .notices:not(:has(.notice:not([hidden]))) { display: block; }
  .layout > main { padding: 1.4rem 1.8rem 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .brand::after, body::before, body::after { animation: none; }
  button { transition: none; }
}

/* Cellules repliables : un clic sur le titre ne laisse que la barre de titre (ui.js) */
.cell-title[data-cell-toggle] { cursor: pointer; user-select: none; }
.cell-toggle { display: flex; align-items: center; gap: .6rem; width: 100%; background: none; border: 0; padding: 0;
               min-height: 2rem; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.cell-toggle:hover { box-shadow: none; color: var(--accent); }
.cell-toggle::after { content: "▾"; margin-left: auto; padding-left: .4rem; color: var(--muted); font-size: .9rem; }
.cell.folded .cell-toggle::after { content: "▸"; }
.cell.folded .cell-body { display: none; }
.cell.folded .cell-title { border-bottom: 0; }
.cell.folded { padding-bottom: .3rem; }
.fold-all { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }

/* Réponse : invite « flag> » et bouton sur une ligne */
.flag-field { display: flex; align-items: stretch; gap: 0; flex: 1 1 16rem; font-weight: normal; }
.flag-field .prompt { display: flex; align-items: center; padding: 0 .6rem; font: 700 .9rem var(--mono); color: var(--accent);
                      background: #050a0f; border: 1px solid var(--line-2); border-right: 0;
                      border-radius: var(--radius) 0 0 var(--radius); }
.flag-field input { flex: 1; min-width: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.flag-field input::placeholder { color: #3d4d5e; }
form.answer { align-items: stretch; }

/* Éditeur de challenges et diff (enseignant) */
textarea.code-edit { min-height: 24rem; font-size: .88rem; line-height: 1.5; tab-size: 2; white-space: pre; overflow: auto; }
pre.diff { overflow-x: auto; background: #050a0f; border: 1px solid var(--line); padding: .7rem .8rem; border-radius: var(--radius);
  line-height: 1.5; }
pre.diff span { display: block; }
pre.diff .add { color: var(--ok); background: rgba(57, 255, 136, .07); }
pre.diff .del { color: var(--err); background: rgba(255, 77, 109, .07); }
pre.diff .hunk { color: var(--link); }
pre.diff .meta { color: var(--muted); }
.chall > * { margin: 0; }
.chall h2 { font-size: 1.1rem; }
