/* MyCarreau — l'atelier sur téléphone (voir js/atelier-mobile.js).
   Tout est sous 900 px de large et sous la classe « m » que pose la couche mobile : l'atelier de bureau n'en voit rien.
   Principe : le carreau garde la place, les outils tiennent en une rangée sous le pouce. */
.dock, .dock-astuce { display: none; }

@media (max-width: 900px) {
  body.m { grid-template-rows: 50px minmax(0, 1fr) auto auto; position: relative; }
  /* l'ancienne barre aux neuf onglets et l'ancienne rangée d'icônes laissent la place */
  body.m .rail { display: block; padding: 0; overflow: visible; border: 0; background: none; -webkit-mask: none; mask: none; }
  body.m .rail > button { display: none !important; }
  body.m .actions { display: none; }
  body.m .film { display: none; }
  body.m[data-film] .film { display: flex; padding: 2px 6px 6px; }
  body.m .scene { padding: 10px 10px 8px; }
  body.m .volet, body.m .droite { max-height: 44dvh; border-radius: 22px 22px 0 0; }

  .dock { display: block; position: relative; z-index: 5; background: var(--papier); border-top: 1px solid var(--trait); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -14px 26px -20px rgba(var(--ombre), .55); }
  .dock button { -webkit-tap-highlight-color: transparent; cursor: pointer; width: auto; min-width: 0; }
  .dock button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

  /* la rangée d'outils : cinq au plus, chacun avec son nom */
  .dock .dock-rangee { display: flex; align-items: stretch; gap: 2px; padding: 6px; }
  .dock .dock-rangee > button, .dock .dock-grille > button { flex: 1 1 0; min-width: 0; min-height: 54px; border: 0; background: transparent; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font: 600 11.5px/1 'Archivo', sans-serif; color: var(--gris); padding: 6px 2px; transition: background .15s, color .15s, transform .12s; }
  .dock .dock-rangee > button span, .dock .dock-grille > button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dock .dock-rangee > button:active, .dock .dock-grille > button:active { background: var(--lin); transform: scale(.95); }
  .dock .dock-rangee > button[aria-pressed='true'] { color: var(--bleu); background: var(--bleu-doux); }
  .dock .dock-rangee.choix > button { color: var(--encre); }
  .dock .dock-rangee.choix > button[aria-pressed='true'] { color: var(--bleu); }
  .dock .dock-rangee > .dock-quitter { flex: 0 0 42px; color: var(--gris); }
  .dock .dock-encre { width: 24px; height: 24px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .18); }
  .dock .dock-aa { font-size: 21px; line-height: 24px; height: 24px; font-weight: 400; }

  /* une feuille est ouverte : son titre, et un grand « Terminé » */
  .dock .dock-rangee.feuille { align-items: center; padding: 8px 10px 8px 18px; gap: 10px; }
  .dock .dock-titre { flex: 1; font-size: 16px; font-weight: 700; }
  .dock .dock-rangee > .dock-termine { flex: none; flex-direction: row; min-height: 46px; padding: 0 22px 0 16px; gap: 8px; border-radius: 999px; background: var(--bleu); color: #fff; font-size: 15px; font-weight: 650; }
  .dock .dock-rangee > .dock-termine:active { background: var(--bleu-vif); }

  /* le panneau d'un outil : une seule rangée, juste au-dessus */
  .dock .dock-panneau { display: flex; align-items: center; gap: 10px; padding: 10px 12px 2px; min-height: 66px; animation: dock-monte .22s cubic-bezier(.2, .9, .3, 1.15); }
  .dock .dock-defile { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; overflow-x: auto; padding: 5px 3px 7px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .dock .dock-defile::-webkit-scrollbar { display: none; }
  .dock .dock-pastille { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .16); }
  .dock .dock-pastille[aria-pressed='true'] { box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .16), 0 0 0 2.5px var(--papier), 0 0 0 5px var(--bleu); }
  .dock .dock-puce { flex: none; display: inline-flex; flex-direction: row; align-items: center; justify-content: center; height: 42px; padding: 0 17px; border-radius: 999px; border: 1.5px solid var(--trait); background: var(--papier); font: 600 14px 'Archivo', sans-serif; color: var(--encre); white-space: nowrap; }
  .dock .dock-puce[aria-pressed='true'] { border-color: var(--bleu); background: var(--bleu-doux); color: var(--bleu); }
  .dock .dock-police { flex: none; width: 80px; height: 60px; border-radius: 14px; border: 1.5px solid var(--trait); background: var(--papier); display: grid; place-items: center; align-content: center; gap: 1px; padding: 4px 2px; color: var(--encre); }
  .dock .dock-police b { font-size: 21px; line-height: 1.15; font-weight: 400; }
  .dock .dock-police span { font: 550 10.5px 'Archivo', sans-serif; color: var(--gris); white-space: nowrap; }
  .dock .dock-police[aria-pressed='true'] { border-color: var(--bleu); background: var(--bleu-doux); }
  .dock .dock-ambiance { flex: none; width: 72px; border: 0; background: none; display: grid; justify-items: center; gap: 6px; font: 600 10.5px/1.15 'Archivo', sans-serif; color: var(--gris); padding: 0; text-align: center; }
  .dock .dock-ambiance i { width: 46px; height: 46px; border-radius: 13px; display: block; outline: 2.5px solid transparent; outline-offset: 2px; }
  .dock .dock-ambiance[aria-pressed='true'] { color: var(--encre); }
  .dock .dock-ambiance[aria-pressed='true'] i { outline-color: var(--bleu); }
  .dock .dock-glissiere { flex: 1; display: flex; align-items: center; gap: 14px; padding: 0 6px; min-width: 0; }
  .dock .dock-glissiere input { flex: 1; min-width: 0; height: 46px; accent-color: var(--bleu); }
  .dock .dock-glissiere output { min-width: 42px; text-align: right; font: 650 15px 'Archivo', sans-serif; font-variant-numeric: tabular-nums; }
  .dock .dock-grille { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; flex: 1; padding-bottom: 4px; }
  .dock .dock-panneau[data-outil='menu'] .dock-grille { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dock .dock-grille > button { background: var(--lin); color: var(--encre); min-height: 60px; }
  .dock .dock-grille > button.fort { background: var(--bleu-doux); color: var(--bleu); }
  .dock .dock-grille > button.danger { color: #c0281c; }

  /* écrire : le champ et son bouton, rien d'autre */
  .dock .dock-panneau[data-outil='ecrire'] { align-items: flex-end; padding-bottom: 8px; }
  .dock .dock-panneau textarea { flex: 1; min-width: 0; font: 500 17px/1.3 'Archivo', sans-serif; color: var(--encre); background: var(--lin); border: 1.5px solid var(--trait); border-radius: 16px; padding: 10px 14px; resize: none; outline: none; }
  .dock .dock-panneau textarea:focus { border-color: var(--bleu); background: #fff; }
  .dock .dock-ok { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--bleu); color: #fff; display: grid; place-items: center; }
  /* clavier ouvert pour écrire : le champ reste au-dessus du clavier, le carreau au-dessus du champ */
  body.m.clavier[data-outil='ecrire'] { grid-template-rows: 46px minmax(0, 1fr) auto auto; }
  body.m.clavier[data-outil='ecrire'] .rail { display: block; }
  body.m.clavier[data-outil='ecrire'] .dock-rangee, body.m.clavier[data-outil='ecrire'] .volet, body.m.clavier[data-outil='ecrire'] .droite { display: none; }

  /* la première fois : dire qu'on peut toucher le carreau */
  .dock-astuce { display: block; position: absolute; left: 50%; top: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); background: var(--encre); color: #fff; font: 500 13.5px/1.35 'Archivo', sans-serif; padding: 10px 16px; border-radius: 14px; text-align: center; pointer-events: none; z-index: 3; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .5); animation: dock-astuce .45s .9s both; }
  .dock-astuce b { font-weight: 700; }
}
@keyframes dock-monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dock-astuce { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .dock-panneau, .dock-astuce { animation: none; } .dock-rangee > button { transition: none; } }

/* le guide d'un souvenir passe devant les autres outils */
@media (max-width: 900px) {
  .dock .dock-rangee > button.vedette { color: var(--bleu); background: var(--bleu-doux); }
  body.m .etape-pied { position: sticky; bottom: -20px; background: var(--papier); padding-bottom: 6px; margin-bottom: -6px; }
}
