@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Inter:wght@400;500;600&display=swap');

/* ====== Variables (charte Uchronya) ====== */
:root {
  --fond:            #0d0f1a;
  --fond-panneau:    #161929;
  --bordure:         #2a2d40;
  --or:              #c9a659;
  --or-clair:        #e8d5a3;
  --violet-1:        #4a3f8c;
  --violet-2:        #7b5ea7;
  --texte:           #f0ece3;
  --texte-doux:      #a09890;
  --erreur:          #c94a4a;
  --succes:          #4a9c6d;
}

/* ====== Base ====== */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--texte);
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

a { color: var(--or); text-decoration: none; }
a:hover { color: var(--or-clair); }

/* ====== En-tête / logo texte ====== */
.marque {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 3px;
  color: var(--or);
  margin-bottom: 8px;
  text-align: center;
}
/* Logo image (remplace le texte .marque) */
.logo {
  display: block;
  width: 300px;
  max-width: 78%;
  height: auto;
  margin: 0 auto 4px;
}
.logo-petit { width: 240px; }

.sous-titre {
  color: var(--texte-doux);
  font-size: 0.9rem;
  margin-bottom: 28px;
  text-align: center;
}

/* ====== Panneau (carte) ====== */
.panneau {
  width: 100%;
  max-width: 400px;
  background: var(--fond-panneau);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.panneau h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--or-clair);
  margin: 0 0 24px;
  text-align: center;
}

/* ====== Formulaire ====== */
label {
  display: block;
  font-size: 0.85rem;
  color: var(--texte-doux);
  margin: 16px 0 6px;
}
input {
  width: 100%;
  padding: 11px 13px;
  background: #0f1220;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  color: var(--texte);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}
input:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 12px rgba(201,166,89,0.35);
}

button {
  width: 100%;
  margin-top: 26px;
  padding: 12px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: filter 0.15s;
}
button:hover { filter: brightness(1.12); }

/* ====== Messages ====== */
.erreurs {
  background: rgba(201,74,74,0.12);
  border: 1px solid var(--erreur);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.erreurs ul { margin: 0; padding-left: 18px; }

.lien-bas {
  margin-top: 22px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--texte-doux);
}

/* ====== Tableau de bord (minimal) ====== */
.dashboard { max-width: 560px; text-align: center; }

.bouton-lien {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.bouton-lien:hover { filter: brightness(1.12); color: #fff; }

/* ====== Wizard ====== */
.panneau-wizard { max-width: 640px; }

.wizard-progress { display: flex; gap: 8px; margin-bottom: 28px; }
.wizard-progress-item {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--texte-doux);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bordure);
  cursor: pointer;
  transition: color .15s ease;
}
.wizard-progress-item .num { transition: border-color .15s ease, color .15s ease; }
.wizard-progress-item:hover { color: var(--texte); }
.wizard-progress-item:hover .num { border-color: var(--or); color: var(--or-clair); }
.wizard-progress-item .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--bordure);
  margin-bottom: 6px;
  font-family: 'Cinzel', serif;
}
.wizard-progress-item.actif { color: var(--or-clair); border-bottom-color: var(--or); }
.wizard-progress-item.actif .num {
  border-color: var(--or); color: var(--or);
  box-shadow: 0 0 10px rgba(201,166,89,0.35);
}
.wizard-progress-item.fait { color: var(--texte); border-bottom-color: var(--violet-2); }
.wizard-progress-item.fait .num { border-color: var(--violet-2); color: var(--violet-2); }

.wizard-etape { display: none; }
.wizard-etape.visible { display: block; }
.wizard-etape h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: var(--or-clair);
  margin: 0 0 18px;
}

textarea {
  width: 100%;
  min-height: 130px;
  padding: 11px 13px;
  background: #0f1220;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  color: var(--texte);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--or); box-shadow: 0 0 12px rgba(201,166,89,0.35); }

select {
  width: 100%; padding: 11px 13px;
  background: #0f1220; border: 1px solid var(--bordure); border-radius: 6px;
  color: var(--texte); font-family: 'Inter', sans-serif; font-size: 0.95rem;
}
select:focus { outline: none; border-color: var(--or); }

.champ-aide { font-size: 0.78rem; color: var(--texte-doux); margin-top: 5px; }

.chips-titre { font-size: 0.82rem; color: var(--texte-doux); margin: 18px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  width: auto;
  margin: 0;
  padding: 7px 12px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 20px;
  color: var(--texte);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--or); color: var(--or-clair); filter: none; }

.wizard-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
.wizard-nav button { width: auto; min-width: 130px; margin-top: 0; }
.btn-secondaire { background: transparent; border: 1px solid var(--bordure); color: var(--texte-doux); }
.btn-secondaire:hover { border-color: var(--or); color: var(--or-clair); filter: none; }
.wizard-nav button[disabled] { opacity: 0.4; cursor: not-allowed; }

.placeholder-etape { color: var(--texte-doux); font-style: italic; padding: 20px 0; }

/* ====== Curseurs (étape 3) ====== */
.slider-bloc { margin-bottom: 26px; }
.slider-entete { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.slider-entete .nom { color: var(--texte); font-weight: 500; }
.slider-valeur { color: var(--or); font-family: 'Cinzel', serif; }
input[type=range].slider {
  width: 100%; margin: 0; padding: 0; border: none; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type=range].slider:focus { outline: none; box-shadow: none; }
input[type=range].slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--violet-1), var(--violet-2));
}
input[type=range].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--or); border: 2px solid var(--fond); margin-top: -6px;
}
input[type=range].slider::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--violet-1), var(--violet-2));
}
input[type=range].slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--or); border: 2px solid var(--fond);
}
.slider-extremes { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--texte-doux); margin-top: 5px; }
.slider-desc { font-size: 0.85rem; color: var(--or-clair); margin-top: 8px; min-height: 1.3em; }
.slider-bloc.recommande {
  border-left: 3px solid var(--or);
  padding: 12px 12px 12px 14px;
  background: rgba(201,166,89,0.05);
  border-radius: 0 8px 8px 0;
}
.slider-bloc.recommande .slider-valeur::after { content: ' ★'; font-size: 0.72em; }
.preset-legende {
  font-size: 0.82rem;
  color: var(--or-clair);
  background: rgba(201,166,89,0.08);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 9px 12px;
  margin: 0 0 22px;
}

/* ====== Cartes de choix (étape 4) ====== */
.groupe-titre {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--or-clair);
  margin: 24px 0 12px;
  padding-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 1px solid var(--bordure);
  display: flex;
  align-items: center;
  gap: 9px;
}
.groupe-titre::before {
  content: '';
  width: 3px;
  height: 15px;
  background: var(--or);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(201,166,89,0.4);
}
.wizard-etape h2 + .groupe-titre { margin-top: 6px; }
.cartes-choix { display: flex; gap: 10px; flex-wrap: wrap; }
.carte-choix {
  flex: 1; min-width: 190px;
  border: 1px solid var(--bordure); border-radius: 8px; padding: 14px;
  cursor: pointer; transition: all 0.15s;
}
.carte-choix:hover { border-color: var(--or); }
.carte-choix input { position: absolute; opacity: 0; width: 0; height: 0; }
.carte-choix .carte-nom { font-family: 'Cinzel', serif; color: var(--texte); margin-bottom: 5px; }
.carte-choix .carte-desc { font-size: 0.8rem; color: var(--texte-doux); }
.carte-choix.selectionne { border-color: var(--or); background: rgba(201,166,89,0.08); box-shadow: 0 0 12px rgba(201,166,89,0.22); }
/* Rôle, forme et longueur : une seule ligne, cartes égales (gère 2 ou 3 cartes). */
.cartes-choix.cartes-role, .cartes-choix.cartes-forme, .cartes-choix#grp-longueur { flex-wrap: nowrap; }
.cartes-role .carte-choix, .cartes-forme .carte-choix, #grp-longueur .carte-choix { min-width: 0; }
@media (max-width: 560px) {
  .cartes-choix.cartes-role, .cartes-choix.cartes-forme, .cartes-choix#grp-longueur { flex-wrap: wrap; }
  .cartes-role .carte-choix, .cartes-forme .carte-choix, #grp-longueur .carte-choix { min-width: 100%; }
}
.oblig { color: var(--or); font-weight: 700; }
.wizard-oblig-note { font-size: 0.78rem; color: var(--texte-doux); margin: 4px 0 14px; }

/* ====== Options (cases à cocher) ====== */
.option-ligne { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--bordure); }
.option-ligne input[type=checkbox] { width: auto; margin: 3px 0 0; }
.option-txt .option-nom { color: var(--texte); }
.option-txt .option-desc { font-size: 0.8rem; color: var(--texte-doux); }
#bloc-age { display: none; margin-top: 12px; padding: 12px; border: 1px solid var(--erreur); border-radius: 6px; background: rgba(201,74,74,0.08); }
#bloc-age.visible { display: block; }
#bloc-age .avert { font-size: 0.82rem; color: var(--texte); margin-bottom: 10px; }

/* ====== Récapitulatif ====== */
.wizard-recap { display: none; }
.wizard-recap.visible { display: block; }
.wizard-recap h2 { font-family: 'Cinzel', serif; color: var(--or-clair); font-size: 1.15rem; margin: 0 0 18px; }
.recap-ligne { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--bordure); font-size: 0.9rem; }
.recap-cle { color: var(--texte-doux); min-width: 130px; flex-shrink: 0; }
.recap-val { color: var(--texte); }
.recap-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.recap-nav button { width: auto; min-width: 130px; margin-top: 0; }
.recap-preview { margin-top: 18px; padding: 12px; background: #0f1220; border: 1px solid var(--bordure); border-radius: 6px; color: var(--texte-doux); font-size: 0.78rem; white-space: pre-wrap; overflow: auto; max-height: 240px; }
.recap-preview:empty { display: none; }

/* ====== Champ « point de divergence » ====== */
.etsi {
  position: relative;
  background: #0f1220;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 10px 13px;
  margin-bottom: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.etsi:focus-within { border-color: var(--or); box-shadow: 0 0 12px rgba(201,166,89,0.35); }
.etsi-prefixe { position: absolute; top: 11px; left: 13px; font-family: 'Cinzel', serif; color: var(--or-clair); font-size: 1rem; pointer-events: none; }
.etsi-input {
  width: 100%; box-sizing: border-box; min-height: 4.2em; overflow: hidden;
  background: transparent; border: none; outline: none; resize: none;
  color: var(--texte); font-family: 'Inter', sans-serif; font-size: 1rem; line-height: 1.5;
  padding: 0; text-indent: 3.6em;
}
.etsi-input::placeholder { color: var(--texte-doux); opacity: 0.6; font-style: italic; }

/* ====== Overlay de chargement ====== */
.overlay-chargement {
  position: fixed; inset: 0;
  background: rgba(13,15,26,0.92);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 1000;
}
.overlay-chargement.visible { display: flex; }
.spinner {
  width: 54px; height: 54px;
  border: 4px solid var(--bordure);
  border-top-color: var(--or);
  border-radius: 50%;
  animation: tourne 0.9s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.overlay-texte { margin-top: 22px; font-family: 'Cinzel', serif; color: var(--or-clair); font-size: 1.05rem; }

/* ====== Liste de scénarios (dashboard) ====== */
.scenario-liste { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; text-align: left; }
.scenario-item { display: flex; align-items: stretch; gap: 8px; }
.scenario-lien {
  flex: 1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: var(--fond);
  border: 1px solid var(--bordure); border-radius: 8px;
  text-decoration: none; transition: border-color 0.15s;
}
.scenario-lien:hover { border-color: var(--or); }
.scenario-suppr {
  width: auto; margin: 0; padding: 0 15px;
  background: transparent; border: 1px solid var(--bordure); border-radius: 8px;
  color: var(--texte-doux); font-size: 1rem; cursor: pointer; transition: all 0.15s;
}
.scenario-suppr:hover { border-color: var(--erreur); color: var(--erreur); filter: none; }
.scenario-oeil {
  display: flex; align-items: center; justify-content: center; padding: 0 13px;
  border: 1px solid var(--bordure); border-radius: 8px;
  color: var(--texte-doux); text-decoration: none; transition: all 0.15s;
}
.scenario-oeil svg { width: 19px; height: 19px; }
.scenario-oeil:hover { border-color: var(--or); color: var(--or); }

/* Menu d'actions « ⋮ » (une seule icône, déplie aperçu/dupliquer/supprimer) */
.scenario-actions { position: relative; display: flex; }
.scenario-menu-btn {
  display: flex; align-items: center; justify-content: center; padding: 0 16px;
  background: transparent; border: 1px solid var(--bordure); border-radius: 8px;
  color: var(--texte-doux); font-size: 1.3rem; line-height: 1; cursor: pointer; transition: all 0.15s;
}
.scenario-menu-btn:hover,
.scenario-actions.ouvert .scenario-menu-btn { border-color: var(--or); color: var(--or); }
.scenario-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 6px; z-index: 30;
  min-width: 190px; background: var(--fond-panneau); border: 1px solid var(--bordure);
  border-radius: 8px; padding: 6px; box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
.scenario-actions.ouvert .scenario-menu { display: block; }
.scenario-menu a,
.scenario-menu button {
  display: block; width: 100%; box-sizing: border-box; margin: 0;
  padding: 11px 12px; background: transparent; border: 0; border-radius: 6px;
  color: var(--texte); font-family: inherit; font-size: 0.9rem; text-align: left;
  text-decoration: none; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.scenario-menu a:hover { background: rgba(201,166,89,0.10); color: var(--or-clair); }
.scenario-menu .scenario-suppr:hover { background: rgba(201,74,74,0.12); color: var(--erreur); border: 0; }

/* Glossaire — grille « codex » (tuiles par catégorie) */
.glo-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 10px; }
.glo-grille.cache { display: none; }
.glo-tuile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 20px 10px; border: 1px solid var(--bordure); border-radius: 12px;
  background: var(--fond-panneau); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-align: center; color: var(--texte-doux);
}
.glo-tuile svg { width: 30px; height: 30px; }
.glo-tuile-nom { font-family: 'Cinzel', serif; font-size: 0.9rem; color: var(--texte); }
.glo-tuile-compte { font-size: 0.78rem; }
.glo-tuile:not(.vide):hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.glo-tuile.vide { opacity: 0.35; cursor: default; }
.glo-panneau { display: none; }
.glo-panneau.actif { display: block; }
.glo-retour-grille {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 0;
  margin-bottom: 12px; color: var(--texte-doux); font-family: inherit; font-size: 0.9rem; cursor: pointer;
}
.glo-retour-grille:hover { color: var(--or); }
.glo-panneau-titre { font-family: 'Cinzel', serif; margin: 2px 0 14px; padding-bottom: 8px; border-bottom: 1px solid; }

/* Pastille de nouveautés sur le menu (glossaire) */
.barre-item { position: relative; }
.barre-pastille {
  position: absolute; top: 0; left: 50%; transform: translateX(3px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--or); color: var(--fond); font-size: 0.68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px var(--fond-panneau);
  animation: pastille-pop 0.3s ease-out;
}
@keyframes pastille-pop { from { transform: translateX(3px) scale(0); } to { transform: translateX(3px) scale(1); } }
@media (prefers-reduced-motion: reduce) { .barre-pastille { animation: none; } }

/* Nouveautés DANS le glossaire : pastille sur la tuile, point devant l'entrée */
.glo-tuile-pastille {
  position: absolute; top: 8px; right: 8px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--or); color: var(--fond); font-size: 0.66rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.glo-point {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle; flex-shrink: 0;
}

/* Liens d'entités DANS le récit + fiche en bottom sheet */
.glo-lien { cursor: pointer; font-weight: 600; border-bottom: 1px dotted currentColor; }
.glo-lien:hover { border-bottom-style: solid; }
#glo-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#glo-sheet-backdrop.ouvert { opacity: 1; pointer-events: auto; }
#glo-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 601;
  max-width: 720px; margin: 0 auto;
  padding: 24px 22px calc(40px + env(safe-area-inset-bottom, 0px));
  background: var(--fond-panneau); border: 1px solid var(--bordure); border-bottom: 0;
  border-radius: 18px 18px 0 0; box-shadow: 0 -12px 44px rgba(0,0,0,0.5);
  transform: translateY(100%); transition: transform 0.25s ease-out;
}
#glo-sheet.ouvert { transform: translateY(0); }
.glo-sheet-fermer { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--texte-doux); font-size: 1.15rem; cursor: pointer; }
.glo-sheet-cat { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 700; }
.glo-sheet-nom { font-family: 'Cinzel', serif; margin: 5px 0 11px; }
.glo-sheet-desc { color: var(--texte-doux); line-height: 1.6; margin: 0; }
@media (prefers-reduced-motion: reduce) { #glo-sheet, #glo-sheet-backdrop { transition: none; } }

/* ====== Aperçu des réglages ====== */
.apercu-liste { margin: 8px 0 20px; }
.apercu-ligne { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--bordure); }
.apercu-ligne:last-child { border-bottom: none; }
.apercu-cle { color: var(--texte-doux); font-size: 0.85rem; flex-shrink: 0; }
.apercu-val { color: var(--texte); text-align: right; }
.apercu-sous-titre { font-family: 'Cinzel', serif; color: var(--or-clair); font-size: 1rem; margin: 22px 0 8px; }
.apercu-prompt { color: var(--texte-doux); line-height: 1.6; font-style: italic; }
.scenario-titre { color: var(--texte); font-weight: 500; }
.scenario-jour { color: var(--texte-doux); font-size: 0.82rem; }

/* ====== Page de jeu ====== */
.panneau-jeu { max-width: 720px; text-align: left; padding-bottom: 40px; margin-bottom: 90px; }
.jeu-retour { display: inline-block; font-size: 0.85rem; margin-bottom: 16px; }
.jeu-titre { font-family: 'Cinzel', serif; color: var(--or-clair); font-size: 1.5rem; margin: 0 0 24px; }
.jour { padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--bordure); }
.jour:last-child { border-bottom: none; margin-bottom: 0; }
.jour-entete { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; flex-wrap: wrap; }
.jour-num { font-family: 'Cinzel', serif; color: var(--or); font-size: 0.82rem; letter-spacing: 0.5px; }
.jour-titre-inline { color: var(--texte-doux); font-size: 0.82rem; font-style: italic; }
.jour-contexte { color: var(--or-clair); font-size: 1rem; margin-bottom: 13px; }
.jour-recit { line-height: 1.7; }
.jour-recit p { margin: 0 0 14px; }
.jour-recit p:last-child { margin-bottom: 0; }
.jeu-fin { text-align: center; font-family: 'Cinzel', serif; color: var(--or); letter-spacing: 4px; font-size: 1.1rem; margin: 30px 0 6px; }

/* ====== Glossaire ====== */
.glo-cat { margin-bottom: 26px; }
.glo-cat-titre {
  font-family: 'Cinzel', serif; font-size: 1.05rem;
  margin: 0 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--bordure);
}
.glo-entite { padding: 9px 0; border-bottom: 1px solid var(--bordure); }
.glo-entite:last-child { border-bottom: none; }
.glo-nom { font-weight: 600; }
.glo-desc { color: var(--texte-doux); font-size: 0.9rem; }
.glo-desc::before { content: " — "; }

/* ====== Barre d'actions (page de jeu) ====== */
.barre-jeu {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-around;
  height: 60px; padding: 0 4px;
  background: linear-gradient(180deg, rgba(26,28,46,0.98), rgba(13,15,26,0.98));
  border-top: 1px solid var(--bordure);
  border-radius: 50% 50% 0 0 / 26px 26px 0 0;
  box-shadow: 0 -6px 22px rgba(0,0,0,0.45);
  z-index: 500;
}
.barre-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 100%; padding: 0 2px;
  color: var(--texte-doux); text-decoration: none;
  background: none; border: none; cursor: pointer; font-family: inherit;
  transition: color 0.15s;
}
.barre-item svg { width: 21px; height: 21px; }
.barre-txt { font-size: 0.6rem; letter-spacing: 0.2px; }
.barre-item:hover:not(.barre-item--soon) { color: var(--or); }
.barre-item--soon { opacity: 0.32; cursor: default; }

.barre-centre {
  flex: 0 0 auto; position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 62px; height: 62px; margin: 0 6px;
  transform: translateY(-16px);
  border-radius: 50%; border: 2px solid var(--or);
  background: radial-gradient(circle at 50% 32%, var(--violet-1), var(--violet-2));
  color: #fff; cursor: pointer; font-family: inherit;
  box-shadow: 0 0 16px rgba(201,166,89,0.45), 0 6px 14px rgba(0,0,0,0.5);
  transition: filter 0.15s;
}
.barre-centre svg { width: 23px; height: 23px; }
.barre-centre .barre-txt { color: var(--or-clair); font-size: 0.54rem; }
.barre-centre:hover { filter: brightness(1.12); }
.barre-centre--fin { background: var(--fond); border-color: var(--bordure); color: var(--or); box-shadow: none; cursor: default; }

.bouton-avancer {
  width: 100%;
  margin-top: 28px;
  padding: 14px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  cursor: pointer;
  transition: filter 0.15s;
}
.bouton-avancer:hover { filter: brightness(1.12); }
.bouton-avancer:disabled { opacity: 0.5; cursor: not-allowed; }
#jeu-erreur { margin-top: 20px; }

/* ---- Arc narratif : visualiseur admin ---- */
.arc-admin-btn {
  display: inline-block; margin: 0 0 20px;
  background: transparent; color: var(--or);
  border: 1px solid var(--or); border-radius: 20px;
  padding: 5px 15px; font-family: 'Cinzel', serif; font-size: 0.8rem; cursor: pointer;
  transition: background .15s ease;
}
.arc-admin-btn:hover { background: rgba(201,166,89,0.12); }
.arc-popup {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5,6,12,0.74);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.arc-popup.ouvert { display: flex; }
.arc-popup-inner {
  position: relative; width: 100%; max-width: 560px; max-height: 82vh; overflow-y: auto;
  background: var(--fond-panneau); border: 1px solid var(--or); border-radius: 12px;
  padding: 26px 24px; box-shadow: 0 12px 44px rgba(0,0,0,0.6);
}
.arc-popup-inner h2 { font-family: 'Cinzel', serif; color: var(--or); font-size: 1.1rem; margin: 0 0 18px; }
.arc-admin-tag {
  font-family: 'Inter', sans-serif; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--fond); background: var(--or); padding: 2px 7px; border-radius: 8px; vertical-align: middle;
}
.arc-popup .arc-ligne { margin: 0 0 13px; color: var(--texte); line-height: 1.5; }
.arc-popup .arc-cle { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--or-clair); }
.arc-popup .arc-etapes { margin: 4px 0 0; padding-left: 20px; }
.arc-popup .arc-etapes li { margin-bottom: 7px; color: var(--texte); line-height: 1.45; }
.arc-popup-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: 0; color: var(--texte-doux); font-size: 1.2rem; cursor: pointer;
}
.arc-popup-close:hover { color: var(--texte); }
.arc-popup .arc-actions { margin: 4px 0 0; padding-left: 20px; }
.arc-popup .arc-actions li { margin-bottom: 8px; color: var(--texte); line-height: 1.4; }
.arc-actions-meta { display: block; font-size: 0.75rem; color: var(--texte-doux); }

/* Rapport de partie copiable (admin) */
.arc-copie { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 18px; }
.arc-copie-btn {
  font-family: 'Inter', sans-serif; font-size: 0.8rem; cursor: pointer;
  color: var(--or-clair); background: transparent; border: 1px solid var(--bordure);
  border-radius: 8px; padding: 7px 13px; transition: border-color .15s, color .15s;
}
.arc-copie-btn:hover { border-color: var(--or); color: var(--or); }
a.arc-copie-btn { text-decoration: none; display: inline-block; }
.arc-copie-etat { font-size: 0.75rem; color: var(--texte-doux); }
/* Le texte source du rapport : présent dans la page (donc sélectionnable en
   repli si le presse-papier est refusé), mais hors du flux visuel. */
.arc-rapport {
  position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0;
}
.arc-copie.replie .arc-rapport {
  position: static; width: 100%; height: 180px; opacity: 1; margin-top: 8px;
  font-family: ui-monospace, monospace; font-size: 0.7rem; line-height: 1.4;
  color: var(--texte); background: var(--fond); border: 1px solid var(--bordure);
  border-radius: 8px; padding: 8px;
}

.jour-semaine { color: var(--or); font-weight: 500; }

/* ---- Assistant de rédaction du pitch ---- */
.assist { margin: 6px 0 4px; }
.assist-btn {
  background: transparent; color: var(--or); border: 1px solid var(--or);
  border-radius: 20px; padding: 5px 14px; font-size: 0.82rem; cursor: pointer;
  font-family: 'Cinzel', serif;
}
.assist-btn:hover { background: rgba(201,166,89,0.12); }
.assist-btn:disabled { opacity: .6; cursor: default; }
.assist-erreur { color: var(--erreur); font-size: 0.82rem; margin-top: 8px; }
.assist-zone {
  margin-top: 12px; background: var(--fond-panneau); border: 1px solid var(--or);
  border-radius: 10px; padding: 14px 16px;
}
.assist-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--or-clair); margin-bottom: 8px; }
.assist-texte { color: var(--texte); line-height: 1.55; white-space: pre-wrap; }
.assist-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.assist-ok, .assist-alt {
  border-radius: 18px; padding: 6px 14px; font-size: 0.82rem; cursor: pointer; border: 1px solid var(--bordure);
}
.assist-ok { background: var(--or); color: var(--fond); border-color: var(--or); font-weight: 600; }
.assist-ok:hover { background: var(--or-clair); }
.assist-alt { background: transparent; color: var(--texte-doux); }
.assist-alt:hover { color: var(--texte); border-color: var(--texte-doux); }
.assist-questions { margin: 4px 0 0; padding-left: 20px; }
.assist-questions li { color: var(--texte); line-height: 1.5; margin-bottom: 7px; }

/* ====== La carte (carte.php) ====== */
.panneau-carte { max-width: 900px; }

.carte-zone {
  height: min(62vh, 560px);
  margin: 6px 0 12px;
  border: 1px solid var(--bordure);
  border-radius: 12px;
  background: #0a0c14;
  overflow: hidden;
  z-index: 0;                      /* reste sous la fiche glissante (z-index 601) */
}

/* Marqueurs : une pastille, pas une épingle — les lieux ne sont pas un trajet. */
.carte-pin span {
  display: block; width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--texte-doux);
  border: 2px solid var(--fond);
  box-shadow: 0 0 0 1px rgba(240,236,227,0.35);
  transition: transform 0.15s;
}
.carte-pin:hover span { transform: scale(1.25); }
.carte-pin--actif span {
  background: var(--or);
  border-color: var(--fond);
  box-shadow: 0 0 0 3px rgba(201,166,89,0.30), 0 0 14px rgba(201,166,89,0.55);
}

.carte-tooltip {
  background: var(--fond-panneau); color: var(--texte);
  border: 1px solid var(--bordure); border-radius: 7px;
  font-family: 'Inter', sans-serif; font-size: 0.8rem; padding: 4px 9px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.carte-tooltip::before { border-top-color: var(--bordure) !important; }

/* Habillage sombre des éléments Leaflet */
.carte-zone .leaflet-container { background: #0a0c14; font-family: 'Inter', sans-serif; }
.carte-zone .leaflet-control-attribution {
  background: rgba(13,15,26,0.82); color: var(--texte-doux); font-size: 0.66rem;
}
.carte-zone .leaflet-control-attribution a { color: var(--or); }
.carte-zone .leaflet-bar a {
  background: var(--fond-panneau); color: var(--texte); border-bottom-color: var(--bordure);
}
.carte-zone .leaflet-bar a:hover { background: var(--bordure); color: var(--or); }

.carte-legende { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--texte-doux); font-size: 0.8rem; margin: 0 0 6px; }
.carte-puce { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--texte-doux); }
.carte-puce--actif { background: var(--or); box-shadow: 0 0 0 2px rgba(201,166,89,0.28); }
.carte-puce--visite { margin-left: 14px; }

.carte-etat, .carte-message { color: var(--texte-doux); font-size: 0.88rem; margin: 8px 0; }

.carte-orphelins { margin-top: 24px; }
.carte-orphelins-titre { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--or-clair); margin: 0 0 10px; }
.carte-orphelin { padding: 9px 0; border-bottom: 1px solid var(--bordure); }
.carte-orphelin:last-child { border-bottom: none; }
.carte-orphelin-nom { display: block; font-weight: 600; }
.carte-orphelin-desc { display: block; color: var(--texte-doux); font-size: 0.87rem; line-height: 1.55; margin-top: 3px; }

/* Fiche de lieu : compléments au bottom sheet partagé avec le récit */
.glo-sheet-sous-titre { font-family: 'Cinzel', serif; font-size: 0.88rem; color: var(--or-clair); margin: 18px 0 8px; }
.glo-sheet-enfant { padding: 7px 0; border-bottom: 1px solid var(--bordure); }
.glo-sheet-enfant:last-child { border-bottom: none; }
.glo-sheet-enfant-nom { display: block; font-size: 0.92rem; }
.glo-sheet-enfant-desc { display: block; color: var(--texte-doux); font-size: 0.83rem; line-height: 1.5; margin-top: 2px; }
.glo-sheet-enfants { max-height: 34vh; overflow-y: auto; }
.carte-compte { color: var(--texte-doux); font-size: 0.8rem; margin: 12px 0 0; }

/* La tuile Carte est un lien : elle doit rester une tuile */
.glo-tuile--lien { text-decoration: none; }
.glo-tuile--lien:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.glo-tuile--lien .glo-tuile-nom { color: var(--texte); }

@media (max-width: 560px) {
  .carte-zone { height: 54vh; }
}

/* Drapeau de pays sur la carte — image SVG, pas d'émoji : Windows n'a aucun
   glyphe de drapeau et rendrait « DE » à la place. */
.carte-drapeau {
  width: 19px; height: auto; margin-right: 7px;
  vertical-align: -2px; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
}
.carte-tooltip .carte-drapeau { width: 15px; margin-right: 5px; vertical-align: -1px; }
.glo-sheet-situation {
  margin: -6px 0 10px; color: var(--texte-doux);
  font-size: 0.82rem; letter-spacing: 0.02em;
}
/* Date in-world d'un événement marquant, dans le glossaire */
.glo-date {
  display: block; color: var(--or); font-size: 0.76rem;
  letter-spacing: 0.04em; margin: 1px 0 3px;
}

/* Liens entre entrées du glossaire — sens RETOUR (« cité par ») */
.glo-liens { margin-top: 7px; padding-left: 10px; border-left: 2px solid var(--bordure); }
.glo-liens-titre {
  display: block; color: var(--texte-doux); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 3px;
}
.glo-lien-retour { display: block; margin: 3px 0; font-size: 0.83rem; }
.glo-lien-retour .glo-lien { font-weight: 600; }
.glo-lien-phrase { color: var(--texte-doux); font-style: italic; }
.glo-lien-phrase::before { content: " — "; font-style: normal; }

/* Entrée visée après un clic sur un lien */
.glo-entite.glo-vise { animation: glo-flash 1.4s ease-out; border-radius: 6px; }
@keyframes glo-flash {
  0%   { background: rgba(201,166,89,0.22); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .glo-entite.glo-vise { animation: none; } }

/* ============================================================
   JOURNAL DE BORD — le décor (étape 6, variante A « sobre »,
   choisie par Julien le 20/10 : « c'est sobre et ça ajoute de la
   lisibilité au journal de bord »)

   ⛔ TOUT EST SOUS .jour-recit-bord, SANS EXCEPTION. Le roman et le
   journal intime sont les deux seules formes réglées (262 séquences) ;
   une règle qui fuirait hors de ce préfixe les abîmerait sans qu'on
   le voie tout de suite. Le hook est posé par jeu.php, qui ne
   l'ajoute que si forme === 'journal_bord'.

   ⚠️ CE CSS NE CIBLE QUE LE GABARIT GARANTI par bord.php — .bord-entree,
   .bord-heure, .bord-date, .bord-corps, .bord-libre, .bord-rubrique,
   .bord-etiq, .bord-liste. Jamais la structure que le modèle aurait
   écrite : c'est tout l'objet de l'étape 5 (document 07 § 5).

   ⛔ POURQUOI PAS LE CAHIER À LIGNES, l'idée d'origine du 10/10 :
   deux obstacles, tous deux vérifiés et non négociables.
    — Le papier crème est impossible : recit_lier() pose un
      style="color:…" EN LIGNE sur chaque lien de glossaire, et un
      style en ligne bat la feuille de style. Sur fond clair, tous les
      liens deviennent illisibles, et les corriger toucherait les deux
      formes validées.
    — Les lignes réglées n'existent que si le line-height est figé en
      PIXELS. Un joueur qui grossit le texte dans son navigateur
      décale alors le texte sans décaler les lignes, et toute la page
      part de travers. On ne fabrique pas un décor qui casse au zoom.
   → L'idée est abandonnée en connaissance de cause, pas oubliée.

   ⚠️ LE SÉPARATEUR est l'idée de Julien du 15/10. Il s'écrit
   « .bord-entree + .bord-entree », donc il n'apparaît NI avant la
   première entrée, NI avant la rubrique — c'était la réserve notée
   avec l'idée, et c'est le gabarit qui la règle, pas le CSS.
   ============================================================ */

/* ---- Une entrée : l'heure à gauche, le fait à droite ---- */
.jour-recit-bord .bord-entree { display: flex; gap: 14px; align-items: baseline; }

/* ⛔ LA COLONNE, c'est `.bord-quand` — corrigé le 21/10 sur capture de Julien.
   Avant, l'heure et la date étaient deux FRÈRES dans la rangée flex : la date
   comptait comme un troisième élément et poussait le corps vers la droite, donc
   l'entrée datée ne s'alignait plus avec les autres. Visible à l'œil tout de suite.
   → Le conteneur prend la largeur fixe, l'heure et la date s'empilent dedans, et le
   corps repart TOUJOURS du même bord, datée ou non. */
.jour-recit-bord .bord-quand {
  flex: 0 0 66px; text-align: right; padding-top: 0.22em; white-space: nowrap;
}
.jour-recit-bord .bord-heure {
  display: block;
  font-family: 'Cinzel', serif; font-size: 0.82rem; letter-spacing: 0.5px;
  color: var(--or);
}
/* ⛔ LA DATE OUVRE UNE JOURNÉE, elle ne décore pas une entrée — idée de Julien,
   21/10, et elle est meilleure que la mienne. Avant, la date se collait sous l'heure
   de l'entrée qui la portait : on lisait heure, date, trois entrées sans date, puis
   à nouveau heure + date. Un registre OUVRE une journée puis liste les heures
   dessous ; répéter la date à chaque ligne, ou la coller à une seule au milieu,
   n'est ni l'un ni l'autre.
   ⚠️ N'apparaît QUE si la page couvre plusieurs jours : sur une page d'un seul
   jour — la grande majorité — bord.php n'émet aucun entête, et la date est déjà
   dans le `contexte` au-dessus du récit. */
.jour-recit-bord .bord-jour {
  margin: 22px 0 12px; padding-bottom: 5px;
  border-bottom: 1px solid var(--bordure);
}
.jour-recit-bord .bord-jour:first-child { margin-top: 0; }
.jour-recit-bord .bord-jour-date {
  font-family: 'Cinzel', serif; font-size: 0.78rem;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--or-clair);
}
/* ⚠️ Le filet entre deux entrées ne doit pas s'ajouter juste après un entête de
   journée : l'entête fait déjà la séparation, et deux traits de suite se lisent
   comme une erreur. */
.jour-recit-bord .bord-jour + .bord-entree { padding-top: 0; }
.jour-recit-bord .bord-jour + .bord-entree::before { content: none; }
.jour-recit-bord .bord-corps { flex: 1; margin: 0; }

/* ---- Le filet entre deux entrées ---- */
.jour-recit-bord .bord-entree + .bord-entree { position: relative; padding-top: 22px; }
.jour-recit-bord .bord-entree + .bord-entree::before {
  content: ""; position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 52px; height: 1px; background: var(--bordure);
}

/* ---- Un bloc sans horodatage : le filet de bord.php ----
   ⚠️ Les parties jouées avant que la forme existe, et toute variante
   d'écriture que le normaliseur n'a pas reconnue. Elles doivent rester
   lisibles comme un paragraphe ordinaire — jamais amputées, jamais
   signalées au joueur comme une anomalie. */
.jour-recit-bord .bord-libre { margin: 0 0 14px; }
.jour-recit-bord .bord-libre .bord-corps { margin: 0; }
.jour-recit-bord .bord-libre:last-child { margin-bottom: 0; }

/* ---- La rubrique de clôture ----
   Document 07 § 4.4 : c'est l'instrument narratif de la forme — elle
   s'allonge quand il perd le contrôle, se vide quand on lui retire la
   main. Elle doit donc se LIRE comme un registre, pas comme une fin de
   chapitre. 4 pages sur 15 n'en portent pas, et c'est accepté (20/10) :
   rien ici ne doit supposer sa présence. */
.jour-recit-bord .bord-rubrique {
  /* ⛔ LE PANNEAU, choisi par Julien le 21/10 — et le défaut qu'il corrige n'est
     PAS celui qu'on croyait. Symptôme : en portrait, la rubrique se lisait comme la
     suite de la dernière entrée ; en paysage elle se détachait bien.
     ⚠️ LA CAUSE : sous 560 px, .bord-heure passe sur sa propre ligne, à gauche, en
     Cinzel or — exactement la forme de .bord-etiq. **Même rôle visuel**, donc
     l'étiquette se lisait comme une heure de plus.
     ⛔ ET UN FILET DE PLUS N'AURAIT RIEN TRANCHÉ : il y en a déjà un entre chaque
     entrée (.bord-entree + .bord-entree::before). Une ligne du même gris et du même
     poids rejoint la famille au lieu de s'en distinguer — c'est précisément pourquoi
     le border-top d'origine ne suffisait pas.
     → On change donc la NATURE du bloc, pas son contour : un fond légèrement relevé
     (#161929 sur #0d0f1a, un murmure) et un trait d'or à gauche. Ne dépend ni d'un
     filet ni d'une police : ça tiendra encore si la typographie des heures change. */
  margin-top: 30px; padding: 13px 15px 14px;
  background: var(--fond-panneau);
  border-left: 2px solid var(--or);
  border-radius: 3px;
}
.jour-recit-bord .bord-etiq {
  display: block; margin-bottom: 7px;
  font-family: 'Cinzel', serif; font-size: 0.74rem;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--or);
}
.jour-recit-bord .bord-liste { margin: 0; padding-left: 0; list-style: none; }
.jour-recit-bord .bord-liste li {
  position: relative; padding: 3px 0 3px 15px;
  color: var(--texte-doux); font-size: 0.93rem;
}
.jour-recit-bord .bord-liste li::before {
  content: "—"; position: absolute; left: 0; color: var(--bordure);
}

/* ---- Mobile ----
   ⚠️ Sous 560 px, une colonne de 66 px prend un cinquième de la largeur
   et hache le texte en mots isolés. L'heure passe donc au-dessus, et le
   filet reste : c'est lui qui porte la respiration entre deux entrées. */
@media (max-width: 560px) {
  .jour-recit-bord .bord-entree { display: block; }
  .jour-recit-bord .bord-quand {
    display: block; text-align: left; margin-bottom: 3px; padding-top: 0;
    white-space: normal;
  }
  .jour-recit-bord .bord-heure { display: inline; }
  .jour-recit-bord .bord-jour { margin: 18px 0 10px; }
}
