/* CLAIRVAUX · la page de lecture (lire.html). */
html, body { height: 100%; overflow: hidden; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; background: var(--encre); }
.sans3d #scene { display: none; }
.sans3d body, body.sans3d { background: radial-gradient(ellipse at 70% 30%, #1d1914, var(--encre) 70%); }

.barre {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: linear-gradient(var(--voile), transparent);
}
.barre .acte { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--papier-2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre .outils { display: flex; gap: 6px; }
.pastille { font-family: var(--f-mono); font-size: 13px; padding: 0 12px; min-height: 40px; border: 1px solid var(--trait); background: rgba(7, 6, 10, 0.55); cursor: pointer; border-radius: 2px; color: var(--papier); display: inline-flex; align-items: center; gap: 6px; }
.pastille:hover { border-color: var(--or); }
.pastille .grain { color: var(--or-vif); }
.pastille[aria-pressed="true"] { border-color: var(--or); color: var(--or-vif); }

/* le livre : le texte de Hugo, par-dessus la scène */
.livre {
  position: fixed; z-index: 4; left: 16px; bottom: 84px; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 170px); overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(10, 9, 13, 0.88), rgba(10, 9, 13, 0.94));
  border: 1px solid var(--trait); border-radius: 3px; padding: 22px 26px 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  scrollbar-width: thin; scrollbar-color: var(--gris) transparent;
}
.livre .station-titre { font-family: var(--f-titre); font-size: 22px; letter-spacing: 0.06em; margin: 0 0 4px; color: var(--papier); font-weight: 600; }
.livre .station-acte { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--or); margin: 0 0 14px; }
.livre .hugo p { opacity: 0.62; transition: opacity 0.8s; }
.livre .hugo p.recent { opacity: 1; animation: entree 0.9s ease both; }
@keyframes entree { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }
.livre .repli { font-family: var(--f-mono); font-size: 14px; color: var(--cendre); border: 1px dashed var(--cendre); padding: 0.6em 0.9em; margin: 0 0 0.85em; }
.livre .repli summary { cursor: pointer; }
.livre .repli[open] { color: var(--papier); font-family: var(--f-hugo); font-size: 19px; }
body.regarde .livre { opacity: 0.12; transform: translateX(-12px); }

/* les commandes du bas */
.commandes { position: fixed; z-index: 5; left: 16px; bottom: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.commandes .btn { min-width: 170px; justify-content: center; }
#btn-regarder { touch-action: none; user-select: none; -webkit-user-select: none; }
#btn-regarder[aria-pressed="true"] { border-color: var(--braise); color: var(--braise); box-shadow: 0 0 24px rgba(255, 138, 61, 0.35); }
.aide-touches { position: fixed; z-index: 4; right: 16px; bottom: 16px; font-family: var(--f-mono); font-size: 12px; color: var(--gris); text-align: right; line-height: 1.7; }
.aide-touches kbd { font-family: inherit; border: 1px solid var(--trait); padding: 0 5px; border-radius: 2px; color: var(--papier-2); }

/* les gestes */
.geste {
  position: fixed; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  background: rgba(9, 8, 12, 0.94); border: 1px solid var(--trait); border-top: 2px solid var(--adapt);
  padding: 24px 26px; border-radius: 3px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}
.geste.discret { top: auto; bottom: 92px; transform: translateX(-50%); }
.geste h2 { font-family: var(--f-mono); font-weight: 400; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--adapt); margin: 0 0 10px; }
.geste .question { font-family: var(--f-hugo); font-size: 22px; line-height: 1.35; margin: 0 0 14px; }
.geste .question i, .geste blockquote { color: var(--or-vif); }
.geste blockquote { font-family: var(--f-hugo); font-size: 20px; margin: 0 0 14px; padding-left: 14px; border-left: 2px solid var(--or); }
.geste .explique { font-family: var(--f-mono); font-size: 13px; color: var(--papier-2); margin: 0 0 16px; }
.geste .choix { display: flex; gap: 10px; flex-wrap: wrap; }
.geste fieldset { border: 1px solid var(--trait); padding: 12px 14px; margin: 0 0 14px; border-radius: 2px; }
.geste legend { font-family: var(--f-hugo); font-size: 19px; padding: 0 6px; }
.geste legend .src { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--adapt); margin-left: 8px; }
.geste legend .src.hugo-src { color: var(--or); }
.geste label { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; cursor: pointer; font-size: 17px; }
.geste input { accent-color: var(--or); }
.geste .vide { font-family: var(--f-mono); font-size: 13px; color: var(--gris); }
.compteur-soirs { display: flex; gap: 8px; margin: 6px 0 16px; }
.compteur-soirs i { width: 22px; height: 34px; border: 1px solid var(--trait); display: block; }
.compteur-soirs i.fait { background: linear-gradient(var(--cendre), #2b3140); border-color: var(--cendre); }
.verbes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.verbes button[aria-pressed="true"] { background: rgba(224, 173, 79, 0.18); border-color: var(--or); color: var(--or-vif); }

/* la coupe du pain : on glisse sur la miche (projetée depuis la scène) */
.coupe { position: fixed; z-index: 7; inset: 0; cursor: col-resize; touch-action: none; }
.coupe .ligne { position: absolute; width: 2px; background: var(--or-vif); box-shadow: 0 0 12px var(--or); pointer-events: none; }
.coupe .zone { position: absolute; border: 1px dashed rgba(255, 200, 106, 0.6); border-radius: 50%; pointer-events: none; }

/* la besace */
.panneau {
  position: fixed; z-index: 9; right: 16px; top: 64px; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow-y: auto;
  background: rgba(9, 8, 12, 0.96); border: 1px solid var(--trait); padding: 18px 20px; border-radius: 3px;
}
.panneau h2 { font-family: var(--f-mono); font-weight: 400; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--or); margin: 0 0 12px; }
.panneau ol { margin: 0; padding-left: 1.2em; }
.panneau li { margin: 0 0 10px; font-size: 17px; }
.panneau .ref { font-family: var(--f-mono); font-size: 11px; color: var(--gris); margin-left: 6px; }
.fermer { position: absolute; right: 8px; top: 8px; background: none; border: 0; color: var(--papier-2); font-size: 22px; cursor: pointer; width: 40px; height: 40px; }

/* la fin : le dossier */
.fin { position: fixed; inset: 0; z-index: 10; overflow-y: auto; background: radial-gradient(ellipse at 50% 30%, rgba(40, 28, 14, 0.82), rgba(7, 6, 10, 0.97) 70%); padding: 60px 16px 40px; }
.fin .cadre { max-width: 720px; margin: 0 auto; }
.fin h1 { font-family: var(--f-titre); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; font-size: clamp(30px, 6vw, 48px); margin: 0 0 6px; text-align: center; }
.fin .derniere { font-family: var(--f-hugo); font-style: italic; text-align: center; color: var(--or-vif); font-size: 22px; margin: 0 0 30px; }
.fin dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; font-size: 18px; border-top: 1px solid var(--trait); padding-top: 18px; }
.fin dt { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--adapt); padding-top: 4px; }
.fin dd { margin: 0; }
.fin .dedicace { margin: 36px auto 24px; max-width: 520px; text-align: center; font-style: italic; color: var(--papier-2); border-top: 1px solid var(--trait); padding-top: 22px; }
.fin .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* chargement */
.chargement { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--encre); font-family: var(--f-mono); letter-spacing: 0.2em; color: var(--papier-2); text-transform: uppercase; font-size: 13px; text-align: center; padding: 16px; }
.chargement b { display: block; font-family: var(--f-titre); font-size: 34px; letter-spacing: 0.35em; color: var(--papier); margin-bottom: 10px; font-weight: 600; }
.toast { position: fixed; z-index: 12; left: 50%; top: 70px; transform: translateX(-50%); font-family: var(--f-mono); font-size: 13px; background: rgba(9, 8, 12, 0.92); border: 1px solid var(--or); color: var(--or-vif); padding: 8px 14px; border-radius: 2px; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
.toast.vu { opacity: 1; }
.st { position: fixed; z-index: 6; left: 50%; bottom: 140px; transform: translateX(-50%); font-family: var(--f-mono); font-size: 13px; color: var(--papier); background: rgba(0, 0, 0, 0.7); padding: 4px 10px; pointer-events: none; }

/* téléphone : le livre devient une feuille en bas */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .livre { left: 0; right: 0; bottom: 68px; width: auto; max-height: 46vh; border-radius: 0; border-left: 0; border-right: 0; padding: 16px 16px 6px; }
  .commandes { left: 16px; right: 16px; bottom: 12px; }
  .commandes .btn, .commandes .btn-sec { flex: 1; min-width: 0; }
  .aide-touches { display: none; }
  .barre .acte { font-size: 11px; }
  .barre .masquer-mobile { display: none; }
  .st { bottom: calc(46vh + 80px); }
}
