/* Atelier - feuille de style commune
   Compatibilite : Safari 9 (iOS 9.3.5) - pas de CSS Grid, pas de variables CSS */

* { -webkit-box-sizing: border-box; box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: #0d1117;
  color: #e6edf3;
  font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

a { color: #58a6ff; text-decoration: none; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ---- En-tete ---- */
.hero { text-align: center; padding: 40px 20px 24px; }
.hero h1 {
  margin: 0; font-size: 52px; letter-spacing: 6px; font-weight: 800;
  background: -webkit-linear-gradient(top, #ffd479, #ff7b72);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { margin: 10px 0 0; color: #8b949e; font-size: 19px; }

/* ---- Cartes de menu ---- */
.grid {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  margin: 0 -10px;
}
.card {
  display: block; width: 50%; padding: 10px; text-decoration: none;
}
.card-inner {
  background: #161b22; border: 1px solid #30363d; border-radius: 14px;
  padding: 22px; height: 100%;
  -webkit-transition: all .15s ease; transition: all .15s ease;
}
.card:active .card-inner { background: #1f2630; border-color: #58a6ff; }
.card .ico { font-size: 34px; line-height: 1; }
.card h2 { margin: 12px 0 6px; font-size: 23px; color: #e6edf3; }
.card p { margin: 0; color: #8b949e; font-size: 16px; line-height: 1.45; }
.card .tag {
  display: inline-block; margin-top: 12px; padding: 3px 10px;
  border-radius: 20px; font-size: 13px; font-weight: 600;
}
.t1 { background: #1f6feb33; color: #58a6ff; }
.t2 { background: #23863633; color: #3fb950; }
.t3 { background: #9e6a0333; color: #d29922; }
.t4 { background: #8957e533; color: #bc8cff; }

/* ---- Boutons ---- */
.btn {
  display: inline-block; padding: 13px 22px; border-radius: 10px;
  background: #238636; color: #fff; border: 0; font-size: 17px;
  font-weight: 600; cursor: pointer; -webkit-appearance: none;
  font-family: inherit;
}
.btn:active { background: #2ea043; }
.btn.grey { background: #30363d; }
.btn.blue { background: #1f6feb; }
.btn.red  { background: #da3633; }

/* ---- Barre de retour ---- */
.topbar {
  background: #161b22; border-bottom: 1px solid #30363d;
  padding: 12px 18px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
}
.topbar a.back { font-size: 17px; margin-right: 16px; }
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; }

/* ---- Zones de code ---- */
.editor {
  width: 100%; min-height: 260px; background: #0d1117; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 10px; padding: 14px;
  font-family: Menlo, Monaco, "Courier New", monospace;
  font-size: 15px; line-height: 1.55; -webkit-appearance: none;
  resize: vertical;
}
.console {
  background: #010409; border: 1px solid #30363d; border-radius: 10px;
  padding: 14px; font-family: Menlo, Monaco, "Courier New", monospace;
  font-size: 14px; color: #7ee787; min-height: 90px;
  white-space: pre-wrap; word-wrap: break-word; overflow-x: auto;
}

/* ---- Editeur colore : calque <pre> sous <textarea> transparent ---- */
/* Les deux couches DOIVENT partager police, taille, interligne, marges
   et bordure, sinon le texte saisi derive du texte colore. */
.ed-wrap { position: relative; width: 100%; }

.ed-wrap .ed-hl,
.ed-wrap textarea.ed-ta {
  font-family: Menlo, Monaco, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.55;
  padding: 14px;
  border: 1px solid #30363d;
  border-radius: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  letter-spacing: 0;
  margin: 0;
  -webkit-box-sizing: border-box; box-sizing: border-box;
}

.ed-wrap .ed-hl {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: #0d1117;
  color: #e6edf3;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.ed-wrap textarea.ed-ta {
  position: relative;
  display: block;
  width: 100%;
  background: transparent;
  /* astuce Safari 9 : le texte devient invisible mais le curseur
     reste peint avec la valeur de "color" */
  color: #e6edf3;
  -webkit-text-fill-color: transparent;
  caret-color: #e6edf3;
  z-index: 2;
  resize: vertical;
  -webkit-appearance: none;
  overflow: auto;
}

/* couleurs des jetons */
.tk-com { color: #8b949e; font-style: italic; }
.tk-str { color: #a5d6ff; }
.tk-num { color: #79c0ff; }
.tk-key { color: #ff7b72; }
.tk-fn  { color: #d2a8ff; }
.console .err { color: #ff7b72; }

canvas { background: #000; border-radius: 10px; max-width: 100%; display: block; }

/* ---- Divers ---- */
.row {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 0 -8px;
}
.col { padding: 8px; }
.col-1-2 { width: 50%; }
.col-1-1 { width: 100%; }

.panel {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 12px; padding: 18px; margin-bottom: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 19px; }
.muted { color: #8b949e; }
.big { font-size: 18px; line-height: 1.6; }

label.slider { display: block; margin: 14px 0; font-size: 16px; }
label.slider span { color: #d29922; font-weight: 700; }
input[type=range] { width: 100%; margin-top: 6px; -webkit-appearance: none;
  height: 30px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track {
  height: 8px; background: #30363d; border-radius: 4px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px;
  background: #58a6ff; border-radius: 50%; }

input[type=text] {
  width: 100%; padding: 13px; border-radius: 10px; border: 1px solid #30363d;
  background: #0d1117; color: #e6edf3; font-size: 17px; -webkit-appearance: none;
  font-family: inherit;
}

/* ---- Pipette a couleurs (js/couleurs.js) ---- */
/* Les deux reperes sont des elements positionnes, pas des dessins :
   on evite ainsi de repeindre le canvas a chaque mouvement du doigt,
   ce qui compte sur un processeur de 2012. */
.pip-boite { position: relative; display: block; line-height: 0; }
.pip-boite-teinte { margin-top: 8px; }
.pip-canvas {
  display: block; width: 100%; border-radius: 10px;
  border: 1px solid #30363d; touch-action: none;
}
.pip-viseur {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.65);
}
.pip-curseur {
  position: absolute; top: -2px; width: 8px; margin-left: -4px;
  border: 2px solid #fff; border-radius: 4px; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.65);
}

/* Tableau de codes couleur */
.codes { font-family: Menlo, Monaco, "Courier New", monospace; font-size: 14px; }
.codes div {
  padding: 6px 9px; border-bottom: 1px solid #21262d;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
}
.codes span.q { color: #8b949e; }
.codes span.v { color: #7ee787; -webkit-user-select: all; user-select: all; }

.pastille { border-radius: 12px; border: 1px solid #30363d; }

/* ---- Barre d'enregistrement (js/stockage.js) ---- */
/* Presente a l'identique dans le bac a sable, le studio et le labo
   photo. Un bouton qui change de place d'une page a l'autre est un
   bouton qu'il faut reapprendre : ces regles sont ecrites une fois. */
.sauvegarde {
  margin-top: 14px; padding: 14px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 10px;
}
.ligne-sauvegarde {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  -webkit-align-items: center; align-items: center;
  margin-bottom: 8px;
}
.ligne-sauvegarde > * { margin: 0 8px 6px 0; }
.sauvegarde input.nom-travail {
  width: auto; -webkit-box-flex: 1; -webkit-flex: 1 1 180px; flex: 1 1 180px;
  min-width: 140px;
}
.sauvegarde select.choix-travail {
  -webkit-box-flex: 1; -webkit-flex: 1 1 200px; flex: 1 1 200px;
  min-width: 150px;
  padding: 12px; border-radius: 10px; border: 1px solid #30363d;
  background: #0d1117; color: #e6edf3; font-size: 16px;
  font-family: inherit; -webkit-appearance: none;
}
.msg-travail { font-size: 15px; min-height: 20px; }
.msg-travail .err { color: #ff7b72; }

/* ---- Explorateur : mes travaux et ma bibliotheque ---- */
.rayon { margin-bottom: 22px; }
.rayon > h3 {
  margin: 0 0 10px; font-size: 19px;
  padding-bottom: 8px; border-bottom: 1px solid #30363d;
}
.rayon .compte { color: #8b949e; font-weight: 400; font-size: 16px; }

.entree {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  padding: 12px 14px; margin-bottom: 8px;
  background: #161b22; border: 1px solid #30363d; border-radius: 10px;
}
.entree:active { background: #1f2630; border-color: #58a6ff; }
.entree .ico { font-size: 26px; margin-right: 14px; line-height: 1; }
.entree .titre { display: block; font-size: 17px; color: #e6edf3; }
.entree .detail { display: block; font-size: 14px; color: #8b949e; margin-top: 2px; }
.entree .corps {
  -webkit-box-flex: 1; -webkit-flex: 1 1 auto; flex: 1 1 auto;
  min-width: 0; overflow: hidden;
}
.entree .actions { -webkit-flex: 0 0 auto; flex: 0 0 auto; margin-left: 10px; }
.entree .actions button {
  padding: 8px 12px; font-size: 14px; border-radius: 8px; border: 0;
  background: #30363d; color: #e6edf3; font-family: inherit;
  -webkit-appearance: none; margin-left: 6px;
}
.entree .actions button.danger { background: #da363355; color: #ffb3b0; }

.vide-rayon {
  padding: 16px; border: 1px dashed #30363d; border-radius: 10px;
  color: #8b949e; font-size: 16px; line-height: 1.5;
}

/* Jauge de place occupee. Montrer que la place n'est pas infinie
   fait partie de ce qu'on veut enseigner. */
.jauge {
  height: 10px; background: #21262d; border-radius: 5px;
  overflow: hidden; margin: 8px 0 4px;
}
.jauge i { display: block; height: 100%; background: #58a6ff; }
.jauge i.pleine { background: #d29922; }

/* ---- Mediatheque ---- */
.etagere {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 0 -8px;
}
.bac { width: 33.33%; padding: 8px; }
.bac-inner {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 16px; height: 100%; text-align: center;
}
.bac:active .bac-inner { border-color: #58a6ff; background: #1f2630; }
.bac .ico { font-size: 32px; line-height: 1; }
.bac .titre { display: block; margin-top: 8px; font-size: 17px; color: #e6edf3; }
.bac .detail { display: block; margin-top: 4px; font-size: 14px; color: #8b949e; }

/* Chemin de fer facon fil d'Ariane : l'enfant doit voir ou il est. */
.chemin {
  font-family: Menlo, Monaco, "Courier New", monospace; font-size: 14px;
  color: #8b949e; padding: 10px 12px; margin-bottom: 12px;
  background: #010409; border: 1px solid #30363d; border-radius: 8px;
  overflow-x: auto; white-space: nowrap;
}
.chemin b { color: #7ee787; font-weight: 600; }

/* ---- Table de montage ---- */
/* Les pistes sont des bandes absolues dans un conteneur en pourcentage :
   deplacer un clip revient a changer un « left » exprime en pour cent de
   la duree, jamais a recalculer une position en pixels. La table survit
   ainsi a une rotation de la tablette sans une ligne de code. */
.piste {
  position: relative; height: 54px; margin-bottom: 6px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px;
  overflow: hidden;
}
.piste.visee { border-color: #58a6ff; background: #111a26; }
.piste .etiquette {
  position: absolute; left: 0; top: 0; bottom: 0; width: 74px;
  background: #161b22; border-right: 1px solid #30363d;
  font-size: 12px; color: #8b949e; z-index: 3;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  text-align: center; line-height: 1.2;
}
.piste .rail { position: absolute; left: 74px; right: 0; top: 0; bottom: 0; }

.clip {
  position: absolute; top: 5px; bottom: 5px;
  border-radius: 6px; border: 1px solid #30363d;
  font-size: 12px; color: #e6edf3; overflow: hidden;
  padding: 4px 6px; line-height: 1.15;
  -webkit-box-sizing: border-box; box-sizing: border-box;
}
.clip.image { background: #1f6feb; border-color: #58a6ff; }
.clip.son   { background: #238636; border-color: #3fb950; }
.clip.texte { background: #8957e5; border-color: #bc8cff; }
.clip.choisi { border-width: 2px; border-color: #ffd479; }
.clip .duree { display: block; font-size: 10px; color: #ffffffbb; }

/* La tete de lecture est un simple trait deplace par « left ».
   Redessiner la table entiere a chaque image couterait bien trop cher
   sur un processeur de 2012. */
.tete {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: #ffd479; z-index: 4; pointer-events: none;
}
.regle {
  position: relative; height: 20px; margin-left: 74px; margin-bottom: 4px;
  border-bottom: 1px solid #30363d;
}
.regle span {
  position: absolute; top: 2px; font-size: 11px; color: #8b949e;
  -webkit-transform: translateX(-50%); transform: translateX(-50%);
}

.ecran-montage {
  background: #000; border-radius: 10px; display: block;
  width: 100%; max-width: 560px; margin: 0 auto;
}

.tiroir {
  max-height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid #30363d; border-radius: 8px; padding: 8px;
  background: #0d1117;
}
.tiroir .entree { margin-bottom: 6px; padding: 9px 11px; }
.tiroir .entree .ico { font-size: 20px; margin-right: 10px; }
.tiroir .entree .titre { font-size: 15px; }

/* Le tiroir du montage s'ouvre dans le flux, sous la table, et non
   par-dessus la page. Un panneau en « position: fixed » qui contient
   une liste a defilement propre et un champ de texte est un nid a
   defauts de repeinture sur iOS 9 : il se fige, ou il se dessine deux
   fois, sans qu'aucune erreur ne soit levee. Ouvrir dans le flux ne
   coute qu'un peu de defilement et ne peut pas mal tourner. */
.tiroir-boite {
  margin-top: 10px; padding: 12px;
  background: #111a26; border: 1px solid #58a6ff; border-radius: 10px;
}
.tiroir-tete {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  margin-bottom: 10px;
}
.tiroir-quoi {
  -webkit-box-flex: 1; -webkit-flex: 1 1 auto; flex: 1 1 auto;
  min-width: 0; font-size: 15px; color: #8b949e; line-height: 1.35;
}
.tiroir-quoi b { color: #e6edf3; }
.tiroir-tete .btn { -webkit-flex: 0 0 auto; flex: 0 0 auto; margin-left: 10px; }
.tiroir-nav { margin-bottom: 8px; }
.tiroir-nav .btn { padding: 9px 14px; font-size: 15px; margin-right: 8px; }
.tiroir-capture:empty { display: none; }
.tiroir-capture { margin-top: 10px; }
.tiroir-msg { margin-top: 8px; font-size: 15px; color: #8b949e; line-height: 1.4; }
.tiroir-msg .err { color: #ff7b72; }
.tiroir .entree .detail { font-size: 13px; }

@media (max-width: 700px) {
  .card, .col-1-2 { width: 100%; }
  .hero h1 { font-size: 38px; }
  .bac { width: 50%; }
}
