:root {
  --bg: #f4f7fb; --card: #fff; --ink: #1f2a44; --muted: #6b7694; --line: #dbe2ee;
  --main: #3b6cf6; --main-ink: #fff; --good: #1f9d55; --good-bg: #e3f6ea; --bad: #d64545; --bad-bg: #fde8e8; --pick: #e6edff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131a2b; --card: #1c2540; --ink: #eef2ff; --muted: #9aa6c7; --line: #2d3860; --pick: #263466; --good-bg: #17382a; --bad-bg: #402024; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 20px/1.5 system-ui, "Segoe UI", sans-serif; }
.wrap { max-width: 900px; margin: 0 auto; padding: 16px; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.bar .grow { flex: 1; font-weight: 700; }
.bar small { color: var(--muted); font-weight: 400; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin: 16px 0; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.6rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], textarea, select { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); }
textarea { resize: vertical; }
label.f { display: block; margin: 14px 0 4px; font-weight: 600; }
.btn { background: var(--main); color: var(--main-ink); border: 0; border-radius: 14px; padding: 12px 22px; min-height: 48px; font-weight: 700; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--main); border: 2px solid var(--main); }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .4; cursor: default; }
.err { color: var(--bad); font-weight: 600; min-height: 1.5em; }
.emoji { font-size: 4rem; line-height: 1; }
.question { font-weight: 700; font-size: 1.15em; }
.text { font-size: 1.1em; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 12px; }
.card { background: var(--bg); border-radius: 16px; padding: 14px; }
.card .icon { font-size: 2.2rem; }
.card h3 { font-size: 1.1rem; margin: 4px 0; }
.card p { margin: 0; font-size: .9em; color: var(--muted); }
.choices { display: grid; gap: 10px; }
.choice { text-align: left; background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; min-height: 56px; cursor: pointer; }
.choice.picked { border-color: var(--main); background: var(--pick); }
.choice.good, .row.good { border-color: var(--good); background: var(--good-bg); }
.choice.bad, .row.bad { border-color: var(--bad); background: var(--bad-bg); }
.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); min-height: 56px; }
.row input[type=checkbox] { width: 28px; height: 28px; flex: none; }
.row .rowtext { flex: 1; }
.matchrow { flex-wrap: wrap; }
.matchrow select { width: 230px; flex: none; }
.mark { font-weight: 700; }
.verdict { padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.verdict.ok { background: var(--good-bg); color: var(--good); }
.verdict.ko { background: var(--bad-bg); color: var(--bad); }
.verdict.neutral { background: var(--bg); color: var(--muted); }
.explain { background: var(--pick); border-radius: 14px; padding: 12px 16px; margin-top: 12px; }
.saved { color: var(--good); font-weight: 600; margin: 8px 0 0; }
.nav { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--line); margin-right: 6px; }
.dot.on { background: var(--good); }
/* prof */
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; max-width: 1300px; margin: 0 auto; padding: 16px; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } }
.side .cls { display: block; width: 100%; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; cursor: pointer; }
.side .cls.sel { border-color: var(--main); }
.side .cls.arch { opacity: .6; }
.code { font: 700 2.4rem/1 ui-monospace, Consolas, monospace; letter-spacing: .15em; background: var(--pick); padding: 8px 16px; border-radius: 14px; display: inline-block; }
table { width: 100%; border-collapse: collapse; font-size: .85em; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ok { color: var(--good); font-weight: 700; } .ko { color: var(--bad); font-weight: 700; }
details.key { margin-top: 14px; border: 2px dashed var(--line); border-radius: 14px; padding: 8px 14px; }
.hide { display: none !important; }

/* ---------- Pixel art & mini-jeux ---------- */
.pixavatar { image-rendering: pixelated; vertical-align: middle; }
.panel.game { border: 4px solid var(--ink); border-radius: 6px; box-shadow: 6px 6px 0 var(--ink); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.panel.game h2 { text-transform: uppercase; letter-spacing: .04em; }
.panel.game .choice, .panel.game .btn, .panel.game .tok, .panel.game .bin, .panel.game .blk, .panel.game .slot, .panel.game .mcard { border-radius: 4px; font-family: inherit; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatars button { background: var(--bg); border: 3px solid var(--line); border-radius: 6px; padding: 6px 0; cursor: pointer; min-height: 56px; }
.avatars button.sel { border-color: var(--main); background: var(--pick); }
.colors { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.colors button { width: 44px; height: 44px; border: 3px solid var(--line); border-radius: 6px; cursor: pointer; }
.colors button.sel { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.me { display: inline-flex; align-items: center; gap: 6px; }
/* robot */
.board { display: grid; gap: 3px; margin: 10px 0; background: var(--ink); padding: 3px; border-radius: 4px; }
.cell { background: #cfe8c3; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; position: relative; font-size: 1.8rem; }
.cell:nth-child(even) { background: #bfe0b2; }
.cell.wall { background: #8a8f9c; }
.cell .dirarrow { position: absolute; right: 1px; bottom: 0; font-size: .75rem; }
.cell .flag.small { position: absolute; left: 1px; top: 0; font-size: .8rem; }
.progbox { margin-top: 8px; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.tok { background: var(--pick); border: 3px solid var(--main); border-radius: 4px; padding: 8px 12px; min-height: 48px; font-weight: 700; cursor: pointer; }
.tok:disabled { opacity: .45; cursor: default; }
.repbox { display: inline-flex; align-items: center; gap: 6px; }
.repsel { width: 70px; padding: 8px; }
.progtitle { font-weight: 700; margin: 6px 0 4px; }
.prog { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 56px; background: var(--bg); border: 3px dashed var(--line); border-radius: 6px; padding: 8px; margin-bottom: 10px; }
.robotmsg { font-weight: 700; min-height: 1.5em; }
.robotmsg.ok { color: var(--good); } .robotmsg.ko { color: var(--bad); }
/* tri & paires */
.sortprog { color: var(--muted); font-weight: 700; margin: 4px 0; }
.sortcard { background: var(--bg); border: 4px solid var(--ink); border-radius: 6px; box-shadow: 4px 4px 0 var(--ink); padding: 18px; text-align: center; font-size: 1.3rem; font-weight: 700; margin: 10px 0 16px; }
.bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.bin { border: 4px solid var(--ink); padding: 18px 10px; min-height: 72px; font-weight: 700; cursor: pointer; background: #ffe9a8; color: #1f2a44; }
.bin1 { background: #ffc4c4; } .bin2 { background: #c4e2ff; }
.sortdone { text-align: center; }
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 560px) { .mgrid { grid-template-columns: repeat(3, 1fr); } }
.mcard { min-height: 84px; border: 4px solid var(--ink); background: #b9c8ff; color: #1f2a44; font-weight: 700; font-size: .95rem; cursor: pointer; padding: 6px; word-break: break-word; }
.mcard.up { background: #fff; }
.mcard.found { background: #b8f0c8; cursor: default; }
/* plateforme */
.hud { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; white-space: pre; }
.stage { position: relative; height: 230px; border: 4px solid var(--ink); background: linear-gradient(#7ec8ff 0 72%, #a9dfff 72%); overflow: hidden; border-radius: 4px; }
.stage .cloud { position: absolute; font-size: 2rem; opacity: .9; }
.stage .c1 { left: 20%; top: 14px; } .stage .c2 { left: 62%; top: 38px; }
.stage .plat { position: absolute; height: 18px; background: repeating-linear-gradient(90deg, #8b5a2b 0 16px, #a06a35 16px 32px); border-top: 5px solid #4cae4f; bottom: 100px; }
.stage .p1 { left: 30%; width: 64px; bottom: 120px; } .stage .p2 { left: 55%; width: 96px; bottom: 90px; }
.stage .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: repeating-linear-gradient(90deg, #8b5a2b 0 24px, #7a4d22 24px 48px); border-top: 10px solid #4cae4f; }
.hero, .foe { position: absolute; bottom: 40px; transition: transform .25s steps(4); }
.hero { left: 7%; } .foe { right: 7%; }
.hero.attack { transform: translateX(min(38vw, 280px)); }
.hero.hurt { animation: blink .6s steps(2) 1; }
.foe.in { animation: foein .5s steps(5) 1; }
.foe.hit { transform: translateX(-60px); }
.foe.dead { opacity: 0; transform: translateY(-50px) rotate(160deg); transition: all .5s; }
@keyframes foein { from { transform: translateX(160px); } to { transform: none; } }
@keyframes blink { 50% { opacity: .15; } }
.qpanel { margin-top: 12px; }
/* construction */
.plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.slot { min-height: 84px; border: 4px dashed var(--muted); background: var(--bg); padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.slot small { color: var(--muted); font-size: .72rem; }
.slot.placed { border: 4px solid #5b3a1a; background: repeating-linear-gradient(45deg, #b07a43 0 8px, #a06c38 8px 16px); color: #fff; cursor: default; }
.slot.placed small { color: #f3e2c6; }
.slot.wrong { animation: shake .4s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.hotbar { background: #3a3a46; border: 4px solid var(--ink); padding: 8px; border-radius: 4px; }
.hotbar small { color: #cfd3e0; }
.blks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.blk { display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 8px; background: #8b8b99; border: 4px solid #1f1f28; color: #fff; font-weight: 700; font-size: .8rem; cursor: pointer; }
.blk.sel { border-color: #ffd23f; background: #a6a6b8; transform: translateY(-4px); }
.blk:disabled { opacity: .3; }
.bemoji { font-size: 1.6rem; }
.certbox { text-align: center; margin-top: 12px; display: grid; gap: 12px; justify-items: center; }
a.btn { display: inline-block; text-decoration: none; }

/* ---------- Tablette épurée ---------- */
.letters { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; margin-top: 10px; }
.letter { font: 800 2.6rem/1 ui-monospace, Consolas, monospace; min-height: 110px; border: 4px solid var(--ink); border-radius: 6px; background: var(--bg); box-shadow: 4px 4px 0 var(--ink); cursor: pointer; color: var(--ink); }
.letter.picked { background: var(--main); color: #fff; }
.lookup { text-align: center; padding: 30px 0; }
.lookup .emoji { font-size: 5rem; }
.slimtitle { font-size: 1.2rem; }
.timeup { background: var(--bad-bg); color: var(--bad); font-weight: 800; padding: 10px 14px; border-radius: 8px; }
.ltr { display: inline-block; min-width: 1.6em; font-weight: 800; color: var(--main); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0 12px; }
.legend .lg b { color: var(--main); }
.choice { position: relative; overflow: hidden; }
.choice > * { position: relative; }
.choice .distbar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--pick); z-index: 0; }
.choice .distn { float: right; color: var(--muted); font-size: .85em; }
.boardgame { text-align: center; padding: 20px 0; }
.boardgame .emoji { font-size: 5rem; }

/* ---------- Chrono pixel ---------- */
.ptimer { display: flex; align-items: center; gap: 12px; background: var(--card); border: 4px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); border-radius: 6px; padding: 8px 12px; margin: 12px 0; font-family: ui-monospace, Consolas, monospace; }
.ptimer .clock { font-size: 1.6rem; }
.ptimer .digits { font-weight: 800; font-size: 1.6rem; min-width: 4.2em; }
.ptimer .track { position: relative; flex: 1; height: 44px; }
.ptimer .cells { position: absolute; left: 0; right: 30px; bottom: 0; display: flex; gap: 3px; height: 12px; }
.ptimer .tc { flex: 1; background: var(--line); }
.ptimer .tc.on { background: #2fb36b; }
.ptimer.mid .tc.on { background: #f5a623; }
.ptimer.low .tc.on { background: #e8453c; }
.ptimer .runner, .ptimer .chaser { position: absolute; bottom: 12px; transition: left .2s linear; }
.ptimer .runner { animation: hop .4s steps(2) infinite; }
.ptimer .chaser { animation: hop .3s steps(2) infinite; }
.ptimer .goal { position: absolute; right: 0; bottom: 10px; font-size: 1.4rem; }
.ptimer.hurry { animation: pulse .5s steps(2) infinite; }
.ptimer.hurry .digits { color: var(--bad); }
.ptimer.over { background: var(--bad-bg); }
.ptimer.over .runner, .ptimer.over .chaser { animation: none; }
.ptimer.over .digits { color: var(--bad); min-width: 0; }
.ptimer.big { padding: 14px 20px; }
.ptimer.big .digits { font-size: 3rem; }
.ptimer.big .clock { font-size: 2.6rem; }
.ptimer.big .track { height: 78px; }
.ptimer.big .cells { height: 20px; }
.ptimer.big .runner, .ptimer.big .chaser { bottom: 20px; }
.ptimer.big .goal { font-size: 2.4rem; bottom: 18px; }
@keyframes hop { 50% { transform: translateY(-5px); } }
@keyframes pulse { 50% { box-shadow: 4px 4px 0 var(--bad); border-color: var(--bad); } }

/* ---------- Poste du prof ---------- */
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .85em; }
.btn.prevu { border-width: 3px; }
.timerctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.timerctl input { padding: 6px 10px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .85em; }
.toggle input { width: 22px; height: 22px; }
.opentext { white-space: pre-wrap; }
tr.sharedrow { background: var(--pick); }
.preview { border: 2px dashed var(--line); border-radius: 14px; padding: 14px; }

/* ---------- Écran de projection ---------- */
.projbody { font-size: 26px; }
.projbody .pbar { font-size: 22px; }
.pwrap { max-width: 1400px; margin: 0 auto; padding: 16px 24px 90px; }
.pslide h2 { font-size: 2.2rem; }
.pslide .question { font-size: 1.3em; }
.code.huge { font-size: 5rem; }
#pWelcome { text-align: center; }
#pShared h3 { margin: 18px 0 10px; }
.bubbles { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.bubble { background: var(--card); border: 4px solid var(--ink); border-radius: 6px; box-shadow: 5px 5px 0 var(--ink); padding: 12px 16px; }
.bubble .who { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .7em; font-weight: 700; }
.bubble p { margin: 6px 0 0; white-space: pre-wrap; }
.pctl { position: fixed; right: 12px; bottom: 12px; display: flex; gap: 6px; opacity: .25; transition: opacity .2s; font-size: 16px; }
.pctl:hover { opacity: 1; }

/* ---------- Chatbot PixIA ---------- */
.chatlog { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; background: var(--bg); border: 4px solid var(--ink); border-radius: 6px; padding: 12px; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.msg p { margin: 0; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 4px; white-space: pre-wrap; }
.msg.bot p { background: #f0e4ff; color: #1f2a44; box-shadow: 3px 3px 0 var(--ink); }
.msg.me { align-self: flex-end; }
.msg.me p { background: var(--main); color: #fff; box-shadow: -3px 3px 0 var(--ink); }
.msg.thinking p { font-style: italic; animation: blink 1s steps(2) infinite; }
.msg .who { flex: none; }
.chatin { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.chatin textarea { flex: 1; }
.convo { border-top: 2px dashed var(--line); margin-top: 6px; padding-top: 4px; }
.convo p { margin: 2px 0; }
.convo .q { font-weight: 700; }
.convo .r { color: var(--muted); }

/* ---------- Connexion seul / en groupe ---------- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.mode { min-height: 56px; border: 3px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 700; cursor: pointer; }
.mode.sel { border-color: var(--main); background: var(--pick); }
.member { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.grp { color: var(--muted); }

/* Champs obligatoires / facultatifs */
.req, .opt { font-size: .7em; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }
.req { background: var(--bad-bg); color: var(--bad); }
.opt { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* Erreur dans un fichier de chapitre */
.contenterr { max-width: 1300px; margin: 16px auto 0; background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad); border-radius: 12px; padding: 10px 16px; font-size: .85em; }
.contenterr ul { margin: 6px 0 0; }

/* Pastilles « qui a répondu » */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); font-size: .8em; color: var(--muted); }
.chip.done { background: var(--good-bg); border-color: var(--good); color: var(--good); font-weight: 700; }
.chip.off { opacity: .5; }
.answered { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; font-weight: 700; font-size: .8em; }
.answered .ava { opacity: .25; filter: grayscale(1); transition: all .3s; }
.answered .ava.done { opacity: 1; filter: none; transform: translateY(-3px); }

/* Écran de connexion : choisir son nom dans la liste */
.namegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.namegrid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.namecard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; min-height: 96px; border: 3px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.namecard small { font-weight: 400; color: var(--muted); font-size: .75em; text-align: center; }
.namecard:active, .namecard.sel { border-color: var(--main); background: var(--pick); }
.namegrid.small .namecard { min-height: 70px; padding: 8px; font-size: .9em; }
.linkbtn { background: none; border: 0; color: var(--main); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* Bouton Valider */
.btn.validate { margin-top: 14px; width: 100%; min-height: 60px; font-size: 1.1em; }
.saved { background: var(--good-bg); padding: 10px 14px; border-radius: 10px; }

/* Éditeur de diapo (espace prof) */
details.editor { margin-top: 14px; border: 2px solid var(--main); border-radius: 14px; padding: 8px 14px; }
details.editor > summary { font-weight: 700; color: var(--main); cursor: pointer; }
.ed-body { margin-top: 10px; }
.ed-field { display: block; margin: 12px 0; }
.ed-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9em; }
.ed-rows { display: grid; gap: 6px; margin-bottom: 6px; }
.ed-row { display: flex; gap: 8px; align-items: center; }
.ed-row .txt { flex: 1; }
.ed-row select { width: auto; max-width: 45%; }
.ed-row input[type=radio], .ed-row input[type=checkbox] { width: 22px; height: 22px; flex: none; }
.ed-yes { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: .85em; }
.ed-adv { margin-top: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .8em; }

/* Jeu des images (vraies photos à placer à côté du nom) */
.picslots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.picslot { border: 3px dashed var(--line); border-radius: 12px; padding: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; min-height: 170px; }
.picslot.ready { border-color: var(--main); cursor: pointer; }
.picname strong { display: block; font-size: 1.05em; }
.picname small { color: var(--muted); font-size: .8em; }
.picdrop { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.picwrap { position: relative; }
.picwrap .mark { position: absolute; top: -8px; right: -8px; background: var(--card); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 2px solid currentColor; }
.pic { width: 120px; height: 100px; object-fit: contain; background: #fff; border: 3px solid var(--line); border-radius: 10px; cursor: pointer; touch-action: manipulation; }
.pic.sel { border-color: var(--main); box-shadow: 0 0 0 4px var(--pick); transform: scale(1.05); }
.pic.noimg { display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.pictray { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--pick); }
.pics-free { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; min-height: 104px; }
.ed-thumb { width: 48px; height: 40px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; flex: none; }
.projbody .pic { width: 170px; height: 140px; }

/* Jeu « relier par des traits » */
.linkboard { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0 90px; margin-top: 8px; }
.lcol { display: flex; flex-direction: column; gap: 10px; justify-content: space-around; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 8px; border: 3px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; position: relative; z-index: 1; min-height: 96px; }
.lrow.left { justify-content: space-between; }
.lrow.sel { border-color: var(--main); box-shadow: 0 0 0 4px var(--pick); }
.lrow.ready { border-color: var(--main); }
.lrow .pic { width: 130px; height: 90px; }
.ldot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); background: var(--card); flex: none; }
.ldot.sel { background: var(--main); }
.llines { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: visible; }
@media (max-width: 640px) { .linkboard { gap: 0 50px; } .lrow .pic { width: 90px; height: 70px; } }
/* Tri avec photos */
.sortimg { width: 220px; height: 160px; object-fit: contain; background: #fff; border-radius: 8px; display: block; margin: 0 auto 8px; }
.sortthumb { width: 56px; height: 44px; object-fit: contain; background: #fff; border-radius: 6px; flex: none; }

/* PixIA : idées de messages à toucher */
.ideas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.idea { border: 2px solid var(--main); background: var(--pick); color: var(--ink); border-radius: 16px; padding: 6px 12px; font: inherit; font-size: .85em; cursor: pointer; }

/* Écran « 📚 Chapitres » */
.chlist { display: grid; gap: 6px; }
.chitem { display: flex; gap: 6px; align-items: center; }
.chitem .chname { flex: 1; text-align: left; background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; color: var(--ink); cursor: pointer; }
.chitem.sel .chname { border-color: var(--main); background: var(--pick); font-weight: 700; }
.chname small { color: var(--muted); font-weight: 400; }
.sllist { display: grid; gap: 6px; }
.slrow { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); }
.slrow.open { border-color: var(--main); }
.slnum { width: 28px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }
.sltitle { flex: 1; text-align: left; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; }
.sltitle small { color: var(--muted); font-size: .75em; }
.sledit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin: 8px 0 14px; padding: 12px; border: 2px dashed var(--main); border-radius: 12px; }
@media (max-width: 1100px) { .sledit { grid-template-columns: 1fr; } }
.sledit details.editor { margin-top: 0; }
.ed-quest { border: 2px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
