/* L'atelier : éditeur à gauche, entrée et sortie à droite. Aucune règle en ligne (CSP stricte). */
/* Taille du code, réglable par l'élève (boutons A- / A+, mémorisée). 16 px par défaut sur écran
   tactile : en dessous, Safari iOS zoome dès qu'on touche un champ — mais c'est SON choix, pas une règle. */
.atelier { --at-fs: 14px; }
.atelier h1 { margin-bottom: .2rem; }
.at-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .8rem 0 .5rem; }
.at-bar label { display: flex; gap: .4rem; align-items: center; font-size: .9rem; color: var(--muted); }
.at-bar select { font: inherit; padding: .3rem; }
.at-bar .at-spacer { flex: 1; }
.at-bar .btn small { font-weight: 400; color: inherit; opacity: .75; }
.btn.at-run { background: #1f5fb1; color: #fff; border-color: #1f5fb1; font-weight: 700; }
.btn.at-run:hover { background: #1a4f96; color: #fff; }
.btn.at-run[disabled] { opacity: .6; cursor: progress; }
.at-state { color: var(--muted); font-size: .9rem; }
.at-message { margin: .3rem 0; padding: .5rem .7rem; border-radius: 6px; background: #eef4ff; color: #274e8a; }
.at-message.ko { background: #fdecea; color: #c0392b; }
.at-message.ok { background: #dff6dd; color: #1a7a30; }
.at-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .at-grid { grid-template-columns: 1fr; } }
.at-editor, .at-side { min-width: 0; }
.at-editor-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .3rem .1rem; }
.at-editor-head strong { font-family: ui-monospace, monospace; }
/* Clavier d'appoint (téléphone, et AZERTY du labo où les accolades demandent AltGr).
   Cibles tactiles de 2,2 rem : au-dessus des 44 px recommandés sur écran tactile. */
.at-touches { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .4rem; }
.at-touches button { min-width: 2.2rem; height: 2.2rem; padding: 0 .4rem; border: 1px solid var(--border);
  border-radius: 6px; background: #f7f8fa; color: #24303f; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; line-height: 1; }
.at-touches button:hover { background: #eef1f6; }
.at-touches button:active { background: #e3e8f0; }

/* Éditeur : une gouttière de numéros + une zone de texte, qui défilent ensemble. */
.at-code { position: relative; display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.at-lines { margin: 0; padding: .7rem .4rem .7rem .6rem; background: #f7f8fa; color: #9aa3af; text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--at-fs); line-height: 1.5; user-select: none; overflow: hidden; min-width: 2.6rem; }
.at-code textarea { flex: 1; border: 0; padding: .7rem; min-height: 55vh; resize: vertical; white-space: pre; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--at-fs); line-height: 1.5; tab-size: 4; }
.at-code textarea:focus { outline: 2px solid #1f5fb1; outline-offset: -2px; }
.at-stdin-label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
#at-args { width: 100%; padding: .45rem .5rem; margin-bottom: .7rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--at-fs); }
.at-aide { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; opacity: .85; }
#at-stdin { width: 100%; min-height: 6rem; padding: .5rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, monospace; font-size: var(--at-fs); resize: vertical; }
.at-out { margin-top: .8rem; border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem; background: #fbfcfe; min-height: 12rem; max-height: 60vh; overflow: auto; }
.at-out h3 { margin: .5rem 0 .25rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.at-out h3:first-child { margin-top: 0; }
.at-out pre { margin: 0; padding: .45rem .6rem; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  font-family: ui-monospace, monospace; font-size: var(--at-fs); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.at-out pre.err { background: #fdecea; border-color: #f3c9c3; color: #8a2018; }
.at-out pre.warn { background: #fff8e1; border-color: #f0e0b0; color: #7a5a10; }
.at-out pre.vide { color: var(--muted); font-style: italic; }
.at-verdict { font-weight: 700; margin: 0 0 .4rem; }
.at-verdict.ok { color: #1a7a30; }
.at-verdict.ko { color: #c0392b; }
.at-meta { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; }
.at-goto { border: 0; background: #ffe9b0; color: #7a5a10; border-radius: 4px; padding: 0 .25rem; font: inherit; cursor: pointer; }
.at-goto:hover { background: #ffd98a; }

/* Écrans tactiles : 16 px par défaut (en dessous, Safari iOS zoome dès qu'on touche un champ).
   Les boutons A- / A+ passent outre : c'est le choix de l'élève, pas une contrainte. */
@media (pointer: coarse) { .atelier { --at-fs: 16px; } }

/* Téléphone : le paragraphe d'explication mange la moitié de l'écran. On garde l'avertissement qui
   compte (pas d'interactivité) et on replie le reste. */
@media (max-width: 700px) {
  .at-long { display: none; }
  .at-touches button { min-width: 2rem; height: 2rem; }
}

/* Réglage de la taille : deux boutons discrets, collés l'un à l'autre. */
.at-zoom { display: inline-flex; gap: .15rem; }
.at-zoom button { min-width: 2.1rem; height: 2.1rem; border: 1px solid var(--border); border-radius: 6px;
  background: #f7f8fa; color: #24303f; cursor: pointer; font: inherit; line-height: 1; }
.at-zoom button:hover { background: #eef1f6; }
.at-zoom button[disabled] { opacity: .4; cursor: default; }

/* Indicateur de présentation (RCI chap. 17) : discret, jamais alarmant — l'atelier signale,
   il ne refuse pas. Le vert ne s'affiche qu'une fois qu'il y a eu quelque chose à corriger. */
.btn.at-forme { font-size: .85rem; }
.btn.at-forme.ok { border-color: #9ed3ab; background: #f0faf2; color: #1a7a30; }
.btn.at-forme.ecart { border-color: #f0d090; background: #fff8e8; color: #7a5a10; }
.at-forme-panneau {
  margin: .4rem 0; border: 1px solid #f0e0b0; border-radius: 8px; background: #fffdf6;
  padding: .6rem .8rem; font-size: .9rem;
}
.at-forme-panneau ul { margin: .3rem 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .25rem; }
.at-forme-panneau li { line-height: 1.45; }
.at-forme-panneau .ligne {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem;
  background: #f3efe2; border-radius: 3px; padding: 0 .3rem; margin-right: .35rem; cursor: pointer;
}
.at-forme-panneau .ligne:hover { background: #e8e0cc; }
.at-forme-panneau .section { color: #8a7440; font-size: .8rem; }
.at-forme-panneau .conseil { color: #5a6472; }
.at-forme-panneau .rien { color: #1a7a30; margin: 0; }
