/* Plateau d'aménagement (client/js/edit-tray.js), style « Fanzine » : chargé après hud-fanzine.css, dont il reprend les
   jetons (papier, encre, rose / bleu / jaune, décalage de calage, coins droits). Ordinateur : posé en bas de la salle à la
   place des gestes. Téléphone : feuille pleine largeur à la place du dock, du chat et des gestes. */

body.editing .actionbar, body.editing .chat-float { display: none !important; }

.edit-bar.et {
  position: absolute; top: auto; right: auto; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 7;
  width: min(760px, calc(100% - 24px)); max-height: calc(100% - 110px); overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; flex-wrap: nowrap; align-items: stretch;
  padding: 0 0 12px; background: var(--paper, var(--panel)); color: var(--ink, var(--text));
  border: 2px solid var(--ink, var(--outline)); border-radius: 4px; box-shadow: 6px 6px 0 var(--pink, #ff5fae);
}
.edit-bar.et > :not(.et-head) { margin: 0 14px; }

/* en-tête tramé : tampon d'état, nom, action de sortie */
.et-head { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 8px 6px 14px; background: var(--trame), var(--paper); border-bottom: 2px solid var(--ink); }
.et-stamp { flex: none; padding: 4px 7px; font: 500 11px/1 var(--mono, monospace); text-transform: uppercase; letter-spacing: 0.05em; background: var(--blue); color: #fff; box-shadow: 2px 2px 0 var(--pink); transform: rotate(-2deg); }
.et-ghost .et-stamp { background: var(--yellow); color: #14121b; box-shadow: 2px 2px 0 var(--blue); }
.et-furni .et-stamp { background: var(--pink); color: #14121b; box-shadow: 2px 2px 0 var(--blue); }
.et-title { min-width: 0; font: 800 19px/1.1 var(--font-titre, inherit); text-transform: uppercase; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-spacer { flex: 1 1 auto; }
.et-done { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; }
.et-x { flex: none; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
.et-ico { width: 22px; height: 22px; flex: none; }
.et-done .et-ico, .et-ok .et-ico, .et-x .et-ico { width: 18px; height: 18px; }

/* outils : grandes touches carrées, icône au-dessus */
.et-tools, .et-row { display: flex; gap: 10px; flex-wrap: wrap; }
.et-tool { position: relative; flex: 1 1 0; min-width: 76px; max-width: 132px; min-height: 64px; padding: 8px 6px 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer;
  background: var(--paper-2, var(--surface-raised)); color: var(--ink); border: 2px solid var(--ink); border-radius: 3px; box-shadow: 3px 3px 0 var(--blue); font: inherit; transition: transform 0.08s, box-shadow 0.08s; }
.et-tool:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--yellow); }
.et-tool:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--blue); }
.et-tool:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }
.et-tool:focus-visible, .et-item:focus-visible, .et-chip:focus-visible, .et-swatch:focus-visible, .et-nudge:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.et-lbl { font: 500 11px/1.1 var(--mono, monospace); text-transform: uppercase; letter-spacing: 0.02em; text-align: center; }
.et-tool.et-danger { box-shadow: 3px 3px 0 var(--pink); }
.et-tool.et-danger .et-ico { color: var(--pink); }
.et-badge { position: absolute; top: -8px; right: -8px; min-width: 22px; padding: 3px 5px; font: 500 11px/1 var(--mono, monospace); background: var(--yellow); color: #14121b; border: 1.5px solid var(--ink); }

/* sac : filtres en pastilles, objets en bande qui défile */
.et-label { font: 500 11px/1 var(--mono, monospace); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft, var(--muted)); white-space: nowrap; }
.et-bag { display: grid; gap: 8px; min-width: 0; }
.et-chips { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px 4px 4px 0; }
.et-chips::-webkit-scrollbar, .et-strip::-webkit-scrollbar { display: none; }
.et-chips .et-label { margin-right: 4px; }
.et-chip { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px; cursor: pointer; font: 500 11.5px/1 var(--mono, monospace); text-transform: uppercase;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 2px; }
.et-chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); box-shadow: 2px 2px 0 var(--pink); }
.et-chip.et-all { background: var(--yellow); color: #14121b; box-shadow: 2px 2px 0 var(--pink); }
.et-chip .et-ico { width: 15px; height: 15px; }
.et-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--blue) transparent; padding: 2px 6px 8px 2px; }
.et-item { position: relative; flex: none; width: 104px; scroll-snap-align: start; display: grid; justify-items: center; gap: 3px; padding: 6px 6px 7px; cursor: pointer;
  background: var(--paper-2, var(--surface-raised)); color: var(--ink); border: 2px solid var(--ink); border-radius: 3px; box-shadow: 3px 3px 0 var(--pink); font: inherit; transition: transform 0.08s, box-shadow 0.08s; }
.et-item:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--yellow); }
.et-item:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--pink); }
.et-thumb { width: 88px; height: 62px; display: grid; place-items: end center; overflow: hidden; }
.et-thumb canvas { max-width: 88px; max-height: 62px; width: auto; height: auto; object-fit: contain; image-rendering: pixelated; }
.et-thumb canvas.lisse { image-rendering: auto; }
.et-name { width: 100%; font: 700 12px/1.15 var(--font, inherit); text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.3em; }
.et-qty { position: absolute; top: 4px; right: 4px; padding: 2px 4px; font: 500 10.5px/1 var(--mono, monospace); background: var(--blue); color: #fff; }
.et-empty { margin: 0; padding: 10px 0; color: var(--ink-soft, var(--muted)); }

/* couleur */
.et-colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.et-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.et-swatch { width: 36px; height: 36px; padding: 0; cursor: pointer; border: 2px solid var(--ink); border-radius: 0; box-shadow: 2px 2px 0 var(--ink-soft, rgba(0, 0, 0, 0.3)); }
.et-swatch[aria-pressed='true'] { outline: 3px solid var(--yellow); outline-offset: 2px; box-shadow: 3px 3px 0 var(--pink); }

/* objet en main : croix de déplacement à gauche, état et validation à droite */
.et-ghost-body { display: flex; gap: 16px; align-items: center; }
.et-pad { flex: none; display: grid; grid-template-columns: repeat(2, 48px); grid-template-rows: repeat(2, 48px); gap: 6px; transform: rotate(0deg); }
.et-nudge { display: grid; place-items: center; padding: 0; cursor: pointer; background: var(--paper-2, var(--surface-raised)); color: var(--ink); border: 2px solid var(--ink); border-radius: 3px; box-shadow: 2px 2px 0 var(--blue); }
.et-nudge:active { transform: translate(2px, 2px); box-shadow: none; }
.et-nudge .et-ico { width: 20px; height: 20px; }
.et-nudge.nw .et-ico { transform: rotate(-135deg); }
.et-nudge.ne .et-ico { transform: rotate(-45deg); }
.et-nudge.sw .et-ico { transform: rotate(135deg); }
.et-nudge.se .et-ico { transform: rotate(45deg); }
.et-ghost-actions { flex: 1 1 auto; min-width: 0; display: grid; gap: 10px; }
.et-ghost-actions .et-row { flex-wrap: nowrap; }
.et-ghost-actions .et-tool { flex: none; width: 84px; }
.et-ok { flex: 1 1 auto; min-height: 64px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 800 17px/1 var(--font-titre, inherit); text-transform: uppercase; }
.et-ok:disabled { opacity: 0.5; cursor: not-allowed; }
.et-state { margin: 0; justify-self: start; padding: 5px 8px; font: 500 12px/1.25 var(--mono, monospace); border: 1.5px solid var(--ink); }
.et-state.ok { background: var(--blue); color: #fff; }
.et-state.ko { background: var(--pink); color: #14121b; }
.et-state.ok::before { content: '✓ '; }
.et-state.ko::before { content: '✕ '; }

.et-hint { margin: 0; font-size: 13px; line-height: 1.35; color: var(--ink-soft, var(--muted)); }
.et-err { margin: 0; padding: 6px 9px; font: 500 12.5px/1.3 var(--mono, monospace); background: var(--pink); color: #14121b; border: 1.5px solid var(--ink); }

/* Ordinateur : colonne à gauche de la salle (la salle se recadre à droite, voir getLeftInset dans main.js) ;
   au repos, elle descend jusqu'au-dessus du dock et le sac défile en grille */
@media (min-width: 901px) {
  .edit-bar.et { left: 12px; top: 12px; bottom: auto; transform: none; width: 324px; max-height: calc(100% - 104px); }
  .edit-bar.et.et-idle { bottom: 92px; max-height: none; }
  .et-idle .et-bag { flex: 1 1 auto; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
  .et-idle .et-strip { flex-wrap: wrap; overflow-x: hidden; overflow-y: auto; scroll-snap-type: none; align-content: start; gap: 8px; }
  .et-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; }
  .et-tool { min-width: 0; max-width: none; min-height: 58px; padding: 6px 3px; gap: 4px; }
  .et-tool .et-ico { width: 20px; height: 20px; }
  .et-lbl { font-size: 10px; }
  .et-head { min-height: 46px; }
  .et-title { font-size: 17px; }
  .et-item { width: 88px; }
  .et-thumb { width: 74px; height: 50px; }
  .et-thumb canvas { max-width: 74px; max-height: 50px; }
  .et-ghost-body { flex-direction: column; align-items: stretch; }
  .et-pad { align-self: center; }
  .et-ghost-actions .et-tool { width: 84px; }
  .et-hint { font-size: 12.5px; }
}

/* « Live au-dessus du chat » (ordinateur) : la barre d'onglets n'est plus posée sur la salle */
@media (min-width: 901px) { body.live-side .edit-bar.et.et-idle { bottom: 14px; } }

/* Téléphone : feuille du bas, à la place du dock, du chat et des gestes */
@media (max-width: 900px) {
  body.editing .mainnav, body.editing .chat-panel, body.editing .tour { display: none !important; }
  .edit-bar.et { position: fixed; left: 0; right: 0; bottom: 0; transform: none; width: auto; max-height: 62dvh; z-index: 9;
    border-width: 2px 0 0; border-radius: 0; box-shadow: 0 -4px 0 var(--pink); padding-bottom: max(12px, env(safe-area-inset-bottom)); gap: 9px; }
  .edit-bar.et > :not(.et-head) { margin: 0 12px; }
  .et-title { font-size: 17px; }
  .et-tools { flex-wrap: nowrap; gap: 8px; }
  .et-tool { min-width: 0; max-width: none; min-height: 60px; }
  .et-lbl { font-size: 10.5px; }
  .et-item { width: 92px; }
  .et-thumb { width: 78px; height: 56px; }
  .et-thumb canvas { max-width: 78px; max-height: 56px; }
  .et-ghost-body { gap: 12px; }
  .et-ghost-actions .et-tool { width: 72px; }
  .et-ok { font-size: 15px; }
  .et-hint { font-size: 12.5px; }
}
@media (max-width: 360px) { .et-pad { grid-template-columns: repeat(2, 42px); grid-template-rows: repeat(2, 42px); } }

/* fenêtres liées : Inventaire (cartes imprimées) et Réglages de la chambre */
html[data-theme] .inv-panel .item-card { border: 2px solid var(--ink); border-radius: 3px; background: var(--paper-2); box-shadow: 3px 3px 0 var(--pink); }
html[data-theme] .inv-panel .item-card:hover:not(:disabled), html[data-theme] .inv-panel .item-card:focus-visible { border-color: var(--ink); box-shadow: 4px 4px 0 var(--yellow); transform: translate(-1px, -1px); }
html[data-theme] .inv-panel .item-card .qty { font: 500 11px/1 var(--mono, monospace); color: var(--blue); }
html[data-theme='nuit'] .inv-panel .item-card .qty { color: var(--yellow); }
html[data-theme] .inv-panel .tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.room-settings { display: grid; gap: 14px; }
.room-settings .rs-sec { display: grid; gap: 8px; padding: 12px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper-2); box-shadow: 3px 3px 0 var(--blue); }
.room-settings .rs-sec.danger { box-shadow: 3px 3px 0 var(--pink); }
.room-settings h3 { margin: 0; font: 500 12px/1 var(--mono, monospace); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.room-settings label { font: 500 11px/1 var(--mono, monospace); text-transform: uppercase; letter-spacing: 0.04em; }
.room-settings .resize-row { display: grid; gap: 8px; }
.room-settings .resize-row h3 { display: none; }
.room-settings .row { display: flex; gap: 8px; flex-wrap: wrap; }
.room-settings .row select { flex: 1 1 180px; }
.room-settings .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.room-settings .builders { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.room-settings .builders li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rs-access { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rs-access button { min-height: 58px; display: grid; gap: 3px; align-content: center; text-align: left; padding: 8px 10px; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 3px; }
.rs-access button strong { font: 800 15px/1.1 var(--font-titre, inherit); }
.rs-access button small { font: 400 11.5px/1.25 var(--mono, monospace); color: var(--ink-soft); }
.rs-access button[aria-pressed='true'] { background: var(--yellow); color: #14121b; box-shadow: 3px 3px 0 var(--pink); }
.rs-access button[aria-pressed='true'] small { color: #3b3550; }
@media (max-width: 420px) { .rs-access { grid-template-columns: 1fr; } }
