/* Le mur des puzzles (src/puzzle.js) : panneau de choix. */
#puzzle-panneau { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; background: rgba(8, 6, 4, 0.72); padding: 16px; }
#puzzle-panneau[hidden] { display: none; }
#puzzle-panneau .pz-carte {
  width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #17120d; border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 22px; color: var(--ink);
}
#puzzle-panneau h2 { margin: 0 0 12px; font: 600 1.6rem var(--serif); }
#puzzle-panneau button { font: inherit; cursor: pointer; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 0.88rem; }
#puzzle-panneau button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1a120a; }
#puzzle-panneau button:disabled { opacity: 0.4; cursor: default; }
#puzzle-panneau .pz-modes { display: flex; gap: 8px; }
#puzzle-panneau .pz-jeux { display: flex; gap: 8px; margin-bottom: 8px; }
#puzzle-panneau .pz-jeux button { padding: 9px 16px; font-size: 0.95rem; }
#puzzle-panneau .pz-regle { margin: 0 0 12px; font-size: 0.84rem; color: var(--ink-soft); }
#puzzle-panneau .pz-verrou { margin: -2px 0 10px; font-size: 0.85rem; color: var(--accent); display: flex; align-items: center; gap: 6px; }
#puzzle-panneau .pz-verrou[hidden] { display: none; }
#puzzle-panneau .pz-etat { margin: 12px 0 8px; font-size: 0.88rem; color: var(--ink-soft); }
#puzzle-panneau .pz-rejoindre { background: var(--accent); border-color: var(--accent); color: #1a120a; font-weight: 500; }
#puzzle-panneau .pz-rejoindre[hidden], #puzzle-panneau .pz-nouveau[hidden] { display: none; }
#puzzle-panneau .pz-l { margin: 14px 0 8px; font-size: 0.82rem; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; }
#puzzle-panneau .pz-hasard { padding: 3px 10px; font-size: 0.78rem; }
#puzzle-panneau .pz-oeuvres {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); grid-auto-rows: 80px; gap: 6px; max-height: 34vh; overflow-y: auto;
  padding: 4px; border: 1px solid var(--line); border-radius: 10px;
}
#puzzle-panneau .pz-oeuvres button { padding: 0; border-radius: 6px; height: 80px; min-height: 80px; width: 100%; overflow: hidden; border: 2px solid transparent; background: #0e0b08; }
#puzzle-panneau .pz-oeuvres button[aria-pressed="true"] { border-color: var(--accent); background: #0e0b08; }
#puzzle-panneau .pz-oeuvres img { width: 100%; height: 100%; object-fit: cover; display: block; }
#puzzle-panneau .pz-tailles { display: flex; gap: 8px; flex-wrap: wrap; }
#puzzle-panneau .pz-info { min-height: 1.2em; margin: 10px 0 0; font-size: 0.84rem; color: var(--accent); }
#puzzle-panneau .pz-actions { display: flex; gap: 8px; margin-top: 14px; }
#puzzle-panneau .pz-go { background: var(--accent) !important; border-color: var(--accent) !important; color: #1a120a !important; font-weight: 500; padding: 10px 20px !important; }
#puzzle-panneau .pz-modele { display: block; margin-top: 14px; font-size: 0.86rem; color: var(--ink-soft); cursor: pointer; }
#puzzle-panneau .pz-modele input { accent-color: var(--accent); margin-right: 6px; vertical-align: -2px; }
#puzzle-panneau .pz-records[hidden] { display: none; }
#puzzle-panneau .pz-moi, #puzzle-panneau .pz-badges { margin: 4px 0; font-size: 0.86rem; color: var(--ink-soft); }
.pz-top { margin: 6px 0; padding-left: 1.6em; font-size: 0.86rem; color: var(--ink); }
.pz-top li { margin: 2px 0; }
.pz-top li span { color: var(--muted); }
.pz-top li.moi { color: var(--accent); }
#puzzle-bravo { position: fixed; inset: 0; z-index: 36; display: grid; place-items: center; background: rgba(8, 6, 4, 0.6); padding: 16px; }
#puzzle-bravo[hidden] { display: none; }
#puzzle-bravo .pb-carte { width: min(460px, 100%); background: #17120d; border: 1px solid var(--accent); border-radius: 16px; padding: 22px; text-align: center; color: var(--ink); animation: pb-entre 0.4s ease-out; }
#puzzle-bravo .pb-badge { font-size: 4rem; line-height: 1; min-height: 1em; animation: pb-badge 0.9s ease-out; }
#puzzle-bravo h2 { margin: 6px 0; font: 600 2rem var(--serif); color: var(--accent); }
#puzzle-bravo .pb-temps { margin: 0; font-size: 1.15rem; }
#puzzle-bravo .pb-record { margin: 8px 0 12px; font-size: 0.92rem; color: var(--ink-soft); }
#puzzle-bravo .pb-l { justify-content: center; }
#puzzle-bravo .pz-top { text-align: left; display: inline-block; }
#puzzle-bravo .pb-ok { display: block; margin: 14px auto 0; font: inherit; cursor: pointer; background: var(--accent); border: 0; color: #1a120a; border-radius: 999px; padding: 10px 22px; font-weight: 500; }
@keyframes pb-entre { from { transform: scale(0.9); opacity: 0; } }
@keyframes pb-badge { 0% { transform: scale(0.2) rotate(-30deg); } 70% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1); } }
.pz-top.vide { list-style: none; padding-left: 0; color: var(--muted); }
#puzzle-bravo .pb-badge:empty { display: none; }
/* Gros plan sur le puzzle : le bouton (quand on regarde le mur), et la colonne de l'atelier masquée pendant */
#puzzle-focus { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 12; font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--accent); background: rgba(23, 18, 13, 0.92); color: var(--ink); padding: 10px 20px; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
#puzzle-focus[hidden], body:has(#pause.visible) #puzzle-focus, body:has(#puzzle-panneau:not([hidden])) #puzzle-focus { display: none; }
body.puzzle-gros-plan #puzzle-focus { top: 14px; bottom: auto; }
body.puzzle-gros-plan #atelier-barre, body.puzzle-gros-plan #joystick, body.puzzle-gros-plan #joystick-regard, body.puzzle-gros-plan #chat { display: none !important; }
@media (max-width: 600px) { #puzzle-focus { bottom: 150px; } body.puzzle-gros-plan #puzzle-focus { top: auto; bottom: 22px; } }
body.mur-gros-plan #joystick, body.mur-gros-plan #joystick-regard, body.mur-gros-plan #chat { display: none !important; }
@media (max-width: 600px) { body.mur-gros-plan #puzzle-focus { top: auto; bottom: 22px; } }
body.cadrage #puzzle-focus { display: none !important; } /* (le déclencheur de l'appareil photo est à sa place) */
/* en gros plan sur téléphone : une simple croix ronde */
#puzzle-focus.icone { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 1.15rem; display: grid; place-items: center; }
/* en gros plan sur le mur des puzzles : 🧩 pour choisir un puzzle, à droite de « Sortir » */
#puzzle-choisir { position: fixed; top: 14px; left: calc(50% + 58px); z-index: 12; font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--accent); background: rgba(23, 18, 13, 0.85); color: var(--ink); }
#puzzle-choisir[hidden], body:has(#pause.visible) #puzzle-choisir, body:has(#puzzle-panneau:not([hidden])) #puzzle-choisir, body.appareil #puzzle-choisir { display: none; }
#puzzle-choisir.icone { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 1.3rem; display: grid; place-items: center; }
@media (max-width: 600px) { #puzzle-choisir { top: auto; bottom: 22px; left: calc(50% + 34px); } }
/* (la forme ronde ne doit jamais faire réapparaître un bouton caché) */
#puzzle-choisir[hidden], #puzzle-focus[hidden] { display: none !important; }
/* téléphone en paysage : les boutons du gros plan en bas aussi (en haut, ils couvrent le titre du puzzle) */
@media (max-height: 500px) {
  body.puzzle-gros-plan #puzzle-focus, body.mur-gros-plan #puzzle-focus { top: auto; bottom: 14px; }
  #puzzle-choisir { top: auto; bottom: 14px; }
}
/* sur un mur à peindre, « Sortir » est dans la colonne de l'atelier (#atelier-barre) */
body.mur-gros-plan #puzzle-focus { display: none !important; }
/* gros plan (puzzle, mur à peindre) : loupes + et − en bas à gauche (main.js : #gp-zoom) */
#gp-zoom { position: fixed; left: 14px; bottom: 22px; z-index: 12; display: none; flex-direction: column; gap: 10px; }
body.puzzle-gros-plan #gp-zoom, body.mur-gros-plan #gp-zoom { display: flex; }
body:has(#pause.visible) #gp-zoom, body.appareil #gp-zoom, body.cadrage #gp-zoom, body:has(#puzzle-panneau:not([hidden])) #gp-zoom,
body:has(#social:not([hidden])) #gp-zoom, body:has(#invitation:not([hidden])) #gp-zoom, body:has(#atelier-photo:not([hidden])) #gp-zoom { display: none !important; }
#gp-zoom button { width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 1px solid var(--accent); background: rgba(23, 18, 13, 0.92); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
#gp-zoom svg { width: 24px; height: 24px; }
@media (max-height: 500px) { #gp-zoom { bottom: 14px; gap: 8px; } }

/* (salle de jeux) les tableaux par groupes : domaine public, puis chaque exposition */
#puzzle-panneau .pz-groupe { grid-column: 1 / -1; margin: 8px 0 2px; font-size: 0.8rem; color: var(--accent); }
#puzzle-panneau .pz-oeuvres:has(.pz-groupe) { grid-auto-rows: auto; }
/* La table de jeu de la salle de jeux (src/expos/tableJeu.js) : « 🔍 Table » tout près, et en gros plan « Sortir » et
   « 🎲 Choisir un jeu » */
#table-focus { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 12; font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--accent); background: rgba(23, 18, 13, 0.92); color: var(--ink); padding: 10px 20px; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
body.table-gros-plan #table-focus { top: 14px; }
#table-choisir { position: fixed; top: 14px; left: calc(50% + 58px); z-index: 12; font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--accent); background: rgba(23, 18, 13, 0.85); color: var(--ink); }
#table-focus.icone, #table-choisir.icone { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 1.2rem; display: grid; place-items: center; }
@media (max-width: 600px) {
  #table-focus { top: auto; bottom: 204px; }
  body.table-gros-plan #table-focus { top: auto; bottom: 22px; left: calc(50% - 34px); }
  #table-choisir { top: auto; bottom: 22px; left: calc(50% + 34px); }
}
body.table-gros-plan #joystick, body.table-gros-plan #joystick-regard, body.table-gros-plan #chat, body.table-gros-plan #puzzle-focus { display: none !important; }
#table-focus[hidden], #table-choisir[hidden], body:has(#pause.visible) #table-focus, body:has(#puzzle-panneau:not([hidden])) #table-focus,
body:has(#puzzle-panneau:not([hidden])) #table-choisir, body.appareil #table-focus, body.appareil #table-choisir, body.cadrage #table-focus { display: none !important; }
