/* La cuve à marbrer (src/marbrureUI.js), en gros plan sur le bac comme les machines : une colonne de boutons
   ronds à droite (certains ouvrent une boîte à leur gauche), le nom et l'aide en haut, la feuille en bas. */
#marbrure { position: fixed; inset: 0; z-index: 35; pointer-events: none; }
#marbrure[hidden] { display: none; }
#marbrure > * { pointer-events: auto; }
#marbrure button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 6px 12px; font-size: 0.84rem; }
#marbrure button:disabled { opacity: 0.35; cursor: default; }
#marbrure [hidden] { display: none !important; }
/* en haut : le nom, l'aide et les messages du moment */
#marbrure .mb-haut { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100vw - 150px)); text-align: center; pointer-events: none;
  background: rgba(15, 12, 9, 0.8); border: 1px solid var(--line); border-radius: 16px; padding: 8px 16px; }
#marbrure h2 { margin: 0; font: 600 1.2rem var(--serif); color: var(--ink); }
#marbrure .mb-intro { margin: 3px 0 0; font-size: 0.78rem; color: var(--ink-soft); }
#marbrure .mb-info { margin: 3px 0 0; font-size: 0.78rem; color: var(--accent); }
#marbrure .mb-info:empty { display: none; }
#marbrure:not([data-etape="preparer"]) .mb-haut { display: none; }
/* en bas : la feuille posée (compte à rebours, retourner), puis faite (coller, nouvelle feuille) */
#marbrure .mb-bas { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 100px); text-align: center;
  background: rgba(15, 12, 9, 0.88); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
#marbrure .mb-compte { margin: 0 0 8px; font: 500 1.15rem var(--serif); color: var(--ink); }
#marbrure .mb-bas-boutons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#marbrure .mb-principal { padding: 9px 18px; font-size: 0.92rem; background: var(--accent); border-color: var(--accent); color: #1a120a; font-weight: 600; }
#marbrure .mb-nouvelle { padding: 9px 16px; font-size: 0.92rem; }
#marbrure .mb-retourner.pret { animation: mb-pret 0.9s ease-in-out infinite alternate; }
@keyframes mb-pret { to { box-shadow: 0 0 0 7px rgba(196, 154, 74, 0.35); } }
/* la colonne */
#marbrure .mb-colonne { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 0; bottom: 0; display: flex; flex-direction: column; gap: 9px; align-items: center; justify-content: center; pointer-events: none; }
#marbrure .mb-colonne > * { pointer-events: auto; }
#marbrure .mb-rail { position: relative; width: 50px; height: 50px; padding: 0; display: grid; place-items: center; background: var(--panel); border-color: var(--line); font-size: 1.3rem; line-height: 1; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
#marbrure .mb-rail.mb-petit { width: 40px; height: 40px; font-size: 1rem; }
#marbrure .mb-rail svg { width: 24px; height: 24px; display: block; }
#marbrure .mb-rail[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #1a120a; }
#marbrure .mb-accent { background: var(--accent); border-color: var(--accent); }
#marbrure .mb-sortie { border-color: var(--accent); }
#marbrure .mb-g-aide .mb-ic { font-weight: 700; font-size: 1rem; }
/* outil courant : une pastille de la taille et de la couleur choisies */
#marbrure .mb-pastille { position: absolute; right: 2px; bottom: 2px; width: var(--t, 8px); height: var(--t, 8px); border-radius: 50%; background: var(--c, #c0392b); box-shadow: 0 0 0 2px var(--panel); }
#marbrure .mb-couleur-courante > i { width: 30px; height: 30px; border-radius: 50%; background: var(--c); display: block; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.2); }
/* les bulles (au survol) */
#marbrure .mb-bulle { position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; color: var(--ink); opacity: 0; transition: opacity 0.2s; }
@media (hover: hover) { #marbrure .mb-rail:hover .mb-bulle { opacity: 1; } #marbrure .mb-rail[aria-expanded="true"] .mb-bulle { opacity: 0; } }
/* les boîtes, à gauche de leur bouton */
#marbrure .mb-groupe { position: relative; }
#marbrure .mb-boite { position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); width: max-content; max-width: min(340px, calc(100vw - 90px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
#marbrure .mb-l { margin: 0; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
#marbrure .mb-l span { text-transform: none; letter-spacing: 0; }
#marbrure .mb-outils { display: grid; grid-template-columns: repeat(4, 52px); gap: 6px; }
#marbrure .mb-outils button { height: 48px; padding: 0; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
#marbrure .mb-tailles { display: flex; gap: 6px; }
#marbrure .mb-tailles button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
#marbrure .mb-tailles i { width: var(--t); height: var(--t); border-radius: 50%; background: currentColor; display: block; }
#marbrure .mb-outils button[aria-pressed="true"], #marbrure .mb-tailles button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1a120a; }
#marbrure .mb-aide-outil { margin: 0; max-width: 240px; font-size: 0.76rem; color: var(--accent); }
#marbrure .mb-couleurs { display: grid; grid-template-columns: repeat(6, 32px); gap: 6px; }
#marbrure .mb-couleurs button { width: 32px; height: 32px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, 0.15); }
#marbrure .mb-couleurs button[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
#marbrure .mb-motifs { display: flex; flex-direction: column; gap: 6px; width: 250px; }
#marbrure .mb-motifs button { border-radius: 12px; text-align: left; padding: 7px 12px; display: flex; flex-direction: column; gap: 1px; }
#marbrure .mb-motifs strong { font-weight: 600; font-size: 0.86rem; }
#marbrure .mb-motifs span { font-size: 0.72rem; color: var(--ink-soft); }
#marbrure .mb-mes-aide { margin: 0; font-size: 0.76rem; color: var(--ink-soft); }
#marbrure .mb-liste { display: grid; grid-template-columns: repeat(3, 80px); gap: 10px; }
#marbrure .mb-f { position: relative; }
#marbrure .mb-prendre { padding: 0; border-radius: 3px; overflow: hidden; display: block; }
#marbrure .mb-prendre img { width: 80px; height: 52px; object-fit: cover; display: block; }
#marbrure .mb-oublier { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0 !important; font-size: 0.65rem !important; background: #17120d !important; }
#marbrure .mb-aide-boite { width: 300px; font-size: 0.78rem; color: var(--ink-soft); }
#marbrure .mb-aide-boite p { margin: 0; line-height: 1.5; }
#marbrure kbd { font: inherit; font-size: 0.72rem; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; }
body.touch #marbrure .mb-clavier { display: none; }
body.marbrure-gros-plan #atelier-barre, body.marbrure-gros-plan #puzzle-focus { display: none !important; }
@media (max-width: 600px) {
  #marbrure .mb-colonne { gap: 7px; }
  #marbrure .mb-rail { width: 42px; height: 42px; font-size: 1.1rem; }
  #marbrure .mb-rail.mb-petit { width: 36px; height: 36px; }
  #marbrure .mb-haut { top: auto; bottom: 14px; max-width: calc(100vw - 80px); padding: 6px 12px; }
  #marbrure .mb-intro { display: none; }
  #marbrure .mb-bas { left: 10px; right: 64px; transform: none; width: auto; max-width: none; }
  #marbrure .mb-couleurs { grid-template-columns: repeat(5, 30px); }
  #marbrure .mb-couleurs button { width: 30px; height: 30px; }
}
#marbrure .mb-partage { padding: 9px 14px; font-size: 0.88rem; }
#marbrure .mb-partage[aria-pressed="true"] { border-color: #6fbf5a; color: #a6e88f; }

/* La chemise de dessinateur : toutes les feuilles de papier marbré, les miennes et celles des visiteurs */
#chemise { position: fixed; inset: 0; z-index: 38; display: grid; place-items: center; background: rgba(8, 6, 4, 0.74); padding: 16px; }
#chemise[hidden], #chemise [hidden] { display: none !important; }
#chemise .ch-carte { width: min(900px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #1d2620; border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px 20px; color: var(--ink);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.18); }
#chemise .ch-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#chemise h2 { margin: 0; font: 600 1.6rem var(--serif); }
#chemise button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 7px 14px; font-size: 0.86rem; }
#chemise button:disabled { opacity: 0.4; cursor: default; }
#chemise .ch-fermer { width: 34px; height: 34px; padding: 0; }
#chemise .ch-intro { margin: 4px 0 10px; font-size: 0.84rem; color: var(--ink-soft); }
#chemise .ch-l { margin: 14px 0 8px; font-size: 0.86rem; color: var(--ink-soft); }
#chemise .ch-l span { color: var(--muted); font-size: 0.76rem; }
#chemise .ch-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
#chemise .ch-f { position: relative; padding: 0; border-radius: 3px; border: 0; overflow: hidden; aspect-ratio: 3 / 2; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); transition: transform 0.15s; }
#chemise .ch-f:hover { transform: translateY(-2px) rotate(-0.6deg); }
#chemise .ch-f img { width: 100%; height: 100%; object-fit: cover; display: block; }
#chemise .ch-badge { position: absolute; top: 4px; right: 4px; font-size: 0.8rem; background: rgba(15, 12, 9, 0.75); border-radius: 999px; padding: 1px 5px; }
#chemise .ch-nom { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 0.72rem; text-align: left; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chemise .ch-vide { grid-column: 1 / -1; margin: 0; font-size: 0.82rem; color: var(--muted); }
#chemise .ch-grande { margin-top: 12px; display: grid; place-items: center; }
#chemise .ch-grande img { max-width: 100%; max-height: 58vh; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5); }
#chemise .ch-legende { margin: 10px 0; text-align: center; font: 500 1.05rem var(--serif); }
#chemise .ch-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#chemise .ch-principal { background: var(--accent); border-color: var(--accent); color: #1a120a; font-weight: 600; }
