/* atelier.css — l'interface de la page de travail.
   Verre sombre et chaud, pour ne jamais rivaliser avec le bois de la scène. */

:root {
  --amber: #e0913f;
  --glass: rgba(14, 11, 8, .72);
  --edge: rgba(226, 190, 140, .16);
  --txt: #ece3d4;
  --dim: #a2947f;
}

canvas { cursor: grab; }
canvas.is-looking { cursor: grabbing; }

.panel {
  position: fixed; z-index: 6;
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 13px;
  backdrop-filter: blur(13px) saturate(1.1);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .55);
  color: var(--txt);
  font: 400 13px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: opacity .22s, transform .22s;
}
body.nude .panel, body.nude .back { opacity: 0; pointer-events: none; transform: translateY(-6px); }

.panel-left { left: 16px; top: 62px; width: 302px; padding: 18px 19px 15px; }
.panel-right { right: 16px; top: 16px; width: 336px; padding: 14px 15px 12px; }

/* Les deux panneaux défilent au lieu de déborder : le contenu dépend de ce
   qu'on a chargé, il n'a aucune raison de tenir dans une hauteur fixe. */
.panel {
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(226, 190, 140, .28) transparent;
}
.panel-right { max-height: calc(100vh - 32px); }
.panel::-webkit-scrollbar { width: 9px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb {
  background: rgba(226, 190, 140, .22); border-radius: 9px;
  border: 2px solid transparent; background-clip: content-box;
}
.panel::-webkit-scrollbar-thumb:hover { background: rgba(226, 190, 140, .42); background-clip: content-box; }

/* rien ne doit pouvoir pousser la largeur du panneau */
.panel * { min-width: 0; }
.panel code, .panel .nm, .detail p { overflow-wrap: anywhere; }

/* ---- interrupteurs -------------------------------------------------------- */

.reglages { margin-bottom: 13px; }
.switch {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--edge); background: rgba(255, 255, 255, .03);
  user-select: none;
}
.switch:hover { background: rgba(224, 145, 63, .12); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .piste {
  width: 34px; height: 19px; border-radius: 20px; flex: none;
  background: rgba(0, 0, 0, .45); border: 1px solid var(--edge);
  transition: background .18s, border-color .18s;
}
.switch .pastille {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: var(--dim); margin: 2px 0 0 3px;
  transition: transform .18s, background .18s;
}
.switch input:checked + .piste { background: rgba(224, 145, 63, .45); border-color: rgba(224, 145, 63, .6); }
.switch input:checked + .piste .pastille { transform: translateX(15px); background: var(--amber); }
.switch input:focus-visible + .piste { outline: 2px solid var(--amber); outline-offset: 2px; }
.switch .lbl { font-size: 12.5px; }
.switch kbd { margin-left: auto; }

.eyebrow {
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 8px;
}
/* La marque coiffe le panneau et ramène au hub. */
.panel header .marque { float: right; line-height: 0; margin: 0 0 6px 10px; }
.panel header .marque img { display: block; width: 30px; height: 30px; }
.panel header .marque:hover img { filter: brightness(1.15); }
.panel h1 {
  font: 600 19px/1.2 ui-serif, Georgia, serif; letter-spacing: -.01em;
  margin-bottom: 9px; color: #fff;
}
.blurb { color: var(--dim); font-size: 12.5px; }
.blurb strong { color: var(--amber); font-weight: 600; }

/* ---- la matrice des propositions ----------------------------------------- */

.matrice {
  margin-top: 16px;
  display: grid; grid-template-columns: 1fr repeat(3, 38px);
  gap: 4px; align-items: center;
}
.matrice .th {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim); text-align: center; padding-bottom: 2px;
}
.matrice .rh {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding-right: 4px;
}
.matrice .rh i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mcell {
  height: 30px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--edge); background: rgba(255, 255, 255, .03);
  color: var(--txt); font: 600 12px/1 ui-monospace, monospace;
  transition: background .15s, border-color .15s, color .15s;
}
.mcell:hover { background: rgba(224, 145, 63, .2); border-color: rgba(224, 145, 63, .55); }
.mcell.on {
  background: var(--amber); border-color: var(--amber); color: #1a1108;
}

/* ---- la fiche de la pièce sélectionnée ----------------------------------- */

.detail {
  margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--edge);
  font-size: 12px; line-height: 1.55; color: var(--dim);
}
.detail h2 {
  font: 600 15px/1.25 ui-serif, Georgia, serif; color: #fff; margin-bottom: 3px;
}
.detail .meta {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 7px;
}
.detail dl { display: grid; grid-template-columns: 15px 1fr; gap: 4px 7px; margin-top: 4px; }
.detail dt { font: 600 11px/1.5 ui-monospace, monospace; color: var(--amber); }
.detail dd { font-size: 11.5px; line-height: 1.45; }
.detail dd b { color: var(--txt); font-weight: 600; }
.detail .go {
  display: inline-block; margin-top: 9px; font-size: 11px; color: var(--amber);
  cursor: pointer; border-bottom: 1px dotted rgba(224, 145, 63, .5);
}

.detail button.go { background: none; border: 0; border-bottom: 1px dotted rgba(224,145,63,.5); padding: 0; font-family: inherit; text-align: left; }
.detail a { color: var(--amber); text-decoration-color: rgba(224,145,63,.5); text-underline-offset: 3px; }
.detail button.go:focus-visible, .detail a:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }

/* ---- relevé de position -------------------------------------------------- */

.readout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--edge); border: 1px solid var(--edge); border-radius: 9px;
  overflow: hidden; margin-bottom: 13px;
}
.ro {
  background: rgba(10, 8, 6, .82); padding: 7px 10px 8px;
  display: flex; flex-direction: column; gap: 1px;
}
.ro:last-child { grid-column: 1 / -1; }
.ro span { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.ro b { font: 600 13px/1.2 ui-monospace, monospace; color: #fff; }

/* ---- vues rapides -------------------------------------------------------- */

.vbtns { display: flex; flex-wrap: wrap; gap: 5px; }
.vbtn {
  flex: 1 1 auto; display: flex; align-items: center; gap: 6px;
  padding: 6px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--edge); background: rgba(255, 255, 255, .03);
  color: var(--txt); font: 500 12px/1 inherit; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.vbtn:hover { background: rgba(224, 145, 63, .18); border-color: rgba(224, 145, 63, .5); }
.vbtn i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.vbtn u { text-decoration: none; color: var(--dim); font: 500 10px ui-monospace, monospace; }

/* ---- aide clavier -------------------------------------------------------- */

.keys { margin-top: 14px; border-top: 1px solid var(--edge); padding-top: 10px; }
.keys summary {
  cursor: pointer; font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--dim); list-style: none;
}
.keys summary::-webkit-details-marker { display: none; }
.keys summary::after { content: ' ▾'; }
.keys[open] summary::after { content: ' ▴'; }
.keys dl {
  margin-top: 9px; display: grid; grid-template-columns: 118px 1fr;
  gap: 6px 10px; align-items: baseline;
}
.keys dt { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.keys dd { color: var(--dim); font-size: 11.5px; line-height: 1.4; }
.keys dd b { color: var(--amber); font-weight: 600; }
kbd {
  font: 500 10.5px/1 ui-monospace, monospace; color: #e8d9c0;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--edge);
  border-bottom-width: 2px; border-radius: 4px; padding: 3px 5px;
  white-space: nowrap;
}

/* ---- écran de chargement ------------------------------------------------- */

.boot {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: #120d09; color: var(--dim);
  font: 400 13px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .1em;
  transition: opacity .5s;
}
.boot span { animation: pulse 1.4s ease-in-out infinite; }
.boot.gone { opacity: 0; pointer-events: none; }
@keyframes pulse { 0%, 100% { opacity: .45 } 50% { opacity: 1 } }

@media (max-width: 900px) {
  .panel-left { display: none; }
  .panel-right { width: 218px; }
}

/* ---- le choix de ce qu'on charge ----------------------------------------- */

.choix {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: 16px; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(12, 9, 6, .93); backdrop-filter: blur(6px);
  font: 400 13px/1.55 ui-sans-serif, system-ui, sans-serif; color: var(--txt);
}
.choix-boite {
  width: min(560px, 92vw); background: var(--glass);
  max-height: calc(100dvh - 32px); min-height: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--edge); border-radius: 14px; padding: 26px 28px 22px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
}
.choix h1 { font: 600 21px/1.25 ui-serif, Georgia, serif; color: #fff; margin-bottom: 6px; }
.choix .sous { color: var(--dim); font-size: 12.5px; margin-bottom: 18px; }
.choix ul {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--amber) transparent;
  scrollbar-gutter: stable; padding-right: 5px;
}
.choix h1, .choix .sous, .choix .pied { flex-shrink: 0; }
.choix li { flex-shrink: 0; }
.choix li { border: 1px solid var(--edge); border-radius: 9px; background: rgba(255,255,255,.02); }
.choix label {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; cursor: pointer;
}
.choix label:hover { background: rgba(224, 145, 63, .10); }
.choix input { margin-top: 2px; accent-color: var(--amber); width: 15px; height: 15px; flex: none; }
.choix .nm { font-weight: 600; font-size: 13.5px; }
.choix .de { color: var(--dim); font-size: 12px; }
.choix .cout {
  margin-left: auto; font: 500 11px ui-monospace, monospace; color: var(--dim);
  background: rgba(0,0,0,.35); border-radius: 20px; padding: 3px 9px; white-space: nowrap;
}
.choix .pied {
  display: flex; align-items: center; gap: 10px; margin-top: 18px;
  padding-top: 15px; border-top: 1px solid var(--edge);
}
.choix .lien { color: var(--dim); font-size: 12px; cursor: pointer; text-decoration: underline dotted; }
.choix .lien:hover { color: var(--amber); }
.choix .go {
  margin-left: auto; padding: 9px 20px; border-radius: 8px; cursor: pointer;
  background: var(--amber); border: 0; color: #1a1108; font: 600 13px/1 inherit;
}
.choix .go:disabled { opacity: .4; cursor: default; }
.choix .total { font-size: 12px; color: var(--dim); }

/* La revue des quatre soldats laisse le quatrième visible. Les coordonnées
   de vol restent utiles dans les anciennes planches, pas devant les figurines. */
.revue-infanterie .panel-right { top: auto; bottom: 16px; }
.revue-infanterie .panel-right .readout,
.revue-infanterie .panel-right .views { display: none; }
.revue-infanterie .panel-right .reglages { margin-bottom: 0; }
.vivant-switch { display: none; margin-top: 7px; }
.revue-infanterie .vivant-switch { display: flex; }
@media (max-width: 540px) {
  .choix-boite { padding: 18px 14px; width: 100%; }
  .choix .pied { flex-wrap: wrap; }
  .choix label { padding: 10px 8px; gap: 8px; }
  .choix .cout { white-space: normal; text-align: center; }
}
@media (max-width: 900px) {
  .revue-infanterie .panel-left { display: block; width: 280px; padding: 10px 14px; }
  .revue-infanterie .panel-left header { display: none; }
  .revue-infanterie .matrice { margin-top: 0; }
  .revue-infanterie .detail { margin-top: 8px; padding-top: 8px; }
  .revue-infanterie .detail p { display: none; }
  .revue-infanterie .detail .go { margin-top: 4px; }
}

/* Les nouveaux ouvriers sont des modèles fixes. */
.revue-ouvriers .vivant-switch { display: none; }

.revue-animations .vivant-switch {display:flex}
.revue-animations .panel-right {top:auto;bottom:16px}
.revue-animations .readout,.revue-animations .views {display:none}
.revue-animations .panel-left {max-height:calc(100vh - 90px);overflow-y:auto}
.nav-ouvriers {position:fixed;top:16px;left:50%;transform:translateX(-50%);display:flex;gap:6px;z-index:20;padding:8px;background:#18120ded;border:1px solid #6b5135;border-radius:10px}
.nav-ouvriers button {background:#392b1a;color:#eadfcd;border:1px solid #705230;border-radius:6px;padding:8px 12px;cursor:pointer}
.nav-ouvriers button:hover,.nav-ouvriers button:focus-visible {background:#a26c28;color:white}
.matrice[hidden],.eyebrow[hidden] {display:none}
@media(max-width:900px){.nav-ouvriers{left:12px;right:12px;top:52px;transform:none;overflow-x:auto}.nav-ouvriers button{white-space:nowrap;padding:7px 9px}.revue-animations .panel-left{display:block;top:114px;width:280px;max-height:40vh;padding:10px}.revue-animations .panel-left header{display:none}.revue-animations .panel-right{bottom:8px;right:8px;width:220px}}

.revue-animations .mcell:disabled{opacity:.3;cursor:default}

/* Douze unités : tableau de factions, modèles détaillés fixes. */
.revue-unites .panel-left{width:342px;max-height:calc(100vh - 90px);overflow-y:auto}
.revue-unites .panel-right{top:auto;bottom:16px}
.revue-unites .readout,.revue-unites .views,.revue-unites .vivant-switch{display:none}
.revue-unites .mcell{font-size:11px;padding:5px 2px}
@media(max-width:900px){.revue-unites .panel-left{display:block;top:62px;left:8px;width:320px;max-height:40vh;padding:10px}.revue-unites .panel-left header{display:none}.revue-unites .panel-right{bottom:8px;right:8px}}
