/* Ateliers HTML : moteur (éditeur + aperçu). Complète atelier.css et zones.css (coque commune) ; ne redéfinit pas la coque. */
:root {
  --cm-tag: #0A3FA8; --cm-attr: #8A4B00; --cm-val: #0F7A55; --cm-com: #5D6A7E; --cm-kw: #7A2EB8;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --cm-tag: #9DBBFF; --cm-attr: #F2C25B; --cm-val: #4CC79A; --cm-com: #93A0B8; --cm-kw: #C9A0FF; } }
:root[data-theme=dark] { --cm-tag: #9DBBFF; --cm-attr: #F2C25B; --cm-val: #4CC79A; --cm-com: #93A0B8; --cm-kw: #C9A0FF; }

#moteurSlot { position: relative; }
.mo-barre { flex: none; display: flex; align-items: center; gap: 6px; padding: 4px 8px 0; border-bottom: 1px solid var(--n2); background: var(--n0); flex-wrap: wrap; }
.mo-barre .btn { min-height: 44px; margin-bottom: 4px; }
.mo-onglets { display: flex; gap: 4px; align-self: flex-end; }
.mo-onglets button { min-height: 44px; padding: 0 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: transparent; font: 600 .8rem var(--f-mono); color: var(--n7); cursor: pointer; }
.mo-onglets button[aria-selected=true] { background: var(--surface); border-color: var(--n3); color: var(--bleu-ink); }
.mo-vues { display: none; gap: 4px; margin-bottom: 4px; }
.mo-vues button { min-height: 44px; padding: 0 14px; border: 1px solid var(--n3); border-radius: 10px; background: var(--surface); font-weight: 650; cursor: pointer; }
.mo-vues button[aria-selected=true] { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.mo-grille { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.mo-code { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-inline-end: 1px solid var(--n2); }
.mo-ed { flex: 1 1 auto; min-height: 0; display: flex; }
.mo-ed[hidden] { display: none; }
.mo-apercu { min-width: 0; min-height: 0; background: #fff; position: relative; }
.apercu-cadre { width: 100%; height: 100%; border: 0; background: #fff; display: block; color-scheme: light; }
.mo-statut { position: absolute; inset-inline: 8px; bottom: 8px; margin: 0; padding: 6px 10px; background: var(--surface); border: 1px solid var(--n3); border-radius: 8px; box-shadow: var(--sh); z-index: 6; }
.mo-statut:empty { display: none; }
.attendu-l { color: var(--warn); font-size: .82rem; } .attendu-l code { white-space: pre-wrap; }
.retours li > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* éditeur */
.mo-ed .cm-editor { flex: 1 1 auto; min-width: 0; height: 100%; background: var(--surface); color: var(--ink); font: 500 .85rem/1.5 var(--f-mono); }
.mo-ed .cm-scroller { font-family: var(--f-mono); overflow: auto; overscroll-behavior: contain; }
.mo-ed .cm-gutters { background: var(--n0); color: var(--n5); border-inline-end: 1px solid var(--n2); }
.mo-ed .cm-activeLine { background: rgba(11, 95, 255, .06); } .mo-ed .cm-activeLineGutter { background: var(--bleu-soft); }
.mo-ed .cm-cursor { border-left-color: var(--ink); } .mo-ed .cm-selectionBackground, .mo-ed .cm-focused .cm-selectionBackground { background: var(--bleu-line) !important; }
.mo-ed .cm-editor.cm-focused { outline: 2px solid var(--bleu); outline-offset: -2px; }
.mo-ed .cm-matchingBracket { background: var(--bleu-soft); outline: 1px solid var(--bleu-line); }
.mo-ed .cm-content { -webkit-user-select: text; user-select: text; }
@media (pointer: coarse), (max-width: 760px) { .mo-ed .cm-editor, .mo-ed .cm-content { font-size: 16px; } }

/* Téléphone (portrait) : code et aperçu en alternance */
@media (max-width: 760px) {
  .mo-vues { display: flex; }
  .mo-grille { grid-template-columns: minmax(0, 1fr); }
  .mo-grille[data-vue=code] .mo-apercu { display: none; }
  .mo-grille[data-vue=apercu] .mo-code { display: none; }
  .mo-onglets.seul { display: none; }
  .mo-barre .btn .lib:not(.vf) { display: none; } .mo-barre .btn#btnReset { min-width: 44px; padding: 0 10px; }
}
@media (max-height: 560px) and (min-width: 761px) { .mo-barre { padding-top: 0; } .mo-barre .btn { margin-bottom: 0; min-height: 44px; } .mo-onglets button { min-height: 44px; border-radius: 8px; } }
.liste-ex { grid-template-rows: none; grid-auto-rows: minmax(52px, 1fr); overflow: auto; }
@media (max-width: 760px), (max-height: 560px) { .liste-ex { grid-auto-rows: minmax(44px, auto); } }
